개정판 224535bb
dev issue #569 : PDF To Image 변환툴 여러 파일 가능하게 수정 / OPC 작업을 위한 Drawing 정보 정리
Change-Id: I62beba4afda9acbeab9bfb5ace94ca221673c584
DTI_PID/SPPIDConverter/DB/Project_DB.cs | ||
---|---|---|
6 | 6 |
using System.Globalization; |
7 | 7 |
using System.Data.SQLite; |
8 | 8 |
using System.Data; |
9 |
using Newtonsoft.Json; |
|
9 | 10 |
|
10 | 11 |
namespace Converter.BaseModel |
11 | 12 |
{ |
... | ... | |
218 | 219 |
} |
219 | 220 |
if (dt.Select(string.Format("NAME = '{0}'", SPPID_DRAWING_INFO)).Length == 0) |
220 | 221 |
{ |
221 |
cmd.CommandText = string.Format("CREATE TABLE {0} (PATH TEXT PRIMARY KEY, DRAWINGNUMBER TEXT, DRAWINGNAME TEXT)", SPPID_DRAWING_INFO); |
|
222 |
cmd.CommandText = string.Format("CREATE TABLE {0} (PATH TEXT PRIMARY KEY, DRAWINGNUMBER TEXT, DRAWINGNAME TEXT, DOCUMENT Text)", SPPID_DRAWING_INFO);
|
|
222 | 223 |
cmd.ExecuteNonQuery(); |
223 | 224 |
} |
224 | 225 |
} |
... | ... | |
247 | 248 |
cmd.ExecuteNonQuery(); |
248 | 249 |
} |
249 | 250 |
} |
251 |
|
|
252 |
cmd.CommandText = string.Format("SELECT * FROM {0}", SPPID_DRAWING_INFO); |
|
253 |
using (SQLiteDataReader dr = cmd.ExecuteReader()) |
|
254 |
using (DataTable dt = new DataTable()) |
|
255 |
{ |
|
256 |
dt.Load(dr); |
|
257 |
if (!dt.Columns.Contains("DOCUMENT")) |
|
258 |
{ |
|
259 |
cmd.CommandText = string.Format("ALTER TABLE {0} ADD COLUMN DOCUMENT Text", SPPID_DRAWING_INFO); |
|
260 |
cmd.ExecuteNonQuery(); |
|
261 |
} |
|
262 |
} |
|
250 | 263 |
#endregion |
251 | 264 |
} |
252 | 265 |
} |
... | ... | |
684 | 697 |
return true; |
685 | 698 |
} |
686 | 699 |
|
687 |
public static bool InsertDrawingInfo(string path, string drawingNumber, string drawingName) |
|
700 |
public static bool InsertDrawingInfo(string path, string drawingNumber, string drawingName, SPPID.Model.SPPID_Document document)
|
|
688 | 701 |
{ |
689 | 702 |
Project_Info projectInfo = Project_Info.GetInstance(); |
690 | 703 |
using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", projectInfo.DBFilePath))) |
... | ... | |
698 | 711 |
{ |
699 | 712 |
using (SQLiteCommand cmd = connection.CreateCommand()) |
700 | 713 |
{ |
701 |
cmd.CommandText = string.Format("INSERT OR REPLACE INTO {0} (PATH, DRAWINGNUMBER, DRAWINGNAME) VALUES (@PATH, @DRAWINGNUMBER, @DRAWINGNAME)", SPPID_DRAWING_INFO);
|
|
714 |
cmd.CommandText = string.Format("INSERT OR REPLACE INTO {0} (PATH, DRAWINGNUMBER, DRAWINGNAME, DOCUMENT) VALUES (@PATH, @DRAWINGNUMBER, @DRAWINGNAME, @DOCUMENT)", SPPID_DRAWING_INFO);
|
|
702 | 715 |
cmd.Parameters.AddWithValue("@PATH", path); |
703 | 716 |
cmd.Parameters.AddWithValue("@DRAWINGNUMBER", drawingNumber); |
704 | 717 |
cmd.Parameters.AddWithValue("@DRAWINGNAME", drawingName); |
718 |
cmd.Parameters.AddWithValue("@DOCUMENT", JsonConvert.SerializeObject(document)); |
|
705 | 719 |
cmd.ExecuteNonQuery(); |
706 | 720 |
} |
707 | 721 |
transaction.Commit(); |
내보내기 Unified diff