hytos / DTI_PID / APIDConverter / AvevaInfo.cs @ 4622d687
이력 | 보기 | 이력해설 | 다운로드 (3.04 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 | |
21 | public static AvevaInfo GetInstance() |
||
22 | { |
||
23 | if (avevaInfo == null) |
||
24 | { |
||
25 | avevaInfo = new AvevaInfo(); |
||
26 | Refresh(); |
||
27 | } |
||
28 | return avevaInfo; |
||
29 | } |
||
30 | |||
31 | public static void Refresh() |
||
32 | { |
||
33 | 1c955e70 | gaqhf | if (avevaInfo == null) |
34 | avevaInfo = new AvevaInfo(); |
||
35 | |||
36 | dfb760ef | gaqhf | avevaInfo.AvevaSymbolTable = Project_DB.SelectSymbolTable(); |
37 | 1c955e70 | gaqhf | SetSymbolInfo(); |
38 | SetAttributeInfo(); |
||
39 | } |
||
40 | |||
41 | private static void SetSymbolInfo() |
||
42 | { |
||
43 | avevaInfo.SymbolInfo = new List<SymbolInfo>(); |
||
44 | 4622d687 | gaqhf | DataTable dt = Project_DB.GetSymbolMappingTableOnlySymbol(); |
45 | foreach (DataRow row in dt.Rows) |
||
46 | { |
||
47 | SymbolInfo info = new SymbolInfo(); |
||
48 | info.UID = DBNull.Value.Equals(row["UID"]) ? string.Empty : row["UID"].ToString(); |
||
49 | info.NAME = DBNull.Value.Equals(row["NAME"]) ? string.Empty : row["NAME"].ToString(); |
||
50 | info.APID_SYMBOL = DBNull.Value.Equals(row["APID_SYMBOL"]) ? string.Empty : row["APID_SYMBOL"].ToString(); |
||
51 | info.DATA1 = DBNull.Value.Equals(row["DATA1"]) ? string.Empty : row["DATA1"].ToString(); |
||
52 | avevaInfo.SymbolInfo.Add(info); |
||
53 | } |
||
54 | dt.Dispose(); |
||
55 | dfb760ef | gaqhf | } |
56 | 1c955e70 | gaqhf | |
57 | private static void SetAttributeInfo() |
||
58 | { |
||
59 | avevaInfo.AttributeInfo = new List<AttributeInfo>(); |
||
60 | 4622d687 | gaqhf | DataTable dt = Project_DB.GetAttributeMappingTableOnlyAttribute(); |
61 | foreach (DataRow row in dt.Rows) |
||
62 | { |
||
63 | AttributeInfo info = new AttributeInfo(); |
||
64 | info.UID = DBNull.Value.Equals(row["UID"]) ? string.Empty : row["UID"].ToString(); |
||
65 | info.APID_ATTRIBUTE = DBNull.Value.Equals(row["APID_ATTRIBUTE"]) ? string.Empty : row["APID_ATTRIBUTE"].ToString(); |
||
66 | info.APID_ATTRIBUTE_TYPE = DBNull.Value.Equals(row["APID_ATTRIBUTE_TYPE"]) ? string.Empty : row["APID_ATTRIBUTE_TYPE"].ToString(); |
||
67 | avevaInfo.AttributeInfo.Add(info); |
||
68 | } |
||
69 | dt.Dispose(); |
||
70 | 1c955e70 | gaqhf | } |
71 | } |
||
72 | |||
73 | |||
74 | |||
75 | public class SymbolInfo |
||
76 | { |
||
77 | public string UID { get; set; } |
||
78 | public string NAME { get; set; } |
||
79 | public string APID_SYMBOL { get; set; } |
||
80 | public string DATA1 { get; set; } |
||
81 | dfb760ef | gaqhf | } |
82 | 1c955e70 | gaqhf | |
83 | public class AttributeInfo |
||
84 | { |
||
85 | public string UID { get; set; } |
||
86 | public string APID_ATTRIBUTE { get; set; } |
||
87 | public string APID_ATTRIBUTE_TYPE { get; set; } |
||
88 | } |
||
89 | |||
90 | dfb760ef | gaqhf | } |