-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathINoSQLDatabase.cs
More file actions
93 lines (76 loc) · 2.69 KB
/
INoSQLDatabase.cs
File metadata and controls
93 lines (76 loc) · 2.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
using ExpressBase.Common.Enums;
using System;
using System.Collections.Generic;
namespace ExpressBase.Common.Data
{
public interface INoSQLDatabase
{
int InfraConId { get; set; }
string UploadFile(string filename, byte[] bytea, EbFileCategory category);
byte[] DownloadFileById(string filestoreid, EbFileCategory category);
//byte[] DownloadFileByName(string filename, EbFileCategory category);
}
//public class EbFileStore : INoSQLDatabase
// {
// public int InfraConId { get; set; }
// public string UploadFile(string filename, byte[] bytea, EbFileCategory category)
// {
// return "";
// }
// public byte[] DownloadFileById(string filestoreid, EbFileCategory category)
// {
// return null;
// }
// }
public class FilesCollection : List<INoSQLDatabase>
{
public int DefaultConId { get; set; }
public int UsedConId { get; set; }
new public INoSQLDatabase this[int _id]
{
get
{
foreach (INoSQLDatabase file in this)
{
if (file.InfraConId == _id)
{
return file;
}
}
return null;
}
}
public string UploadFile(string filename, byte[] bytea, EbFileCategory category, int _infraConId)
{
Console.WriteLine("Inside Upload FilesDB Collection");
Console.WriteLine("InfraCon Id: " + _infraConId);
Console.WriteLine("Default Con Id: " + DefaultConId);
try
{
if (_infraConId == 0)
{
_infraConId = DefaultConId;
}
this.UsedConId = _infraConId;
Console.WriteLine("Used Con Id: " + UsedConId);
return this[this.UsedConId].UploadFile(filename, bytea, category);
}
catch (Exception e)
{
Console.WriteLine("Error in Upload File" + e.Message + "\nStack Trace: " + e.StackTrace);
return null;
}
}
public byte[] DownloadFileById(string filestoreid, EbFileCategory category, int _infraConId)
{
//if (_infraConId == 0)
//{
// _infraConId = DefaultConId;
//}
//this.UsedConId = _infraConId;
if (this[_infraConId + 1000000] != null)
return this[_infraConId + 1000000].DownloadFileById(filestoreid, category);
return this[_infraConId].DownloadFileById(filestoreid, category);
}
}
}