프로젝트

일반

사용자정보

개정판 9ee9b61d

ID9ee9b61d287a8086e8cf0cb6882d6738f6aaccd2
상위 71aba947
하위 ab9a7ab5

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

dev issue #1227 : mapping 화면 개발

Change-Id: I8e738f1b849c55887c1e8cc66e48777f4033b409

차이점 보기:

DTI_PID/APIDConverter/DB/Project_DB.cs
25 25
        const string Symbol_TABLE = "Symbol";
26 26
        const string OPCRelations_TABLE = "OPCRelations";
27 27

  
28
        #region Only ID2 DB
28 29
        private static SqlConnection GetSqlConnection()
29 30
        {
30 31
            Project_Info projectInfo = Project_Info.GetInstance();
......
213 214

  
214 215
            return dt;
215 216
        }
217
        public static DataTable GetLineMappingTable()
218
        {
219
            DataTable dt = new DataTable();
220
            Project_Info projectInfo = Project_Info.GetInstance();
221
            if (projectInfo.DBType == ID2DB_Type.SQLite)
222
            {
223
                using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", projectInfo.DBFilePath)))
224
                {
225
                    try
226
                    {
227
                        connection.Open();
228
                        using (SQLiteCommand cmd = connection.CreateCommand())
229
                        {
230
                            cmd.CommandText = string.Format(@"
231
                            SELECT l.UID, l.Name, sp.APID_SYMBOL FROM {0} as l 
232
                                LEFT OUTER JOIN {1} as sp 
233
                                    ON l.UID = SP.UID ;", LineTypes_TABLE, APID_SYMBOL_MAPPING_TABLE);
234
                            using (SQLiteDataReader dr = cmd.ExecuteReader())
235
                                dt.Load(dr);
236
                        }
237
                        connection.Close();
238
                    }
239
                    catch (Exception ex)
240
                    {
241
                        Log.Write(ex.Message + "\r\n" + ex.StackTrace);
242
                    }
243
                    finally
244
                    {
245
                        connection.Dispose();
246
                    }
247
                }
248
            }
249
            else if (projectInfo.DBType == ID2DB_Type.MSSQL)
250
            {
251
                using (SqlConnection connection = GetSqlConnection())
252
                {
253
                    try
254
                    {
255
                        if (connection != null && connection.State == ConnectionState.Open)
256
                        {
257
                            using (SqlCommand cmd = connection.CreateCommand())
258
                            {
259
                                cmd.CommandText = string.Format(@"
260
                            SELECT l.UID, l.Name, sp.APID_SYMBOL FROM {0} as l 
261
                                LEFT OUTER JOIN {1} as sp 
262
                                    ON l.UID = SP.UID ;", LineTypes_TABLE, APID_SYMBOL_MAPPING_TABLE);
263
                                using (SqlDataReader dr = cmd.ExecuteReader())
264
                                    dt.Load(dr);
265
                            }
266
                            connection.Close();
267
                        }
268
                    }
269
                    catch (Exception ex)
270
                    {
271
                        Log.Write(ex.Message + "\r\n" + ex.StackTrace);
272
                    }
273
                    finally
274
                    {
275
                        if (connection != null)
276
                            connection.Dispose();
277
                    }
278
                }
279
            }
216 280

  
217

  
218

  
219

  
220
        #region Only ID2 DB
281
            return dt;
282
        }
221 283
        public static DataTable SelectID2SymbolTable()
222 284
        {
223 285
            DataTable dt = new DataTable();

내보내기 Unified diff

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