개정판 e00e891d
dev issue #000 : end mapping
Change-Id: I66da9a36ddc64be0951b68927751ea4089b8db40
DTI_PID/BaseModel/Project_DB.cs | ||
---|---|---|
14 | 14 |
const string SPPID_DB_INFO_TABLE = "T_SPPID_CONNECTION_INFO"; |
15 | 15 |
const string SPPID_SYMBOL_MAPPING_TABLE = "T_SPPID_SYMBOL_MAPPING"; |
16 | 16 |
const string SPPID_ATTRIBUTE_MAPPING_TABLE = "T_SPPID_ATTRIBUTE_MAPPING"; |
17 |
const string SPPID_ETC_SETTING_TABLE = "T_SPPID_ETC_SETTING_TABLE"; |
|
17 | 18 |
|
18 | 19 |
const string LineProperties_TABLE = "LineProperties"; |
19 | 20 |
const string LineTypes_TABLE = "LineTypes"; |
... | ... | |
87 | 88 |
Project_Info projectInfo = Project_Info.GetInstance(); |
88 | 89 |
using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", projectInfo.DBFilePath))) |
89 | 90 |
{ |
90 |
|
|
91 | 91 |
try |
92 | 92 |
{ |
93 | 93 |
connection.Open(); |
... | ... | |
112 | 112 |
return dt; |
113 | 113 |
} |
114 | 114 |
|
115 |
public static bool SaveETCSetting(string jsonString) |
|
116 |
{ |
|
117 |
Project_Info projectInfo = Project_Info.GetInstance(); |
|
118 |
using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", projectInfo.DBFilePath))) |
|
119 |
{ |
|
120 |
|
|
121 |
try |
|
122 |
{ |
|
123 |
connection.Open(); |
|
124 |
using (SQLiteCommand cmd = connection.CreateCommand()) |
|
125 |
{ |
|
126 |
cmd.CommandText = string.Format("DELETE FROM {0}", SPPID_ETC_SETTING_TABLE); |
|
127 |
cmd.ExecuteNonQuery(); |
|
128 |
|
|
129 |
cmd.CommandText = string.Format("INSERT INTO {0} VALUES (@jsonString)", SPPID_ETC_SETTING_TABLE); |
|
130 |
cmd.Parameters.AddWithValue("@jsonString", jsonString); |
|
131 |
cmd.ExecuteNonQuery(); |
|
132 |
} |
|
133 |
connection.Close(); |
|
134 |
} |
|
135 |
catch (Exception ex) |
|
136 |
{ |
|
137 |
return false; |
|
138 |
} |
|
139 |
finally |
|
140 |
{ |
|
141 |
connection.Dispose(); |
|
142 |
} |
|
143 |
} |
|
144 |
|
|
145 |
return true; |
|
146 |
} |
|
147 |
|
|
148 |
public static DataTable SelectETCSetting() |
|
149 |
{ |
|
150 |
DataTable dt = new DataTable(); |
|
151 |
Project_Info projectInfo = Project_Info.GetInstance(); |
|
152 |
using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", projectInfo.DBFilePath))) |
|
153 |
{ |
|
154 |
try |
|
155 |
{ |
|
156 |
connection.Open(); |
|
157 |
using (SQLiteCommand cmd = connection.CreateCommand()) |
|
158 |
{ |
|
159 |
cmd.CommandText = string.Format("SELECT * FROM {0}", SPPID_ETC_SETTING_TABLE); |
|
160 |
using (SQLiteDataReader dr = cmd.ExecuteReader()) |
|
161 |
dt.Load(dr); |
|
162 |
} |
|
163 |
connection.Close(); |
|
164 |
} |
|
165 |
catch (Exception ex) |
|
166 |
{ |
|
167 |
|
|
168 |
} |
|
169 |
finally |
|
170 |
{ |
|
171 |
connection.Dispose(); |
|
172 |
} |
|
173 |
} |
|
174 |
|
|
175 |
return dt; |
|
176 |
} |
|
177 |
|
|
115 | 178 |
private static void CreateTable(SQLiteConnection connection) |
116 | 179 |
{ |
117 | 180 |
using (SQLiteCommand cmd = connection.CreateCommand()) |
... | ... | |
127 | 190 |
cmd.CommandText = string.Format("CREATE TABLE {0} (JsonString TEXT)", SPPID_DB_INFO_TABLE); |
128 | 191 |
cmd.ExecuteNonQuery(); |
129 | 192 |
} |
193 |
if (dt.Select(string.Format("NAME = '{0}'", SPPID_ETC_SETTING_TABLE)).Length == 0) |
|
194 |
{ |
|
195 |
cmd.CommandText = string.Format("CREATE TABLE {0} (JsonString TEXT)", SPPID_ETC_SETTING_TABLE); |
|
196 |
cmd.ExecuteNonQuery(); |
|
197 |
} |
|
130 | 198 |
if (dt.Select(string.Format("NAME = '{0}'", SPPID_SYMBOL_MAPPING_TABLE)).Length == 0) |
131 | 199 |
{ |
132 | 200 |
cmd.CommandText = string.Format("CREATE TABLE {0} (UID TEXT PRIMARY KEY, NAME TEXT, SPPID_SYMBOL_PATH TEXT)", SPPID_SYMBOL_MAPPING_TABLE); |
DTI_PID/SPPIDConverter_AutoModeling/ConverterForm.cs | ||
---|---|---|
171 | 171 |
InitID2Line(); |
172 | 172 |
InitID2LineNumber(); |
173 | 173 |
InitID2Association(); |
174 |
|
|
175 |
InitETCSetting(); |
|
176 |
} |
|
177 |
} |
|
178 |
private void InitETCSetting() |
|
179 |
{ |
|
180 |
Project_Info _ProjectInfo = Project_Info.GetInstance(); |
|
181 |
if (_ProjectInfo.Enable) |
|
182 |
{ |
|
183 |
DataTable dt = Project_DB.SelectETCSetting(); |
|
184 |
if (dt.Columns.Count > 0 && dt.Rows.Count > 0) |
|
185 |
SPPIDUtil.ConvertToETCSetting(dt.Rows[0][0].ToString()); |
|
186 |
else |
|
187 |
SPPID_DBInfo.Clear(); |
|
174 | 188 |
} |
175 | 189 |
} |
176 | 190 |
|
DTI_PID/SPPIDConverter_AutoModeling/Form/MappingForm.Designer.cs | ||
---|---|---|
30 | 30 |
{ |
31 | 31 |
this.ribbonControl = new DevExpress.XtraBars.Ribbon.RibbonControl(); |
32 | 32 |
this.layoutControl1 = new DevExpress.XtraLayout.LayoutControl(); |
33 |
this.textEdit1 = new DevExpress.XtraEditors.TextEdit();
|
|
33 |
this.textBoxDrainValveSize = new DevExpress.XtraEditors.TextEdit();
|
|
34 | 34 |
this.textBoxNoteSymbolPath = new DevExpress.XtraEditors.ButtonEdit(); |
35 | 35 |
this.textBoxTextSymbolPath = new DevExpress.XtraEditors.ButtonEdit(); |
36 | 36 |
this.textBoxLineNumberPath = new DevExpress.XtraEditors.ButtonEdit(); |
... | ... | |
90 | 90 |
((System.ComponentModel.ISupportInitialize)(this.ribbonControl)).BeginInit(); |
91 | 91 |
((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).BeginInit(); |
92 | 92 |
this.layoutControl1.SuspendLayout(); |
93 |
((System.ComponentModel.ISupportInitialize)(this.textEdit1.Properties)).BeginInit();
|
|
93 |
((System.ComponentModel.ISupportInitialize)(this.textBoxDrainValveSize.Properties)).BeginInit();
|
|
94 | 94 |
((System.ComponentModel.ISupportInitialize)(this.textBoxNoteSymbolPath.Properties)).BeginInit(); |
95 | 95 |
((System.ComponentModel.ISupportInitialize)(this.textBoxTextSymbolPath.Properties)).BeginInit(); |
96 | 96 |
((System.ComponentModel.ISupportInitialize)(this.textBoxLineNumberPath.Properties)).BeginInit(); |
... | ... | |
164 | 164 |
// |
165 | 165 |
// layoutControl1 |
166 | 166 |
// |
167 |
this.layoutControl1.Controls.Add(this.textEdit1);
|
|
167 |
this.layoutControl1.Controls.Add(this.textBoxDrainValveSize);
|
|
168 | 168 |
this.layoutControl1.Controls.Add(this.textBoxNoteSymbolPath); |
169 | 169 |
this.layoutControl1.Controls.Add(this.textBoxTextSymbolPath); |
170 | 170 |
this.layoutControl1.Controls.Add(this.textBoxLineNumberPath); |
... | ... | |
186 | 186 |
this.layoutControl1.TabIndex = 2; |
187 | 187 |
this.layoutControl1.Text = "layoutControl1"; |
188 | 188 |
// |
189 |
// textEdit1
|
|
189 |
// textBoxDrainValveSize
|
|
190 | 190 |
// |
191 |
this.textEdit1.Location = new System.Drawing.Point(206, 172);
|
|
192 |
this.textEdit1.MenuManager = this.ribbonControl;
|
|
193 |
this.textEdit1.Name = "textEdit1";
|
|
194 |
this.textEdit1.Size = new System.Drawing.Size(493, 20);
|
|
195 |
this.textEdit1.StyleController = this.layoutControl1;
|
|
196 |
this.textEdit1.TabIndex = 26;
|
|
191 |
this.textBoxDrainValveSize.Location = new System.Drawing.Point(206, 172);
|
|
192 |
this.textBoxDrainValveSize.MenuManager = this.ribbonControl;
|
|
193 |
this.textBoxDrainValveSize.Name = "textBoxDrainValveSize";
|
|
194 |
this.textBoxDrainValveSize.Size = new System.Drawing.Size(493, 20);
|
|
195 |
this.textBoxDrainValveSize.StyleController = this.layoutControl1;
|
|
196 |
this.textBoxDrainValveSize.TabIndex = 26;
|
|
197 | 197 |
// |
198 | 198 |
// textBoxNoteSymbolPath |
199 | 199 |
// |
... | ... | |
458 | 458 |
// |
459 | 459 |
this.tabbedControlGroup.Location = new System.Drawing.Point(0, 0); |
460 | 460 |
this.tabbedControlGroup.Name = "tabbedControlGroup"; |
461 |
this.tabbedControlGroup.SelectedTabPage = this.GroupETCSetting;
|
|
461 |
this.tabbedControlGroup.SelectedTabPage = this.GroupSymbol;
|
|
462 | 462 |
this.tabbedControlGroup.Size = new System.Drawing.Size(715, 678); |
463 | 463 |
this.tabbedControlGroup.TabPages.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] { |
464 | 464 |
this.GroupSymbol, |
... | ... | |
525 | 525 |
// |
526 | 526 |
// layoutControlItem14 |
527 | 527 |
// |
528 |
this.layoutControlItem14.Control = this.textEdit1;
|
|
528 |
this.layoutControlItem14.Control = this.textBoxDrainValveSize;
|
|
529 | 529 |
this.layoutControlItem14.Location = new System.Drawing.Point(0, 0); |
530 | 530 |
this.layoutControlItem14.Name = "layoutControlItem14"; |
531 | 531 |
this.layoutControlItem14.Size = new System.Drawing.Size(667, 24); |
... | ... | |
755 | 755 |
((System.ComponentModel.ISupportInitialize)(this.ribbonControl)).EndInit(); |
756 | 756 |
((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).EndInit(); |
757 | 757 |
this.layoutControl1.ResumeLayout(false); |
758 |
((System.ComponentModel.ISupportInitialize)(this.textEdit1.Properties)).EndInit();
|
|
758 |
((System.ComponentModel.ISupportInitialize)(this.textBoxDrainValveSize.Properties)).EndInit();
|
|
759 | 759 |
((System.ComponentModel.ISupportInitialize)(this.textBoxNoteSymbolPath.Properties)).EndInit(); |
760 | 760 |
((System.ComponentModel.ISupportInitialize)(this.textBoxTextSymbolPath.Properties)).EndInit(); |
761 | 761 |
((System.ComponentModel.ISupportInitialize)(this.textBoxLineNumberPath.Properties)).EndInit(); |
... | ... | |
871 | 871 |
private DevExpress.XtraLayout.EmptySpaceItem emptySpaceItem3; |
872 | 872 |
private DevExpress.XtraEditors.ButtonEdit textBoxNoteSymbolPath; |
873 | 873 |
private DevExpress.XtraLayout.LayoutControlItem layoutControlItem7; |
874 |
private DevExpress.XtraEditors.TextEdit textEdit1;
|
|
874 |
private DevExpress.XtraEditors.TextEdit textBoxDrainValveSize;
|
|
875 | 875 |
private DevExpress.XtraLayout.LayoutControlGroup layoutControlGroup9; |
876 | 876 |
private DevExpress.XtraLayout.LayoutControlGroup layoutControlGroup10; |
877 | 877 |
private DevExpress.XtraLayout.LayoutControlItem layoutControlItem14; |
DTI_PID/SPPIDConverter_AutoModeling/Form/MappingForm.cs | ||
---|---|---|
16 | 16 |
using DevExpress.XtraEditors; |
17 | 17 |
using Converter.BaseModel; |
18 | 18 |
using Converter.AutoModeling.SPPID.Properties; |
19 |
using Newtonsoft.Json; |
|
19 | 20 |
|
20 | 21 |
namespace Converter.AutoModeling.SPPID.Form |
21 | 22 |
{ |
... | ... | |
57 | 58 |
clearButton.ButtonClick += repositoryItemButtonEdit_ButtonClick; |
58 | 59 |
clearButton.TextEditStyle = TextEditStyles.HideTextEditor; |
59 | 60 |
|
61 |
// Symbol GridView |
|
60 | 62 |
gridControlSymbol.DataSource = symbolDT; |
61 | 63 |
gridViewSymbol.Columns["UID"].Visible = false; |
62 | 64 |
gridViewSymbol.Columns["SPPID_SYMBOL_PATH"].Caption = "SPPID Symbol Path"; |
... | ... | |
66 | 68 |
gridControlSymbol.RepositoryItems.Add(clearButton); |
67 | 69 |
gridViewSymbol.ExpandAllGroups(); |
68 | 70 |
|
69 |
|
|
70 |
|
|
71 |
// Line GridView |
|
71 | 72 |
gridControlLine.DataSource = lineDT; |
72 | 73 |
gridViewLine.Columns["UID"].Visible = false; |
73 | 74 |
gridViewLine.Columns["SPPID_SYMBOL_PATH"].Caption = "SPPID Symbol Path"; |
... | ... | |
76 | 77 |
gridControlLine.RepositoryItems.Add(clearButton); |
77 | 78 |
gridViewLine.ExpandAllGroups(); |
78 | 79 |
|
79 |
|
|
80 |
|
|
81 |
|
|
80 |
// Association GridView |
|
82 | 81 |
gridControlAssociation.DataSource = associationDT; |
83 | 82 |
gridViewAssociation.Columns["UID"].Visible = false; |
84 | 83 |
gridViewAssociation.Columns["DisplayAttribute"].Caption = "Attribute Name"; |
... | ... | |
88 | 87 |
gridControlAssociation.RepositoryItems.Add(clearButton); |
89 | 88 |
gridViewAssociation.ExpandAllGroups(); |
90 | 89 |
|
91 |
|
|
92 |
|
|
90 |
// LineNumber GridView |
|
93 | 91 |
gridControlLineNumber.DataSource = linePropertyDT; |
94 | 92 |
gridViewLineNumber.Columns["UID"].Visible = false; |
95 | 93 |
gridViewLineNumber.Columns["DisplayName"].Caption = "Property Name"; |
96 | 94 |
gridViewLineNumber.Columns["SPPID_ATTRIBUTE"].Caption = "SPPID Attribute Name"; |
95 |
gridViewLineNumber.Columns["SPPID_SYMBOL_PATH"].Visible = false; |
|
97 | 96 |
gridViewLineNumber.Columns["Type"].GroupIndex = 0; |
98 | 97 |
gridViewLineNumber.ExpandAllGroups(); |
99 | 98 |
|
99 |
|
|
100 |
// Common |
|
100 | 101 |
gridViewSymbol.Columns["Clear"].ColumnEdit = clearButton; |
101 | 102 |
gridViewSymbol.Columns["Clear"].MaxWidth = 16; |
102 | 103 |
gridViewLine.Columns["Clear"].ColumnEdit = clearButton; |
... | ... | |
129 | 130 |
textBoxNoteSymbolPath.Properties.TextEditStyle = TextEditStyles.DisableTextEditor; |
130 | 131 |
textBoxNoteSymbolPath.Properties.Buttons[0].Kind = ButtonPredefines.Glyph; |
131 | 132 |
textBoxNoteSymbolPath.Properties.Buttons[0].Image = Resources.pencolor_16x16; |
133 |
|
|
134 |
ETCSetting _ETCSetting = ETCSetting.GetInstance(); |
|
135 |
textBoxTextSymbolPath.Text = _ETCSetting.TextSymbolPath; |
|
136 |
textBoxNoteSymbolPath.Text = _ETCSetting.NoteSymbolPath; |
|
137 |
textBoxDrainValveSize.Text = _ETCSetting.DrainValveSize; |
|
132 | 138 |
} |
133 | 139 |
|
134 | 140 |
private void textBoxETC_ButtonClick(object sender, ButtonPressedEventArgs e) |
... | ... | |
221 | 227 |
attributeDatas.Add(new Tuple<string, string>(_uid, _SPPID_Attribute)); |
222 | 228 |
} |
223 | 229 |
|
224 |
|
|
225 |
|
|
226 |
//foreach (DataRow row in associationDT.Rows) |
|
227 |
//{ |
|
228 |
// string _uid = row["UID"].ToString(); |
|
229 |
// string _SPPID_Attribute = row["SPPID_ATTRIBUTE"] == DBNull.Value ? null : row["SPPID_ATTRIBUTE"].ToString(); |
|
230 |
// attributeDatas.Add(new Tuple<string, string>(_uid, _SPPID_Attribute)); |
|
231 |
//} |
|
230 |
#region ETC Setting |
|
231 |
ETCSetting _ETCSetting = new ETCSetting(); |
|
232 |
_ETCSetting.TextSymbolPath = textBoxTextSymbolPath.Text; |
|
233 |
_ETCSetting.NoteSymbolPath = textBoxNoteSymbolPath.Text; |
|
234 |
_ETCSetting.DrainValveSize = textBoxDrainValveSize.Text; |
|
235 |
string jsonString = JsonConvert.SerializeObject(_ETCSetting); |
|
236 |
#endregion |
|
232 | 237 |
|
233 |
if (Project_DB.InsertSymbolMapping(symbolDatas) && Project_DB.InsertAttributeMapping(attributeDatas)) |
|
238 |
if (Project_DB.InsertSymbolMapping(symbolDatas) && Project_DB.InsertAttributeMapping(attributeDatas) && Project_DB.SaveETCSetting(jsonString))
|
|
234 | 239 |
MessageBox.Show(Msg.SuccessSave, Msg.Information, MessageBoxButtons.OK, MessageBoxIcon.Information); |
235 | 240 |
else |
236 | 241 |
MessageBox.Show(Msg.FailSave, Msg.Warning, MessageBoxButtons.OK, MessageBoxIcon.Warning); |
DTI_PID/SPPIDConverter_AutoModeling/Model/ETCSetting.cs | ||
---|---|---|
24 | 24 |
|
25 | 25 |
return setting; |
26 | 26 |
} |
27 |
|
|
28 |
public static void Clear() |
|
29 |
{ |
|
30 |
setting = new ETCSetting(); |
|
31 |
} |
|
27 | 32 |
} |
28 | 33 |
} |
DTI_PID/SPPIDConverter_AutoModeling/Util/SPPIDUtil.cs | ||
---|---|---|
44 | 44 |
} |
45 | 45 |
return true; |
46 | 46 |
} |
47 |
|
|
48 |
public static bool ConvertToETCSetting(string jsonString) |
|
49 |
{ |
|
50 |
ETCSetting _ETCSetting = ETCSetting.GetInstance(); |
|
51 |
try |
|
52 |
{ |
|
53 |
ETCSetting jsonETCSetting = JsonConvert.DeserializeObject<ETCSetting>(jsonString); |
|
54 |
|
|
55 |
_ETCSetting.NoteSymbolPath = jsonETCSetting.NoteSymbolPath; |
|
56 |
_ETCSetting.TextSymbolPath = jsonETCSetting.TextSymbolPath; |
|
57 |
_ETCSetting.DrainValveSize = jsonETCSetting.DrainValveSize; |
|
58 |
|
|
59 |
} |
|
60 |
catch (Exception ex) |
|
61 |
{ |
|
62 |
return false; |
|
63 |
} |
|
64 |
return true; |
|
65 |
} |
|
47 | 66 |
} |
48 | 67 |
} |
내보내기 Unified diff