hytos / DTI_PID / APIDConverter / AvevaInfo.cs @ eaa41534
이력 | 보기 | 이력해설 | 다운로드 (2.83 KB)
1 | dfb760ef | gaqhf | using System; |
---|---|---|---|
2 | using System.Collections.Generic; |
||
3 | using System.Linq; |
||
4 | using System.Text; |
||
5 | using System.Threading.Tasks; |
||
6 | using AVEVA.PID.CustomizationUtility.DB; |
||
7 | using AVEVA.PID.CustomizationUtility.Model; |
||
8 | using AVEVA.PID.CustomizationUtility.Properties; |
||
9 | using System.Data; |
||
10 | |||
11 | namespace AVEVA.PID.CustomizationUtility |
||
12 | { |
||
13 | public class AvevaInfo |
||
14 | { |
||
15 | static AvevaInfo avevaInfo; |
||
16 | |||
17 | public DataTable AvevaSymbolTable { get; set; } |
||
18 | 1c955e70 | gaqhf | public List<SymbolInfo> SymbolInfo { get; set; } |
19 | public List<AttributeInfo> AttributeInfo { get; set; } |
||
20 | dfb760ef | gaqhf | public static AvevaInfo GetInstance() |
21 | { |
||
22 | if (avevaInfo == null) |
||
23 | { |
||
24 | avevaInfo = new AvevaInfo(); |
||
25 | Refresh(); |
||
26 | } |
||
27 | return avevaInfo; |
||
28 | } |
||
29 | public static void Refresh() |
||
30 | { |
||
31 | 1c955e70 | gaqhf | if (avevaInfo == null) |
32 | avevaInfo = new AvevaInfo(); |
||
33 | |||
34 | dfb760ef | gaqhf | avevaInfo.AvevaSymbolTable = Project_DB.SelectSymbolTable(); |
35 | 1c955e70 | gaqhf | SetSymbolInfo(); |
36 | SetAttributeInfo(); |
||
37 | } |
||
38 | private static void SetSymbolInfo() |
||
39 | { |
||
40 | avevaInfo.SymbolInfo = new List<SymbolInfo>(); |
||
41 | 4622d687 | gaqhf | DataTable dt = Project_DB.GetSymbolMappingTableOnlySymbol(); |
42 | foreach (DataRow row in dt.Rows) |
||
43 | { |
||
44 | SymbolInfo info = new SymbolInfo(); |
||
45 | info.UID = DBNull.Value.Equals(row["UID"]) ? string.Empty : row["UID"].ToString(); |
||
46 | info.NAME = DBNull.Value.Equals(row["NAME"]) ? string.Empty : row["NAME"].ToString(); |
||
47 | info.APID_SYMBOL = DBNull.Value.Equals(row["APID_SYMBOL"]) ? string.Empty : row["APID_SYMBOL"].ToString(); |
||
48 | info.DATA1 = DBNull.Value.Equals(row["DATA1"]) ? string.Empty : row["DATA1"].ToString(); |
||
49 | avevaInfo.SymbolInfo.Add(info); |
||
50 | } |
||
51 | dt.Dispose(); |
||
52 | dfb760ef | gaqhf | } |
53 | 1c955e70 | gaqhf | private static void SetAttributeInfo() |
54 | { |
||
55 | avevaInfo.AttributeInfo = new List<AttributeInfo>(); |
||
56 | 4622d687 | gaqhf | DataTable dt = Project_DB.GetAttributeMappingTableOnlyAttribute(); |
57 | foreach (DataRow row in dt.Rows) |
||
58 | { |
||
59 | AttributeInfo info = new AttributeInfo(); |
||
60 | info.UID = DBNull.Value.Equals(row["UID"]) ? string.Empty : row["UID"].ToString(); |
||
61 | info.APID_ATTRIBUTE = DBNull.Value.Equals(row["APID_ATTRIBUTE"]) ? string.Empty : row["APID_ATTRIBUTE"].ToString(); |
||
62 | avevaInfo.AttributeInfo.Add(info); |
||
63 | } |
||
64 | dt.Dispose(); |
||
65 | 1c955e70 | gaqhf | } |
66 | } |
||
67 | |||
68 | public class SymbolInfo |
||
69 | { |
||
70 | public string UID { get; set; } |
||
71 | public string NAME { get; set; } |
||
72 | public string APID_SYMBOL { get; set; } |
||
73 | public string DATA1 { get; set; } |
||
74 | dfb760ef | gaqhf | } |
75 | 1c955e70 | gaqhf | |
76 | public class AttributeInfo |
||
77 | { |
||
78 | public string UID { get; set; } |
||
79 | public string APID_ATTRIBUTE { get; set; } |
||
80 | c8b025e0 | gaqhf | } |
81 | dfb760ef | gaqhf | } |