프로젝트

일반

사용자정보

개정판 757ab2f2

ID757ab2f273f4c70249128cf0d90b9b3ffce34258
상위 fc860304
하위 e82963d4

이지연이(가) 3년 이상 전에 추가함

issue #000: mssql db type 추가 확인중

Change-Id: I145dc94db492eeedf55863441b65c26ba6fa43d3

차이점 보기:

DTI_PID/ID2PSN/DB.cs
6 6
using System.Data.SQLite;
7 7
using System.Data;
8 8
using System.Globalization;
9
using System.Data.SQLite;
10
using System.Data;
11 9
using System.Text.RegularExpressions;
10
using System.Data.Common;
11
using System.Data.SqlClient;
12 12

  
13 13
namespace ID2PSN
14 14
{
15
    public static class DB
15
    public class DB 
16 16
    {
17 17
        const string PSN_TOPOLOGY_RULE = "T_PSN_TOPOLOGY_RULE";
18 18
        const string PSN_HEADER_SETTING = "T_PSN_HEADER_SETTING";
......
27 27
        const string PSN_VIEW = "T_PSN_VIEW";
28 28
        const string PSN_TOPOLOGYSET = "SPPIDTopologySet";
29 29

  
30
        private static SqlConnection GetSqlConnection()
31
        {
32

  
33

  
34
                ID2Info id2Info = ID2Info.GetInstance();
35
            SqlConnection connection = null;
36
            try
37
            {
38
                //new SqlConnection(@"Data Source = {0}; Initial Catalog = {2}; User ID = {3}; Password = {4};",
39
                connection = new SqlConnection(string.Format("Server= {0}; Database= {1}; uid= {2} ; pwd= {3}",                
40
                    id2Info.ServerIP,
41
                    //id2Info.Port,
42
                    System.IO.Path.GetFileName(id2Info.DefaultPath),
43
                    id2Info.DBUser,
44
                    id2Info.DBPassword));
45

  
46
                connection.Open();
47
            }
48
            catch (Exception ex)
49
            {
50
                Log.Write(ex.Message + "\r\n" + ex.StackTrace);
51
                if (connection != null)
52
                    connection.Dispose();
53
                connection = null;
54
            }
55

  
56
            return connection;
57

  
58
        }
30 59
        public static bool ConnTestAndCreateTable()
31 60
        {
32 61
            bool result = false;
33 62
            ID2Info id2Info = ID2Info.GetInstance();
34
            using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, @"Data Source = {0}", id2Info.DBFilePath), true))
63
         
64
            if(id2Info.ID2DBType == ID2DB_Type.SQLite)
35 65
            {
36
                try
66
                using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, @"Data Source = {0}", id2Info.DBFilePath), true))
37 67
                {
38
                    connection.Open();
39
                    if (connection.State == ConnectionState.Open)
68
                    try
40 69
                    {
41
                        using (SQLiteCommand cmd = connection.CreateCommand())
70
                        connection.Open();
71
                        if (connection.State == ConnectionState.Open)
42 72
                        {
43
                            cmd.CommandText = "SELECT NAME FROM sqlite_master WHERE type='table'";
44
                            using (SQLiteDataReader dr = cmd.ExecuteReader())
45
                            using (DataTable dt = new DataTable())
73
                            using (SQLiteCommand cmd = connection.CreateCommand())
46 74
                            {
47
                                dt.Load(dr);
48

  
49
                                if (dt.Select(string.Format("NAME = '{0}'", PSN_HEADER_SETTING)).Length == 0)
50
                                {
51
                                    cmd.CommandText = string.Format("CREATE TABLE {0} (GROUP_ID TEXT, DESCRIPTION TEXT, [INDEX] INTEGER, NAME TEXT)", PSN_HEADER_SETTING);
52
                                    cmd.ExecuteNonQuery();
53
                                }
54
                                if (dt.Select(string.Format("NAME = '{0}'", PSN_VENTDRAIN_SETTING)).Length == 0)
55
                                {
56
                                    cmd.CommandText = string.Format("CREATE TABLE {0} (GROUP_ID TEXT, DESCRIPTION TEXT, [INDEX] INTEGER, NAME TEXT)", PSN_VENTDRAIN_SETTING);
57
                                    cmd.ExecuteNonQuery();
58
                                }
59
                                if (dt.Select(string.Format("NAME = '{0}'", PSN_TOPOLOGY_RULE)).Length == 0)
60
                                {
61
                                    cmd.CommandText = string.Format("CREATE TABLE {0} (UID TEXT)", PSN_TOPOLOGY_RULE);
62
                                    cmd.ExecuteNonQuery();
63

  
64
                                    DataTable topologyRule = new DataTable();
65
                                    topologyRule.Columns.Add("NAME", typeof(string));
66

  
67
                                    topologyRule.Rows.Add("FluidCode");
68
                                    topologyRule.Rows.Add("-");
69
                                    topologyRule.Rows.Add("PipingMaterialsClass");
70
                                    topologyRule.Rows.Add("-");
71
                                    topologyRule.Rows.Add("Tag Seq No");
72

  
73
                                    SaveTopologyRule(topologyRule);
74
                                }
75
                                if (dt.Select(string.Format("NAME = '{0}'", PSN_PATHITEMS)).Length == 0)
76
                                {
77
                                    cmd.CommandText = string.Format("CREATE TABLE {0} (OID TEXT, SequenceData_OID TEXT, TopologySet_OID TEXT, BranchTopologySet_OID TEXT, PipeLine_OID TEXT, ITEMNAME TEXT, ITEMTAG TEXT, Class TEXT, SubClass TEXT, TYPE TEXT, PIDNAME TEXT, NPD TEXT, PipeSystemNetwork_OID TEXT, ViewPipeSystemNetwork_OID TEXT, PipeRun_OID TEXT)", PSN_PATHITEMS);
78
                                    cmd.ExecuteNonQuery();
79
                                }
80
                                if (dt.Select(string.Format("NAME = '{0}'", PSN_SEQUENCEDATA)).Length == 0)
81
                                {
82
                                    cmd.CommandText = string.Format("CREATE TABLE {0} (OID TEXT, SERIALNUMBER TEXT, PathItem_OID TEXT, TopologySet_OID_Key TEXT)", PSN_SEQUENCEDATA);
83
                                    cmd.ExecuteNonQuery();
84
                                }
85
                                if (dt.Select(string.Format("NAME = '{0}'", PSN_PIPESYSTEMNETWORK)).Length == 0)
86
                                {
87
                                    cmd.CommandText = string.Format("CREATE TABLE {0} (OID TEXT, Type TEXT, OrderNumber TEXT, Pipeline_OID TEXT, FROM_DATA TEXT, TO_DATA TEXT, TopologySet_OID_Key TEXT, PSNRevisionNumber TEXT, PBS TEXT, PIDDrawings TEXT, Validity TEXT, Status TEXT)", PSN_PIPESYSTEMNETWORK);
88
                                    cmd.ExecuteNonQuery();
89
                                }
90

  
91
                                if (dt.Select(string.Format("NAME = '{0}'", PSN_EQUIPMENT)).Length == 0)
92
                                {
93
                                    cmd.CommandText = string.Format("CREATE TABLE {0} (OID TEXT, ITEMTAG TEXT, XCOORDS TEXT, YCOORDS TEXT)", PSN_EQUIPMENT);
94
                                    cmd.ExecuteNonQuery();
95
                                }
96
                                if (dt.Select(string.Format("NAME = '{0}'", PSN_NOZZLE)).Length == 0)
97
                                {
98
                                    cmd.CommandText = string.Format("CREATE TABLE {0} (OID TEXT, ITEMTAG TEXT, XCOORDS TEXT, YCOORDS TEXT, Equipment_OID TEXT, FLUID TEXT, NPD TEXT, ROTATION TEXT, FlowDirection TEXT)", PSN_NOZZLE);
99
                                    cmd.ExecuteNonQuery();
100
                                }
101
                                if (dt.Select(string.Format("NAME = '{0}'", PSN_FLUIDCODE)).Length == 0)
102
                                {
103
                                    cmd.CommandText = string.Format("CREATE TABLE {0} (UID TEXT, Code TEXT, Description TEXT, Condition TEXT, Remarks TEXT, GroundLevel TEXT)", PSN_FLUIDCODE);
104
                                    cmd.ExecuteNonQuery();
105
                                }
106
                                if (dt.Select(string.Format("NAME = '{0}'", PSN_PIPINGMATLCLASS)).Length == 0)
107
                                {
108
                                    cmd.CommandText = string.Format("CREATE TABLE {0} (UID TEXT, Priority TEXT, Code TEXT, Description TEXT, Condition TEXT, Remarks TEXT, GroundLevel TEXT)", PSN_PIPINGMATLCLASS);
109
                                    cmd.ExecuteNonQuery();
110
                                }
111
                                if (dt.Select(string.Format("NAME = '{0}'", PSN_VIEW)).Length == 0)
112
                                {
113
                                    cmd.CommandText = string.Format("CREATE TABLE {0} (OID TEXT)", PSN_VIEW);
114
                                    cmd.ExecuteNonQuery();
115
                                }
116
                                if (dt.Select(string.Format("NAME = '{0}'", PSN_TOPOLOGYSET)).Length == 0)
75
                                cmd.CommandText = "SELECT NAME FROM sqlite_master WHERE type='table'";
76
                                using (SQLiteDataReader dr = cmd.ExecuteReader())
77
                                using (DataTable dt = new DataTable())
117 78
                                {
118
                                    cmd.CommandText = string.Format("CREATE TABLE {0} (OID TEXT, Type TEXT, SubType TEXT, HeadItemTag TEXT, TailItemTag TEXT, HeadItemID TEXT, TailItemID TEXT)", PSN_TOPOLOGYSET);
119
                                    cmd.ExecuteNonQuery();
79
                                    dt.Load(dr);
80

  
81
                                    if (dt.Select(string.Format("NAME = '{0}'", PSN_HEADER_SETTING)).Length == 0)
82
                                    {
83
                                        cmd.CommandText = string.Format("CREATE TABLE {0} (GROUP_ID TEXT, DESCRIPTION TEXT, [INDEX] INTEGER, NAME TEXT)", PSN_HEADER_SETTING);
84
                                        cmd.ExecuteNonQuery();
85
                                    }
86
                                    if (dt.Select(string.Format("NAME = '{0}'", PSN_VENTDRAIN_SETTING)).Length == 0)
87
                                    {
88
                                        cmd.CommandText = string.Format("CREATE TABLE {0} (GROUP_ID TEXT, DESCRIPTION TEXT, [INDEX] INTEGER, NAME TEXT)", PSN_VENTDRAIN_SETTING);
89
                                        cmd.ExecuteNonQuery();
90
                                    }
91
                                    if (dt.Select(string.Format("NAME = '{0}'", PSN_TOPOLOGY_RULE)).Length == 0)
92
                                    {
93
                                        cmd.CommandText = string.Format("CREATE TABLE {0} (UID TEXT)", PSN_TOPOLOGY_RULE);
94
                                        cmd.ExecuteNonQuery();
95

  
96
                                        DataTable topologyRule = new DataTable();
97
                                        topologyRule.Columns.Add("NAME", typeof(string));
98

  
99
                                        topologyRule.Rows.Add("FluidCode");
100
                                        topologyRule.Rows.Add("-");
101
                                        topologyRule.Rows.Add("PipingMaterialsClass");
102
                                        topologyRule.Rows.Add("-");
103
                                        topologyRule.Rows.Add("Tag Seq No");
104

  
105
                                        SaveTopologyRule(topologyRule);
106
                                    }
107
                                    if (dt.Select(string.Format("NAME = '{0}'", PSN_PATHITEMS)).Length == 0)
108
                                    {
109
                                        cmd.CommandText = string.Format("CREATE TABLE {0} (OID TEXT, SequenceData_OID TEXT, TopologySet_OID TEXT, BranchTopologySet_OID TEXT, PipeLine_OID TEXT, ITEMNAME TEXT, ITEMTAG TEXT, Class TEXT, SubClass TEXT, TYPE TEXT, PIDNAME TEXT, NPD TEXT, PipeSystemNetwork_OID TEXT, ViewPipeSystemNetwork_OID TEXT, PipeRun_OID TEXT)", PSN_PATHITEMS);
110
                                        cmd.ExecuteNonQuery();
111
                                    }
112
                                    if (dt.Select(string.Format("NAME = '{0}'", PSN_SEQUENCEDATA)).Length == 0)
113
                                    {
114
                                        cmd.CommandText = string.Format("CREATE TABLE {0} (OID TEXT, SERIALNUMBER TEXT, PathItem_OID TEXT, TopologySet_OID_Key TEXT)", PSN_SEQUENCEDATA);
115
                                        cmd.ExecuteNonQuery();
116
                                    }
117
                                    if (dt.Select(string.Format("NAME = '{0}'", PSN_PIPESYSTEMNETWORK)).Length == 0)
118
                                    {
119
                                        cmd.CommandText = string.Format("CREATE TABLE {0} (OID TEXT, Type TEXT, OrderNumber TEXT, Pipeline_OID TEXT, FROM_DATA TEXT, TO_DATA TEXT, TopologySet_OID_Key TEXT, PSNRevisionNumber TEXT, PBS TEXT, PIDDrawings TEXT, Validity TEXT, Status TEXT)", PSN_PIPESYSTEMNETWORK);
120
                                        cmd.ExecuteNonQuery();
121
                                    }
122
                                    if (dt.Select(string.Format("NAME = '{0}'", PSN_EQUIPMENT)).Length == 0)
123
                                    {
124
                                        cmd.CommandText = string.Format("CREATE TABLE {0} (OID TEXT, ITEMTAG TEXT, XCOORDS TEXT, YCOORDS TEXT)", PSN_EQUIPMENT);
125
                                        cmd.ExecuteNonQuery();
126
                                    }
127
                                    if (dt.Select(string.Format("NAME = '{0}'", PSN_NOZZLE)).Length == 0)
128
                                    {
129
                                        cmd.CommandText = string.Format("CREATE TABLE {0} (OID TEXT, ITEMTAG TEXT, XCOORDS TEXT, YCOORDS TEXT, Equipment_OID TEXT, FLUID TEXT, NPD TEXT, ROTATION TEXT, FlowDirection TEXT)", PSN_NOZZLE);
130
                                        cmd.ExecuteNonQuery();
131
                                    }
132
                                    if (dt.Select(string.Format("NAME = '{0}'", PSN_FLUIDCODE)).Length == 0)
133
                                    {
134
                                        cmd.CommandText = string.Format("CREATE TABLE {0} (UID TEXT, Code TEXT, Description TEXT, Condition TEXT, Remarks TEXT, GroundLevel TEXT)", PSN_FLUIDCODE);
135
                                        cmd.ExecuteNonQuery();
136
                                    }
137
                                    if (dt.Select(string.Format("NAME = '{0}'", PSN_PIPINGMATLCLASS)).Length == 0)
138
                                    {
139
                                        cmd.CommandText = string.Format("CREATE TABLE {0} (UID TEXT, Priority TEXT, Code TEXT, Description TEXT, Condition TEXT, Remarks TEXT, GroundLevel TEXT)", PSN_PIPINGMATLCLASS);
140
                                        cmd.ExecuteNonQuery();
141
                                    }
142
                                    if (dt.Select(string.Format("NAME = '{0}'", PSN_VIEW)).Length == 0)
143
                                    {
144
                                        cmd.CommandText = string.Format("CREATE TABLE {0} (OID TEXT)", PSN_VIEW);
145
                                        cmd.ExecuteNonQuery();
146
                                    }
147
                                    if (dt.Select(string.Format("NAME = '{0}'", PSN_TOPOLOGYSET)).Length == 0)
148
                                    {
149
                                        cmd.CommandText = string.Format("CREATE TABLE {0} (OID TEXT, Type TEXT, SubType TEXT, HeadItemTag TEXT, TailItemTag TEXT, HeadItemID TEXT, TailItemID TEXT)", PSN_TOPOLOGYSET);
150
                                        cmd.ExecuteNonQuery();
151
                                    }
120 152
                                }
121 153
                            }
154
                            result = true;
122 155
                        }
123
                        result = true;
156
                        connection.Close();
157
                    }
158
                    catch (Exception ex)
159
                    {
160
                        Log.Write(ex.Message + "\r\n" + ex.StackTrace);
161
                    }
162
                    finally
163
                    {
164
                        connection.Dispose();
124 165
                    }
125
                    connection.Close();
126
                }
127
                catch (Exception ex)
128
                {
129
                    Log.Write(ex.Message + "\r\n" + ex.StackTrace);
130 166
                }
131
                finally
167
            }
168
            else if (id2Info.ID2DBType == ID2DB_Type.MSSQL)
169
            {
170
                using (SqlConnection connection = GetSqlConnection())
132 171
                {
133
                    connection.Dispose();
172
                    try
173
                    {
174
                        if (connection != null && connection.State == ConnectionState.Open)
175
                        {
176
                            using (SqlCommand cmd = connection.CreateCommand())
177
                            {
178
                                cmd.CommandText = "SELECT TABLE_NAME AS NAME FROM INFORMATION_SCHEMA.TABLES";
179
                                using (SqlDataReader dr = cmd.ExecuteReader())
180
                                using (DataTable dt = new DataTable())
181
                                {
182
                                    dt.Load(dr);
183
                                    if (dt.Select(string.Format("NAME = '{0}'", PSN_VIEW)).Length == 0) //T_PSN_VIEW - id2 zoom 용
184
                                    {
185
                                        cmd.CommandText = string.Format("CREATE TABLE {0} (OID TEXT)", PSN_VIEW);
186
                                        cmd.ExecuteNonQuery();
187
                                    }
188
                                }                                
189
                            }
190
                            result = true;
191
                        }
192
                    }
193
                    catch (Exception ex)
194
                    {
195
                        Log.Write(ex.Message + "\r\n" + ex.StackTrace);
196
                    }
197
                    finally
198
                    {
199
                        if (connection != null)
200
                            connection.Dispose();
201
                    }
134 202
                }
135 203
            }
204

  
136 205
            return result;
137 206
        }
138 207

  
......
140 209
        {
141 210
            DataTable dt = new DataTable();
142 211
            ID2Info id2Info = ID2Info.GetInstance();
143
            using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", id2Info.DBFilePath), true))
212
            if (id2Info.ID2DBType == ID2DB_Type.SQLite)
144 213
            {
145
                try
214
                using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", id2Info.DBFilePath), true))
146 215
                {
147
                    connection.Open();
148
                    using (SQLiteCommand cmd = connection.CreateCommand())
216
                    try
149 217
                    {
150
                        cmd.CommandText = string.Format(@"SELECT GROUP_ID, DESCRIPTION, [INDEX], NAME FROM {0};", PSN_HEADER_SETTING);
151
                        using (SQLiteDataReader dr = cmd.ExecuteReader())
152
                            dt.Load(dr);
218
                        connection.Open();
219
                        using (SQLiteCommand cmd = connection.CreateCommand())
220
                        {
221
                            cmd.CommandText = string.Format(@"SELECT GROUP_ID, DESCRIPTION, [INDEX], NAME FROM {0};", PSN_HEADER_SETTING);
222
                            using (SQLiteDataReader dr = cmd.ExecuteReader())
223
                                dt.Load(dr);
224
                        }
225
                        connection.Close();
226
                    }
227
                    catch (Exception ex)
228
                    {
229
                        Log.Write(ex.Message + "\r\n" + ex.StackTrace);
230
                    }
231
                    finally
232
                    {
233
                        connection.Dispose();
153 234
                    }
154
                    connection.Close();
155
                }
156
                catch (Exception ex)
157
                {
158
                    Log.Write(ex.Message + "\r\n" + ex.StackTrace);
159
                }
160
                finally
161
                {
162
                    connection.Dispose();
163 235
                }
164 236
            }
237

  
165 238
            return dt;
166 239
        }
167 240

  
......
923 996
            ID2Info id2Info = ID2Info.GetInstance();
924 997

  
925 998
            bool result = true;
926
            using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", id2Info.DBFilePath), true))
999

  
1000
            if(id2Info.ID2DBType == ID2DB_Type.SQLite)
927 1001
            {
928
                try
1002
                using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", id2Info.DBFilePath), true))
929 1003
                {
930
                    connection.Open();
1004
                    try
1005
                    {
1006
                        connection.Open();
931 1007

  
932
                    using (SQLiteTransaction transaction = connection.BeginTransaction())
1008
                        using (SQLiteTransaction transaction = connection.BeginTransaction())
1009
                        {
1010
                            try
1011
                            {
1012
                                using (SQLiteCommand cmd = connection.CreateCommand())
1013
                                {
1014
                                    cmd.CommandText = string.Format("DELETE FROM {0}", PSN_VIEW);
1015
                                    cmd.ExecuteNonQuery();
1016

  
1017
                                    foreach (string value in values)
1018
                                    {
1019
                                        cmd.CommandText = string.Format("INSERT INTO {0} VALUES (@OID)", PSN_VIEW);
1020
                                        cmd.Parameters.Clear();
1021
                                        cmd.Parameters.AddWithValue("@OID", value);
1022
                                        cmd.ExecuteNonQuery();
1023
                                    }
1024
                                }
1025
                                transaction.Commit();
1026
                                connection.Close();
1027
                            }
1028
                            catch (Exception ex)
1029
                            {
1030
                                transaction.Rollback();
1031
                                result = false;
1032
                            }
1033
                            finally
1034
                            {
1035
                                transaction.Dispose();
1036
                            }
1037
                        }
1038
                    }
1039
                    catch (Exception ex)
933 1040
                    {
934
                        try
1041
                        System.Windows.Forms.MessageBox.Show(ex.Message);
1042
                        result = false;
1043
                    }
1044
                    finally
1045
                    {
1046
                        connection.Dispose();
1047
                    }
1048
                }
1049
            }
1050
            else if(id2Info.ID2DBType == ID2DB_Type.MSSQL)
1051
            {
1052
                using (SqlConnection connection = GetSqlConnection())
1053
                {
1054
                    try
1055
                    {
1056
                        if (connection != null && connection.State == ConnectionState.Open)
935 1057
                        {
936
                            using (SQLiteCommand cmd = connection.CreateCommand())
1058
                            using (SqlCommand cmd = connection.CreateCommand())
937 1059
                            {
938 1060
                                cmd.CommandText = string.Format("DELETE FROM {0}", PSN_VIEW);
939 1061
                                cmd.ExecuteNonQuery();
......
946 1068
                                    cmd.ExecuteNonQuery();
947 1069
                                }
948 1070
                            }
949
                            transaction.Commit();
950 1071
                            connection.Close();
951 1072
                        }
952
                        catch (Exception ex)
953
                        {
954
                            transaction.Rollback();
955
                            result = false;
956
                        }
957
                        finally
1073
                        else
958 1074
                        {
959
                            transaction.Dispose();
1075
                            return false;
960 1076
                        }
961 1077
                    }
962
                }
963
                catch (Exception ex)
964
                {
965
                    System.Windows.Forms.MessageBox.Show(ex.Message);
966
                    result = false;
967
                }
968
                finally
969
                {
970
                    connection.Dispose();
1078
                    catch (Exception ex)
1079
                    {
1080
                        Log.Write(ex.Message + "\r\n" + ex.StackTrace);
1081
                        return false;
1082
                    }
1083
                    finally
1084
                    {
1085
                        if (connection != null)
1086
                            connection.Dispose();
1087
                    }
971 1088
                }
972 1089
            }
973

  
974 1090
            return result;
975 1091
        }
976 1092

  
......
979 1095
            ID2Info id2Info = ID2Info.GetInstance();
980 1096

  
981 1097
            bool result = true;
982
            using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", id2Info.DBFilePath), true))
1098
            if (id2Info.ID2DBType == ID2DB_Type.SQLite)
983 1099
            {
984
                try
1100
                using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", id2Info.DBFilePath), true))
985 1101
                {
986
                    connection.Open();
1102
                    try
1103
                    {
1104
                        connection.Open();
987 1105

  
988
                    using (SQLiteTransaction transaction = connection.BeginTransaction())
1106
                        using (SQLiteTransaction transaction = connection.BeginTransaction())
1107
                        {
1108
                            try
1109
                            {
1110
                                using (SQLiteCommand cmd = connection.CreateCommand())
1111
                                {
1112
                                    cmd.CommandText = string.Format("DELETE FROM {0}", PSN_VIEW);
1113
                                    cmd.ExecuteNonQuery();
1114
                                }
1115
                                transaction.Commit();
1116
                                connection.Close();
1117
                            }
1118
                            catch (Exception ex)
1119
                            {
1120
                                transaction.Rollback();
1121
                                result = false;
1122
                            }
1123
                            finally
1124
                            {
1125
                                transaction.Dispose();
1126
                            }
1127
                        }
1128
                    }
1129
                    catch (Exception ex)
989 1130
                    {
990
                        try
1131
                        System.Windows.Forms.MessageBox.Show(ex.Message);
1132
                        result = false;
1133
                    }
1134
                    finally
1135
                    {
1136
                        connection.Dispose();
1137
                    }
1138
                }
1139
            }
1140
            else if (id2Info.ID2DBType == ID2DB_Type.MSSQL)
1141
            {
1142
                using (SqlConnection connection = GetSqlConnection())
1143
                {
1144
                    try
1145
                    {
1146
                        if (connection != null && connection.State == ConnectionState.Open)
991 1147
                        {
992
                            using (SQLiteCommand cmd = connection.CreateCommand())
1148
                            using (SqlCommand cmd = connection.CreateCommand())
993 1149
                            {
994 1150
                                cmd.CommandText = string.Format("DELETE FROM {0}", PSN_VIEW);
995 1151
                                cmd.ExecuteNonQuery();
996 1152
                            }
997
                            transaction.Commit();
998 1153
                            connection.Close();
999 1154
                        }
1000
                        catch (Exception ex)
1001
                        {
1002
                            transaction.Rollback();
1003
                            result = false;
1004
                        }
1005
                        finally
1155
                        else
1006 1156
                        {
1007
                            transaction.Dispose();
1157
                            return false;
1008 1158
                        }
1009 1159
                    }
1010
                }
1011
                catch (Exception ex)
1012
                {
1013
                    System.Windows.Forms.MessageBox.Show(ex.Message);
1014
                    result = false;
1015
                }
1016
                finally
1017
                {
1018
                    connection.Dispose();
1160
                    catch (Exception ex)
1161
                    {
1162
                        Log.Write(ex.Message + "\r\n" + ex.StackTrace);
1163
                        return false;
1164
                    }
1165
                    finally
1166
                    {
1167
                        if (connection != null)
1168
                            connection.Dispose();
1169
                    }
1019 1170
                }
1020 1171
            }
1021 1172

  
1173

  
1022 1174
            return result;
1023 1175
        }
1024 1176

  
......
1264 1416

  
1265 1417
            return dt;
1266 1418
        }
1419

  
1267 1420
        public static DataTable GetPathItem()
1268 1421
        {
1269 1422
            DataTable dt = new DataTable();
......
1292 1445
            }
1293 1446
            return dt;
1294 1447
        }
1448

  
1295 1449
        public static DataTable GetTopologySet()
1296 1450
        {
1297 1451
            DataTable dt = new DataTable();
......
1320 1474
            }
1321 1475
            return dt;
1322 1476
        }
1477

  
1323 1478
        public static DataTable GetPipeSystemNetwork()
1324 1479
        {
1325 1480
            DataTable dt = new DataTable();
......
1348 1503
            }
1349 1504
            return dt;
1350 1505
        }
1506

  
1351 1507
        public static DataTable GetSequenceData()
1352 1508
        {
1353 1509
            DataTable dt = new DataTable();
......
1376 1532
            }
1377 1533
            return dt;
1378 1534
        }
1535

  
1379 1536
    }
1380 1537
}
DTI_PID/ID2PSN/Form/MainForm.Designer.cs
672 672
            this.Name = "MainForm";
673 673
            this.Ribbon = this.ribbonControl;
674 674
            this.Text = "ID2 PSN";
675
            this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.MainForm_FormClosed);
675 676
            this.Load += new System.EventHandler(this.MainForm_Load);
676 677
            ((System.ComponentModel.ISupportInitialize)(this.ribbonControl)).EndInit();
677 678
            ((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).EndInit();
DTI_PID/ID2PSN/Form/MainForm.cs
397 397
            gridControlPSN.EndUpdate();
398 398
            gridControlTopologys.EndUpdate();
399 399
        }
400

  
400 401
        private void SetDataTableByCurrentPSN()
401 402
        {
402 403
            SetDataTable(currentPSN.TopologySet,
......
473 474
                }
474 475
            }
475 476
        }
477

  
476 478
        private void toolStripPathItemsClick(object sender, EventArgs e)
477 479
        {
478 480
            gridControlPathItems.BeginUpdate();
......
639 641
                workbook.Dispose();
640 642
            }
641 643
        }
644

  
645
        private void MainForm_FormClosed(object sender, FormClosedEventArgs e)
646
        {
647
            try
648
            {
649
                TcpClient tcpClient = new TcpClient();
650
                tcpClient.SendTimeout = 500;
651
                tcpClient.Connect("localhost", 2549);
652

  
653
                byte[] message = Encoding.UTF8.GetBytes("ProcessEnd");
654

  
655
                NetworkStream networkStream = tcpClient.GetStream();
656
                networkStream.Write(message, 0, message.Length);
657

  
658
                byte[] outbuf = new byte[1024];
659
                int nbytes = networkStream.Read(outbuf, 0, outbuf.Length);
660
                string output = Encoding.UTF8.GetString(outbuf, 0, nbytes);
661

  
662
                // (5) 스트림과 TcpClient 객체 닫기
663
                networkStream.Close();
664
                tcpClient.Close();
665
                MessageBox.Show(output);
666
            }
667
            catch (Exception ex)
668
            {
669
                MessageBox.Show("Failed to open ID2 drawing.", "ID2 " + ID2Info.ProgramName, MessageBoxButtons.OK, MessageBoxIcon.Error);
670
            }
671
        }
642 672
    }
643 673
}
DTI_PID/ID2PSN/Form/PriorityForm.Designer.cs
96 96
            this.ribbonControl.ShowDisplayOptionsMenuButton = DevExpress.Utils.DefaultBoolean.False;
97 97
            this.ribbonControl.ShowPageHeadersMode = DevExpress.XtraBars.Ribbon.ShowPageHeadersMode.ShowOnMultiplePages;
98 98
            this.ribbonControl.ShowToolbarCustomizeItem = false;
99
            this.ribbonControl.Size = new System.Drawing.Size(572, 32);
99
            this.ribbonControl.Size = new System.Drawing.Size(580, 32);
100 100
            this.ribbonControl.Toolbar.ShowCustomizeItem = false;
101 101
            // 
102 102
            // layoutControl1
......
113 113
            this.layoutControl1.Name = "layoutControl1";
114 114
            this.layoutControl1.OptionsView.UseDefaultDragAndDropRendering = false;
115 115
            this.layoutControl1.Root = this.Root;
116
            this.layoutControl1.Size = new System.Drawing.Size(572, 945);
116
            this.layoutControl1.Size = new System.Drawing.Size(580, 949);
117 117
            this.layoutControl1.TabIndex = 1;
118 118
            this.layoutControl1.Text = "layoutControl1";
119 119
            // 
120 120
            // btnImport
121 121
            // 
122 122
            this.btnImport.ImageOptions.SvgImage = ((DevExpress.Utils.Svg.SvgImage)(resources.GetObject("btnImport.ImageOptions.SvgImage")));
123
            this.btnImport.Location = new System.Drawing.Point(116, 895);
123
            this.btnImport.Location = new System.Drawing.Point(116, 899);
124 124
            this.btnImport.Name = "btnImport";
125 125
            this.btnImport.Size = new System.Drawing.Size(81, 38);
126 126
            this.btnImport.StyleController = this.layoutControl1;
......
131 131
            // btnExport
132 132
            // 
133 133
            this.btnExport.ImageOptions.SvgImage = ((DevExpress.Utils.Svg.SvgImage)(resources.GetObject("btnExport.ImageOptions.SvgImage")));
134
            this.btnExport.Location = new System.Drawing.Point(12, 895);
134
            this.btnExport.Location = new System.Drawing.Point(12, 899);
135 135
            this.btnExport.Name = "btnExport";
136 136
            this.btnExport.Size = new System.Drawing.Size(80, 38);
137 137
            this.btnExport.StyleController = this.layoutControl1;
......
142 142
            // btnDown
143 143
            // 
144 144
            this.btnDown.ImageOptions.Image = ((System.Drawing.Image)(resources.GetObject("btnDown.ImageOptions.Image")));
145
            this.btnDown.Location = new System.Drawing.Point(538, 12);
145
            this.btnDown.Location = new System.Drawing.Point(546, 12);
146 146
            this.btnDown.Name = "btnDown";
147 147
            this.btnDown.Size = new System.Drawing.Size(22, 22);
148 148
            this.btnDown.StyleController = this.layoutControl1;
......
152 152
            // btnUp
153 153
            // 
154 154
            this.btnUp.ImageOptions.Image = ((System.Drawing.Image)(resources.GetObject("btnUp.ImageOptions.Image")));
155
            this.btnUp.Location = new System.Drawing.Point(492, 12);
155
            this.btnUp.Location = new System.Drawing.Point(500, 12);
156 156
            this.btnUp.Name = "btnUp";
157 157
            this.btnUp.Size = new System.Drawing.Size(22, 22);
158 158
            this.btnUp.StyleController = this.layoutControl1;
......
162 162
            // btnClose
163 163
            // 
164 164
            this.btnClose.ImageOptions.Image = ((System.Drawing.Image)(resources.GetObject("btnClose.ImageOptions.Image")));
165
            this.btnClose.Location = new System.Drawing.Point(490, 895);
165
            this.btnClose.Location = new System.Drawing.Point(498, 899);
166 166
            this.btnClose.Name = "btnClose";
167 167
            this.btnClose.Size = new System.Drawing.Size(70, 36);
168 168
            this.btnClose.StyleController = this.layoutControl1;
......
173 173
            // btnSave
174 174
            // 
175 175
            this.btnSave.ImageOptions.Image = ((System.Drawing.Image)(resources.GetObject("btnSave.ImageOptions.Image")));
176
            this.btnSave.Location = new System.Drawing.Point(398, 895);
176
            this.btnSave.Location = new System.Drawing.Point(406, 899);
177 177
            this.btnSave.Name = "btnSave";
178 178
            this.btnSave.Size = new System.Drawing.Size(68, 36);
179 179
            this.btnSave.StyleController = this.layoutControl1;
......
186 186
            this.xtraTabControlSetting.Location = new System.Drawing.Point(12, 38);
187 187
            this.xtraTabControlSetting.Name = "xtraTabControlSetting";
188 188
            this.xtraTabControlSetting.SelectedTabPage = this.xtraTabPageFluidCode;
189
            this.xtraTabControlSetting.Size = new System.Drawing.Size(548, 853);
189
            this.xtraTabControlSetting.Size = new System.Drawing.Size(556, 857);
190 190
            this.xtraTabControlSetting.TabIndex = 4;
191 191
            this.xtraTabControlSetting.TabPages.AddRange(new DevExpress.XtraTab.XtraTabPage[] {
192 192
            this.xtraTabPageFluidCode,
......
196 196
            // 
197 197
            this.xtraTabPageFluidCode.Controls.Add(this.gridControlFluidCode);
198 198
            this.xtraTabPageFluidCode.Name = "xtraTabPageFluidCode";
199
            this.xtraTabPageFluidCode.Size = new System.Drawing.Size(546, 827);
199
            this.xtraTabPageFluidCode.Size = new System.Drawing.Size(554, 831);
200 200
            this.xtraTabPageFluidCode.Text = "Fluid Code";
201 201
            // 
202 202
            // gridControlFluidCode
......
206 206
            this.gridControlFluidCode.MainView = this.gridViewFluidCode;
207 207
            this.gridControlFluidCode.MenuManager = this.ribbonControl;
208 208
            this.gridControlFluidCode.Name = "gridControlFluidCode";
209
            this.gridControlFluidCode.Size = new System.Drawing.Size(546, 827);
209
            this.gridControlFluidCode.Size = new System.Drawing.Size(554, 831);
210 210
            this.gridControlFluidCode.TabIndex = 0;
211 211
            this.gridControlFluidCode.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] {
212 212
            this.gridViewFluidCode});
......
221 221
            // 
222 222
            this.xtraTabPagePipingMaterialsClass.Controls.Add(this.gridControlPipingMaterialsClass);
223 223
            this.xtraTabPagePipingMaterialsClass.Name = "xtraTabPagePipingMaterialsClass";
224
            this.xtraTabPagePipingMaterialsClass.Size = new System.Drawing.Size(546, 827);
224
            this.xtraTabPagePipingMaterialsClass.Size = new System.Drawing.Size(542, 824);
225 225
            this.xtraTabPagePipingMaterialsClass.Text = "Piping Materials Class";
226 226
            // 
227 227
            // gridControlPipingMaterialsClass
......
231 231
            this.gridControlPipingMaterialsClass.MainView = this.gridViewPipingMaterialsClass;
232 232
            this.gridControlPipingMaterialsClass.MenuManager = this.ribbonControl;
233 233
            this.gridControlPipingMaterialsClass.Name = "gridControlPipingMaterialsClass";
234
            this.gridControlPipingMaterialsClass.Size = new System.Drawing.Size(546, 827);
234
            this.gridControlPipingMaterialsClass.Size = new System.Drawing.Size(542, 824);
235 235
            this.gridControlPipingMaterialsClass.TabIndex = 0;
236 236
            this.gridControlPipingMaterialsClass.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] {
237 237
            this.gridViewPipingMaterialsClass});
......
260 260
            this.layoutControlItem7,
261 261
            this.emptySpaceItem5});
262 262
            this.Root.Name = "Root";
263
            this.Root.Size = new System.Drawing.Size(572, 945);
263
            this.Root.Size = new System.Drawing.Size(580, 949);
264 264
            this.Root.TextVisible = false;
265 265
            // 
266 266
            // layoutControlItem1
......
268 268
            this.layoutControlItem1.Control = this.xtraTabControlSetting;
269 269
            this.layoutControlItem1.Location = new System.Drawing.Point(0, 26);
270 270
            this.layoutControlItem1.Name = "layoutControlItem1";
271
            this.layoutControlItem1.Size = new System.Drawing.Size(552, 857);
271
            this.layoutControlItem1.Size = new System.Drawing.Size(560, 861);
272 272
            this.layoutControlItem1.TextSize = new System.Drawing.Size(0, 0);
273 273
            this.layoutControlItem1.TextVisible = false;
274 274
            // 
275 275
            // layoutControlItem2
276 276
            // 
277 277
            this.layoutControlItem2.Control = this.btnSave;
278
            this.layoutControlItem2.Location = new System.Drawing.Point(386, 883);
278
            this.layoutControlItem2.Location = new System.Drawing.Point(394, 887);
279 279
            this.layoutControlItem2.MaxSize = new System.Drawing.Size(72, 40);
280 280
            this.layoutControlItem2.MinSize = new System.Drawing.Size(72, 40);
281 281
            this.layoutControlItem2.Name = "layoutControlItem2";
......
287 287
            // layoutControlItem3
288 288
            // 
289 289
            this.layoutControlItem3.Control = this.btnClose;
290
            this.layoutControlItem3.Location = new System.Drawing.Point(478, 883);
290
            this.layoutControlItem3.Location = new System.Drawing.Point(486, 887);
291 291
            this.layoutControlItem3.MaxSize = new System.Drawing.Size(74, 40);
292 292
            this.layoutControlItem3.MinSize = new System.Drawing.Size(74, 40);
293 293
            this.layoutControlItem3.Name = "layoutControlItem3";
......
299 299
            // emptySpaceItem1
300 300
            // 
301 301
            this.emptySpaceItem1.AllowHotTrack = false;
302
            this.emptySpaceItem1.Location = new System.Drawing.Point(458, 883);
302
            this.emptySpaceItem1.Location = new System.Drawing.Point(466, 887);
303 303
            this.emptySpaceItem1.MaxSize = new System.Drawing.Size(20, 40);
304 304
            this.emptySpaceItem1.MinSize = new System.Drawing.Size(20, 40);
305 305
            this.emptySpaceItem1.Name = "emptySpaceItem1";
......
310 310
            // emptySpaceItem2
311 311
            // 
312 312
            this.emptySpaceItem2.AllowHotTrack = false;
313
            this.emptySpaceItem2.Location = new System.Drawing.Point(189, 883);
313
            this.emptySpaceItem2.Location = new System.Drawing.Point(189, 887);
314 314
            this.emptySpaceItem2.Name = "emptySpaceItem2";
315
            this.emptySpaceItem2.Size = new System.Drawing.Size(197, 42);
315
            this.emptySpaceItem2.Size = new System.Drawing.Size(205, 42);
316 316
            this.emptySpaceItem2.TextSize = new System.Drawing.Size(0, 0);
317 317
            // 
318 318
            // layoutControlItem5
319 319
            // 
320 320
            this.layoutControlItem5.Control = this.btnDown;
321
            this.layoutControlItem5.Location = new System.Drawing.Point(526, 0);
321
            this.layoutControlItem5.Location = new System.Drawing.Point(534, 0);
322 322
            this.layoutControlItem5.MaxSize = new System.Drawing.Size(26, 26);
323 323
            this.layoutControlItem5.MinSize = new System.Drawing.Size(26, 26);
324 324
            this.layoutControlItem5.Name = "layoutControlItem5";
......
330 330
            // emptySpaceItem3
331 331
            // 
332 332
            this.emptySpaceItem3.AllowHotTrack = false;
333
            this.emptySpaceItem3.Location = new System.Drawing.Point(506, 0);
333
            this.emptySpaceItem3.Location = new System.Drawing.Point(514, 0);
334 334
            this.emptySpaceItem3.MaxSize = new System.Drawing.Size(20, 26);
335 335
            this.emptySpaceItem3.MinSize = new System.Drawing.Size(20, 26);
336 336
            this.emptySpaceItem3.Name = "emptySpaceItem3";
......
343 343
            this.emptySpaceItem4.AllowHotTrack = false;
344 344
            this.emptySpaceItem4.Location = new System.Drawing.Point(0, 0);
345 345
            this.emptySpaceItem4.Name = "emptySpaceItem4";
346
            this.emptySpaceItem4.Size = new System.Drawing.Size(480, 26);
346
            this.emptySpaceItem4.Size = new System.Drawing.Size(488, 26);
347 347
            this.emptySpaceItem4.TextSize = new System.Drawing.Size(0, 0);
348 348
            // 
349 349
            // layoutControlItem4
350 350
            // 
351 351
            this.layoutControlItem4.Control = this.btnUp;
352
            this.layoutControlItem4.Location = new System.Drawing.Point(480, 0);
352
            this.layoutControlItem4.Location = new System.Drawing.Point(488, 0);
353 353
            this.layoutControlItem4.MaxSize = new System.Drawing.Size(26, 26);
354 354
            this.layoutControlItem4.MinSize = new System.Drawing.Size(26, 26);
355 355
            this.layoutControlItem4.Name = "layoutControlItem4";
......
361 361
            // layoutControlItem6
362 362
            // 
363 363
            this.layoutControlItem6.Control = this.btnExport;
364
            this.layoutControlItem6.Location = new System.Drawing.Point(0, 883);
364
            this.layoutControlItem6.Location = new System.Drawing.Point(0, 887);
365 365
            this.layoutControlItem6.MaxSize = new System.Drawing.Size(84, 42);
366 366
            this.layoutControlItem6.MinSize = new System.Drawing.Size(84, 42);
367 367
            this.layoutControlItem6.Name = "layoutControlItem6";
......
373 373
            // layoutControlItem7
374 374
            // 
375 375
            this.layoutControlItem7.Control = this.btnImport;
376
            this.layoutControlItem7.Location = new System.Drawing.Point(104, 883);
376
            this.layoutControlItem7.Location = new System.Drawing.Point(104, 887);
377 377
            this.layoutControlItem7.MaxSize = new System.Drawing.Size(85, 42);
378 378
            this.layoutControlItem7.MinSize = new System.Drawing.Size(85, 42);
379 379
            this.layoutControlItem7.Name = "layoutControlItem7";
......
385 385
            // emptySpaceItem5
386 386
            // 
387 387
            this.emptySpaceItem5.AllowHotTrack = false;
388
            this.emptySpaceItem5.Location = new System.Drawing.Point(84, 883);
388
            this.emptySpaceItem5.Location = new System.Drawing.Point(84, 887);
389 389
            this.emptySpaceItem5.MaxSize = new System.Drawing.Size(20, 40);
390 390
            this.emptySpaceItem5.MinSize = new System.Drawing.Size(20, 40);
391 391
            this.emptySpaceItem5.Name = "emptySpaceItem5";
......
397 397
            // 
398 398
            this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F);
399 399
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
400
            this.ClientSize = new System.Drawing.Size(572, 977);
400
            this.ClientSize = new System.Drawing.Size(580, 981);
401 401
            this.Controls.Add(this.layoutControl1);
402 402
            this.Controls.Add(this.ribbonControl);
403 403
            this.Name = "PriorityForm";
DTI_PID/ID2PSN/Form/TopologyRuleForm.Designer.cs
58 58
            // 
59 59
            this.ribbonControl.ExpandCollapseItem.Id = 0;
60 60
            this.ribbonControl.Items.AddRange(new DevExpress.XtraBars.BarItem[] {
61
            this.ribbonControl.ExpandCollapseItem});
61
            this.ribbonControl.ExpandCollapseItem,
62
            this.ribbonControl.SearchEditItem});
62 63
            this.ribbonControl.Location = new System.Drawing.Point(0, 0);
63 64
            this.ribbonControl.MaxItemId = 1;
64 65
            this.ribbonControl.Name = "ribbonControl";
DTI_PID/ID2PSN/Object/ID2Info.cs
9 9
{
10 10
    public enum ID2DB_Type
11 11
    {
12
        SQLite,
13
        MSSQL
12
        None, //ID2와 숫자 동일하게 하기위해 None은 의미 없음
13
        MSSQL,
14
        SQLite
14 15
    }
15 16

  
16 17
    public class ID2Info
......
23 24
        private string _ImageDirPath;
24 25
        private string _SvgImageDirPath;
25 26
        private string _ProgramName;
27
        private string _ProgramErrorName;
28
        private ID2DB_Type _ID2DBType;
29

  
30
        public string ServerIP { get; set; }
31
        public string Port { get; set; }
32
        public string DBUser { get; set; }
33
        public string DBPassword { get; set; }
26 34

  
27 35
        public string DefaultPath {
28 36
            get { return _DefaultPath; }
......
42 50
            set { _ProgramName = value; }
43 51
        }
44 52

  
53
        public ID2DB_Type ID2DBType
54
        {
55
            get { return _ID2DBType; }
56
            set { _ID2DBType = value; }
57
        }
58

  
45 59
        public string Name
46 60
        {
47 61
            get { return _Name; }
DTI_PID/ID2PSN/Program.cs
26 26
                //    ID2Info info = ID2Info.GetInstance();
27 27
                //    info.DefaultPath = File.ReadAllLines(path)[0];
28 28
                //}
29
                //projectTable = DB.GetProject();
30 29

  
31
                string[] result = args[0].Split(new string[] { "☆■☆" }, StringSplitOptions.None);
30
#if DEBUG
31
                //info.DefaultPath = @"E:\DOFTECH\10.PSN\REB";
32
                //info.DefaultPath = @"E:\DOFTECH\10.PSN\SampleProject_규호";
33
                //info.DefaultPath = @"D:\Projects\dd\21100497014_REB";
34
                args = new string[1];
35
                 args[0] = @"E:\DOFTECH\10.PSN\REB☆■☆PSN";
36
                
37
                //args[0] = @"E:\DOFTECH\10.PSN\SampleProject_규호";
38
#endif
32 39

  
33
                if (result.Length > 0)
40
                if (args.Length > 0)
34 41
                {
35
                    info.DefaultPath = result[0];
36
                    if (result.Length > 1)
37
                        info.ProgramName = result[1];
38
                    else
39
                        info.ProgramName = "PSN";
42
                    //이름 변경
43
                    string[] result = args[0].Split(new string[] { "☆■☆" }, StringSplitOptions.None);
44
                    if (result.Length > 0)
45
                    {
46
                        info.DefaultPath = result[0];
47
                        if (result.Length > 1)
48
                            info.ProgramName = result[1];
49
                        else
50
                            info.ProgramName = "PSN";
51
                    }
52

  
53
                    //DB Type 확인
54
                    projectTable = DB.GetProject();
55
                    DataRow dr = projectTable.Select(string.Format("Path = '{0}'", result[0].Replace(@"\", @"/"))).FirstOrDefault();
56
                    //2는 mssql 1은 sqlite
57
                    if (Convert.ToInt32(dr.Field<long>("DBTypes_UID")) == 1)
58
                        info.ID2DBType = ID2DB_Type.SQLite;
59
                    else if (Convert.ToInt32(dr.Field<long>("DBTypes_UID")) == 2)
60
                    {
61
                        info.ID2DBType = ID2DB_Type.MSSQL;
62
                        info.ServerIP = dr.Field<string>("Host");
63
                        //2021-11-03 ID2는 무조건 기본포트 쓴다고 함
64
                        //info.Port = "3389"; 
65
                        info.DBUser = dr.Field<string>("User");
66
                        info.DBPassword = dr.Field<string>("Password");
67
                        //info.DefaultPath = dr.Field<string>("Name");
68
                    }
40 69
                }
41
    #if DEBUG
42
                info.DefaultPath = @"E:\DOFTECH\10.PSN\REB";
43
                //info.DefaultPath = @"E:\DOFTECH\10.PSN\SampleProject_규호";
44
            
45
                info.ProgramName = "PNET";
46
                //info.DefaultPath = @"D:\Projects\dd\21100497014_REB";
47
    #endif
48 70

  
49 71
                if (DB.ConnTestAndCreateTable())
50 72
                {

내보내기 Unified diff