프로젝트

일반

사용자정보

개정판 8847ea67

ID8847ea67e8e1f07b684ed75ed66457fe8fa32003
상위 2062c36a
하위 6ea71950

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

dev issue #1203 : MSSQL 설정 창 추가 및 데이터 구조 변경

Change-Id: I7f310aba7b221ea99c3e5b8070fb89c7a85460e3

차이점 보기:

DTI_PID/SPPIDConverter/App.config
21 21
  </entityFramework>
22 22
  <userSettings>
23 23
    <Converter.SPPID.Properties.Settings>
24
      <setting name="LatestProjectPath" serializeAs="String">
24
      <setting name="ProjectPath" serializeAs="String">
25 25
        <value />
26 26
      </setting>
27 27
      <setting name="DrawingX" serializeAs="String">
......
36 36
      <setting name="DefaultUnit" serializeAs="String">
37 37
        <value />
38 38
      </setting>
39
      <setting name="ProjectDBType" serializeAs="String">
40
        <value>0</value>
41
      </setting>
42
      <setting name="ProjectServerIP" serializeAs="String">
43
        <value />
44
      </setting>
45
      <setting name="ProjectPort" serializeAs="String">
46
        <value />
47
      </setting>
48
      <setting name="ProjectDBUser" serializeAs="String">
49
        <value />
50
      </setting>
51
      <setting name="ProjectDBPassword" serializeAs="String">
52
        <value />
53
      </setting>
39 54
    </Converter.SPPID.Properties.Settings>
40 55
  </userSettings>
41 56
  <system.data>
DTI_PID/SPPIDConverter/ConverterDocking.cs
46 46
                textEditDrawingY.EditValue = Settings.Default.DrawingY;
47 47

  
48 48
                Project_Info _ProjectInfo = Project_Info.GetInstance();
49
                _ProjectInfo.DefaultPath = Settings.Default.LatestProjectPath;
49
                _ProjectInfo.DefaultPath = Settings.Default.ProjectPath;
50
                _ProjectInfo.DBType = (ID2DB_Type)Settings.Default.ProjectDBType;
51
                _ProjectInfo.ServerIP = Settings.Default.ProjectServerIP;
52
                _ProjectInfo.Port = Settings.Default.ProjectPort;
53
                _ProjectInfo.DBUser = Settings.Default.ProjectDBUser;
54
                _ProjectInfo.DBPassword = Settings.Default.ProjectDBPassword;
50 55
            }
51 56
            catch (Exception ex)
52 57
            {
DTI_PID/SPPIDConverter/ConverterForm.Designer.cs
32 32
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ConverterForm));
33 33
            this.ribbonControl = new DevExpress.XtraBars.Ribbon.RibbonControl();
34 34
            this.layoutControl1 = new DevExpress.XtraLayout.LayoutControl();
35
            this.btnID2DB = new DevExpress.XtraEditors.SimpleButton();
35 36
            this.checkEditCloseDocument = new DevExpress.XtraEditors.CheckEdit();
36 37
            this.btnRefresh = new DevExpress.XtraEditors.SimpleButton();
37 38
            this.comboBoxEditDefaultTemplate = new DevExpress.XtraEditors.ComboBoxEdit();
......
42 43
            this.btnSPPIDDB = new DevExpress.XtraEditors.SimpleButton();
43 44
            this.gridControlConverter = new DevExpress.XtraGrid.GridControl();
44 45
            this.gridViewConverter = new DevExpress.XtraGrid.Views.Grid.GridView();
45
            this.btnID2Project = new DevExpress.XtraEditors.ButtonEdit();
46 46
            this.Root = new DevExpress.XtraLayout.LayoutControlGroup();
47 47
            this.layoutControlGroupSPPIDDB = new DevExpress.XtraLayout.LayoutControlGroup();
48 48
            this.labelSPPIDPlantName = new DevExpress.XtraLayout.SimpleLabelItem();
......
70 70
            this.layoutControlGroupID2Project = new DevExpress.XtraLayout.LayoutControlGroup();
71 71
            this.labelID2ProjectName = new DevExpress.XtraLayout.SimpleLabelItem();
72 72
            this.labelID2ProjectStatus = new DevExpress.XtraLayout.SimpleLabelItem();
73
            this.layoutControlItem7 = new DevExpress.XtraLayout.LayoutControlItem();
74 73
            this.simpleLabelItem3 = new DevExpress.XtraLayout.SimpleLabelItem();
75 74
            this.simpleLabelItem4 = new DevExpress.XtraLayout.SimpleLabelItem();
75
            this.layoutControlItem7 = new DevExpress.XtraLayout.LayoutControlItem();
76
            this.labelDBType = new DevExpress.XtraLayout.SimpleLabelItem();
77
            this.simpleLabelItem7 = new DevExpress.XtraLayout.SimpleLabelItem();
76 78
            this.splitterItem1 = new DevExpress.XtraLayout.SplitterItem();
77 79
            this.xtraFolderBrowserDialog = new DevExpress.XtraEditors.XtraFolderBrowserDialog(this.components);
78 80
            this.xtraOpenFileDialog = new DevExpress.XtraEditors.XtraOpenFileDialog(this.components);
......
84 86
            ((System.ComponentModel.ISupportInitialize)(this.buttonEditDefaultUnit.Properties)).BeginInit();
85 87
            ((System.ComponentModel.ISupportInitialize)(this.gridControlConverter)).BeginInit();
86 88
            ((System.ComponentModel.ISupportInitialize)(this.gridViewConverter)).BeginInit();
87
            ((System.ComponentModel.ISupportInitialize)(this.btnID2Project.Properties)).BeginInit();
88 89
            ((System.ComponentModel.ISupportInitialize)(this.Root)).BeginInit();
89 90
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroupSPPIDDB)).BeginInit();
90 91
            ((System.ComponentModel.ISupportInitialize)(this.labelSPPIDPlantName)).BeginInit();
......
112 113
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroupID2Project)).BeginInit();
113 114
            ((System.ComponentModel.ISupportInitialize)(this.labelID2ProjectName)).BeginInit();
114 115
            ((System.ComponentModel.ISupportInitialize)(this.labelID2ProjectStatus)).BeginInit();
115
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem7)).BeginInit();
116 116
            ((System.ComponentModel.ISupportInitialize)(this.simpleLabelItem3)).BeginInit();
117 117
            ((System.ComponentModel.ISupportInitialize)(this.simpleLabelItem4)).BeginInit();
118
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem7)).BeginInit();
119
            ((System.ComponentModel.ISupportInitialize)(this.labelDBType)).BeginInit();
120
            ((System.ComponentModel.ISupportInitialize)(this.simpleLabelItem7)).BeginInit();
118 121
            ((System.ComponentModel.ISupportInitialize)(this.splitterItem1)).BeginInit();
119 122
            this.SuspendLayout();
120 123
            // 
......
135 138
            // 
136 139
            // layoutControl1
137 140
            // 
141
            this.layoutControl1.Controls.Add(this.btnID2DB);
138 142
            this.layoutControl1.Controls.Add(this.checkEditCloseDocument);
139 143
            this.layoutControl1.Controls.Add(this.btnRefresh);
140 144
            this.layoutControl1.Controls.Add(this.comboBoxEditDefaultTemplate);
......
144 148
            this.layoutControl1.Controls.Add(this.btnItemMapping);
145 149
            this.layoutControl1.Controls.Add(this.btnSPPIDDB);
146 150
            this.layoutControl1.Controls.Add(this.gridControlConverter);
147
            this.layoutControl1.Controls.Add(this.btnID2Project);
148 151
            this.layoutControl1.Dock = System.Windows.Forms.DockStyle.Fill;
149 152
            this.layoutControl1.Location = new System.Drawing.Point(0, 32);
150 153
            this.layoutControl1.Name = "layoutControl1";
......
154 157
            this.layoutControl1.TabIndex = 1;
155 158
            this.layoutControl1.Text = "layoutControl1";
156 159
            // 
160
            // btnID2DB
161
            // 
162
            this.btnID2DB.ImageOptions.SvgImage = ((DevExpress.Utils.Svg.SvgImage)(resources.GetObject("btnID2DB.ImageOptions.SvgImage")));
163
            this.btnID2DB.Location = new System.Drawing.Point(967, 58);
164
            this.btnID2DB.Name = "btnID2DB";
165
            this.btnID2DB.Size = new System.Drawing.Size(243, 36);
166
            this.btnID2DB.StyleController = this.layoutControl1;
167
            this.btnID2DB.TabIndex = 15;
168
            this.btnID2DB.Text = "Setting";
169
            this.btnID2DB.Click += new System.EventHandler(this.btnID2DB_Click);
170
            // 
157 171
            // checkEditCloseDocument
158 172
            // 
159
            this.checkEditCloseDocument.Location = new System.Drawing.Point(744, 76);
173
            this.checkEditCloseDocument.Location = new System.Drawing.Point(735, 76);
160 174
            this.checkEditCloseDocument.MenuManager = this.ribbonControl;
161 175
            this.checkEditCloseDocument.Name = "checkEditCloseDocument";
162 176
            this.checkEditCloseDocument.Properties.Caption = "Close Document";
......
177 191
            // 
178 192
            // comboBoxEditDefaultTemplate
179 193
            // 
180
            this.comboBoxEditDefaultTemplate.Location = new System.Drawing.Point(613, 76);
194
            this.comboBoxEditDefaultTemplate.Location = new System.Drawing.Point(609, 76);
181 195
            this.comboBoxEditDefaultTemplate.MenuManager = this.ribbonControl;
182 196
            this.comboBoxEditDefaultTemplate.Name = "comboBoxEditDefaultTemplate";
183 197
            this.comboBoxEditDefaultTemplate.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
184 198
            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
185 199
            this.comboBoxEditDefaultTemplate.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
186
            this.comboBoxEditDefaultTemplate.Size = new System.Drawing.Size(117, 20);
200
            this.comboBoxEditDefaultTemplate.Size = new System.Drawing.Size(112, 20);
187 201
            this.comboBoxEditDefaultTemplate.StyleController = this.layoutControl1;
188 202
            this.comboBoxEditDefaultTemplate.TabIndex = 12;
189 203
            this.comboBoxEditDefaultTemplate.SelectedIndexChanged += new System.EventHandler(this.comboBoxEditDefaultTemplate_SelectedIndexChanged);
190 204
            // 
191 205
            // buttonEditDefaultUnit
192 206
            // 
193
            this.buttonEditDefaultUnit.Location = new System.Drawing.Point(393, 76);
207
            this.buttonEditDefaultUnit.Location = new System.Drawing.Point(392, 76);
194 208
            this.buttonEditDefaultUnit.MenuManager = this.ribbonControl;
195 209
            this.buttonEditDefaultUnit.Name = "buttonEditDefaultUnit";
196 210
            this.buttonEditDefaultUnit.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
197 211
            new DevExpress.XtraEditors.Controls.EditorButton()});
198 212
            this.buttonEditDefaultUnit.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
199
            this.buttonEditDefaultUnit.Size = new System.Drawing.Size(116, 20);
213
            this.buttonEditDefaultUnit.Size = new System.Drawing.Size(113, 20);
200 214
            this.buttonEditDefaultUnit.StyleController = this.layoutControl1;
201 215
            this.buttonEditDefaultUnit.TabIndex = 11;
202 216
            this.buttonEditDefaultUnit.ButtonClick += new DevExpress.XtraEditors.Controls.ButtonPressedEventHandler(this.buttonEditDefaulUnit_ButtonClick);
......
205 219
            // btnRun
206 220
            // 
207 221
            this.btnRun.ImageOptions.SvgImage = ((DevExpress.Utils.Svg.SvgImage)(resources.GetObject("btnRun.ImageOptions.SvgImage")));
208
            this.btnRun.Location = new System.Drawing.Point(859, 58);
222
            this.btnRun.Location = new System.Drawing.Point(850, 58);
209 223
            this.btnRun.Name = "btnRun";
210 224
            this.btnRun.Size = new System.Drawing.Size(79, 36);
211 225
            this.btnRun.StyleController = this.layoutControl1;
......
227 241
            // btnItemMapping
228 242
            // 
229 243
            this.btnItemMapping.ImageOptions.SvgImage = ((DevExpress.Utils.Svg.SvgImage)(resources.GetObject("btnItemMapping.ImageOptions.SvgImage")));
230
            this.btnItemMapping.Location = new System.Drawing.Point(976, 310);
244
            this.btnItemMapping.Location = new System.Drawing.Point(967, 344);
231 245
            this.btnItemMapping.Name = "btnItemMapping";
232
            this.btnItemMapping.Size = new System.Drawing.Size(234, 36);
246
            this.btnItemMapping.Size = new System.Drawing.Size(243, 36);
233 247
            this.btnItemMapping.StyleController = this.layoutControl1;
234 248
            this.btnItemMapping.TabIndex = 7;
235 249
            this.btnItemMapping.Text = "Item Mapping Setting";
......
238 252
            // btnSPPIDDB
239 253
            // 
240 254
            this.btnSPPIDDB.ImageOptions.SvgImage = ((DevExpress.Utils.Svg.SvgImage)(resources.GetObject("btnSPPIDDB.ImageOptions.SvgImage")));
241
            this.btnSPPIDDB.Location = new System.Drawing.Point(976, 176);
255
            this.btnSPPIDDB.Location = new System.Drawing.Point(967, 210);
242 256
            this.btnSPPIDDB.Name = "btnSPPIDDB";
243
            this.btnSPPIDDB.Size = new System.Drawing.Size(234, 36);
257
            this.btnSPPIDDB.Size = new System.Drawing.Size(243, 36);
244 258
            this.btnSPPIDDB.StyleController = this.layoutControl1;
245 259
            this.btnSPPIDDB.TabIndex = 5;
246 260
            this.btnSPPIDDB.Text = "Setting";
......
252 266
            this.gridControlConverter.MainView = this.gridViewConverter;
253 267
            this.gridControlConverter.MenuManager = this.ribbonControl;
254 268
            this.gridControlConverter.Name = "gridControlConverter";
255
            this.gridControlConverter.Size = new System.Drawing.Size(914, 441);
269
            this.gridControlConverter.Size = new System.Drawing.Size(905, 441);
256 270
            this.gridControlConverter.TabIndex = 4;
257 271
            this.gridControlConverter.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] {
258 272
            this.gridViewConverter});
......
265 279
            this.gridViewConverter.RowCellClick += new DevExpress.XtraGrid.Views.Grid.RowCellClickEventHandler(this.gridViewConverter_RowCellClick);
266 280
            this.gridViewConverter.SelectionChanged += new DevExpress.Data.SelectionChangedEventHandler(this.gridViewConverter_SelectionChanged);
267 281
            // 
268
            // btnID2Project
269
            // 
270
            this.btnID2Project.Location = new System.Drawing.Point(1014, 58);
271
            this.btnID2Project.MenuManager = this.ribbonControl;
272
            this.btnID2Project.Name = "btnID2Project";
273
            this.btnID2Project.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
274
            new DevExpress.XtraEditors.Controls.EditorButton()});
275
            this.btnID2Project.Properties.ReadOnly = true;
276
            this.btnID2Project.Size = new System.Drawing.Size(196, 20);
277
            this.btnID2Project.StyleController = this.layoutControl1;
278
            this.btnID2Project.TabIndex = 10;
279
            this.btnID2Project.ButtonClick += new DevExpress.XtraEditors.Controls.ButtonPressedEventHandler(this.btnID2Project_ButtonClick);
280
            // 
281 282
            // Root
282 283
            // 
283 284
            this.Root.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.True;
......
303 304
            this.layoutControlItem2,
304 305
            this.simpleLabelItem2,
305 306
            this.simpleLabelItem1});
306
            this.layoutControlGroupSPPIDDB.Location = new System.Drawing.Point(952, 118);
307
            this.layoutControlGroupSPPIDDB.Location = new System.Drawing.Point(943, 152);
307 308
            this.layoutControlGroupSPPIDDB.Name = "layoutControlGroupSPPIDDB";
308
            this.layoutControlGroupSPPIDDB.Size = new System.Drawing.Size(262, 134);
309
            this.layoutControlGroupSPPIDDB.Size = new System.Drawing.Size(271, 134);
309 310
            this.layoutControlGroupSPPIDDB.Text = "SPPID DB";
310 311
            // 
311 312
            // labelSPPIDPlantName
......
314 315
            this.labelSPPIDPlantName.AppearanceItemCaption.Options.UseForeColor = true;
315 316
            this.labelSPPIDPlantName.Location = new System.Drawing.Point(78, 40);
316 317
            this.labelSPPIDPlantName.Name = "labelSPPIDPlantName";
317
            this.labelSPPIDPlantName.Size = new System.Drawing.Size(160, 18);
318
            this.labelSPPIDPlantName.Size = new System.Drawing.Size(169, 18);
318 319
            this.labelSPPIDPlantName.Text = "SPPIDPlantName";
319 320
            this.labelSPPIDPlantName.TextSize = new System.Drawing.Size(93, 14);
320 321
            // 
......
324 325
            this.labelSPPIDDBStatus.AppearanceItemCaption.Options.UseForeColor = true;
325 326
            this.labelSPPIDDBStatus.Location = new System.Drawing.Point(51, 58);
326 327
            this.labelSPPIDDBStatus.Name = "labelSPPIDDBStatus";
327
            this.labelSPPIDDBStatus.Size = new System.Drawing.Size(187, 18);
328
            this.labelSPPIDDBStatus.Size = new System.Drawing.Size(196, 18);
328 329
            this.labelSPPIDDBStatus.Text = "SPPIDDBStatus";
329 330
            this.labelSPPIDDBStatus.TextSize = new System.Drawing.Size(93, 14);
330 331
            // 
......
333 334
            this.layoutControlItem2.Control = this.btnSPPIDDB;
334 335
            this.layoutControlItem2.Location = new System.Drawing.Point(0, 0);
335 336
            this.layoutControlItem2.Name = "layoutControlItem2";
336
            this.layoutControlItem2.Size = new System.Drawing.Size(238, 40);
337
            this.layoutControlItem2.Size = new System.Drawing.Size(247, 40);
337 338
            this.layoutControlItem2.TextSize = new System.Drawing.Size(0, 0);
338 339
            this.layoutControlItem2.TextVisible = false;
339 340
            // 
......
373 374
            this.layoutControlItem4,
374 375
            this.labelItemMappingStatus,
375 376
            this.simpleLabelItem5});
376
            this.layoutControlGroupItemMapping.Location = new System.Drawing.Point(952, 252);
377
            this.layoutControlGroupItemMapping.Location = new System.Drawing.Point(943, 286);
377 378
            this.layoutControlGroupItemMapping.Name = "layoutControlGroupItemMapping";
378
            this.layoutControlGroupItemMapping.Size = new System.Drawing.Size(262, 116);
379
            this.layoutControlGroupItemMapping.Size = new System.Drawing.Size(271, 116);
379 380
            this.layoutControlGroupItemMapping.Text = "Item Mapping";
380 381
            // 
381 382
            // layoutControlItem4
......
383 384
            this.layoutControlItem4.Control = this.btnItemMapping;
384 385
            this.layoutControlItem4.Location = new System.Drawing.Point(0, 0);
385 386
            this.layoutControlItem4.Name = "layoutControlItem4";
386
            this.layoutControlItem4.Size = new System.Drawing.Size(238, 40);
387
            this.layoutControlItem4.Size = new System.Drawing.Size(247, 40);
387 388
            this.layoutControlItem4.TextSize = new System.Drawing.Size(0, 0);
388 389
            this.layoutControlItem4.TextVisible = false;
389 390
            // 
......
393 394
            this.labelItemMappingStatus.AppearanceItemCaption.Options.UseForeColor = true;
394 395
            this.labelItemMappingStatus.Location = new System.Drawing.Point(51, 40);
395 396
            this.labelItemMappingStatus.Name = "labelItemMappingStatus";
396
            this.labelItemMappingStatus.Size = new System.Drawing.Size(187, 18);
397
            this.labelItemMappingStatus.Size = new System.Drawing.Size(196, 18);
397 398
            this.labelItemMappingStatus.Text = "MappingStatus";
398 399
            this.labelItemMappingStatus.TextSize = new System.Drawing.Size(93, 14);
399 400
            // 
......
429 430
            this.emptySpaceItem5});
430 431
            this.layoutControlGroupAutoConverter.Location = new System.Drawing.Point(0, 0);
431 432
            this.layoutControlGroupAutoConverter.Name = "layoutControlGroupAutoConverter";
432
            this.layoutControlGroupAutoConverter.Size = new System.Drawing.Size(942, 545);
433
            this.layoutControlGroupAutoConverter.Size = new System.Drawing.Size(933, 545);
433 434
            this.layoutControlGroupAutoConverter.Text = "Auto Converter";
434 435
            // 
435 436
            // layoutControlItem1
......
437 438
            this.layoutControlItem1.Control = this.gridControlConverter;
438 439
            this.layoutControlItem1.Location = new System.Drawing.Point(0, 42);
439 440
            this.layoutControlItem1.Name = "layoutControlItem1";
440
            this.layoutControlItem1.Size = new System.Drawing.Size(918, 445);
441
            this.layoutControlItem1.Size = new System.Drawing.Size(909, 445);
441 442
            this.layoutControlItem1.TextSize = new System.Drawing.Size(0, 0);
442 443
            this.layoutControlItem1.TextVisible = false;
443 444
            // 
......
458 459
            this.emptySpaceItem2.AllowHotTrack = false;
459 460
            this.emptySpaceItem2.Location = new System.Drawing.Point(236, 0);
460 461
            this.emptySpaceItem2.Name = "emptySpaceItem2";
461
            this.emptySpaceItem2.Size = new System.Drawing.Size(599, 18);
462
            this.emptySpaceItem2.Size = new System.Drawing.Size(590, 18);
462 463
            this.emptySpaceItem2.TextSize = new System.Drawing.Size(0, 0);
463 464
            // 
464 465
            // layoutControlItem6
465 466
            // 
466 467
            this.layoutControlItem6.Control = this.btnRun;
467
            this.layoutControlItem6.Location = new System.Drawing.Point(835, 0);
468
            this.layoutControlItem6.Location = new System.Drawing.Point(826, 0);
468 469
            this.layoutControlItem6.MaxSize = new System.Drawing.Size(83, 40);
469 470
            this.layoutControlItem6.MinSize = new System.Drawing.Size(83, 40);
470 471
            this.layoutControlItem6.Name = "layoutControlItem6";
......
476 477
            // layoutControlItem3
477 478
            // 
478 479
            this.layoutControlItem3.Control = this.buttonEditDefaultUnit;
479
            this.layoutControlItem3.Location = new System.Drawing.Point(299, 18);
480
            this.layoutControlItem3.Location = new System.Drawing.Point(298, 18);
480 481
            this.layoutControlItem3.Name = "layoutControlItem3";
481
            this.layoutControlItem3.Size = new System.Drawing.Size(190, 24);
482
            this.layoutControlItem3.Size = new System.Drawing.Size(187, 24);
482 483
            this.layoutControlItem3.Text = "Default Unit";
483 484
            this.layoutControlItem3.TextAlignMode = DevExpress.XtraLayout.TextAlignModeItem.AutoSize;
484 485
            this.layoutControlItem3.TextSize = new System.Drawing.Size(65, 14);
......
487 488
            // layoutControlItem8
488 489
            // 
489 490
            this.layoutControlItem8.Control = this.comboBoxEditDefaultTemplate;
490
            this.layoutControlItem8.Location = new System.Drawing.Point(489, 18);
491
            this.layoutControlItem8.Location = new System.Drawing.Point(485, 18);
491 492
            this.layoutControlItem8.Name = "layoutControlItem8";
492
            this.layoutControlItem8.Size = new System.Drawing.Size(221, 24);
493
            this.layoutControlItem8.Size = new System.Drawing.Size(216, 24);
493 494
            this.layoutControlItem8.Text = "Default Template";
494 495
            this.layoutControlItem8.TextAlignMode = DevExpress.XtraLayout.TextAlignModeItem.AutoSize;
495 496
            this.layoutControlItem8.TextSize = new System.Drawing.Size(95, 14);
......
500 501
            this.emptySpaceItem3.AllowHotTrack = false;
501 502
            this.emptySpaceItem3.Location = new System.Drawing.Point(236, 18);
502 503
            this.emptySpaceItem3.Name = "emptySpaceItem3";
503
            this.emptySpaceItem3.Size = new System.Drawing.Size(63, 24);
504
            this.emptySpaceItem3.Size = new System.Drawing.Size(62, 24);
504 505
            this.emptySpaceItem3.TextSize = new System.Drawing.Size(0, 0);
505 506
            // 
506 507
            // layoutControlItem9
......
526 527
            // layoutControlItem10
527 528
            // 
528 529
            this.layoutControlItem10.Control = this.checkEditCloseDocument;
529
            this.layoutControlItem10.Location = new System.Drawing.Point(720, 18);
530
            this.layoutControlItem10.Location = new System.Drawing.Point(711, 18);
530 531
            this.layoutControlItem10.MaxSize = new System.Drawing.Size(115, 24);
531 532
            this.layoutControlItem10.MinSize = new System.Drawing.Size(115, 24);
532 533
            this.layoutControlItem10.Name = "layoutControlItem10";
......
538 539
            // emptySpaceItem5
539 540
            // 
540 541
            this.emptySpaceItem5.AllowHotTrack = false;
541
            this.emptySpaceItem5.Location = new System.Drawing.Point(710, 18);
542
            this.emptySpaceItem5.Location = new System.Drawing.Point(701, 18);
542 543
            this.emptySpaceItem5.Name = "emptySpaceItem5";
543 544
            this.emptySpaceItem5.Size = new System.Drawing.Size(10, 24);
544 545
            this.emptySpaceItem5.TextSize = new System.Drawing.Size(0, 0);
......
546 547
            // emptySpaceItem1
547 548
            // 
548 549
            this.emptySpaceItem1.AllowHotTrack = false;
549
            this.emptySpaceItem1.Location = new System.Drawing.Point(952, 368);
550
            this.emptySpaceItem1.Location = new System.Drawing.Point(943, 402);
550 551
            this.emptySpaceItem1.Name = "emptySpaceItem1";
551
            this.emptySpaceItem1.Size = new System.Drawing.Size(262, 177);
552
            this.emptySpaceItem1.Size = new System.Drawing.Size(271, 143);
552 553
            this.emptySpaceItem1.TextSize = new System.Drawing.Size(0, 0);
553 554
            // 
554 555
            // layoutControlGroupID2Project
......
558 559
            this.layoutControlGroupID2Project.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] {
559 560
            this.labelID2ProjectName,
560 561
            this.labelID2ProjectStatus,
561
            this.layoutControlItem7,
562 562
            this.simpleLabelItem3,
563
            this.simpleLabelItem4});
564
            this.layoutControlGroupID2Project.Location = new System.Drawing.Point(952, 0);
563
            this.simpleLabelItem4,
564
            this.layoutControlItem7,
565
            this.labelDBType,
566
            this.simpleLabelItem7});
567
            this.layoutControlGroupID2Project.Location = new System.Drawing.Point(943, 0);
565 568
            this.layoutControlGroupID2Project.Name = "layoutControlGroupID2Project";
566
            this.layoutControlGroupID2Project.Size = new System.Drawing.Size(262, 118);
569
            this.layoutControlGroupID2Project.Size = new System.Drawing.Size(271, 152);
567 570
            this.layoutControlGroupID2Project.Text = "ID2 Project";
568 571
            // 
569 572
            // labelID2ProjectName
570 573
            // 
571 574
            this.labelID2ProjectName.AllowHotTrack = false;
572 575
            this.labelID2ProjectName.AppearanceItemCaption.Options.UseForeColor = true;
573
            this.labelID2ProjectName.Location = new System.Drawing.Point(90, 24);
576
            this.labelID2ProjectName.Location = new System.Drawing.Point(90, 40);
574 577
            this.labelID2ProjectName.Name = "labelID2ProjectName";
575
            this.labelID2ProjectName.Size = new System.Drawing.Size(148, 18);
578
            this.labelID2ProjectName.Size = new System.Drawing.Size(157, 18);
576 579
            this.labelID2ProjectName.Text = "ID2ProjectName";
577 580
            this.labelID2ProjectName.TextSize = new System.Drawing.Size(93, 14);
578 581
            // 
......
580 583
            // 
581 584
            this.labelID2ProjectStatus.AllowHotTrack = false;
582 585
            this.labelID2ProjectStatus.AppearanceItemCaption.Options.UseForeColor = true;
583
            this.labelID2ProjectStatus.Location = new System.Drawing.Point(51, 42);
586
            this.labelID2ProjectStatus.Location = new System.Drawing.Point(51, 76);
584 587
            this.labelID2ProjectStatus.Name = "labelID2ProjectStatus";
585
            this.labelID2ProjectStatus.Size = new System.Drawing.Size(187, 18);
588
            this.labelID2ProjectStatus.Size = new System.Drawing.Size(196, 18);
586 589
            this.labelID2ProjectStatus.Text = "ID2ProjectStatus";
587 590
            this.labelID2ProjectStatus.TextSize = new System.Drawing.Size(93, 14);
588 591
            // 
589
            // layoutControlItem7
590
            // 
591
            this.layoutControlItem7.Control = this.btnID2Project;
592
            this.layoutControlItem7.Location = new System.Drawing.Point(0, 0);
593
            this.layoutControlItem7.Name = "layoutControlItem7";
594
            this.layoutControlItem7.Size = new System.Drawing.Size(238, 24);
595
            this.layoutControlItem7.Text = "Path :";
596
            this.layoutControlItem7.TextAlignMode = DevExpress.XtraLayout.TextAlignModeItem.AutoSize;
597
            this.layoutControlItem7.TextSize = new System.Drawing.Size(33, 14);
598
            this.layoutControlItem7.TextToControlDistance = 5;
599
            // 
600 592
            // simpleLabelItem3
601 593
            // 
602 594
            this.simpleLabelItem3.AllowHotTrack = false;
603 595
            this.simpleLabelItem3.AppearanceItemCaption.Options.UseForeColor = true;
604
            this.simpleLabelItem3.Location = new System.Drawing.Point(0, 24);
596
            this.simpleLabelItem3.Location = new System.Drawing.Point(0, 40);
605 597
            this.simpleLabelItem3.MaxSize = new System.Drawing.Size(90, 18);
606 598
            this.simpleLabelItem3.MinSize = new System.Drawing.Size(90, 18);
607 599
            this.simpleLabelItem3.Name = "simpleLabelItem3";
......
615 607
            // 
616 608
            this.simpleLabelItem4.AllowHotTrack = false;
617 609
            this.simpleLabelItem4.AppearanceItemCaption.Options.UseForeColor = true;
618
            this.simpleLabelItem4.Location = new System.Drawing.Point(0, 42);
610
            this.simpleLabelItem4.Location = new System.Drawing.Point(0, 76);
619 611
            this.simpleLabelItem4.MaxSize = new System.Drawing.Size(51, 18);
620 612
            this.simpleLabelItem4.MinSize = new System.Drawing.Size(51, 18);
621 613
            this.simpleLabelItem4.Name = "simpleLabelItem4";
......
625 617
            this.simpleLabelItem4.TextAlignMode = DevExpress.XtraLayout.TextAlignModeItem.AutoSize;
626 618
            this.simpleLabelItem4.TextSize = new System.Drawing.Size(47, 14);
627 619
            // 
620
            // layoutControlItem7
621
            // 
622
            this.layoutControlItem7.Control = this.btnID2DB;
623
            this.layoutControlItem7.Location = new System.Drawing.Point(0, 0);
624
            this.layoutControlItem7.Name = "layoutControlItem7";
625
            this.layoutControlItem7.Size = new System.Drawing.Size(247, 40);
626
            this.layoutControlItem7.TextSize = new System.Drawing.Size(0, 0);
627
            this.layoutControlItem7.TextVisible = false;
628
            // 
629
            // labelDBType
630
            // 
631
            this.labelDBType.AllowHotTrack = false;
632
            this.labelDBType.AppearanceItemCaption.Options.UseForeColor = true;
633
            this.labelDBType.Location = new System.Drawing.Point(63, 58);
634
            this.labelDBType.MinSize = new System.Drawing.Size(97, 18);
635
            this.labelDBType.Name = "labelDBType";
636
            this.labelDBType.Size = new System.Drawing.Size(184, 18);
637
            this.labelDBType.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
638
            this.labelDBType.Text = "DB Type";
639
            this.labelDBType.TextSize = new System.Drawing.Size(93, 14);
640
            // 
641
            // simpleLabelItem7
642
            // 
643
            this.simpleLabelItem7.AllowHotTrack = false;
644
            this.simpleLabelItem7.AppearanceItemCaption.Options.UseForeColor = true;
645
            this.simpleLabelItem7.Location = new System.Drawing.Point(0, 58);
646
            this.simpleLabelItem7.MaxSize = new System.Drawing.Size(63, 18);
647
            this.simpleLabelItem7.MinSize = new System.Drawing.Size(63, 18);
648
            this.simpleLabelItem7.Name = "simpleLabelItem7";
649
            this.simpleLabelItem7.Size = new System.Drawing.Size(63, 18);
650
            this.simpleLabelItem7.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
651
            this.simpleLabelItem7.Text = "DB Type : ";
652
            this.simpleLabelItem7.TextAlignMode = DevExpress.XtraLayout.TextAlignModeItem.AutoSize;
653
            this.simpleLabelItem7.TextSize = new System.Drawing.Size(59, 14);
654
            // 
628 655
            // splitterItem1
629 656
            // 
630 657
            this.splitterItem1.AllowHotTrack = true;
631
            this.splitterItem1.Location = new System.Drawing.Point(942, 0);
658
            this.splitterItem1.Location = new System.Drawing.Point(933, 0);
632 659
            this.splitterItem1.Name = "splitterItem1";
633 660
            this.splitterItem1.Size = new System.Drawing.Size(10, 545);
634 661
            // 
......
636 663
            // 
637 664
            this.xtraFolderBrowserDialog.DialogStyle = DevExpress.Utils.CommonDialogs.FolderBrowserDialogStyle.Wide;
638 665
            this.xtraFolderBrowserDialog.SelectedPath = "xtraFolderBrowserDialog1";
666
            this.xtraFolderBrowserDialog.ShowNewFolderButton = false;
639 667
            // 
640 668
            // xtraOpenFileDialog
641 669
            // 
......
663 691
            ((System.ComponentModel.ISupportInitialize)(this.buttonEditDefaultUnit.Properties)).EndInit();
664 692
            ((System.ComponentModel.ISupportInitialize)(this.gridControlConverter)).EndInit();
665 693
            ((System.ComponentModel.ISupportInitialize)(this.gridViewConverter)).EndInit();
666
            ((System.ComponentModel.ISupportInitialize)(this.btnID2Project.Properties)).EndInit();
667 694
            ((System.ComponentModel.ISupportInitialize)(this.Root)).EndInit();
668 695
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroupSPPIDDB)).EndInit();
669 696
            ((System.ComponentModel.ISupportInitialize)(this.labelSPPIDPlantName)).EndInit();
......
691 718
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroupID2Project)).EndInit();
692 719
            ((System.ComponentModel.ISupportInitialize)(this.labelID2ProjectName)).EndInit();
693 720
            ((System.ComponentModel.ISupportInitialize)(this.labelID2ProjectStatus)).EndInit();
694
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem7)).EndInit();
695 721
            ((System.ComponentModel.ISupportInitialize)(this.simpleLabelItem3)).EndInit();
696 722
            ((System.ComponentModel.ISupportInitialize)(this.simpleLabelItem4)).EndInit();
723
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem7)).EndInit();
724
            ((System.ComponentModel.ISupportInitialize)(this.labelDBType)).EndInit();
725
            ((System.ComponentModel.ISupportInitialize)(this.simpleLabelItem7)).EndInit();
697 726
            ((System.ComponentModel.ISupportInitialize)(this.splitterItem1)).EndInit();
698 727
            this.ResumeLayout(false);
699 728
            this.PerformLayout();
......
732 761
        private DevExpress.XtraLayout.SimpleLabelItem simpleLabelItem4;
733 762
        private DevExpress.XtraLayout.SimpleLabelItem simpleLabelItem5;
734 763
        private DevExpress.XtraLayout.SplitterItem splitterItem1;
735
        private DevExpress.XtraEditors.ButtonEdit btnID2Project;
736
        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem7;
737 764
        private DevExpress.XtraEditors.XtraFolderBrowserDialog xtraFolderBrowserDialog;
738 765
        private DevExpress.XtraEditors.XtraOpenFileDialog xtraOpenFileDialog;
739 766
        private DevExpress.XtraEditors.ComboBoxEdit comboBoxEditDefaultTemplate;
......
747 774
        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem10;
748 775
        private DevExpress.XtraLayout.EmptySpaceItem emptySpaceItem5;
749 776
        public DevExpress.XtraEditors.CheckEdit checkEditCloseDocument;
777
        private DevExpress.XtraEditors.SimpleButton btnID2DB;
778
        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem7;
779
        private DevExpress.XtraLayout.SimpleLabelItem labelDBType;
780
        private DevExpress.XtraLayout.SimpleLabelItem simpleLabelItem7;
750 781
    }
751 782
}
DTI_PID/SPPIDConverter/ConverterForm.cs
143 143
            }
144 144
        }
145 145

  
146
        private void btnID2Project_ButtonClick(object sender, ButtonPressedEventArgs e)
146
        private void btnID2DB_Click(object sender, EventArgs e)
147 147
        {
148
            xtraFolderBrowserDialog.SelectedPath = btnID2Project.Text;
149

  
150
            if (xtraFolderBrowserDialog.ShowDialog() == DialogResult.OK)
148
            ID2DBSetting form = new ID2DBSetting();
149
            DialogResult = form.ShowDialog();
150
            Project_Info _ProjectInfo = Project_Info.GetInstance();
151
            _ProjectInfo.DefaultPath = Settings.Default.ProjectPath;
152
            _ProjectInfo.DBType = (ID2DB_Type)Settings.Default.ProjectDBType;
153
            _ProjectInfo.ServerIP = Settings.Default.ProjectServerIP;
154
            _ProjectInfo.Port = Settings.Default.ProjectPort;
155
            _ProjectInfo.DBUser = Settings.Default.ProjectDBUser;
156
            _ProjectInfo.DBPassword = Settings.Default.ProjectDBPassword;
157

  
158
            if (DialogResult == DialogResult.OK)
151 159
            {
152
                if (xtraFolderBrowserDialog.SelectedPath[xtraFolderBrowserDialog.SelectedPath.Length - 1] == '\\')
153
                    xtraFolderBrowserDialog.SelectedPath = xtraFolderBrowserDialog.SelectedPath.Remove(xtraFolderBrowserDialog.SelectedPath.Length - 1);
154
                Settings.Default.LatestProjectPath = xtraFolderBrowserDialog.SelectedPath;
155
                Settings.Default.Save();
156 160
                if (InitID2Project())
157
                {
158 161
                    MessageBox.Show(Msg.SuccessProjectSelect, Msg.Information, MessageBoxButtons.OK, MessageBoxIcon.Information);
159
                }
160 162
                else
161 163
                    MessageBox.Show(Msg.FailProjectSelect, Msg.Warning, MessageBoxButtons.OK, MessageBoxIcon.Warning);
162 164
            }
......
165 167
        private bool InitID2Project()
166 168
        {
167 169
            Project_Info _ProjectInfo = Project_Info.GetInstance();
168
            _ProjectInfo.DefaultPath = Settings.Default.LatestProjectPath;
169 170
            if (Project_DB.ConnTestAndCreateTable())
170 171
            {
171 172
                _ProjectInfo.Enable = true;
172
                btnID2Project.Text = _ProjectInfo.DefaultPath;
173
                labelDBType.Text = _ProjectInfo.DBType.ToString();
174
                labelDBType.AppearanceItemCaption.ForeColor = Color.Blue;
173 175
                labelID2ProjectName.Text = _ProjectInfo.Name;
174 176
                labelID2ProjectName.AppearanceItemCaption.ForeColor = Color.Blue;
175 177
                labelID2ProjectStatus.Text = Msg.ConnectionSuccessful;
......
180 182
            else
181 183
            {
182 184
                _ProjectInfo.Enable = false;
183
                btnID2Project.Text = "";
185
                labelDBType.Text = "";
184 186
                labelID2ProjectName.Text = " ";
185 187
                labelID2ProjectName.AppearanceItemCaption.ForeColor = Color.Red;
186 188
                labelID2ProjectStatus.Text = Msg.ConnectionFail;
......
764 766
            Settings.Default.DefaultTemplate = comboBoxEditDefaultTemplate.SelectedItem.ToString();
765 767
            Settings.Default.Save();
766 768
        }
769

  
770
        
767 771
    }
768 772
}
DTI_PID/SPPIDConverter/ConverterForm.resx
118 118
    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119 119
  </resheader>
120 120
  <assembly alias="DevExpress.Data.v18.2" name="DevExpress.Data.v18.2, Version=18.2.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
121
  <data name="btnID2DB.ImageOptions.SvgImage" type="DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v18.2" mimetype="application/x-microsoft.net.object.bytearray.base64">
122
    <value>
123
        AAEAAAD/////AQAAAAAAAAAMAgAAAFlEZXZFeHByZXNzLkRhdGEudjE4LjIsIFZlcnNpb249MTguMi43
124
        LjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjg4ZDE3NTRkNzAwZTQ5YQUBAAAAHURl
125
        dkV4cHJlc3MuVXRpbHMuU3ZnLlN2Z0ltYWdlAQAAAAREYXRhBwICAAAACQMAAAAPAwAAAA0DAAAC77u/
126
        PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0nVVRGLTgnPz4NCjxzdmcgeD0iMHB4IiB5PSIwcHgi
127
        IHZpZXdCb3g9IjAgMCAzMiAzMiIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcv
128
        MjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBlbmFibGUt
129
        YmFja2dyb3VuZD0ibmV3IDAgMCAzMiAzMiIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSIgaWQ9IkxheWVyXzEi
130
        Pg0KICA8ZyBpZD0iUHJvcGVydGllcyI+DQogICAgPHBhdGggZD0iTTMwLDE4di00bC00LjQtMC43Yy0w
131
        LjItMC44LTAuNS0xLjUtMC45LTIuMWwyLjYtMy42bC0yLjgtMi44bC0zLjYsMi42Yy0wLjctMC40LTEu
132
        NC0wLjctMi4xLTAuOUwxOCwyaC00ICAgbC0wLjcsNC40Yy0wLjgsMC4yLTEuNSwwLjUtMi4xLDAuOUw3
133
        LjUsNC43TDQuNyw3LjVsMi42LDMuNmMtMC40LDAuNy0wLjcsMS40LTAuOSwyLjFMMiwxNHY0bDQuNCww
134
        LjdjMC4yLDAuOCwwLjUsMS41LDAuOSwyLjEgICBsLTIuNiwzLjZsMi44LDIuOGwzLjYtMi42YzAuNyww
135
        LjQsMS40LDAuNywyLjEsMC45TDE0LDMwaDRsMC43LTQuNGMwLjgtMC4yLDEuNS0wLjUsMi4xLTAuOWwz
136
        LjYsMi42bDIuOC0yLjhsLTIuNi0zLjYgICBjMC40LTAuNywwLjctMS40LDAuOS0yLjFMMzAsMTh6IE0x
137
        NiwyMGMtMi4yLDAtNC0xLjgtNC00YzAtMi4yLDEuOC00LDQtNHM0LDEuOCw0LDRDMjAsMTguMiwxOC4y
138
        LDIwLDE2LDIweiIgZmlsbD0iIzExNzdENyIgY2xhc3M9IkJsdWUiIC8+DQogIDwvZz4NCjwvc3ZnPgs=
139
</value>
140
  </data>
121 141
  <data name="btnRefresh.ImageOptions.SvgImage" type="DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v18.2" mimetype="application/x-microsoft.net.object.bytearray.base64">
122 142
    <value>
123 143
        AAEAAAD/////AQAAAAAAAAAMAgAAAFlEZXZFeHByZXNzLkRhdGEudjE4LjIsIFZlcnNpb249MTguMi43
DTI_PID/SPPIDConverter/DB/Project_DB.cs
6 6
using System.Globalization;
7 7
using System.Data.SQLite;
8 8
using System.Data;
9
using System.Data.SqlClient;
9 10
using Newtonsoft.Json;
10 11

  
11 12
namespace Converter.BaseModel
......
27 28
        const string Symbol_TABLE = "Symbol";
28 29
        const string OPCRelations_TABLE = "OPCRelations";
29 30

  
30
        public static bool ConnTestAndCreateTable()
31
        private static SqlConnection GetSqlConnection()
31 32
        {
32
            bool result = false;
33 33
            Project_Info projectInfo = Project_Info.GetInstance();
34
            SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, @"Data Source = {0}", projectInfo.DBFilePath));
34
            SqlConnection connection = null;
35 35
            try
36 36
            {
37
                connection = new SqlConnection(string.Format(CultureInfo.CurrentCulture,
38
                    @"Data Source = {0},{1}; Initial Catalog = {2}; User ID = {3}; Password = {4};",
39
                    projectInfo.ServerIP,
40
                    projectInfo.Port,
41
                    System.IO.Path.GetFileName(projectInfo.DefaultPath),
42
                    projectInfo.DBUser,
43
                    projectInfo.DBPassword));
44

  
37 45
                connection.Open();
38
                if (connection.State == ConnectionState.Open)
39
                {
40
                    CreateTable(connection);
41
                    result = true;
42
                }
43
                connection.Close();
44 46
            }
45 47
            catch (Exception ex)
46 48
            {
47

  
48
            }
49
            finally
50
            {
51 49
                connection.Dispose();
50
                connection = null;
52 51
            }
53 52

  
54
            return result;
53
            return connection;
55 54
        }
56 55

  
57
        public static bool SaveSPPID_DB_INFO(string jsonString)
56
        public static bool ConnTestAndCreateTable()
58 57
        {
58
            bool result = false;
59 59
            Project_Info projectInfo = Project_Info.GetInstance();
60
            using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", projectInfo.DBFilePath)))
60
            if (projectInfo.DBType == ID2DB_Type.SQLite)
61 61
            {
62

  
63
                try
62
                using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, @"Data Source = {0}", projectInfo.DBFilePath)))
64 63
                {
65
                    connection.Open();
66
                    using (SQLiteCommand cmd = connection.CreateCommand())
64
                    try
67 65
                    {
68
                        cmd.CommandText = string.Format("DELETE FROM {0}", SPPID_DB_INFO_TABLE);
69
                        cmd.ExecuteNonQuery();
66
                        connection.Open();
67
                        if (connection.State == ConnectionState.Open)
68
                        {
69
                            using (SQLiteCommand cmd = connection.CreateCommand())
70
                            {
71
                                cmd.CommandText = "SELECT NAME FROM sqlite_master WHERE type='table'";
72
                                using (SQLiteDataReader dr = cmd.ExecuteReader())
73
                                using (DataTable dt = new DataTable())
74
                                {
75
                                    dt.Load(dr);
76

  
77
                                    if (dt.Select(string.Format("NAME = '{0}'", SPPID_DB_INFO_TABLE)).Length == 0)
78
                                    {
79
                                        cmd.CommandText = string.Format("CREATE TABLE {0} (JsonString TEXT)", SPPID_DB_INFO_TABLE);
80
                                        cmd.ExecuteNonQuery();
81
                                    }
82
                                    if (dt.Select(string.Format("NAME = '{0}'", SPPID_SETTING_TABLE)).Length == 0)
83
                                    {
84
                                        cmd.CommandText = string.Format("CREATE TABLE {0} (JsonString TEXT, SettingType TEXT)", SPPID_SETTING_TABLE);
85
                                        cmd.ExecuteNonQuery();
86
                                    }
87
                                    if (dt.Select(string.Format("NAME = '{0}'", SPPID_SYMBOL_MAPPING_TABLE)).Length == 0)
88
                                    {
89
                                        cmd.CommandText = string.Format("CREATE TABLE {0} (UID TEXT PRIMARY KEY, NAME TEXT, SPPID_SYMBOL_PATH TEXT, LEADERLINE BOOLEAN)", SPPID_SYMBOL_MAPPING_TABLE);
90
                                        cmd.ExecuteNonQuery();
91
                                    }
92
                                    if (dt.Select(string.Format("NAME = '{0}'", SPPID_ATTRIBUTE_MAPPING_TABLE)).Length == 0)
93
                                    {
94
                                        cmd.CommandText = string.Format("CREATE TABLE {0} (UID TEXT PRIMARY KEY, SPPID_ATTRIBUTE TEXT)", SPPID_ATTRIBUTE_MAPPING_TABLE);
95
                                        cmd.ExecuteNonQuery();
96
                                    }
97
                                    if (dt.Select(string.Format("NAME = '{0}'", SPPID_LABEL_INFO_TABLE)).Length == 0)
98
                                    {
99
                                        cmd.CommandText = string.Format("CREATE TABLE {0} (UID TEXT PRIMARY KEY, LOCATION INT DEFAULT 0, LEADERLINE BOOLEAN)", SPPID_LABEL_INFO_TABLE);
100
                                        cmd.ExecuteNonQuery();
101
                                    }
102
                                    if (dt.Select(string.Format("NAME = '{0}'", SPPID_DRAWING_INFO)).Length == 0)
103
                                    {
104
                                        cmd.CommandText = string.Format("CREATE TABLE {0} (ID2_DRAWING_UID Text PRIMARY KEY, PATH TEXT, DRAWINGNUMBER TEXT, DRAWINGNAME TEXT)", SPPID_DRAWING_INFO);
105
                                        cmd.ExecuteNonQuery();
106
                                    }
107
                                    if (dt.Select(string.Format("NAME = '{0}'", SPPID_OPC_INFO)).Length == 0)
108
                                    {
109
                                        cmd.CommandText = string.Format("CREATE TABLE {0} (ID2_OPC_UID TEXT PRIMARY KEY, SPPID_OPC_MODELITEM_ID TEXT, ID2_DRAWING_UID TEXT, ATTRIBUTES TEXT, PAIRED BOOL)", SPPID_OPC_INFO);
110
                                        cmd.ExecuteNonQuery();
111
                                    }
112
                                }
113

  
114
                                #region Check Column 업데이트시 예비용
115
                                cmd.CommandText = string.Format("SELECT * FROM {0}", SPPID_SYMBOL_MAPPING_TABLE);
116
                                using (SQLiteDataReader dr = cmd.ExecuteReader())
117
                                using (DataTable dt = new DataTable())
118
                                {
119
                                    dt.Load(dr);
120
                                    if (!dt.Columns.Contains("LEADERLINE"))
121
                                    {
122
                                        cmd.CommandText = string.Format("ALTER TABLE {0} ADD COLUMN LEADERLINE BOOLEAN", SPPID_SYMBOL_MAPPING_TABLE);
123
                                        cmd.ExecuteNonQuery();
124
                                    }
125
                                }
126

  
127
                                cmd.CommandText = string.Format("SELECT * FROM {0}", SPPID_SETTING_TABLE);
128
                                using (SQLiteDataReader dr = cmd.ExecuteReader())
129
                                using (DataTable dt = new DataTable())
130
                                {
131
                                    dt.Load(dr);
132
                                    if (!dt.Columns.Contains("SettingType"))
133
                                    {
134
                                        cmd.CommandText = string.Format("ALTER TABLE {0} ADD COLUMN SettingType Text", SPPID_SETTING_TABLE);
135
                                        cmd.ExecuteNonQuery();
136
                                    }
137
                                }
70 138

  
71
                        cmd.CommandText = string.Format("INSERT INTO {0} VALUES (@jsonString)", SPPID_DB_INFO_TABLE);
72
                        cmd.Parameters.AddWithValue("@jsonString", jsonString);
73
                        cmd.ExecuteNonQuery();
139
                                cmd.CommandText = string.Format("SELECT * FROM {0}", SPPID_DRAWING_INFO);
140
                                using (SQLiteDataReader dr = cmd.ExecuteReader())
141
                                using (DataTable dt = new DataTable())
142
                                {
143
                                    dt.Load(dr);
144
                                    if (dt.Columns.Contains("DOCUMENT"))
145
                                    {
146
                                        cmd.CommandText = string.Format("DROP TABLE {0}", SPPID_DRAWING_INFO);
147
                                        cmd.ExecuteNonQuery();
148

  
149
                                        cmd.CommandText = string.Format("CREATE TABLE {0} (ID2_DRAWING_UID Text PRIMARY KEY, PATH TEXT, DRAWINGNUMBER TEXT, DRAWINGNAME TEXT)", SPPID_DRAWING_INFO);
150
                                        cmd.ExecuteNonQuery();
151
                                    }
152
                                }
153
                                #endregion
154
                            }
155
                            result = true;
156
                        }
157
                        connection.Close();
158
                    }
159
                    catch (Exception ex)
160
                    {
161

  
162
                    }
163
                    finally
164
                    {
165
                        connection.Dispose();
74 166
                    }
75
                    connection.Close();
76
                }
77
                catch (Exception ex)
78
                {
79
                    return false;
80
                }
81
                finally
82
                {
83
                    connection.Dispose();
84 167
                }
85 168
            }
86

  
87
            return true;
88
        }
89

  
90
        public static DataTable SelectSPPID_DB_INFO()
91
        {
92
            DataTable dt = new DataTable();
93
            Project_Info projectInfo = Project_Info.GetInstance();
94
            using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", projectInfo.DBFilePath)))
169
            else if (projectInfo.DBType == ID2DB_Type.MSSQL)
95 170
            {
96
                try
171
                using (SqlConnection connection = GetSqlConnection())
97 172
                {
98
                    connection.Open();
99
                    using (SQLiteCommand cmd = connection.CreateCommand())
173
                    try
100 174
                    {
101
                        cmd.CommandText = string.Format("SELECT * FROM {0}", SPPID_DB_INFO_TABLE);
102
                        using (SQLiteDataReader dr = cmd.ExecuteReader())
103
                            dt.Load(dr);
175
                        if (connection != null && connection.State == ConnectionState.Open)
176
                        {
177
                            using (SqlCommand cmd = connection.CreateCommand())
178
                            {
179
                                cmd.CommandText = "SELECT TABLE_NAME AS NAME FROM INFORMATION_SCHEMA.TABLES";
180
                                using (SqlDataReader dr = cmd.ExecuteReader())
181
                                using (DataTable dt = new DataTable())
182
                                {
183
                                    dt.Load(dr);
184

  
185
                                    if (dt.Select(string.Format("NAME = '{0}'", SPPID_DB_INFO_TABLE)).Length == 0)
186
                                    {
187
                                        cmd.CommandText = string.Format("CREATE TABLE {0} (JsonString varchar(255))", SPPID_DB_INFO_TABLE);
188
                                        cmd.ExecuteNonQuery();
189
                                    }
190
                                    if (dt.Select(string.Format("NAME = '{0}'", SPPID_SETTING_TABLE)).Length == 0)
191
                                    {
192
                                        cmd.CommandText = string.Format("CREATE TABLE {0} (JsonString varchar(255), SettingType varchar(255))", SPPID_SETTING_TABLE);
193
                                        cmd.ExecuteNonQuery();
194
                                    }
195
                                    if (dt.Select(string.Format("NAME = '{0}'", SPPID_SYMBOL_MAPPING_TABLE)).Length == 0)
196
                                    {
197
                                        cmd.CommandText = string.Format("CREATE TABLE {0} (UID varchar(255) PRIMARY KEY, NAME varchar(255), SPPID_SYMBOL_PATH varchar(255), LEADERLINE BIT)", SPPID_SYMBOL_MAPPING_TABLE);
198
                                        cmd.ExecuteNonQuery();
199
                                    }
200
                                    if (dt.Select(string.Format("NAME = '{0}'", SPPID_ATTRIBUTE_MAPPING_TABLE)).Length == 0)
201
                                    {
202
                                        cmd.CommandText = string.Format("CREATE TABLE {0} (UID varchar(255) PRIMARY KEY, SPPID_ATTRIBUTE varchar(255))", SPPID_ATTRIBUTE_MAPPING_TABLE);
203
                                        cmd.ExecuteNonQuery();
204
                                    }
205
                                    if (dt.Select(string.Format("NAME = '{0}'", SPPID_LABEL_INFO_TABLE)).Length == 0)
206
                                    {
207
                                        cmd.CommandText = string.Format("CREATE TABLE {0} (UID varchar(255) PRIMARY KEY, LOCATION INT DEFAULT 0, LEADERLINE BIT)", SPPID_LABEL_INFO_TABLE);
208
                                        cmd.ExecuteNonQuery();
209
                                    }
210
                                    if (dt.Select(string.Format("NAME = '{0}'", SPPID_DRAWING_INFO)).Length == 0)
211
                                    {
212
                                        cmd.CommandText = string.Format("CREATE TABLE {0} (ID2_DRAWING_UID varchar(255) PRIMARY KEY, PATH varchar(255), DRAWINGNUMBER varchar(255), DRAWINGNAME varchar(255))", SPPID_DRAWING_INFO);
213
                                        cmd.ExecuteNonQuery();
214
                                    }
215
                                    if (dt.Select(string.Format("NAME = '{0}'", SPPID_OPC_INFO)).Length == 0)
216
                                    {
217
                                        cmd.CommandText = string.Format("CREATE TABLE {0} (ID2_OPC_UID varchar(255) PRIMARY KEY, SPPID_OPC_MODELITEM_ID varchar(255), ID2_DRAWING_UID varchar(255), ATTRIBUTES varchar(255), PAIRED BIT)", SPPID_OPC_INFO);
218
                                        cmd.ExecuteNonQuery();
219
                                    }
220
                                }
221

  
222
                                #region Check Column 업데이트시 예비용
223
                                #endregion
224
                            }
225
                            result = true;
226
                        }
104 227
                    }
105
                    connection.Close();
106
                }
107
                catch (Exception ex)
108
                {
228
                    catch (Exception ex)
229
                    {
109 230

  
110
                }
111
                finally
112
                {
113
                    connection.Dispose();
231
                    }
232
                    finally
233
                    {
234
                        if (connection != null)
235
                            connection.Dispose();
236
                    }
114 237
                }
115 238
            }
116 239

  
117
            return dt;
240
            return result;
118 241
        }
119 242

  
120
        public static bool SaveETCSetting(Dictionary<string,string> dicSetting)
243
        public static bool SaveSPPID_DB_INFO(string jsonString)
121 244
        {
122 245
            Project_Info projectInfo = Project_Info.GetInstance();
123
            using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", projectInfo.DBFilePath)))
246
            if (projectInfo.DBType == ID2DB_Type.SQLite)
124 247
            {
125

  
126
                try
248
                using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", projectInfo.DBFilePath)))
127 249
                {
128
                    connection.Open();
129
                    using (SQLiteCommand cmd = connection.CreateCommand())
130
                    {
131
                        cmd.CommandText = string.Format("DELETE FROM {0}", SPPID_SETTING_TABLE);
132
                        cmd.ExecuteNonQuery();
133 250

  
134
                        foreach (var item in dicSetting)
251
                    try
252
                    {
253
                        connection.Open();
254
                        using (SQLiteCommand cmd = connection.CreateCommand())
135 255
                        {
136
                            cmd.CommandText = string.Format("INSERT INTO {0} VALUES (@jsonString, @SettingType)", SPPID_SETTING_TABLE);
137
                            cmd.Parameters.AddWithValue("@jsonString", item.Value);
138
                            cmd.Parameters.AddWithValue("@SettingType", item.Key);
256
                            cmd.CommandText = string.Format("DELETE FROM {0}", SPPID_DB_INFO_TABLE);
257
                            cmd.ExecuteNonQuery();
258

  
259
                            cmd.CommandText = string.Format("INSERT INTO {0} VALUES (@jsonString)", SPPID_DB_INFO_TABLE);
260
                            cmd.Parameters.AddWithValue("@jsonString", jsonString);
139 261
                            cmd.ExecuteNonQuery();
140 262
                        }
263
                        connection.Close();
264
                    }
265
                    catch (Exception ex)
266
                    {
267
                        return false;
268
                    }
269
                    finally
270
                    {
271
                        connection.Dispose();
141 272
                    }
142
                    connection.Close();
143
                }
144
                catch (Exception ex)
145
                {
146
                    return false;
147 273
                }
148
                finally
274
            }
275
            else if (projectInfo.DBType == ID2DB_Type.MSSQL)
276
            {
277
                using (SqlConnection connection = GetSqlConnection())
149 278
                {
150
                    connection.Dispose();
279
                    try
280
                    {
281
                        if (connection != null && connection.State == ConnectionState.Open)
282
                        {
283

  
284
                        }
285
                    }
286
                    catch (Exception ex)
287
                    {
288

  
289
                    }
290
                    finally
291
                    {
292
                        if (connection != null)
293
                            connection.Dispose();
294
                    }
151 295
                }
152 296
            }
153 297

  
298

  
154 299
            return true;
155 300
        }
156 301

  
157
        public static DataTable SelectSetting()
302
        public static DataTable SelectSPPID_DB_INFO()
158 303
        {
159 304
            DataTable dt = new DataTable();
160 305
            Project_Info projectInfo = Project_Info.GetInstance();
161
            using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", projectInfo.DBFilePath)))
306
            if (projectInfo.DBType == ID2DB_Type.SQLite)
162 307
            {
163
                try
308
                using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", projectInfo.DBFilePath)))
164 309
                {
165
                    connection.Open();
166
                    using (SQLiteCommand cmd = connection.CreateCommand())
310
                    try
167 311
                    {
168
                        cmd.CommandText = string.Format("SELECT * FROM {0}", SPPID_SETTING_TABLE);
169
                        using (SQLiteDataReader dr = cmd.ExecuteReader())
170
                            dt.Load(dr);
312
                        connection.Open();
313
                        using (SQLiteCommand cmd = connection.CreateCommand())
314
                        {
315
                            cmd.CommandText = string.Format("SELECT * FROM {0}", SPPID_DB_INFO_TABLE);
316
                            using (SQLiteDataReader dr = cmd.ExecuteReader())
317
                                dt.Load(dr);
318
                        }
319
                        connection.Close();
171 320
                    }
172
                    connection.Close();
173
                }
174
                catch (Exception ex)
175
                {
321
                    catch (Exception ex)
322
                    {
176 323

  
324
                    }
325
                    finally
326
                    {
327
                        connection.Dispose();
328
                    }
177 329
                }
178
                finally
330
            }
331
            else if (projectInfo.DBType == ID2DB_Type.MSSQL)
332
            {
333
                using (SqlConnection connection = GetSqlConnection())
179 334
                {
180
                    connection.Dispose();
335
                    try
336
                    {
337
                        if (connection != null && connection.State == ConnectionState.Open)
338
                        {
339

  
340
                        }
341
                    }
342
                    catch (Exception ex)
343
                    {
344

  
345
                    }
346
                    finally
347
                    {
348
                        if (connection != null)
349
                            connection.Dispose();
350
                    }
181 351
                }
182 352
            }
183 353

  
184 354
            return dt;
185 355
        }
186 356

  
187
        private static void CreateTable(SQLiteConnection connection)
357
        public static bool SaveETCSetting(Dictionary<string,string> dicSetting)
188 358
        {
189
            using (SQLiteCommand cmd = connection.CreateCommand())
359
            Project_Info projectInfo = Project_Info.GetInstance();
360
            if (projectInfo.DBType == ID2DB_Type.SQLite)
190 361
            {
191
                cmd.CommandText = "SELECT NAME FROM sqlite_master WHERE type='table'";
192
                using (SQLiteDataReader dr = cmd.ExecuteReader())
193
                using (DataTable dt = new DataTable())
362
                using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", projectInfo.DBFilePath)))
194 363
                {
195
                    dt.Load(dr);
196 364

  
197
                    if (dt.Select(string.Format("NAME = '{0}'", SPPID_DB_INFO_TABLE)).Length == 0)
198
                    {
199
                        cmd.CommandText = string.Format("CREATE TABLE {0} (JsonString TEXT)", SPPID_DB_INFO_TABLE);
200
                        cmd.ExecuteNonQuery();
201
                    }
202
                    if (dt.Select(string.Format("NAME = '{0}'", SPPID_SETTING_TABLE)).Length == 0)
365
                    try
203 366
                    {
204
                        cmd.CommandText = string.Format("CREATE TABLE {0} (JsonString TEXT, SettingType TEXT)", SPPID_SETTING_TABLE);
205
                        cmd.ExecuteNonQuery();
367
                        connection.Open();
368
                        using (SQLiteCommand cmd = connection.CreateCommand())
369
                        {
370
                            cmd.CommandText = string.Format("DELETE FROM {0}", SPPID_SETTING_TABLE);
371
                            cmd.ExecuteNonQuery();
372

  
373
                            foreach (var item in dicSetting)
374
                            {
375
                                cmd.CommandText = string.Format("INSERT INTO {0} VALUES (@jsonString, @SettingType)", SPPID_SETTING_TABLE);
376
                                cmd.Parameters.AddWithValue("@jsonString", item.Value);
377
                                cmd.Parameters.AddWithValue("@SettingType", item.Key);
378
                                cmd.ExecuteNonQuery();
379
                            }
380
                        }
381
                        connection.Close();
206 382
                    }
207
                    if (dt.Select(string.Format("NAME = '{0}'", SPPID_SYMBOL_MAPPING_TABLE)).Length == 0)
383
                    catch (Exception ex)
208 384
                    {
209
                        cmd.CommandText = string.Format("CREATE TABLE {0} (UID TEXT PRIMARY KEY, NAME TEXT, SPPID_SYMBOL_PATH TEXT, LEADERLINE BOOLEAN)", SPPID_SYMBOL_MAPPING_TABLE);
210
                        cmd.ExecuteNonQuery();
385
                        return false;
211 386
                    }
212
                    if (dt.Select(string.Format("NAME = '{0}'", SPPID_ATTRIBUTE_MAPPING_TABLE)).Length == 0)
387
                    finally
213 388
                    {
214
                        cmd.CommandText = string.Format("CREATE TABLE {0} (UID TEXT PRIMARY KEY, SPPID_ATTRIBUTE TEXT)", SPPID_ATTRIBUTE_MAPPING_TABLE);
215
                        cmd.ExecuteNonQuery();
389
                        connection.Dispose();
216 390
                    }
217
                    if (dt.Select(string.Format("NAME = '{0}'", SPPID_LABEL_INFO_TABLE)).Length == 0)
391
                }
392
            }
393
            else if (projectInfo.DBType == ID2DB_Type.MSSQL)
394
            {
395
                using (SqlConnection connection = GetSqlConnection())
396
                {
397
                    try
218 398
                    {
219
                        cmd.CommandText = string.Format("CREATE TABLE {0} (UID TEXT PRIMARY KEY, LOCATION INT DEFAULT 0, LEADERLINE BOOLEAN)", SPPID_LABEL_INFO_TABLE);
220
                        cmd.ExecuteNonQuery();
399
                        if (connection != null && connection.State == ConnectionState.Open)
400
                        {
401

  
402
                        }
221 403
                    }
222
                    if (dt.Select(string.Format("NAME = '{0}'", SPPID_DRAWING_INFO)).Length == 0)
404
                    catch (Exception ex)
223 405
                    {
224
                        cmd.CommandText = string.Format("CREATE TABLE {0} (ID2_DRAWING_UID Text PRIMARY KEY, PATH TEXT, DRAWINGNUMBER TEXT, DRAWINGNAME TEXT)", SPPID_DRAWING_INFO);
225
                        cmd.ExecuteNonQuery();
406

  
226 407
                    }
227
                    if (dt.Select(string.Format("NAME = '{0}'", SPPID_OPC_INFO)).Length == 0)
408
                    finally
228 409
                    {
229
                        cmd.CommandText = string.Format("CREATE TABLE {0} (ID2_OPC_UID TEXT PRIMARY KEY, SPPID_OPC_MODELITEM_ID TEXT, ID2_DRAWING_UID TEXT, ATTRIBUTES TEXT, PAIRED BOOL)", SPPID_OPC_INFO);
230
                        cmd.ExecuteNonQuery();
410
                        if (connection != null)
411
                            connection.Dispose();
231 412
                    }
232 413
                }
414
            }
233 415

  
234
                #region Check Column 업데이트시 예비용
235
                cmd.CommandText = string.Format("SELECT * FROM {0}", SPPID_SYMBOL_MAPPING_TABLE);
236
                using (SQLiteDataReader dr = cmd.ExecuteReader())
237
                using (DataTable dt = new DataTable())
416
            return true;
417
        }
418

  
419
        public static DataTable SelectSetting()
420
        {
421
            DataTable dt = new DataTable();
422
            Project_Info projectInfo = Project_Info.GetInstance();
423
            if (projectInfo.DBType == ID2DB_Type.SQLite)
424
            {
425
                using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", projectInfo.DBFilePath)))
238 426
                {
239
                    dt.Load(dr);
240
                    if (!dt.Columns.Contains("LEADERLINE"))
427
                    try
241 428
                    {
242
                        cmd.CommandText = string.Format("ALTER TABLE {0} ADD COLUMN LEADERLINE BOOLEAN", SPPID_SYMBOL_MAPPING_TABLE);
243
                        cmd.ExecuteNonQuery();
429
                        connection.Open();
430
                        using (SQLiteCommand cmd = connection.CreateCommand())
431
                        {
432
                            cmd.CommandText = string.Format("SELECT * FROM {0}", SPPID_SETTING_TABLE);
433
                            using (SQLiteDataReader dr = cmd.ExecuteReader())
434
                                dt.Load(dr);
435
                        }
436
                        connection.Close();
244 437
                    }
245
                }
438
                    catch (Exception ex)
439
                    {
246 440

  
247
                cmd.CommandText = string.Format("SELECT * FROM {0}", SPPID_SETTING_TABLE);
248
                using (SQLiteDataReader dr = cmd.ExecuteReader())
249
                using (DataTable dt = new DataTable())
250
                {
251
                    dt.Load(dr);
252
                    if (!dt.Columns.Contains("SettingType"))
441
                    }
442
                    finally
253 443
                    {
254
                        cmd.CommandText = string.Format("ALTER TABLE {0} ADD COLUMN SettingType Text", SPPID_SETTING_TABLE);
255
                        cmd.ExecuteNonQuery();
444
                        connection.Dispose();
256 445
                    }
257 446
                }
258

  
259
                cmd.CommandText = string.Format("SELECT * FROM {0}", SPPID_DRAWING_INFO);
260
                using (SQLiteDataReader dr = cmd.ExecuteReader())
261
                using (DataTable dt = new DataTable())
447
            }
448
            else if (projectInfo.DBType == ID2DB_Type.MSSQL)
449
            {
450
                using (SqlConnection connection = GetSqlConnection())
262 451
                {
263
                    dt.Load(dr);
264
                    if (dt.Columns.Contains("DOCUMENT"))
452
                    try
453
                    {
454
                        if (connection != null && connection.State == ConnectionState.Open)
455
                        {
456

  
457
                        }
458
                    }
459
                    catch (Exception ex)
265 460
                    {
266
                        cmd.CommandText = string.Format("DROP TABLE {0}", SPPID_DRAWING_INFO);
267
                        cmd.ExecuteNonQuery();
268 461

  
269
                        cmd.CommandText = string.Format("CREATE TABLE {0} (ID2_DRAWING_UID Text PRIMARY KEY, PATH TEXT, DRAWINGNUMBER TEXT, DRAWINGNAME TEXT)", SPPID_DRAWING_INFO);
270
                        cmd.ExecuteNonQuery();
462
                    }
463
                    finally
464
                    {
465
                        if (connection != null)
466
                            connection.Dispose();
271 467
                    }
272 468
                }
273
                #endregion
274 469
            }
470

  
471
            return dt;
275 472
        }
276 473

  
277 474
        public static DataTable SelectProjectSymbol()
278 475
        {
279 476
            DataTable dt = new DataTable();
280 477
            Project_Info projectInfo = Project_Info.GetInstance();
281
            using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", projectInfo.DBFilePath)))
478
            if (projectInfo.DBType == ID2DB_Type.SQLite)
282 479
            {
283
                try
480
                using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", projectInfo.DBFilePath)))
284 481
                {
285
                    connection.Open();
286
                    using (SQLiteCommand cmd = connection.CreateCommand())
482
                    try
287 483
                    {
288
                        cmd.CommandText = string.Format(@"
484
                        connection.Open();
485
                        using (SQLiteCommand cmd = connection.CreateCommand())
486
                        {
487
                            cmd.CommandText = string.Format(@"
289 488
                            SELECT s.UID, s.Name, st.Type, sp.SPPID_SYMBOL_PATH, sp.LEADERLINE FROM {1} as st, {0} as s 
290 489
                                LEFT OUTER JOIN {2} as sp 
291 490
                                    ON s.UID = SP.UID 
292 491
                            WHERE s.SymbolType_UID = st.UID 
293 492
                            ORDER BY st.TYPE ASC;", Symbol_TABLE, SymbolType_TABLE, SPPID_SYMBOL_MAPPING_TABLE);
294
                        using (SQLiteDataReader dr = cmd.ExecuteReader())
295
                            dt.Load(dr);
493
                            using (SQLiteDataReader dr = cmd.ExecuteReader())
494
                                dt.Load(dr);
296 495

  
297
                        DataTable dtClone = dt.Clone();
298
                        dtClone.Columns["UID"].DataType = typeof(string);
299
                        foreach (DataRow row in dt.Rows)
300
                        {
301
                            dtClone.ImportRow(row);
496
                            DataTable dtClone = dt.Clone();
497
                            dtClone.Columns["UID"].DataType = typeof(string);
498
                            foreach (DataRow row in dt.Rows)
499
                            {
500
                                dtClone.ImportRow(row);
501
                            }
502
                            dt.Dispose();
503
                            dt = dtClone;
302 504
                        }
303
                        dt.Dispose();
304
                        dt = dtClone;
505
                        connection.Close();
305 506
                    }
306
                    connection.Close();
307
                }
308
                catch (Exception ex)
309
                {
507
                    catch (Exception ex)
508
                    {
310 509

  
510
                    }
511
                    finally
512
                    {
513
                        connection.Dispose();
514
                    }
311 515
                }
312
                finally
516
            }
517
            else if (projectInfo.DBType == ID2DB_Type.MSSQL)
518
            {
519
                using (SqlConnection connection = GetSqlConnection())
313 520
                {
314
                    connection.Dispose();
521
                    try
522
                    {
523
                        if (connection != null && connection.State == ConnectionState.Open)
524
                        {
525

  
526
                        }
527
                    }
528
                    catch (Exception ex)
529
                    {
530

  
531
                    }
532
                    finally
533
                    {
534
                        if (connection != null)
535
                            connection.Dispose();
536
                    }
315 537
                }
316 538
            }
317 539

  
......
327 549
            result.Columns.Add("SPPID_SYMBOL_PATH");
328 550
            
329 551
            Project_Info projectInfo = Project_Info.GetInstance();
330
            using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", projectInfo.DBFilePath)))
331
            using (DataTable dt = new DataTable())
552
            if (projectInfo.DBType == ID2DB_Type.SQLite)
332 553
            {
333
                try
554
                using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", projectInfo.DBFilePath)))
555
                using (DataTable dt = new DataTable())
334 556
                {
335
                    connection.Open();
336
                    using (SQLiteCommand cmd = connection.CreateCommand())
557
                    try
337 558
                    {
338
                        cmd.CommandText = string.Format(@"
559
                        connection.Open();
560
                        using (SQLiteCommand cmd = connection.CreateCommand())
561
                        {
562
                            cmd.CommandText = string.Format(@"
339 563
                            SELECT AdditionalSymbol FROM Symbol");
340
                        using (SQLiteDataReader dr = cmd.ExecuteReader())
341
                            dt.Load(dr);
342
                        List<string> childList = new List<string>();
343
                        foreach (DataRow row in dt.Rows)
344
                        { 
345
                            if (row["AdditionalSymbol"] != null && !DBNull.Value.Equals(row["AdditionalSymbol"]) && !string.IsNullOrEmpty((string)row["AdditionalSymbol"]))
564
                            using (SQLiteDataReader dr = cmd.ExecuteReader())
565
                                dt.Load(dr);
566
                            List<string> childList = new List<string>();
567
                            foreach (DataRow row in dt.Rows)
346 568
                            {
347
                                string[] array = row["AdditionalSymbol"].ToString().Split(new char[] { '/' });
348
                                foreach (var childString in array)
569
                                if (row["AdditionalSymbol"] != null && !DBNull.Value.Equals(row["AdditionalSymbol"]) && !string.IsNullOrEmpty((string)row["AdditionalSymbol"]))
349 570
                                {
350
                                    childList.Add(childString.Split(new char[] { ',' })[2]);
571
                                    string[] array = row["AdditionalSymbol"].ToString().Split(new char[] { '/' });
572
                                    foreach (var childString in array)
573
                                    {
574
                                        childList.Add(childString.Split(new char[] { ',' })[2]);
575
                                    }
351 576
                                }
352
                            }
353 577

  
354
                        }
578
                            }
355 579

  
356
                        dt.Clear();
357
                        cmd.Reset();
358
                        cmd.CommandText = string.Format(@"
580
                            dt.Clear();
581
                            cmd.Reset();
582
                            cmd.CommandText = string.Format(@"
359 583
                            SELECT * FROM {0}", SPPID_SYMBOL_MAPPING_TABLE);
360
                        using (SQLiteDataReader dr = cmd.ExecuteReader())
361
                            dt.Load(dr);
362

  
363
                        childList = childList.Distinct().ToList();
364
                        foreach (var child in childList)
365
                        {
366
                            string mappingPath = string.Empty;
367
                            DataRow[] rows = dt.Select(string.Format("UID = '{0}'", child));
368
                            if (rows.Length == 1)
369
                                mappingPath = !DBNull.Value.Equals(rows[0]["SPPID_SYMBOL_PATH"]) ? (string)rows[0]["SPPID_SYMBOL_PATH"] : null;
584
                            using (SQLiteDataReader dr = cmd.ExecuteReader())
585
                                dt.Load(dr);
370 586

  
371
                            DataRow newRow = result.NewRow();
372
                            newRow["UID"] = child;
373
                            newRow["Name"] = child;
374
                            newRow["Type"] = "Child Symbol";
375
                            newRow["SPPID_SYMBOL_PATH"] = mappingPath;
376
                            result.Rows.Add(newRow);
587
                            childList = childList.Distinct().ToList();
588
                            foreach (var child in childList)
589
                            {
590
                                string mappingPath = string.Empty;
591
                                DataRow[] rows = dt.Select(string.Format("UID = '{0}'", child));
592
                                if (rows.Length == 1)
593
                                    mappingPath = !DBNull.Value.Equals(rows[0]["SPPID_SYMBOL_PATH"]) ? (string)rows[0]["SPPID_SYMBOL_PATH"] : null;
594

  
595
                                DataRow newRow = result.NewRow();
596
                                newRow["UID"] = child;
597
                                newRow["Name"] = child;
598
                                newRow["Type"] = "Child Symbol";
599
                                newRow["SPPID_SYMBOL_PATH"] = mappingPath;
600
                                result.Rows.Add(newRow);
601
                            }
377 602
                        }
603
                        connection.Close();
378 604
                    }
379
                    connection.Close();
380
                }
381
                catch (Exception ex)
382
                {
605
                    catch (Exception ex)
606
                    {
383 607

  
608
                    }
609
                    finally
610
                    {
611
                        connection.Dispose();
612
                    }
384 613
                }
385
                finally
614
            }
615
            else if (projectInfo.DBType == ID2DB_Type.MSSQL)
616
            {
617
                using (SqlConnection connection = GetSqlConnection())
386 618
                {
387
                    connection.Dispose();
619
                    try
620
                    {
621
                        if (connection != null && connection.State == ConnectionState.Open)
622
                        {
623

  
624
                        }
625
                    }
626
                    catch (Exception ex)
627
                    {
628

  
629
                    }
630
                    finally
631
                    {
632
                        if (connection != null)
633
                            connection.Dispose();
634
                    }
... 이 차이점은 표시할 수 있는 최대 줄수를 초과해서 이 차이점은 잘렸습니다.

내보내기 Unified diff

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