프로젝트

일반

사용자정보

개정판 4fb0f8d5

ID4fb0f8d533e55b9a31b67bb2ec149dc2822e6790
상위 87f02fc0
하위 8f34b603

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

dev issue #498 : OPC 모델링 준비

Change-Id: Icf7f1608f28725a2a916cc3c1306adeafe305bc6

차이점 보기:

DTI_PID/SPPIDConverter/ConverterDocking.cs
51 51
#if DEBUG
52 52
            simpleButton1.Visible = true;
53 53

  
54
            Project_Info _ProjectInfo = Project_Info.GetInstance();
55
            _ProjectInfo.DefaultPath = Settings.Default.LatestProjectPath;
56
            if (Project_DB.ConnTestAndCreateTable())
57
            {
58
                
59
            }
60
            else
61
            {
62

  
63
            }
54
            
64 55
#endif
65 56
        }
66 57

  
......
99 90

  
100 91
        private void btnLinkOPC_Click(object sender, EventArgs e)
101 92
        {
93
            LMADataSource dataSource = new LMADataSource();
94
            LMDrawings drawings = new LMDrawings();
95

  
102 96
            try
103 97
            {
104
                LMADataSource dataSource = new LMADataSource();
105
                LMDrawings drawings = new LMDrawings();
106
                drawings.Collect(dataSource);
98
                Project_Info _ProjectInfo = Project_Info.GetInstance();
99
                _ProjectInfo.DefaultPath = Settings.Default.LatestProjectPath;
100
                if (Project_DB.ConnTestAndCreateTable())
101
                {
102
                    drawings.Collect(dataSource);
107 103

  
108
                List<string> drawingNameList = new List<string>();
109
                List<string> drawingNumberList = new List<string>();
104
                    List<string> drawingNameList = new List<string>();
105
                    List<string> drawingNumberList = new List<string>();
106
                    DataTable drawingTable = Project_DB.SelectDrawingInfo();
110 107

  
111
                foreach (LMDrawing item in drawings)
112
                {
113
                    drawingNameList.Add(item.Attributes["Name"].get_Value().ToString());
114
                    drawingNumberList.Add(item.Attributes["DrawingNumber"].get_Value().ToString());
115
                }
108
                    foreach (LMDrawing item in drawings)
109
                    {
110
                        drawingNameList.Add(item.Attributes["Name"].get_Value().ToString());
111
                        drawingNumberList.Add(item.Attributes["DrawingNumber"].get_Value().ToString());
112
                    }
116 113

  
117 114

  
115
                }
116
                else
117
                {
118
                    MessageBox.Show(Msg.ConnectionFail, Msg.Warning, MessageBoxButtons.OK, MessageBoxIcon.Warning);
119
                }
118 120
            }
119 121
            catch (Exception ex)
120 122
            {
121 123
                MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
122 124
            }
125
            finally
126
            {
127
                ReleaseCOMObjects(dataSource);
128
                ReleaseCOMObjects(drawings);
129
            }
123 130
        }
124 131

  
132
        public void ReleaseCOMObjects(params object[] objVars)
133
        {
134
            int intNewRefCount = 0;
135
            foreach (object obj in objVars)
136
            {
137
                if (!Information.IsNothing(obj) && System.Runtime.InteropServices.Marshal.IsComObject(obj))
138
                    intNewRefCount = intNewRefCount + System.Runtime.InteropServices.Marshal.FinalReleaseComObject(obj);
139
            }
140
        }
141

  
142

  
125 143
        private void btnGetDrawingSize_Click(object sender, EventArgs e)
126 144
        {
127 145
            if (radApp.ActiveSelectSet.Count > 0)
DTI_PID/SPPIDConverter/DB/Project_DB.cs
506 506
            return dt;
507 507
        }
508 508

  
509
        public static DataTable SelectDrawingInfo()
510
        {
511
            DataTable dt = new DataTable();
512
            Project_Info projectInfo = Project_Info.GetInstance();
513
            using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", projectInfo.DBFilePath)))
514
            {
515
                try
516
                {
517
                    connection.Open();
518
                    using (SQLiteCommand cmd = connection.CreateCommand())
519
                    {
520
                        cmd.CommandText = string.Format("SELECT * FROM {0}",SPPID_DRAWING_INFO);
521
                        using (SQLiteDataReader dr = cmd.ExecuteReader())
522
                            dt.Load(dr);
523
                    }
524
                    connection.Close();
525
                }
526
                catch (Exception ex)
527
                {
528

  
529
                }
530
                finally
531
                {
532
                    connection.Dispose();
533
                }
534
            }
535

  
536
            return dt;
537
        }
538

  
509 539
        public static bool InsertSymbolMapping(List<Tuple<string, string, string, bool>> datas)
510 540
        {
511 541
            Project_Info projectInfo = Project_Info.GetInstance();

내보내기 Unified diff

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