프로젝트

일반

사용자정보

통계
| 브랜치(Branch): | 개정판:

hytos / DTI_PID / APIDConverter / AvevaInfo.cs @ 4622d687

이력 | 보기 | 이력해설 | 다운로드 (3.04 KB)

1
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
        public List<SymbolInfo> SymbolInfo { get; set; }
19
        public List<AttributeInfo> AttributeInfo { get; set; }
20

    
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
            if (avevaInfo == null)
34
                avevaInfo = new AvevaInfo();
35

    
36
            avevaInfo.AvevaSymbolTable = Project_DB.SelectSymbolTable();
37
            SetSymbolInfo();
38
            SetAttributeInfo();
39
        }
40

    
41
        private static void SetSymbolInfo()
42
        {
43
            avevaInfo.SymbolInfo = new List<SymbolInfo>();
44
            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
        }
56

    
57
        private static void SetAttributeInfo()
58
        {
59
            avevaInfo.AttributeInfo = new List<AttributeInfo>();
60
            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
        }
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
    }
82

    
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
}
클립보드 이미지 추가 (최대 크기: 500 MB)