개정판 0fe04b33
issue #000: sqlite로 변경
Change-Id: I1913bcc05f79108010c8d9a29600aae8336169f8
DTI_PID/ID2PSN/DB.cs | ||
---|---|---|
110 | 110 |
bool result = false; |
111 | 111 |
ID2Info id2Info = ID2Info.GetInstance(); |
112 | 112 | |
113 |
if (id2Info.ID2DBType == ID2DB_Type.SQLite)
|
|
113 |
using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, @"Data Source = {0}", id2Info.DBFilePath), true))
|
|
114 | 114 |
{ |
115 |
using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, @"Data Source = {0}", id2Info.DBFilePath), true))
|
|
115 |
try
|
|
116 | 116 |
{ |
117 |
try |
|
117 |
connection.Open(); |
|
118 |
if (connection.State == ConnectionState.Open) |
|
118 | 119 |
{ |
119 |
connection.Open(); |
|
120 |
if (connection.State == ConnectionState.Open) |
|
120 |
using (SQLiteCommand cmd = connection.CreateCommand()) |
|
121 | 121 |
{ |
122 |
using (SQLiteCommand cmd = connection.CreateCommand()) |
|
122 |
cmd.CommandText = "SELECT NAME FROM sqlite_master WHERE type='table'"; |
|
123 |
using (SQLiteDataReader dr = cmd.ExecuteReader()) |
|
124 |
using (DataTable dt = new DataTable()) |
|
123 | 125 |
{ |
124 |
cmd.CommandText = "SELECT NAME FROM sqlite_master WHERE type='table'"; |
|
125 |
using (SQLiteDataReader dr = cmd.ExecuteReader()) |
|
126 |
using (DataTable dt = new DataTable()) |
|
127 |
{ |
|
128 |
dt.Load(dr); |
|
126 |
dt.Load(dr); |
|
129 | 127 | |
130 |
if (dt.Select(string.Format("NAME = '{0}'", PSN_HEADER_SETTING)).Length == 0)
|
|
131 |
{
|
|
132 |
cmd.CommandText = string.Format("CREATE TABLE {0} (GROUP_ID TEXT, DESCRIPTION TEXT, [INDEX] INTEGER, NAME TEXT)", PSN_HEADER_SETTING);
|
|
133 |
cmd.ExecuteNonQuery();
|
|
134 |
}
|
|
135 |
if (dt.Select(string.Format("NAME = '{0}'", PSN_VENTDRAIN_SETTING)).Length == 0)
|
|
136 |
{
|
|
137 |
cmd.CommandText = string.Format("CREATE TABLE {0} (GROUP_ID TEXT, DESCRIPTION TEXT, [INDEX] INTEGER, NAME TEXT)", PSN_VENTDRAIN_SETTING);
|
|
138 |
cmd.ExecuteNonQuery();
|
|
139 |
}
|
|
140 |
if (dt.Select(string.Format("NAME = '{0}'", PSN_TOPOLOGY_RULE)).Length == 0)
|
|
141 |
{
|
|
142 |
cmd.CommandText = string.Format("CREATE TABLE {0} (UID TEXT)", PSN_TOPOLOGY_RULE);
|
|
143 |
cmd.ExecuteNonQuery();
|
|
128 |
if (dt.Select(string.Format("NAME = '{0}'", PSN_HEADER_SETTING)).Length == 0) |
|
129 |
{ |
|
130 |
cmd.CommandText = string.Format("CREATE TABLE {0} (GROUP_ID TEXT, DESCRIPTION TEXT, [INDEX] INTEGER, NAME TEXT)", PSN_HEADER_SETTING); |
|
131 |
cmd.ExecuteNonQuery(); |
|
132 |
} |
|
133 |
if (dt.Select(string.Format("NAME = '{0}'", PSN_VENTDRAIN_SETTING)).Length == 0) |
|
134 |
{ |
|
135 |
cmd.CommandText = string.Format("CREATE TABLE {0} (GROUP_ID TEXT, DESCRIPTION TEXT, [INDEX] INTEGER, NAME TEXT)", PSN_VENTDRAIN_SETTING); |
|
136 |
cmd.ExecuteNonQuery(); |
|
137 |
} |
|
138 |
if (dt.Select(string.Format("NAME = '{0}'", PSN_TOPOLOGY_RULE)).Length == 0) |
|
139 |
{ |
|
140 |
cmd.CommandText = string.Format("CREATE TABLE {0} (UID TEXT)", PSN_TOPOLOGY_RULE); |
|
141 |
cmd.ExecuteNonQuery(); |
|
144 | 142 | |
145 |
DataTable topologyRule = new DataTable();
|
|
146 |
topologyRule.Columns.Add("NAME", typeof(string));
|
|
143 |
DataTable topologyRule = new DataTable(); |
|
144 |
topologyRule.Columns.Add("NAME", typeof(string)); |
|
147 | 145 | |
148 |
topologyRule.Rows.Add("FluidCode");
|
|
149 |
topologyRule.Rows.Add("-");
|
|
150 |
topologyRule.Rows.Add("PipingMaterialsClass");
|
|
151 |
topologyRule.Rows.Add("-");
|
|
152 |
topologyRule.Rows.Add("Tag Seq No");
|
|
146 |
topologyRule.Rows.Add("FluidCode"); |
|
147 |
topologyRule.Rows.Add("-"); |
|
148 |
topologyRule.Rows.Add("PipingMaterialsClass"); |
|
149 |
topologyRule.Rows.Add("-"); |
|
150 |
topologyRule.Rows.Add("Tag Seq No"); |
|
153 | 151 | |
154 |
SaveTopologyRule(topologyRule); |
|
155 |
} |
|
156 |
if (dt.Select(string.Format("NAME = '{0}'", PSN_PATHITEMS)).Length == 0) |
|
157 |
{ |
|
158 |
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); |
|
159 |
cmd.ExecuteNonQuery(); |
|
160 |
} |
|
161 |
if (dt.Select(string.Format("NAME = '{0}'", PSN_SEQUENCEDATA)).Length == 0) |
|
162 |
{ |
|
163 |
cmd.CommandText = string.Format("CREATE TABLE {0} (OID TEXT, SERIALNUMBER TEXT, PathItem_OID TEXT, TopologySet_OID_Key TEXT)", PSN_SEQUENCEDATA); |
|
164 |
cmd.ExecuteNonQuery(); |
|
165 |
} |
|
166 |
if (dt.Select(string.Format("NAME = '{0}'", PSN_PIPESYSTEMNETWORK)).Length == 0) |
|
167 |
{ |
|
168 |
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); |
|
169 |
cmd.ExecuteNonQuery(); |
|
170 |
} |
|
171 |
if (dt.Select(string.Format("NAME = '{0}'", PSN_EQUIPMENT)).Length == 0) |
|
172 |
{ |
|
173 |
cmd.CommandText = string.Format("CREATE TABLE {0} (OID TEXT, ITEMTAG TEXT, XCOORDS TEXT, YCOORDS TEXT)", PSN_EQUIPMENT); |
|
174 |
cmd.ExecuteNonQuery(); |
|
175 |
} |
|
176 |
if (dt.Select(string.Format("NAME = '{0}'", PSN_NOZZLE)).Length == 0) |
|
177 |
{ |
|
178 |
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); |
|
179 |
cmd.ExecuteNonQuery(); |
|
180 |
} |
|
181 |
if (dt.Select(string.Format("NAME = '{0}'", PSN_FLUIDCODE)).Length == 0) |
|
182 |
{ |
|
183 |
cmd.CommandText = string.Format("CREATE TABLE {0} (UID TEXT, Code TEXT, Description TEXT, Condition TEXT, Remarks TEXT, GroundLevel TEXT)", PSN_FLUIDCODE); |
|
184 |
cmd.ExecuteNonQuery(); |
|
185 |
} |
|
186 |
if (dt.Select(string.Format("NAME = '{0}'", PSN_PIPINGMATLCLASS)).Length == 0) |
|
187 |
{ |
|
188 |
cmd.CommandText = string.Format("CREATE TABLE {0} (UID TEXT, Priority TEXT, Code TEXT, Description TEXT, Condition TEXT, Remarks TEXT, GroundLevel TEXT)", PSN_PIPINGMATLCLASS); |
|
189 |
cmd.ExecuteNonQuery(); |
|
190 |
} |
|
191 |
if (dt.Select(string.Format("NAME = '{0}'", PSN_VIEW)).Length == 0) |
|
192 |
{ |
|
193 |
cmd.CommandText = string.Format("CREATE TABLE {0} (OID TEXT)", PSN_VIEW); |
|
194 |
cmd.ExecuteNonQuery(); |
|
195 |
} |
|
196 |
if (dt.Select(string.Format("NAME = '{0}'", PSN_TOPOLOGYSET)).Length == 0) |
|
197 |
{ |
|
198 |
cmd.CommandText = string.Format("CREATE TABLE {0} (OID TEXT, Type TEXT, SubType TEXT, HeadItemTag TEXT, TailItemTag TEXT, HeadItemID TEXT, TailItemID TEXT)", PSN_TOPOLOGYSET); |
|
199 |
cmd.ExecuteNonQuery(); |
|
200 |
} |
|
152 |
SaveTopologyRule(topologyRule); |
|
201 | 153 |
} |
202 |
} |
|
203 |
result = true; |
|
204 |
} |
|
205 |
connection.Close(); |
|
206 |
} |
|
207 |
catch (Exception ex) |
|
208 |
{ |
|
209 |
Log.Write(ex.Message + "\r\n" + ex.StackTrace); |
|
210 |
} |
|
211 |
finally |
|
212 |
{ |
|
213 |
connection.Dispose(); |
|
214 |
} |
|
215 |
} |
|
216 |
} |
|
217 |
else if (id2Info.ID2DBType == ID2DB_Type.MSSQL) |
|
218 |
{ |
|
219 |
using (SqlConnection connection = GetSqlConnection()) |
|
220 |
{ |
|
221 |
try |
|
222 |
{ |
|
223 |
if (connection != null && connection.State == ConnectionState.Open) |
|
224 |
{ |
|
225 |
using (SqlCommand cmd = connection.CreateCommand()) |
|
226 |
{ |
|
227 |
cmd.CommandText = "SELECT TABLE_NAME AS NAME FROM INFORMATION_SCHEMA.TABLES"; |
|
228 |
using (SqlDataReader dr = cmd.ExecuteReader()) |
|
229 |
using (DataTable dt = new DataTable()) |
|
154 |
if (dt.Select(string.Format("NAME = '{0}'", PSN_PATHITEMS)).Length == 0) |
|
230 | 155 |
{ |
231 |
dt.Load(dr); |
|
232 |
if (dt.Select(string.Format("NAME = '{0}'", PSN_VIEW)).Length == 0) //T_PSN_VIEW - id2 zoom 용 |
|
233 |
{ |
|
234 |
cmd.CommandText = string.Format("CREATE TABLE {0} (OID TEXT)", PSN_VIEW); |
|
235 |
cmd.ExecuteNonQuery(); |
|
236 |
} |
|
156 |
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); |
|
157 |
cmd.ExecuteNonQuery(); |
|
158 |
} |
|
159 |
if (dt.Select(string.Format("NAME = '{0}'", PSN_SEQUENCEDATA)).Length == 0) |
|
160 |
{ |
|
161 |
cmd.CommandText = string.Format("CREATE TABLE {0} (OID TEXT, SERIALNUMBER TEXT, PathItem_OID TEXT, TopologySet_OID_Key TEXT)", PSN_SEQUENCEDATA); |
|
162 |
cmd.ExecuteNonQuery(); |
|
163 |
} |
|
164 |
if (dt.Select(string.Format("NAME = '{0}'", PSN_PIPESYSTEMNETWORK)).Length == 0) |
|
165 |
{ |
|
166 |
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); |
|
167 |
cmd.ExecuteNonQuery(); |
|
168 |
} |
|
169 |
if (dt.Select(string.Format("NAME = '{0}'", PSN_EQUIPMENT)).Length == 0) |
|
170 |
{ |
|
171 |
cmd.CommandText = string.Format("CREATE TABLE {0} (OID TEXT, ITEMTAG TEXT, XCOORDS TEXT, YCOORDS TEXT)", PSN_EQUIPMENT); |
|
172 |
cmd.ExecuteNonQuery(); |
|
173 |
} |
|
174 |
if (dt.Select(string.Format("NAME = '{0}'", PSN_NOZZLE)).Length == 0) |
|
175 |
{ |
|
176 |
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); |
|
177 |
cmd.ExecuteNonQuery(); |
|
178 |
} |
|
179 |
if (dt.Select(string.Format("NAME = '{0}'", PSN_FLUIDCODE)).Length == 0) |
|
180 |
{ |
|
181 |
cmd.CommandText = string.Format("CREATE TABLE {0} (UID TEXT, Code TEXT, Description TEXT, Condition TEXT, Remarks TEXT, GroundLevel TEXT)", PSN_FLUIDCODE); |
|
182 |
cmd.ExecuteNonQuery(); |
|
183 |
} |
|
184 |
if (dt.Select(string.Format("NAME = '{0}'", PSN_PIPINGMATLCLASS)).Length == 0) |
|
185 |
{ |
|
186 |
cmd.CommandText = string.Format("CREATE TABLE {0} (UID TEXT, Priority TEXT, Code TEXT, Description TEXT, Condition TEXT, Remarks TEXT, GroundLevel TEXT)", PSN_PIPINGMATLCLASS); |
|
187 |
cmd.ExecuteNonQuery(); |
|
188 |
} |
|
189 |
if (dt.Select(string.Format("NAME = '{0}'", PSN_VIEW)).Length == 0) |
|
190 |
{ |
|
191 |
cmd.CommandText = string.Format("CREATE TABLE {0} (OID TEXT)", PSN_VIEW); |
|
192 |
cmd.ExecuteNonQuery(); |
|
193 |
} |
|
194 |
if (dt.Select(string.Format("NAME = '{0}'", PSN_TOPOLOGYSET)).Length == 0) |
|
195 |
{ |
|
196 |
cmd.CommandText = string.Format("CREATE TABLE {0} (OID TEXT, Type TEXT, SubType TEXT, HeadItemTag TEXT, TailItemTag TEXT, HeadItemID TEXT, TailItemID TEXT)", PSN_TOPOLOGYSET); |
|
197 |
cmd.ExecuteNonQuery(); |
|
237 | 198 |
} |
238 | 199 |
} |
239 |
result = true; |
|
240 | 200 |
} |
201 |
result = true; |
|
241 | 202 |
} |
242 |
catch (Exception ex)
|
|
243 |
{
|
|
244 |
Log.Write(ex.Message + "\r\n" + ex.StackTrace);
|
|
245 |
}
|
|
246 |
finally
|
|
247 |
{
|
|
248 |
if (connection != null)
|
|
249 |
connection.Dispose();
|
|
250 |
}
|
|
203 |
connection.Close();
|
|
204 |
}
|
|
205 |
catch (Exception ex)
|
|
206 |
{
|
|
207 |
Log.Write(ex.Message + "\r\n" + ex.StackTrace);
|
|
208 |
}
|
|
209 |
finally
|
|
210 |
{
|
|
211 |
connection.Dispose();
|
|
251 | 212 |
} |
252 | 213 |
} |
214 |
|
|
215 |
//if (id2Info.ID2DBType == ID2DB_Type.MSSQL) |
|
216 |
//{ |
|
217 |
// using (SqlConnection connection = GetSqlConnection()) |
|
218 |
// { |
|
219 |
// try |
|
220 |
// { |
|
221 |
// if (connection != null && connection.State == ConnectionState.Open) |
|
222 |
// { |
|
223 |
// using (SqlCommand cmd = connection.CreateCommand()) |
|
224 |
// { |
|
225 |
// cmd.CommandText = "SELECT TABLE_NAME AS NAME FROM INFORMATION_SCHEMA.TABLES"; |
|
226 |
// using (SqlDataReader dr = cmd.ExecuteReader()) |
|
227 |
// using (DataTable dt = new DataTable()) |
|
228 |
// { |
|
229 |
// dt.Load(dr); |
|
230 |
// if (dt.Select(string.Format("NAME = '{0}'", PSN_VIEW)).Length == 0) //T_PSN_VIEW - id2 zoom 용 |
|
231 |
// { |
|
232 |
// cmd.CommandText = string.Format("CREATE TABLE {0} (OID TEXT)", PSN_VIEW); |
|
233 |
// cmd.ExecuteNonQuery(); |
|
234 |
// } |
|
235 |
// } |
|
236 |
// } |
|
237 |
// result = true; |
|
238 |
// } |
|
239 |
// } |
|
240 |
// catch (Exception ex) |
|
241 |
// { |
|
242 |
// Log.Write(ex.Message + "\r\n" + ex.StackTrace); |
|
243 |
// } |
|
244 |
// finally |
|
245 |
// { |
|
246 |
// if (connection != null) |
|
247 |
// connection.Dispose(); |
|
248 |
// } |
|
249 |
// } |
|
250 |
//} |
|
253 | 251 | |
254 | 252 |
return result; |
255 | 253 |
} |
... | ... | |
259 | 257 |
{ |
260 | 258 |
DataTable dt = new DataTable(); |
261 | 259 |
ID2Info id2Info = ID2Info.GetInstance(); |
262 |
if (id2Info.ID2DBType == ID2DB_Type.SQLite) |
|
260 | ||
261 |
using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", id2Info.DBFilePath), true)) |
|
263 | 262 |
{ |
264 |
using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", id2Info.DBFilePath), true))
|
|
263 |
try
|
|
265 | 264 |
{ |
266 |
try |
|
267 |
{ |
|
268 |
connection.Open(); |
|
269 |
using (SQLiteCommand cmd = connection.CreateCommand()) |
|
270 |
{ |
|
271 |
cmd.CommandText = "SELECT * FROM OPCRelations;"; |
|
272 |
using (SQLiteDataReader dr = cmd.ExecuteReader()) |
|
273 |
dt.Load(dr); |
|
274 |
} |
|
275 |
connection.Close(); |
|
276 |
} |
|
277 |
catch (Exception ex) |
|
278 |
{ |
|
279 |
Log.Write(ex.Message + "\r\n" + ex.StackTrace); |
|
280 |
} |
|
281 |
finally |
|
265 |
connection.Open(); |
|
266 |
using (SQLiteCommand cmd = connection.CreateCommand()) |
|
282 | 267 |
{ |
283 |
connection.Dispose(); |
|
268 |
cmd.CommandText = "SELECT * FROM OPCRelations;"; |
|
269 |
using (SQLiteDataReader dr = cmd.ExecuteReader()) |
|
270 |
dt.Load(dr); |
|
284 | 271 |
} |
272 |
connection.Close(); |
|
285 | 273 |
} |
286 |
} |
|
287 |
else if (id2Info.ID2DBType == ID2DB_Type.MSSQL) |
|
288 |
{ |
|
289 |
using (SqlConnection connection = GetSqlConnection()) |
|
274 |
catch (Exception ex) |
|
290 | 275 |
{ |
291 |
try |
|
292 |
{ |
|
293 |
if (connection != null && connection.State == ConnectionState.Open) |
|
294 |
{ |
|
295 |
using (SqlCommand cmd = connection.CreateCommand()) |
|
296 |
{ |
|
297 |
cmd.CommandText = "SELECT * FROM OPCRelations;"; |
|
298 |
using (SqlDataReader dr = cmd.ExecuteReader()) |
|
299 |
dt.Load(dr); |
|
300 |
} |
|
301 |
connection.Close(); |
|
302 |
} |
|
303 |
} |
|
304 |
catch (Exception ex) |
|
305 |
{ |
|
306 |
Log.Write(ex.Message + "\r\n" + ex.StackTrace); |
|
307 |
} |
|
308 |
finally |
|
309 |
{ |
|
310 |
if (connection != null) |
|
311 |
connection.Dispose(); |
|
312 |
} |
|
276 |
Log.Write(ex.Message + "\r\n" + ex.StackTrace); |
|
277 |
} |
|
278 |
finally |
|
279 |
{ |
|
280 |
connection.Dispose(); |
|
313 | 281 |
} |
314 | 282 |
} |
315 | 283 | |
284 |
//if (id2Info.ID2DBType == ID2DB_Type.SQLite) |
|
285 |
//{ |
|
286 |
// using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", id2Info.DBFilePath), true)) |
|
287 |
// { |
|
288 |
// try |
|
289 |
// { |
|
290 |
// connection.Open(); |
|
291 |
// using (SQLiteCommand cmd = connection.CreateCommand()) |
|
292 |
// { |
|
293 |
// cmd.CommandText = "SELECT * FROM OPCRelations;"; |
|
294 |
// using (SQLiteDataReader dr = cmd.ExecuteReader()) |
|
295 |
// dt.Load(dr); |
|
296 |
// } |
|
297 |
// connection.Close(); |
|
298 |
// } |
|
299 |
// catch (Exception ex) |
|
300 |
// { |
|
301 |
// Log.Write(ex.Message + "\r\n" + ex.StackTrace); |
|
302 |
// } |
|
303 |
// finally |
|
304 |
// { |
|
305 |
// connection.Dispose(); |
|
306 |
// } |
|
307 |
// } |
|
308 |
//} |
|
309 |
//else if (id2Info.ID2DBType == ID2DB_Type.MSSQL) |
|
310 |
//{ |
|
311 |
// using (SqlConnection connection = GetSqlConnection()) |
|
312 |
// { |
|
313 |
// try |
|
314 |
// { |
|
315 |
// if (connection != null && connection.State == ConnectionState.Open) |
|
316 |
// { |
|
317 |
// using (SqlCommand cmd = connection.CreateCommand()) |
|
318 |
// { |
|
319 |
// cmd.CommandText = "SELECT * FROM OPCRelations;"; |
|
320 |
// using (SqlDataReader dr = cmd.ExecuteReader()) |
|
321 |
// dt.Load(dr); |
|
322 |
// } |
|
323 |
// connection.Close(); |
|
324 |
// } |
|
325 |
// } |
|
326 |
// catch (Exception ex) |
|
327 |
// { |
|
328 |
// Log.Write(ex.Message + "\r\n" + ex.StackTrace); |
|
329 |
// } |
|
330 |
// finally |
|
331 |
// { |
|
332 |
// if (connection != null) |
|
333 |
// connection.Dispose(); |
|
334 |
// } |
|
335 |
// } |
|
336 |
//} |
|
337 | ||
316 | 338 |
return dt; |
317 | 339 |
} |
318 | 340 | |
... | ... | |
320 | 342 |
{ |
321 | 343 |
DataTable dt = new DataTable(); |
322 | 344 |
ID2Info id2Info = ID2Info.GetInstance(); |
323 |
if (id2Info.ID2DBType == ID2DB_Type.SQLite) |
|
345 | ||
346 |
using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", id2Info.DBFilePath), true)) |
|
324 | 347 |
{ |
325 |
using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", id2Info.DBFilePath), true))
|
|
348 |
try
|
|
326 | 349 |
{ |
327 |
try |
|
328 |
{ |
|
329 |
connection.Open(); |
|
330 |
using (SQLiteCommand cmd = connection.CreateCommand()) |
|
331 |
{ |
|
332 |
cmd.CommandText = "SELECT * FROM Drawings;"; |
|
333 |
using (SQLiteDataReader dr = cmd.ExecuteReader()) |
|
334 |
dt.Load(dr); |
|
335 |
} |
|
336 |
connection.Close(); |
|
337 |
} |
|
338 |
catch (Exception ex) |
|
339 |
{ |
|
340 |
Log.Write(ex.Message + "\r\n" + ex.StackTrace); |
|
341 |
} |
|
342 |
finally |
|
350 |
connection.Open(); |
|
351 |
using (SQLiteCommand cmd = connection.CreateCommand()) |
|
343 | 352 |
{ |
344 |
connection.Dispose(); |
|
353 |
cmd.CommandText = "SELECT * FROM Drawings;"; |
|
354 |
using (SQLiteDataReader dr = cmd.ExecuteReader()) |
|
355 |
dt.Load(dr); |
|
345 | 356 |
} |
357 |
connection.Close(); |
|
346 | 358 |
} |
347 |
} |
|
348 |
else if (id2Info.ID2DBType == ID2DB_Type.MSSQL) |
|
349 |
{ |
|
350 |
using (SqlConnection connection = GetSqlConnection()) |
|
359 |
catch (Exception ex) |
|
351 | 360 |
{ |
352 |
try |
|
353 |
{ |
|
354 |
if (connection != null && connection.State == ConnectionState.Open) |
|
355 |
{ |
|
356 |
using (SqlCommand cmd = connection.CreateCommand()) |
|
357 |
{ |
|
358 |
cmd.CommandText = "SELECT * FROM Drawings;"; |
|
359 |
using (SqlDataReader dr = cmd.ExecuteReader()) |
|
360 |
dt.Load(dr); |
|
361 |
} |
|
362 |
connection.Close(); |
|
363 |
} |
|
364 |
} |
|
365 |
catch (Exception ex) |
|
366 |
{ |
|
367 |
Log.Write(ex.Message + "\r\n" + ex.StackTrace); |
|
368 |
} |
|
369 |
finally |
|
370 |
{ |
|
371 |
if (connection != null) |
|
372 |
connection.Dispose(); |
|
373 |
} |
|
361 |
Log.Write(ex.Message + "\r\n" + ex.StackTrace); |
|
362 |
} |
|
363 |
finally |
|
364 |
{ |
|
365 |
connection.Dispose(); |
|
374 | 366 |
} |
375 | 367 |
} |
376 | 368 | |
369 |
//if (id2Info.ID2DBType == ID2DB_Type.SQLite) |
|
370 |
//{ |
|
371 |
// using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", id2Info.DBFilePath), true)) |
|
372 |
// { |
|
373 |
// try |
|
374 |
// { |
|
375 |
// connection.Open(); |
|
376 |
// using (SQLiteCommand cmd = connection.CreateCommand()) |
|
377 |
// { |
|
378 |
// cmd.CommandText = "SELECT * FROM Drawings;"; |
|
379 |
// using (SQLiteDataReader dr = cmd.ExecuteReader()) |
|
380 |
// dt.Load(dr); |
|
381 |
// } |
|
382 |
// connection.Close(); |
|
383 |
// } |
|
384 |
// catch (Exception ex) |
|
385 |
// { |
|
386 |
// Log.Write(ex.Message + "\r\n" + ex.StackTrace); |
|
387 |
// } |
|
388 |
// finally |
|
389 |
// { |
|
390 |
// connection.Dispose(); |
|
391 |
// } |
|
392 |
// } |
|
393 |
//} |
|
394 |
//else if (id2Info.ID2DBType == ID2DB_Type.MSSQL) |
|
395 |
//{ |
|
396 |
// using (SqlConnection connection = GetSqlConnection()) |
|
397 |
// { |
|
398 |
// try |
|
399 |
// { |
|
400 |
// if (connection != null && connection.State == ConnectionState.Open) |
|
401 |
// { |
|
402 |
// using (SqlCommand cmd = connection.CreateCommand()) |
|
403 |
// { |
|
404 |
// cmd.CommandText = "SELECT * FROM Drawings;"; |
|
405 |
// using (SqlDataReader dr = cmd.ExecuteReader()) |
|
406 |
// dt.Load(dr); |
|
407 |
// } |
|
408 |
// connection.Close(); |
|
409 |
// } |
|
410 |
// } |
|
411 |
// catch (Exception ex) |
|
412 |
// { |
|
413 |
// Log.Write(ex.Message + "\r\n" + ex.StackTrace); |
|
414 |
// } |
|
415 |
// finally |
|
416 |
// { |
|
417 |
// if (connection != null) |
|
418 |
// connection.Dispose(); |
|
419 |
// } |
|
420 |
// } |
|
421 |
//} |
|
422 | ||
377 | 423 |
return dt; |
378 | 424 |
} |
379 | 425 | |
... | ... | |
381 | 427 |
{ |
382 | 428 |
DataTable dt = new DataTable(); |
383 | 429 |
ID2Info id2Info = ID2Info.GetInstance(); |
384 |
if (id2Info.ID2DBType == ID2DB_Type.SQLite)
|
|
430 |
using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", id2Info.DBFilePath), true))
|
|
385 | 431 |
{ |
386 |
using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", id2Info.DBFilePath), true))
|
|
432 |
try
|
|
387 | 433 |
{ |
388 |
try |
|
389 |
{ |
|
390 |
connection.Open(); |
|
391 |
using (SQLiteCommand cmd = connection.CreateCommand()) |
|
392 |
{ |
|
393 |
cmd.CommandText = "SELECT * FROM LineProperties;"; |
|
394 |
using (SQLiteDataReader dr = cmd.ExecuteReader()) |
|
395 |
dt.Load(dr); |
|
396 |
} |
|
397 |
connection.Close(); |
|
398 |
} |
|
399 |
catch (Exception ex) |
|
400 |
{ |
|
401 |
Log.Write(ex.Message + "\r\n" + ex.StackTrace); |
|
402 |
} |
|
403 |
finally |
|
434 |
connection.Open(); |
|
435 |
using (SQLiteCommand cmd = connection.CreateCommand()) |
|
404 | 436 |
{ |
405 |
connection.Dispose(); |
|
437 |
cmd.CommandText = "SELECT * FROM LineProperties;"; |
|
438 |
using (SQLiteDataReader dr = cmd.ExecuteReader()) |
|
439 |
dt.Load(dr); |
|
406 | 440 |
} |
441 |
connection.Close(); |
|
407 | 442 |
} |
408 |
} |
|
409 |
else if (id2Info.ID2DBType == ID2DB_Type.MSSQL) |
|
410 |
{ |
|
411 |
using (SqlConnection connection = GetSqlConnection()) |
|
443 |
catch (Exception ex) |
|
412 | 444 |
{ |
413 |
try |
|
414 |
{ |
|
415 |
if (connection != null && connection.State == ConnectionState.Open) |
|
416 |
{ |
|
417 |
using (SqlCommand cmd = connection.CreateCommand()) |
|
418 |
{ |
|
419 |
cmd.CommandText = "SELECT * FROM LineProperties;"; |
|
420 |
using (SqlDataReader dr = cmd.ExecuteReader()) |
|
421 |
dt.Load(dr); |
|
422 |
} |
|
423 |
connection.Close(); |
|
424 |
} |
|
425 |
} |
|
426 |
catch (Exception ex) |
|
427 |
{ |
|
428 |
Log.Write(ex.Message + "\r\n" + ex.StackTrace); |
|
429 |
} |
|
430 |
finally |
|
431 |
{ |
|
432 |
if (connection != null) |
|
433 |
connection.Dispose(); |
|
434 |
} |
|
445 |
Log.Write(ex.Message + "\r\n" + ex.StackTrace); |
|
446 |
} |
|
447 |
finally |
|
448 |
{ |
|
449 |
connection.Dispose(); |
|
435 | 450 |
} |
436 | 451 |
} |
452 | ||
453 |
//if (id2Info.ID2DBType == ID2DB_Type.SQLite) |
|
454 |
//{ |
|
455 |
// using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", id2Info.DBFilePath), true)) |
|
456 |
// { |
|
457 |
// try |
|
458 |
// { |
|
459 |
// connection.Open(); |
|
460 |
// using (SQLiteCommand cmd = connection.CreateCommand()) |
|
461 |
// { |
|
462 |
// cmd.CommandText = "SELECT * FROM LineProperties;"; |
|
463 |
// using (SQLiteDataReader dr = cmd.ExecuteReader()) |
|
464 |
// dt.Load(dr); |
|
465 |
// } |
|
466 |
// connection.Close(); |
|
467 |
// } |
|
468 |
// catch (Exception ex) |
|
469 |
// { |
|
470 |
// Log.Write(ex.Message + "\r\n" + ex.StackTrace); |
|
471 |
// } |
|
472 |
// finally |
|
473 |
// { |
|
474 |
// connection.Dispose(); |
|
475 |
// } |
|
476 |
// } |
|
477 |
//} |
|
478 |
//else if (id2Info.ID2DBType == ID2DB_Type.MSSQL) |
|
479 |
//{ |
|
480 |
// using (SqlConnection connection = GetSqlConnection()) |
|
481 |
// { |
|
482 |
// try |
|
483 |
// { |
|
484 |
// if (connection != null && connection.State == ConnectionState.Open) |
|
485 |
// { |
|
486 |
// using (SqlCommand cmd = connection.CreateCommand()) |
|
487 |
// { |
|
488 |
// cmd.CommandText = "SELECT * FROM LineProperties;"; |
|
489 |
// using (SqlDataReader dr = cmd.ExecuteReader()) |
|
490 |
// dt.Load(dr); |
|
491 |
// } |
|
492 |
// connection.Close(); |
|
493 |
// } |
|
494 |
// } |
|
495 |
// catch (Exception ex) |
|
496 |
// { |
|
497 |
// Log.Write(ex.Message + "\r\n" + ex.StackTrace); |
|
498 |
// } |
|
499 |
// finally |
|
500 |
// { |
|
501 |
// if (connection != null) |
|
502 |
// connection.Dispose(); |
|
503 |
// } |
|
504 |
// } |
|
505 |
//} |
|
437 | 506 |
return dt; |
438 | 507 |
} |
439 | 508 |
|
... | ... | |
441 | 510 |
{ |
442 | 511 |
DataTable dt = new DataTable(); |
443 | 512 |
ID2Info id2Info = ID2Info.GetInstance(); |
444 |
if (id2Info.ID2DBType == ID2DB_Type.SQLite) |
|
513 | ||
514 |
using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", id2Info.DBFilePath), true)) |
|
445 | 515 |
{ |
446 |
using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", id2Info.DBFilePath), true))
|
|
516 |
try
|
|
447 | 517 |
{ |
448 |
try |
|
449 |
{ |
|
450 |
connection.Open(); |
|
451 |
using (SQLiteCommand cmd = connection.CreateCommand()) |
|
452 |
{ |
|
453 |
cmd.CommandText = "SELECT * FROM FluidCode;"; |
|
454 |
using (SQLiteDataReader dr = cmd.ExecuteReader()) |
|
455 |
dt.Load(dr); |
|
456 |
} |
|
457 |
connection.Close(); |
|
458 |
} |
|
459 |
catch (Exception ex) |
|
460 |
{ |
|
461 |
Log.Write(ex.Message + "\r\n" + ex.StackTrace); |
|
462 |
} |
|
463 |
finally |
|
518 |
connection.Open(); |
|
519 |
using (SQLiteCommand cmd = connection.CreateCommand()) |
|
464 | 520 |
{ |
465 |
connection.Dispose(); |
|
521 |
cmd.CommandText = "SELECT * FROM FluidCode;"; |
|
522 |
using (SQLiteDataReader dr = cmd.ExecuteReader()) |
|
523 |
dt.Load(dr); |
|
466 | 524 |
} |
525 |
connection.Close(); |
|
467 | 526 |
} |
468 |
} |
|
469 |
else if (id2Info.ID2DBType == ID2DB_Type.MSSQL) |
|
470 |
{ |
|
471 |
using (SqlConnection connection = GetSqlConnection()) |
|
527 |
catch (Exception ex) |
|
472 | 528 |
{ |
473 |
try |
|
474 |
{ |
|
475 |
if (connection != null && connection.State == ConnectionState.Open) |
|
476 |
{ |
|
477 |
using (SqlCommand cmd = connection.CreateCommand()) |
|
478 |
{ |
|
479 |
cmd.CommandText = "SELECT * FROM FluidCode;"; |
|
480 |
using (SqlDataReader dr = cmd.ExecuteReader()) |
|
481 |
dt.Load(dr); |
|
482 |
} |
|
483 |
connection.Close(); |
|
484 |
} |
|
485 |
} |
|
486 |
catch (Exception ex) |
|
487 |
{ |
|
488 |
Log.Write(ex.Message + "\r\n" + ex.StackTrace); |
|
489 |
} |
|
490 |
finally |
|
491 |
{ |
|
492 |
if (connection != null) |
|
493 |
connection.Dispose(); |
|
494 |
} |
|
529 |
Log.Write(ex.Message + "\r\n" + ex.StackTrace); |
|
530 |
} |
|
531 |
finally |
|
532 |
{ |
|
533 |
connection.Dispose(); |
|
495 | 534 |
} |
496 | 535 |
} |
497 | 536 | |
537 |
//if (id2Info.ID2DBType == ID2DB_Type.SQLite) |
|
538 |
//{ |
|
539 |
// using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", id2Info.DBFilePath), true)) |
|
540 |
// { |
|
541 |
// try |
|
542 |
// { |
|
543 |
// connection.Open(); |
|
544 |
// using (SQLiteCommand cmd = connection.CreateCommand()) |
|
545 |
// { |
|
546 |
// cmd.CommandText = "SELECT * FROM FluidCode;"; |
|
547 |
// using (SQLiteDataReader dr = cmd.ExecuteReader()) |
|
548 |
// dt.Load(dr); |
|
549 |
// } |
|
550 |
// connection.Close(); |
|
551 |
// } |
|
552 |
// catch (Exception ex) |
|
553 |
// { |
|
554 |
// Log.Write(ex.Message + "\r\n" + ex.StackTrace); |
|
555 |
// } |
|
556 |
// finally |
|
557 |
// { |
|
558 |
// connection.Dispose(); |
|
559 |
// } |
|
560 |
// } |
|
561 |
//} |
|
562 |
//else if (id2Info.ID2DBType == ID2DB_Type.MSSQL) |
|
563 |
//{ |
|
564 |
// using (SqlConnection connection = GetSqlConnection()) |
|
565 |
// { |
|
566 |
// try |
|
567 |
// { |
|
568 |
// if (connection != null && connection.State == ConnectionState.Open) |
|
569 |
// { |
|
570 |
// using (SqlCommand cmd = connection.CreateCommand()) |
|
571 |
// { |
|
572 |
// cmd.CommandText = "SELECT * FROM FluidCode;"; |
|
573 |
// using (SqlDataReader dr = cmd.ExecuteReader()) |
|
574 |
// dt.Load(dr); |
|
575 |
// } |
|
576 |
// connection.Close(); |
|
577 |
// } |
|
578 |
// } |
|
579 |
// catch (Exception ex) |
|
580 |
// { |
|
581 |
// Log.Write(ex.Message + "\r\n" + ex.StackTrace); |
|
582 |
// } |
|
583 |
// finally |
|
584 |
// { |
|
585 |
// if (connection != null) |
|
586 |
// connection.Dispose(); |
|
587 |
// } |
|
588 |
// } |
|
589 |
//} |
|
590 | ||
498 | 591 |
return dt; |
499 | 592 |
} |
500 | 593 | |
... | ... | |
502 | 595 |
{ |
503 | 596 |
DataTable dt = new DataTable(); |
504 | 597 |
ID2Info id2Info = ID2Info.GetInstance(); |
505 |
if (id2Info.ID2DBType == ID2DB_Type.SQLite) |
|
598 | ||
599 |
using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", id2Info.DBFilePath), true)) |
|
506 | 600 |
{ |
507 |
using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", id2Info.DBFilePath), true))
|
|
601 |
try
|
|
508 | 602 |
{ |
509 |
try |
|
510 |
{ |
|
511 |
connection.Open(); |
|
512 |
using (SQLiteCommand cmd = connection.CreateCommand()) |
|
513 |
{ |
|
514 |
cmd.CommandText = "SELECT * FROM PipingMaterialsClass;"; |
|
515 |
using (SQLiteDataReader dr = cmd.ExecuteReader()) |
|
516 |
dt.Load(dr); |
|
517 |
} |
|
518 |
connection.Close(); |
|
519 |
} |
|
520 |
catch (Exception ex) |
|
521 |
{ |
|
522 |
Log.Write(ex.Message + "\r\n" + ex.StackTrace); |
|
523 |
} |
|
524 |
finally |
|
603 |
connection.Open(); |
|
604 |
using (SQLiteCommand cmd = connection.CreateCommand()) |
|
525 | 605 |
{ |
526 |
connection.Dispose(); |
|
606 |
cmd.CommandText = "SELECT * FROM PipingMaterialsClass;"; |
|
607 |
using (SQLiteDataReader dr = cmd.ExecuteReader()) |
|
608 |
dt.Load(dr); |
|
527 | 609 |
} |
610 |
connection.Close(); |
|
528 | 611 |
} |
529 |
} |
|
530 |
else if (id2Info.ID2DBType == ID2DB_Type.MSSQL) |
|
531 |
{ |
|
532 |
using (SqlConnection connection = GetSqlConnection()) |
|
612 |
catch (Exception ex) |
|
533 | 613 |
{ |
534 |
try |
|
535 |
{ |
|
536 |
if (connection != null && connection.State == ConnectionState.Open) |
|
537 |
{ |
|
538 |
using (SqlCommand cmd = connection.CreateCommand()) |
|
539 |
{ |
|
540 |
cmd.CommandText = "SELECT * FROM PipingMaterialsClass;"; |
|
541 |
using (SqlDataReader dr = cmd.ExecuteReader()) |
|
542 |
dt.Load(dr); |
|
543 |
} |
|
544 |
connection.Close(); |
|
545 |
} |
|
546 |
} |
|
547 |
catch (Exception ex) |
|
548 |
{ |
|
549 |
Log.Write(ex.Message + "\r\n" + ex.StackTrace); |
|
550 |
} |
|
551 |
finally |
|
552 |
{ |
|
553 |
if (connection != null) |
|
554 |
connection.Dispose(); |
|
555 |
} |
|
614 |
Log.Write(ex.Message + "\r\n" + ex.StackTrace); |
|
615 |
} |
|
616 |
finally |
|
617 |
{ |
|
618 |
connection.Dispose(); |
|
556 | 619 |
} |
557 | 620 |
} |
558 | 621 | |
622 |
//if (id2Info.ID2DBType == ID2DB_Type.SQLite) |
|
623 |
//{ |
|
624 |
// using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", id2Info.DBFilePath), true)) |
|
625 |
// { |
|
626 |
// try |
|
627 |
// { |
|
628 |
// connection.Open(); |
|
629 |
// using (SQLiteCommand cmd = connection.CreateCommand()) |
|
630 |
// { |
|
631 |
// cmd.CommandText = "SELECT * FROM PipingMaterialsClass;"; |
|
632 |
// using (SQLiteDataReader dr = cmd.ExecuteReader()) |
|
633 |
// dt.Load(dr); |
|
634 |
// } |
|
635 |
// connection.Close(); |
|
636 |
// } |
|
637 |
// catch (Exception ex) |
|
638 |
// { |
|
639 |
// Log.Write(ex.Message + "\r\n" + ex.StackTrace); |
|
640 |
// } |
|
641 |
// finally |
|
642 |
// { |
|
643 |
// connection.Dispose(); |
|
644 |
// } |
|
645 |
// } |
|
646 |
//} |
|
647 |
//else if (id2Info.ID2DBType == ID2DB_Type.MSSQL) |
|
648 |
//{ |
|
649 |
// using (SqlConnection connection = GetSqlConnection()) |
|
650 |
// { |
|
651 |
// try |
|
652 |
// { |
|
653 |
// if (connection != null && connection.State == ConnectionState.Open) |
|
654 |
// { |
|
655 |
// using (SqlCommand cmd = connection.CreateCommand()) |
|
656 |
// { |
|
657 |
// cmd.CommandText = "SELECT * FROM PipingMaterialsClass;"; |
|
658 |
// using (SqlDataReader dr = cmd.ExecuteReader()) |
|
659 |
// dt.Load(dr); |
|
660 |
// } |
|
661 |
// connection.Close(); |
|
662 |
// } |
|
663 |
// } |
|
664 |
// catch (Exception ex) |
|
665 |
// { |
|
666 |
// Log.Write(ex.Message + "\r\n" + ex.StackTrace); |
|
667 |
// } |
|
668 |
// finally |
|
669 |
// { |
|
670 |
// if (connection != null) |
|
671 |
// connection.Dispose(); |
|
672 |
// } |
|
673 |
// } |
|
674 |
//} |
|
675 | ||
559 | 676 |
return dt; |
560 | 677 |
} |
561 | 678 | |
... | ... | |
563 | 680 |
{ |
564 | 681 |
DataTable dt = new DataTable(); |
565 | 682 |
ID2Info id2Info = ID2Info.GetInstance(); |
566 |
if (id2Info.ID2DBType == ID2DB_Type.SQLite) |
|
683 | ||
684 |
using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", id2Info.DBFilePath), true)) |
|
567 | 685 |
{ |
568 |
using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", id2Info.DBFilePath), true))
|
|
686 |
try
|
|
569 | 687 |
{ |
570 |
try |
|
571 |
{ |
|
572 |
connection.Open(); |
|
573 |
using (SQLiteCommand cmd = connection.CreateCommand()) |
|
574 |
{ |
|
575 |
cmd.CommandText = string.Format("SELECT * FROM {0}", PSN_PIPINGMATLCLASS); |
|
576 |
using (SQLiteDataReader dr = cmd.ExecuteReader()) |
|
577 |
dt.Load(dr); |
|
578 |
} |
|
579 |
connection.Close(); |
|
580 |
} |
|
581 |
catch (Exception ex) |
|
582 |
{ |
|
583 |
Log.Write(ex.Message + "\r\n" + ex.StackTrace); |
|
584 |
} |
|
585 |
finally |
|
688 |
connection.Open(); |
|
689 |
using (SQLiteCommand cmd = connection.CreateCommand()) |
|
586 | 690 |
{ |
587 |
connection.Dispose(); |
|
691 |
cmd.CommandText = string.Format("SELECT * FROM {0}", PSN_PIPINGMATLCLASS); |
|
692 |
using (SQLiteDataReader dr = cmd.ExecuteReader()) |
|
693 |
dt.Load(dr); |
|
588 | 694 |
} |
695 |
connection.Close(); |
|
589 | 696 |
} |
590 |
} |
|
591 |
else if (id2Info.ID2DBType == ID2DB_Type.MSSQL) |
|
592 |
{ |
|
593 |
using (SqlConnection connection = GetSqlConnection()) |
|
697 |
catch (Exception ex) |
|
594 | 698 |
{ |
595 |
try |
|
596 |
{ |
|
597 |
if (connection != null && connection.State == ConnectionState.Open) |
|
598 |
{ |
|
599 |
using (SqlCommand cmd = connection.CreateCommand()) |
|
600 |
{ |
|
601 |
cmd.CommandText = string.Format("SELECT * FROM {0}", PSN_PIPINGMATLCLASS); |
|
602 |
using (SqlDataReader dr = cmd.ExecuteReader()) |
|
603 |
dt.Load(dr); |
|
604 |
} |
|
605 |
connection.Close(); |
|
606 |
} |
|
607 |
} |
|
608 |
catch (Exception ex) |
|
609 |
{ |
|
610 |
Log.Write(ex.Message + "\r\n" + ex.StackTrace); |
|
611 |
} |
|
612 |
finally |
|
613 |
{ |
|
614 |
if (connection != null) |
|
615 |
connection.Dispose(); |
|
616 |
} |
|
699 |
Log.Write(ex.Message + "\r\n" + ex.StackTrace); |
|
700 |
} |
|
701 |
finally |
|
702 |
{ |
|
703 |
connection.Dispose(); |
|
617 | 704 |
} |
618 | 705 |
} |
619 | 706 | |
707 |
//if (id2Info.ID2DBType == ID2DB_Type.SQLite) |
|
708 |
//{ |
|
709 |
// using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", id2Info.DBFilePath), true)) |
|
710 |
// { |
|
711 |
// try |
|
712 |
// { |
|
713 |
// connection.Open(); |
|
714 |
// using (SQLiteCommand cmd = connection.CreateCommand()) |
|
715 |
// { |
|
716 |
// cmd.CommandText = string.Format("SELECT * FROM {0}", PSN_PIPINGMATLCLASS); |
|
717 |
// using (SQLiteDataReader dr = cmd.ExecuteReader()) |
|
718 |
// dt.Load(dr); |
|
719 |
// } |
|
720 |
// connection.Close(); |
|
721 |
// } |
|
722 |
// catch (Exception ex) |
|
723 |
// { |
|
724 |
// Log.Write(ex.Message + "\r\n" + ex.StackTrace); |
|
725 |
// } |
|
726 |
// finally |
|
727 |
// { |
|
728 |
// connection.Dispose(); |
|
729 |
// } |
|
730 |
// } |
|
731 |
//} |
|
732 |
//else if (id2Info.ID2DBType == ID2DB_Type.MSSQL) |
|
733 |
//{ |
|
734 |
// using (SqlConnection connection = GetSqlConnection()) |
|
735 |
// { |
|
736 |
// try |
|
737 |
// { |
|
738 |
// if (connection != null && connection.State == ConnectionState.Open) |
|
739 |
// { |
|
740 |
// using (SqlCommand cmd = connection.CreateCommand()) |
|
741 |
// { |
|
742 |
// cmd.CommandText = string.Format("SELECT * FROM {0}", PSN_PIPINGMATLCLASS); |
|
743 |
// using (SqlDataReader dr = cmd.ExecuteReader()) |
|
744 |
// dt.Load(dr); |
|
745 |
// } |
|
746 |
// connection.Close(); |
|
747 |
// } |
|
748 |
// } |
|
749 |
// catch (Exception ex) |
|
750 |
// { |
|
751 |
// Log.Write(ex.Message + "\r\n" + ex.StackTrace); |
|
752 |
// } |
|
753 |
// finally |
|
754 |
// { |
|
755 |
// if (connection != null) |
|
756 |
// connection.Dispose(); |
|
757 |
// } |
|
758 |
// } |
|
759 |
//} |
|
760 | ||
620 | 761 |
return dt; |
621 | 762 |
} |
622 | 763 | |
... | ... | |
624 | 765 |
{ |
625 | 766 |
DataTable dt = new DataTable(); |
626 | 767 |
ID2Info id2Info = ID2Info.GetInstance(); |
627 |
if (id2Info.ID2DBType == ID2DB_Type.SQLite) |
|
628 |
{ |
|
629 |
using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", id2Info.DBFilePath), true)) |
|
630 |
{ |
|
631 |
try |
|
632 |
{ |
|
633 |
connection.Open(); |
|
634 |
using (SQLiteCommand cmd = connection.CreateCommand()) |
|
635 |
{ |
|
636 |
cmd.CommandText = "SELECT * FROM NominalDiameter ORDER BY Metric DESC;"; |
|
637 |
using (SQLiteDataReader dr = cmd.ExecuteReader()) |
|
638 |
dt.Load(dr); |
|
639 |
} |
|
640 |
connection.Close(); |
|
641 |
} |
|
642 |
catch (Exception ex) |
|
643 |
{ |
|
644 |
Log.Write(ex.Message + "\r\n" + ex.StackTrace); |
|
645 |
} |
|
646 |
finally |
|
647 |
{ |
|
648 |
connection.Dispose(); |
|
649 |
} |
|
650 |
} |
|
651 |
} |
|
652 |
else if (id2Info.ID2DBType == ID2DB_Type.MSSQL) |
|
768 | ||
769 |
using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", id2Info.DBFilePath), true)) |
|
653 | 770 |
{ |
654 |
using (SqlConnection connection = GetSqlConnection()) |
|
655 |
{ |
|
656 |
try |
|
657 |
{ |
|
658 |
if (connection != null && connection.State == ConnectionState.Open) |
|
659 |
{ |
|
660 |
using (SqlCommand cmd = connection.CreateCommand()) |
|
661 |
{ |
|
662 |
cmd.CommandText = "SELECT * FROM NominalDiameter ORDER BY Metric DESC;"; |
|
663 |
using (SqlDataReader dr = cmd.ExecuteReader()) |
|
664 |
dt.Load(dr); |
|
665 |
} |
|
666 |
connection.Close(); |
|
667 |
} |
|
668 |
} |
|
669 |
catch (Exception ex) |
|
670 |
{ |
|
671 |
Log.Write(ex.Message + "\r\n" + ex.StackTrace); |
|
672 |
} |
|
673 |
finally |
|
771 |
try |
|
772 |
{ |
|
773 |
connection.Open(); |
|
774 |
using (SQLiteCommand cmd = connection.CreateCommand()) |
|
674 | 775 |
{ |
675 |
if (connection != null) |
|
676 |
connection.Dispose(); |
|
776 |
cmd.CommandText = "SELECT * FROM NominalDiameter ORDER BY Metric DESC;"; |
|
777 |
using (SQLiteDataReader dr = cmd.ExecuteReader()) |
|
778 |
dt.Load(dr); |
|
677 | 779 |
} |
780 |
connection.Close(); |
|
781 |
} |
|
782 |
catch (Exception ex) |
|
783 |
{ |
|
784 |
Log.Write(ex.Message + "\r\n" + ex.StackTrace); |
|
785 |
} |
|
786 |
finally |
|
787 |
{ |
|
788 |
connection.Dispose(); |
|
678 | 789 |
} |
679 | 790 |
} |
680 | 791 | |
792 |
//if (id2Info.ID2DBType == ID2DB_Type.SQLite) |
|
793 |
//{ |
|
794 |
// using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", id2Info.DBFilePath), true)) |
|
795 |
// { |
|
796 |
// try |
|
797 |
// { |
|
798 |
// connection.Open(); |
|
799 |
// using (SQLiteCommand cmd = connection.CreateCommand()) |
|
800 |
// { |
|
801 |
// cmd.CommandText = "SELECT * FROM NominalDiameter ORDER BY Metric DESC;"; |
|
802 |
// using (SQLiteDataReader dr = cmd.ExecuteReader()) |
|
803 |
// dt.Load(dr); |
|
804 |
// } |
|
805 |
// connection.Close(); |
|
806 |
// } |
|
807 |
// catch (Exception ex) |
|
808 |
// { |
|
809 |
// Log.Write(ex.Message + "\r\n" + ex.StackTrace); |
|
810 |
// } |
|
811 |
// finally |
|
812 |
// { |
|
813 |
// connection.Dispose(); |
|
814 |
// } |
|
815 |
// } |
|
816 |
//} |
|
817 |
//else if (id2Info.ID2DBType == ID2DB_Type.MSSQL) |
|
818 |
//{ |
|
819 |
// using (SqlConnection connection = GetSqlConnection()) |
|
820 |
// { |
|
821 |
// try |
|
822 |
// { |
|
823 |
// if (connection != null && connection.State == ConnectionState.Open) |
|
824 |
// { |
|
825 |
// using (SqlCommand cmd = connection.CreateCommand()) |
|
826 |
// { |
|
827 |
// cmd.CommandText = "SELECT * FROM NominalDiameter ORDER BY Metric DESC;"; |
|
828 |
// using (SqlDataReader dr = cmd.ExecuteReader()) |
|
829 |
// dt.Load(dr); |
|
830 |
// } |
|
831 |
// connection.Close(); |
|
832 |
// } |
|
833 |
// } |
|
834 |
// catch (Exception ex) |
|
835 |
// { |
|
836 |
// Log.Write(ex.Message + "\r\n" + ex.StackTrace); |
|
837 |
// } |
|
838 |
// finally |
|
839 |
// { |
|
840 |
// if (connection != null) |
|
841 |
// connection.Dispose(); |
|
842 |
// } |
|
843 |
// } |
|
844 |
//} |
|
845 | ||
681 | 846 |
dt.Rows.RemoveAt(0); |
682 | 847 |
dt.Rows.RemoveAt(0); |
683 | 848 |
dt.Rows.RemoveAt(0); |
... | ... | |
690 | 855 |
{ |
691 | 856 |
DataTable dt = new DataTable(); |
692 | 857 |
ID2Info id2Info = ID2Info.GetInstance(); |
693 |
if(id2Info.ID2DBType == ID2DB_Type.SQLite) |
|
858 | ||
859 |
using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", id2Info.DBFilePath), true)) |
|
694 | 860 |
{ |
695 |
using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", id2Info.DBFilePath), true))
|
|
861 |
try
|
|
696 | 862 |
{ |
697 |
try |
|
698 |
{ |
|
699 |
connection.Open(); |
|
700 |
using (SQLiteCommand cmd = connection.CreateCommand()) |
|
701 |
{ |
|
702 |
cmd.CommandText = "SELECT DISTINCT Attribute, DisplayAttribute FROM SymbolAttribute;"; |
|
703 |
using (SQLiteDataReader dr = cmd.ExecuteReader()) |
|
704 |
dt.Load(dr); |
|
705 |
} |
|
706 |
connection.Close(); |
|
707 |
} |
|
708 |
catch (Exception ex) |
|
709 |
{ |
|
710 |
Log.Write(ex.Message + "\r\n" + ex.StackTrace); |
|
711 |
} |
|
712 |
finally |
|
863 |
connection.Open(); |
|
864 |
using (SQLiteCommand cmd = connection.CreateCommand()) |
|
713 | 865 |
{ |
714 |
connection.Dispose(); |
|
866 |
//cmd.CommandText = "SELECT DISTINCT Attribute, DisplayAttribute FROM SymbolAttribute;"; |
|
867 |
cmd.CommandText = "SELECT DISTINCT Attribute, DisplayAttribute FROM SymbolAttribute;"; |
|
868 |
using (SQLiteDataReader dr = cmd.ExecuteReader()) |
|
869 |
dt.Load(dr); |
|
715 | 870 |
} |
871 |
connection.Close(); |
|
716 | 872 |
} |
717 |
} |
|
718 |
else if (id2Info.ID2DBType == ID2DB_Type.MSSQL) |
|
719 |
{ |
|
720 |
using (SqlConnection connection = GetSqlConnection()) |
|
873 |
catch (Exception ex) |
|
721 | 874 |
{ |
722 |
try |
|
723 |
{ |
|
724 |
if (connection != null && connection.State == ConnectionState.Open) |
|
725 |
{ |
|
726 |
using (SqlCommand cmd = connection.CreateCommand()) |
|
727 |
{ |
|
728 |
cmd.CommandText = "SELECT DISTINCT Attribute, DisplayAttribute FROM SymbolAttribute;"; |
|
729 |
using (SqlDataReader dr = cmd.ExecuteReader()) |
|
730 |
dt.Load(dr); |
|
731 |
} |
|
732 |
connection.Close(); |
|
733 |
} |
|
734 |
} |
|
735 |
catch (Exception ex) |
|
736 |
{ |
|
737 |
Log.Write(ex.Message + "\r\n" + ex.StackTrace); |
|
738 |
} |
|
739 |
finally |
|
740 |
{ |
|
741 |
if (connection != null) |
|
742 |
connection.Dispose(); |
|
743 |
} |
|
875 |
Log.Write(ex.Message + "\r\n" + ex.StackTrace); |
|
876 |
} |
|
877 |
finally |
|
878 |
{ |
|
879 |
connection.Dispose(); |
|
744 | 880 |
} |
745 | 881 |
} |
882 | ||
883 |
//if (id2Info.ID2DBType == ID2DB_Type.SQLite) |
|
884 |
//{ |
|
885 |
// using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", id2Info.DBFilePath), true)) |
|
886 |
// { |
|
887 |
// try |
|
888 |
// { |
|
889 |
// connection.Open(); |
|
890 |
// using (SQLiteCommand cmd = connection.CreateCommand()) |
|
891 |
// { |
|
892 |
// //cmd.CommandText = "SELECT DISTINCT Attribute, DisplayAttribute FROM SymbolAttribute;"; |
|
893 |
// cmd.CommandText = "SELECT DISTINCT Attribute, DisplayAttribute FROM SymbolAttribute;"; |
|
894 |
// using (SQLiteDataReader dr = cmd.ExecuteReader()) |
|
895 |
// dt.Load(dr); |
|
896 |
// } |
|
897 |
// connection.Close(); |
|
898 |
// } |
|
899 |
// catch (Exception ex) |
|
900 |
// { |
|
901 |
// Log.Write(ex.Message + "\r\n" + ex.StackTrace); |
|
902 |
// } |
|
903 |
// finally |
|
904 |
// { |
|
905 |
// connection.Dispose(); |
|
906 |
// } |
|
907 |
// } |
|
908 |
//} |
|
909 |
//else if (id2Info.ID2DBType == ID2DB_Type.MSSQL) |
|
910 |
//{ |
|
911 |
// using (SqlConnection connection = GetSqlConnection()) |
|
912 |
// { |
|
913 |
// try |
|
914 |
// { |
|
915 |
// if (connection != null && connection.State == ConnectionState.Open) |
|
916 |
// { |
|
917 |
// using (SqlCommand cmd = connection.CreateCommand()) |
|
918 |
// { |
|
919 |
// //"SELECT DISTINCT Attribute, DisplayAttribute FROM SymbolAttribute;"; //DisplayAttribute-> 제거 mssql에서 안됨 |
|
920 |
// cmd.CommandText = "SELECT DISTINCT Attribute FROM SymbolAttribute;"; |
|
921 |
// using (SqlDataReader dr = cmd.ExecuteReader()) |
|
922 |
// dt.Load(dr); |
|
923 |
// } |
|
924 |
// connection.Close(); |
|
925 |
// } |
|
926 |
// } |
|
927 |
// catch (Exception ex) |
|
928 |
// { |
|
929 |
// Log.Write(ex.Message + "\r\n" + ex.StackTrace); |
|
930 |
// } |
|
931 |
// finally |
|
932 |
// { |
|
933 |
// if (connection != null) |
|
934 |
// connection.Dispose(); |
|
935 |
// } |
|
936 |
// } |
|
937 |
//} |
|
746 | 938 |
return dt; |
747 | 939 |
} |
748 | 940 | |
... | ... | |
750 | 942 |
{ |
751 | 943 |
DataTable dt = new DataTable(); |
752 | 944 |
ID2Info id2Info = ID2Info.GetInstance(); |
753 |
if (id2Info.ID2DBType == ID2DB_Type.SQLite) |
|
945 | ||
946 |
using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", id2Info.DBFilePath), true)) |
|
754 | 947 |
{ |
755 |
using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", id2Info.DBFilePath), true))
|
|
948 |
try
|
|
756 | 949 |
{ |
757 |
try |
|
758 |
{ |
|
759 |
connection.Open(); |
|
760 |
using (SQLiteCommand cmd = connection.CreateCommand()) |
|
761 |
{ |
|
762 |
cmd.CommandText = "SELECT * FROM SymbolName;"; |
|
763 |
using (SQLiteDataReader dr = cmd.ExecuteReader()) |
|
764 |
dt.Load(dr); |
|
765 |
} |
|
766 |
connection.Close(); |
|
767 |
} |
|
768 |
catch (Exception ex) |
|
769 |
{ |
|
770 |
Log.Write(ex.Message + "\r\n" + ex.StackTrace); |
|
771 |
} |
|
772 |
finally |
|
950 |
connection.Open(); |
|
951 |
using (SQLiteCommand cmd = connection.CreateCommand()) |
|
773 | 952 |
{ |
774 |
connection.Dispose(); |
|
953 |
cmd.CommandText = "SELECT * FROM SymbolName;"; |
|
954 |
using (SQLiteDataReader dr = cmd.ExecuteReader()) |
|
955 |
dt.Load(dr); |
|
775 | 956 |
} |
957 |
connection.Close(); |
|
776 | 958 |
} |
777 |
} |
|
778 |
else if (id2Info.ID2DBType == ID2DB_Type.MSSQL) |
|
779 |
{ |
|
780 |
using (SqlConnection connection = GetSqlConnection()) |
|
959 |
catch (Exception ex) |
|
781 | 960 |
{ |
782 |
try |
|
783 |
{ |
|
784 |
if (connection != null && connection.State == ConnectionState.Open) |
|
785 |
{ |
|
786 |
using (SqlCommand cmd = connection.CreateCommand()) |
|
787 |
{ |
|
788 |
cmd.CommandText = "SELECT * FROM SymbolName;"; |
|
789 |
using (SqlDataReader dr = cmd.ExecuteReader()) |
|
790 |
dt.Load(dr); |
|
791 |
} |
|
792 |
connection.Close(); |
|
793 |
} |
|
794 |
} |
|
795 |
catch (Exception ex) |
|
796 |
{ |
|
797 |
Log.Write(ex.Message + "\r\n" + ex.StackTrace); |
|
798 |
} |
|
799 |
finally |
|
800 |
{ |
|
801 |
if (connection != null) |
|
802 |
connection.Dispose(); |
|
803 |
} |
|
961 |
Log.Write(ex.Message + "\r\n" + ex.StackTrace); |
|
962 |
} |
|
963 |
finally |
|
964 |
{ |
|
965 |
connection.Dispose(); |
|
804 | 966 |
} |
805 | 967 |
} |
968 | ||
969 |
//if (id2Info.ID2DBType == ID2DB_Type.SQLite) |
|
970 |
//{ |
|
971 |
// using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", id2Info.DBFilePath), true)) |
|
972 |
// { |
|
973 |
// try |
|
974 |
// { |
|
975 |
// connection.Open(); |
|
976 |
// using (SQLiteCommand cmd = connection.CreateCommand()) |
|
977 |
// { |
|
978 |
// cmd.CommandText = "SELECT * FROM SymbolName;"; |
|
979 |
// using (SQLiteDataReader dr = cmd.ExecuteReader()) |
|
980 |
// dt.Load(dr); |
|
981 |
// } |
|
982 |
// connection.Close(); |
|
983 |
// } |
|
984 |
// catch (Exception ex) |
|
985 |
// { |
|
986 |
// Log.Write(ex.Message + "\r\n" + ex.StackTrace); |
|
987 |
// } |
|
988 |
// finally |
|
989 |
// { |
|
990 |
// connection.Dispose(); |
|
991 |
// } |
|
992 |
// } |
|
993 |
//} |
|
994 |
//else if (id2Info.ID2DBType == ID2DB_Type.MSSQL) |
|
995 |
//{ |
|
996 |
// using (SqlConnection connection = GetSqlConnection()) |
|
997 |
// { |
|
998 |
// try |
|
999 |
// { |
|
1000 |
// if (connection != null && connection.State == ConnectionState.Open) |
|
1001 |
// { |
|
1002 |
// using (SqlCommand cmd = connection.CreateCommand()) |
|
1003 |
// { |
|
1004 |
// cmd.CommandText = "SELECT * FROM SymbolName;"; |
|
1005 |
// using (SqlDataReader dr = cmd.ExecuteReader()) |
|
1006 |
// dt.Load(dr); |
|
1007 |
// } |
|
1008 |
// connection.Close(); |
|
1009 |
// } |
|
1010 |
// } |
|
1011 |
// catch (Exception ex) |
|
1012 |
// { |
|
1013 |
// Log.Write(ex.Message + "\r\n" + ex.StackTrace); |
|
1014 |
// } |
|
1015 |
// finally |
|
1016 |
// { |
|
1017 |
// if (connection != null) |
|
1018 |
// connection.Dispose(); |
|
1019 |
// } |
|
1020 |
// } |
|
1021 |
//} |
|
806 | 1022 |
return dt; |
807 | 1023 |
} |
808 | 1024 | |
... | ... | |
812 | 1028 | |
813 | 1029 |
DataTable dt = new DataTable(); |
814 | 1030 |
ID2Info id2Info = ID2Info.GetInstance(); |
815 |
if (id2Info.ID2DBType == ID2DB_Type.SQLite) |
|
1031 | ||
1032 |
using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", id2Info.DBFilePath), true)) |
|
816 | 1033 |
{ |
817 |
using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", id2Info.DBFilePath), true))
|
|
1034 |
try
|
|
818 | 1035 |
{ |
819 |
try |
|
1036 |
connection.Open(); |
|
1037 |
using (SQLiteCommand cmd = connection.CreateCommand()) |
|
820 | 1038 |
{ |
821 |
connection.Open(); |
|
822 |
using (SQLiteCommand cmd = connection.CreateCommand()) |
|
823 |
{ |
|
824 |
cmd.CommandText = "SELECT value FROM Configuration WHERE Section = 'Area' AND Key = 'Drawing';"; |
|
825 |
using (SQLiteDataReader dr = cmd.ExecuteReader()) |
|
826 |
dt.Load(dr); |
|
1039 |
cmd.CommandText = "SELECT value FROM Configuration WHERE Section = 'Area' AND Key = 'Drawing';"; |
|
1040 |
using (SQLiteDataReader dr = cmd.ExecuteReader()) |
|
1041 |
dt.Load(dr); |
|
827 | 1042 | |
828 |
if (dt.Rows.Count == 1)
|
|
829 |
{
|
|
830 |
string value = dt.Rows[0][0].ToString();
|
|
831 |
string[] split = value.Split(new char[] { ',' });
|
|
832 |
result = new double[] {
|
|
1043 |
if (dt.Rows.Count == 1) |
|
1044 |
{ |
|
1045 |
string value = dt.Rows[0][0].ToString(); |
|
1046 |
string[] split = value.Split(new char[] { ',' }); |
|
1047 |
result = new double[] { |
|
833 | 1048 |
Convert.ToDouble(Regex.Replace(split[0], @"[^0-9]", "")), |
834 | 1049 |
Convert.ToDouble(Regex.Replace(split[1], @"[^0-9]", "")), |
835 | 1050 |
Convert.ToDouble(Regex.Replace(split[2], @"[^0-9]", "")), |
836 | 1051 |
Convert.ToDouble(Regex.Replace(split[3], @"[^0-9]", "")) |
837 | 1052 |
}; |
838 |
result = new double[] {
|
|
1053 |
result = new double[] { |
|
839 | 1054 |
Math.Min(result[0], result[2]), |
840 | 1055 |
Math.Min(result[1], result[3]), |
841 | 1056 |
Math.Max(result[0], result[2]), |
842 | 1057 |
Math.Max(result[1], result[3]) |
843 | 1058 |
}; |
844 |
} |
|
845 | 1059 |
} |
내보내기 Unified diff