개정판 e88aae98
dev issue #1134 : SPPID Attribute 목록들을 사용자에게 보여주고 선택가능하게 수정.
Change-Id: Ic7d15ede6c81932abb6575f85668ab134225e610
DTI_PID/SPPIDConverter/DB/SPPID_DB.cs | ||
---|---|---|
299 | 299 |
return TemplatePath; |
300 | 300 |
} |
301 | 301 |
|
302 |
public static List<string> GetSPPIDAttribute()
|
|
302 |
public static DataTable GetSPPIDAttribute()
|
|
303 | 303 |
{ |
304 | 304 |
List<string> attributes = new List<string>(); |
305 | 305 |
SPPID_DBInfo dbInfo = SPPID_DBInfo.GetInstance(); |
306 |
DataTable dt = null; |
|
306 | 307 |
try |
307 | 308 |
{ |
308 | 309 |
if (dbInfo.DBType == "ORACLE") |
... | ... | |
315 | 316 |
conn.Open(); |
316 | 317 |
if (conn.State == System.Data.ConnectionState.Open) |
317 | 318 |
{ |
318 |
using (OracleCommand cmd = new OracleCommand()) |
|
319 |
string sQuery = string.Format(CultureInfo.CurrentCulture, |
|
320 |
@"SELECT DISTINCT(ATTR.displayname), ATTR.name FROM {0}.itemattributions ATTR |
|
321 |
ORDER BY ATTR.displayname ASC", dbInfo.PlantPIDDic); |
|
322 |
using (OracleCommand cmd = new OracleCommand(sQuery, conn)) |
|
323 |
using (OracleDataAdapter adapter = new OracleDataAdapter()) |
|
319 | 324 |
{ |
320 |
cmd.Connection = conn; |
|
321 |
|
|
322 |
// 정리 필요 |
|
323 |
cmd.CommandText = string.Format(CultureInfo.CurrentCulture, "SELECT * FROM {0}.{1}", dbInfo.PlantPID, "T_EQUIPMENT"); |
|
324 |
using (OracleDataReader reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly)) |
|
325 |
{ |
|
326 |
DataTable dt = reader.GetSchemaTable(); |
|
327 |
foreach (DataRow row in dt.Rows) |
|
328 |
attributes.Add(row["ColumnName"].ToString()); |
|
329 |
} |
|
330 |
|
|
331 |
cmd.CommandText = string.Format(CultureInfo.CurrentCulture, "SELECT * FROM {0}.{1}", dbInfo.PlantPID, "T_NOZZLE"); |
|
332 |
using (OracleDataReader reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly)) |
|
333 |
{ |
|
334 |
DataTable dt = reader.GetSchemaTable(); |
|
335 |
foreach (DataRow row in dt.Rows) |
|
336 |
attributes.Add(row["ColumnName"].ToString()); |
|
337 |
} |
|
338 |
|
|
339 |
cmd.CommandText = string.Format(CultureInfo.CurrentCulture, "SELECT * FROM {0}.{1}", dbInfo.PlantPID, "T_PIPINGCOMP"); |
|
340 |
using (OracleDataReader reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly)) |
|
341 |
{ |
|
342 |
DataTable dt = reader.GetSchemaTable(); |
|
343 |
foreach (DataRow row in dt.Rows) |
|
344 |
attributes.Add(row["ColumnName"].ToString()); |
|
345 |
} |
|
346 |
|
|
347 |
cmd.CommandText = string.Format(CultureInfo.CurrentCulture, "SELECT * FROM {0}.{1}", dbInfo.PlantPID, "T_PIPERUN"); |
|
348 |
using (OracleDataReader reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly)) |
|
349 |
{ |
|
350 |
|
|
351 |
DataTable dt = reader.GetSchemaTable(); |
|
352 |
foreach (DataRow row in dt.Rows) |
|
353 |
attributes.Add(row["ColumnName"].ToString()); |
|
354 |
} |
|
355 |
|
|
356 |
cmd.CommandText = string.Format(CultureInfo.CurrentCulture, "SELECT * FROM {0}.{1}", dbInfo.PlantPID, "T_INSTRUMENT"); |
|
357 |
using (OracleDataReader reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly)) |
|
358 |
{ |
|
359 |
DataTable dt = reader.GetSchemaTable(); |
|
360 |
foreach (DataRow row in dt.Rows) |
|
361 |
attributes.Add(row["ColumnName"].ToString()); |
|
362 |
} |
|
363 |
|
|
364 |
cmd.CommandText = string.Format(CultureInfo.CurrentCulture, "SELECT * FROM {0}.{1}", dbInfo.PlantPID, "T_INLINECOMP"); |
|
365 |
using (OracleDataReader reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly)) |
|
366 |
{ |
|
367 |
DataTable dt = reader.GetSchemaTable(); |
|
368 |
foreach (DataRow row in dt.Rows) |
|
369 |
attributes.Add(row["ColumnName"].ToString()); |
|
370 |
} |
|
371 |
|
|
372 |
cmd.CommandText = string.Format(CultureInfo.CurrentCulture, "SELECT * FROM {0}.{1}", dbInfo.PlantPID, "T_VESSEL"); |
|
373 |
using (OracleDataReader reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly)) |
|
374 |
{ |
|
375 |
DataTable dt = reader.GetSchemaTable(); |
|
376 |
foreach (DataRow row in dt.Rows) |
|
377 |
attributes.Add(row["ColumnName"].ToString()); |
|
378 |
} |
|
379 |
|
|
380 |
cmd.CommandText = string.Format(CultureInfo.CurrentCulture, "SELECT * FROM {0}.{1}", dbInfo.PlantPID, "T_EXCHANGER"); |
|
381 |
using (OracleDataReader reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly)) |
|
382 |
{ |
|
383 |
DataTable dt = reader.GetSchemaTable(); |
|
384 |
foreach (DataRow row in dt.Rows) |
|
385 |
attributes.Add(row["ColumnName"].ToString()); |
|
386 |
} |
|
387 |
|
|
388 |
cmd.CommandText = string.Format(CultureInfo.CurrentCulture, "SELECT * FROM {0}.{1}", dbInfo.PlantPID, "T_MECHANICAL"); |
|
389 |
using (OracleDataReader reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly)) |
|
390 |
{ |
|
391 |
DataTable dt = reader.GetSchemaTable(); |
|
392 |
foreach (DataRow row in dt.Rows) |
|
393 |
attributes.Add(row["ColumnName"].ToString()); |
|
394 |
} |
|
395 |
|
|
396 |
cmd.CommandText = string.Format(CultureInfo.CurrentCulture, "SELECT * FROM {0}.{1}", dbInfo.PlantPID, "T_EQUIPCOMPONENT"); |
|
397 |
using (OracleDataReader reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly)) |
|
398 |
{ |
|
399 |
DataTable dt = reader.GetSchemaTable(); |
|
400 |
foreach (DataRow row in dt.Rows) |
|
401 |
attributes.Add(row["ColumnName"].ToString()); |
|
402 |
} |
|
403 |
|
|
325 |
adapter.SelectCommand = cmd; |
|
326 |
dt = new DataTable(); |
|
327 |
adapter.Fill(dt); |
|
404 | 328 |
} |
405 | 329 |
} |
406 | 330 |
} |
... | ... | |
415 | 339 |
System.Windows.Forms.MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); |
416 | 340 |
} |
417 | 341 |
|
418 |
|
|
419 |
|
|
420 |
return attributes.Distinct().ToList(); |
|
342 |
return dt; |
|
421 | 343 |
} |
422 | 344 |
} |
423 | 345 |
} |
내보내기 Unified diff