프로젝트

일반

사용자정보

개정판 4622d687

ID4622d68769614e865ae2f133cdb23e020c067306
상위 1c955e70
하위 4328cb06

gaqhf 이(가) 약 5년 전에 추가함

dev issue #1230 : set mapping info

Change-Id: I164bc1d6e35560ab97dcf2afd1da03f9b658a447

차이점 보기:

DTI_PID/APIDConverter/AvevaInfo.cs
41 41
        private static void SetSymbolInfo()
42 42
        {
43 43
            avevaInfo.SymbolInfo = new List<SymbolInfo>();
44

  
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();
45 55
        }
46 56

  
47 57
        private static void SetAttributeInfo()
48 58
        {
49 59
            avevaInfo.AttributeInfo = new List<AttributeInfo>();
50

  
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();
51 70
        }
52 71
    }
53 72

  
DTI_PID/APIDConverter/DB/Project_DB.cs
375 375

  
376 376
            return dt;
377 377
        }
378
        public static DataTable SelectID2SymbolTable()
378
        public static DataTable GetID2SymbolTable()
379 379
        {
380 380
            DataTable dt = new DataTable();
381 381
            Project_Info projectInfo = Project_Info.GetInstance();
......
435 435

  
436 436
            return dt;
437 437
        }
438
        public static DataTable SelectSymbolType()
438
        public static DataTable GetSymbolType()
439 439
        {
440 440
            DataTable dt = new DataTable();
441 441
            Project_Info projectInfo = Project_Info.GetInstance();
......
495 495

  
496 496
            return dt;
497 497
        }
498
        public static DataTable SelectDrawings()
498
        public static DataTable GetDrawings()
499 499
        {
500 500
            DataTable dt = new DataTable();
501 501
            Project_Info projectInfo = Project_Info.GetInstance();
......
863 863

  
864 864
            return true;
865 865
        }
866
        public static DataTable SelectProjectAttribute()
866
        public static DataTable GetProjectAttribute()
867 867
        {
868 868
            DataTable dt = new DataTable();
869 869
            Project_Info projectInfo = Project_Info.GetInstance();
......
940 940

  
941 941
            return dt;
942 942
        }
943
        public static DataTable SelectProjectLineProperties()
943
        public static DataTable GetProjectLineProperties()
944 944
        {
945 945
            DataTable dt = new DataTable();
946 946
            Project_Info projectInfo = Project_Info.GetInstance();
......
1012 1012

  
1013 1013
            return dt;
1014 1014
        }
1015
        public static DataTable GetSymbolMappingTableOnlySymbol()
1016
        {
1017
            DataTable dt = new DataTable();
1018
            Project_Info projectInfo = Project_Info.GetInstance();
1019
            if (projectInfo.DBType == ID2DB_Type.SQLite)
1020
            {
1021
                using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", projectInfo.DBFilePath)))
1022
                {
1023
                    try
1024
                    {
1025
                        connection.Open();
1026
                        using (SQLiteCommand cmd = connection.CreateCommand())
1027
                        {
1028
                            cmd.CommandText = string.Format("SELECT * FROM {0}", APID_SYMBOL_MAPPING_TABLE);
1029
                            using (SQLiteDataReader dr = cmd.ExecuteReader())
1030
                                dt.Load(dr);
1031
                        }
1032
                        connection.Close();
1033
                    }
1034
                    catch (Exception ex)
1035
                    {
1036
                        Log.Write(ex.Message + "\r\n" + ex.StackTrace);
1037
                    }
1038
                    finally
1039
                    {
1040
                        connection.Dispose();
1041
                    }
1042
                }
1043
            }
1044
            else if (projectInfo.DBType == ID2DB_Type.MSSQL)
1045
            {
1046
                using (SqlConnection connection = GetSqlConnection())
1047
                {
1048
                    try
1049
                    {
1050
                        if (connection != null && connection.State == ConnectionState.Open)
1051
                        {
1052
                            using (SqlCommand cmd = connection.CreateCommand())
1053
                            {
1054
                                cmd.CommandText = string.Format("SELECT * FROM {0}", APID_SYMBOL_MAPPING_TABLE);
1055
                                using (SqlDataReader dr = cmd.ExecuteReader())
1056
                                    dt.Load(dr);
1057
                            }
1058
                            connection.Close();
1059
                        }
1060
                    }
1061
                    catch (Exception ex)
1062
                    {
1063
                        Log.Write(ex.Message + "\r\n" + ex.StackTrace);
1064
                    }
1065
                    finally
1066
                    {
1067
                        if (connection != null)
1068
                            connection.Dispose();
1069
                    }
1070
                }
1071
            }
1072

  
1073
            return dt;
1074
        }
1075
        public static DataTable GetAttributeMappingTableOnlyAttribute()
1076
        {
1077
            DataTable dt = new DataTable();
1078
            Project_Info projectInfo = Project_Info.GetInstance();
1079
            if (projectInfo.DBType == ID2DB_Type.SQLite)
1080
            {
1081
                using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", projectInfo.DBFilePath)))
1082
                {
1083
                    try
1084
                    {
1085
                        connection.Open();
1086
                        using (SQLiteCommand cmd = connection.CreateCommand())
1087
                        {
1088
                            cmd.CommandText = string.Format("SELECT * FROM {0}", APID_ATTRIBUTE_MAPPING_TABLE);
1089
                            using (SQLiteDataReader dr = cmd.ExecuteReader())
1090
                                dt.Load(dr);
1091
                        }
1092
                        connection.Close();
1093
                    }
1094
                    catch (Exception ex)
1095
                    {
1096
                        Log.Write(ex.Message + "\r\n" + ex.StackTrace);
1097
                    }
1098
                    finally
1099
                    {
1100
                        connection.Dispose();
1101
                    }
1102
                }
1103
            }
1104
            else if (projectInfo.DBType == ID2DB_Type.MSSQL)
1105
            {
1106
                using (SqlConnection connection = GetSqlConnection())
1107
                {
1108
                    try
1109
                    {
1110
                        if (connection != null && connection.State == ConnectionState.Open)
1111
                        {
1112
                            using (SqlCommand cmd = connection.CreateCommand())
1113
                            {
1114
                                cmd.CommandText = string.Format("SELECT * FROM {0}", APID_ATTRIBUTE_MAPPING_TABLE);
1115
                                using (SqlDataReader dr = cmd.ExecuteReader())
1116
                                    dt.Load(dr);
1117
                            }
1118
                            connection.Close();
1119
                        }
1120
                    }
1121
                    catch (Exception ex)
1122
                    {
1123
                        Log.Write(ex.Message + "\r\n" + ex.StackTrace);
1124
                    }
1125
                    finally
1126
                    {
1127
                        if (connection != null)
1128
                            connection.Dispose();
1129
                    }
1130
                }
1131
            }
1132

  
1133
            return dt;
1134
        }
1015 1135
        #endregion
1016 1136

  
1017 1137
        #region AVEVA
DTI_PID/APIDConverter/Form/APIDConverter.cs
182 182
            }
183 183
            else
184 184
            {
185
                ID2SymbolTypeTable = Project_DB.SelectSymbolType();
185
                ID2SymbolTypeTable = Project_DB.GetSymbolType();
186 186
            }
187 187
        }
188 188

  
......
197 197
            DataTable symbolMappingTable = Project_DB.GetSymbolMappingTable();
198 198
            DataTable lineMappingTable = Project_DB.GetLineMappingTable();
199 199
            DataTable opcMappingTable = Project_DB.GetOPCMappingTable();
200
            DataTable tDrawing = Project_DB.SelectDrawings();
200
            DataTable tDrawing = Project_DB.GetDrawings();
201 201
            Documents.Clear();
202 202
            foreach (int rowHandle in gridViewConverter.GetSelectedRows())
203 203
            {
DTI_PID/APIDConverter/Form/MappingForm.cs
222 222
        }
223 223
        private void SetLineNumberAttributeMappingTable()
224 224
        {
225
            DataTable dt = Project_DB.SelectProjectLineProperties();
225
            DataTable dt = Project_DB.GetProjectLineProperties();
226 226
            dt.Columns.Add("Type");
227 227
            foreach (DataRow row in dt.Rows)
228 228
                row["Type"] = "Line";
......
268 268
            clearButton.ButtonClick += repositoryItemButtonEdit_ButtonClick;
269 269
            clearButton.TextEditStyle = TextEditStyles.HideTextEditor;
270 270

  
271
            DataTable dt = Project_DB.SelectProjectAttribute();
271
            DataTable dt = Project_DB.GetProjectAttribute();
272 272
            dt.Columns.Add("Clear");
273 273
            dt.Columns["Clear"].Caption = "";
274 274

  

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)