1 |
3610fd3f
|
LJIYEON
|
using System;
|
2 |
|
|
using System.Collections.Generic;
|
3 |
|
|
using System.ComponentModel;
|
4 |
|
|
using System.Data;
|
5 |
|
|
using System.Drawing;
|
6 |
|
|
using System.Linq;
|
7 |
|
|
using System.Text;
|
8 |
|
|
using System.Threading.Tasks;
|
9 |
|
|
using System.Windows.Forms;
|
10 |
|
|
using System.IO;
|
11 |
|
|
using DevExpress.XtraEditors.Repository;
|
12 |
|
|
using DevExpress.XtraGrid.Columns;
|
13 |
|
|
using DevExpress.XtraGrid;
|
14 |
|
|
using DevExpress.XtraGrid.Views.Grid;
|
15 |
|
|
using DevExpress.Utils.StructuredStorage.Internal.Reader;
|
16 |
|
|
using DevExpress.XtraTreeList;
|
17 |
|
|
using DevExpress.XtraTreeList.Columns;
|
18 |
|
|
using DevExpress.XtraTreeList.Nodes;
|
19 |
|
|
using DevExpress.Utils.Extensions;
|
20 |
|
|
using DevExpress.Utils;
|
21 |
|
|
using DevExpress.Utils.Drawing;
|
22 |
|
|
|
23 |
|
|
namespace ID2PSN
|
24 |
|
|
{
|
25 |
|
|
public partial class ValveGroupingSetting : DevExpress.XtraBars.Ribbon.RibbonForm
|
26 |
|
|
{
|
27 |
|
|
ID2Info ID2Info = ID2Info.GetInstance();
|
28 |
|
|
List<ValveGroupInfo> ValveGroupInfos = new List<ValveGroupInfo>();
|
29 |
|
|
ValveGroupInfo currentValveGroupInfo = null;
|
30 |
|
|
private RepositoryItemComboBox repositoryAttributeItem = new RepositoryItemComboBox();
|
31 |
|
|
private RepositoryItemComboBox repositoryGroupType = new RepositoryItemComboBox();
|
32 |
b267209c
|
LJIYEON
|
private DataTable SymbolList = new DataTable();
|
33 |
3610fd3f
|
LJIYEON
|
|
34 |
|
|
public ValveGroupingSetting()
|
35 |
|
|
{
|
36 |
|
|
InitializeComponent();
|
37 |
|
|
|
38 |
|
|
InitGridValveGroupItems();
|
39 |
|
|
|
40 |
b267209c
|
LJIYEON
|
|
41 |
3610fd3f
|
LJIYEON
|
|
42 |
b267209c
|
LJIYEON
|
// gridViewValveGroup.CellValueChanged += new DevExpress.XtraGrid.Views.Base.CellValueChangedEventHandler(gridViewSymbol_CellValueChanged);
|
43 |
|
|
gridViewValveGroup.CellValueChanging += new DevExpress.XtraGrid.Views.Base.CellValueChangedEventHandler(gridViewSymbol_CellValueChanged);
|
44 |
3610fd3f
|
LJIYEON
|
ValveGroupInfos = new List<ValveGroupInfo>();
|
45 |
|
|
currentValveGroupInfo = new ValveGroupInfo();
|
46 |
|
|
|
47 |
|
|
InitData();
|
48 |
|
|
}
|
49 |
|
|
|
50 |
|
|
public void InitGridValveGroupItems()
|
51 |
|
|
{
|
52 |
|
|
RepositoryItemButtonEdit btnRemove = new RepositoryItemButtonEdit();
|
53 |
|
|
btnRemove.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.HideTextEditor;
|
54 |
|
|
btnRemove.ButtonClick += new DevExpress.XtraEditors.Controls.ButtonPressedEventHandler(removeSymbolButton_Click);
|
55 |
|
|
btnRemove.Buttons[0].Kind = DevExpress.XtraEditors.Controls.ButtonPredefines.Glyph;
|
56 |
|
|
btnRemove.Buttons[0].ImageOptions.Image = ID2PSN.Properties.Resources.cancel_16x16;
|
57 |
|
|
|
58 |
|
|
gridValveGroup.RepositoryItems.Add(btnRemove);
|
59 |
|
|
|
60 |
|
|
DataTable dtType = new DataTable();
|
61 |
|
|
// dtType.Columns.Add("OID");
|
62 |
|
|
dtType.Columns.Add("GroupType");
|
63 |
|
|
dtType.Columns.Add("TagIdentifier");
|
64 |
|
|
dtType.Columns.Add("AttributeName");
|
65 |
|
|
dtType.Columns.Add("SppidSymbolName");
|
66 |
|
|
dtType.Columns.Add(" ");
|
67 |
|
|
gridValveGroup.DataSource = dtType;
|
68 |
|
|
|
69 |
|
|
GridColumn gridColumn = gridViewValveGroup.Columns[0];
|
70 |
|
|
//gridColumn.Name = "OID";
|
71 |
|
|
//gridColumn.Caption = "OID";
|
72 |
|
|
//gridColumn.OptionsColumn.AllowEdit = false;
|
73 |
|
|
//gridColumn.OptionsColumn.AllowSort = DevExpress.Utils.DefaultBoolean.False;
|
74 |
|
|
//gridColumn.Visible = true;
|
75 |
|
|
//gridColumn.VisibleIndex = 0;
|
76 |
|
|
|
77 |
|
|
|
78 |
|
|
repositoryGroupType = new RepositoryItemComboBox();
|
79 |
bfbc9f6c
|
이지연
|
repositoryGroupType.Items.AddRange(new string[] { "Valves (CV, PRV..)", "Traps (ST, DT..)", "Reliefs (PSV..)", "Scope Break" });
|
80 |
3610fd3f
|
LJIYEON
|
repositoryGroupType.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
|
81 |
b267209c
|
LJIYEON
|
//repositoryGroupType.EditValueChanging += RepositoryGroupType_EditValueChanging;
|
82 |
|
|
// repositoryGroupType.SelectedIndexChanged += RepositoryGroupType_SelectedIndexChanged;
|
83 |
|
|
|
84 |
3610fd3f
|
LJIYEON
|
gridValveGroup.RepositoryItems.Add(repositoryGroupType);
|
85 |
|
|
//gridColumn = gridViewValveGroup.Columns[0];
|
86 |
|
|
gridColumn.Name = "GroupType";
|
87 |
|
|
gridColumn.Caption = "Group Type";
|
88 |
|
|
gridColumn.OptionsColumn.AllowSort = DevExpress.Utils.DefaultBoolean.False;
|
89 |
|
|
gridColumn.VisibleIndex = 0;
|
90 |
|
|
|
91 |
|
|
gridViewValveGroup.Columns["GroupType"].ColumnEdit = repositoryGroupType;
|
92 |
|
|
|
93 |
|
|
//gridColumn.AppearanceHeader.BackColor = Color.Red;
|
94 |
|
|
|
95 |
|
|
gridColumn = gridViewValveGroup.Columns[1];
|
96 |
|
|
gridColumn.Name = "TagIdentifier";
|
97 |
|
|
gridColumn.Caption = "Prefix";
|
98 |
|
|
gridColumn.OptionsColumn.AllowSort = DevExpress.Utils.DefaultBoolean.False;
|
99 |
|
|
gridColumn.VisibleIndex = 1;
|
100 |
b267209c
|
LJIYEON
|
|
101 |
|
|
|
102 |
|
|
SymbolList = DB.SelectAllSymbolAttribute();
|
103 |
3610fd3f
|
LJIYEON
|
|
104 |
353c2919
|
LJIYEON
|
//repositoryAttributeItem.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
|
105 |
|
|
//repositoryAttributeItem.AppearanceDropDown.Font = Font;
|
106 |
|
|
//repositoryAttributeItem.Items.Add("NoSelection");
|
107 |
|
|
//foreach (DataRow dr in SymbolList.Rows)
|
108 |
|
|
//{
|
109 |
|
|
// repositoryAttributeItem.Items.Add(dr["SymbolAttribute"].ToString());
|
110 |
|
|
//}
|
111 |
|
|
//repositoryAttributeItem.Items.Add("");
|
112 |
|
|
|
113 |
3610fd3f
|
LJIYEON
|
repositoryAttributeItem.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
|
114 |
|
|
repositoryAttributeItem.AppearanceDropDown.Font = Font;
|
115 |
|
|
gridValveGroup.RepositoryItems.Add(repositoryAttributeItem);
|
116 |
|
|
|
117 |
|
|
gridColumn = gridViewValveGroup.Columns[2];
|
118 |
|
|
gridColumn.Name = "AttributeName";
|
119 |
|
|
gridColumn.Caption = "ID2 Attribute Name";
|
120 |
|
|
gridColumn.OptionsColumn.AllowSort = DevExpress.Utils.DefaultBoolean.False;
|
121 |
|
|
gridColumn.VisibleIndex = 2;
|
122 |
|
|
gridViewValveGroup.Columns["AttributeName"].ColumnEdit = repositoryAttributeItem;
|
123 |
|
|
|
124 |
|
|
gridColumn = gridViewValveGroup.Columns[3];
|
125 |
|
|
gridColumn.Name = "SppidSymbolName";
|
126 |
|
|
gridColumn.Caption = "ID2 Symbol Name";
|
127 |
|
|
gridColumn.OptionsColumn.AllowSort = DevExpress.Utils.DefaultBoolean.False;
|
128 |
|
|
gridColumn.VisibleIndex = 3;
|
129 |
|
|
|
130 |
|
|
RepositoryItemTreeListLookUpEdit treeListLookUpEdit = new RepositoryItemTreeListLookUpEdit();
|
131 |
|
|
gridValveGroup.RepositoryItems.Add(treeListLookUpEdit);
|
132 |
|
|
SetSymbol(treeListLookUpEdit);
|
133 |
353c2919
|
LJIYEON
|
|
134 |
b267209c
|
LJIYEON
|
// gridColumn.ColumnEdit = treeListLookUpEdit;
|
135 |
|
|
gridViewValveGroup.Columns["SppidSymbolName"].ColumnEdit = treeListLookUpEdit;
|
136 |
3610fd3f
|
LJIYEON
|
|
137 |
|
|
gridColumn = gridViewValveGroup.Columns[4];
|
138 |
|
|
gridColumn.Name = "Remove";
|
139 |
|
|
gridColumn.Caption = "";
|
140 |
|
|
gridColumn.OptionsColumn.AllowSort = DevExpress.Utils.DefaultBoolean.False;
|
141 |
|
|
gridColumn.VisibleIndex = 4;
|
142 |
|
|
gridColumn.MaxWidth = 16;
|
143 |
353c2919
|
LJIYEON
|
|
144 |
3610fd3f
|
LJIYEON
|
gridColumn.ColumnEdit = btnRemove;
|
145 |
|
|
gridColumn.ShowButtonMode = DevExpress.XtraGrid.Views.Base.ShowButtonModeEnum.ShowAlways;
|
146 |
353c2919
|
LJIYEON
|
gridViewValveGroup.CustomRowCellEditForEditing += gridView1_CustomRowCellEditForEditing;
|
147 |
3610fd3f
|
LJIYEON
|
//gridViewKeyword.CustomDrawColumnHeader += GridViewKeyword_CustomDrawColumnHeader;
|
148 |
353c2919
|
LJIYEON
|
|
149 |
|
|
|
150 |
|
|
}
|
151 |
|
|
|
152 |
|
|
private void gridView1_CustomRowCellEditForEditing(object sender, DevExpress.XtraGrid.Views.Grid.CustomRowCellEditEventArgs e)
|
153 |
|
|
{
|
154 |
|
|
if (e.Column == (sender as GridView).Columns["AttributeName"])
|
155 |
|
|
{
|
156 |
|
|
DevExpress.XtraGrid.Views.Base.ColumnView columnView = sender as DevExpress.XtraGrid.Views.Base.ColumnView;
|
157 |
|
|
DataTable dt = gridValveGroup.DataSource as DataTable;
|
158 |
|
|
string SppidSymbolName = dt.Rows[columnView.FocusedRowHandle]["SppidSymbolName"].ToString();
|
159 |
|
|
|
160 |
|
|
if(string.IsNullOrEmpty(SppidSymbolName))
|
161 |
|
|
{
|
162 |
|
|
MessageBox.Show("Choose a symbol !", "ID2 " + ID2Info.ProgramName, MessageBoxButtons.OK, MessageBoxIcon.Information);
|
163 |
|
|
return;
|
164 |
|
|
}
|
165 |
|
|
|
166 |
dd27861e
|
이지연
|
repositoryAttributeItem.Items.Clear();
|
167 |
|
|
repositoryAttributeItem.Items.Add("");
|
168 |
353c2919
|
LJIYEON
|
repositoryAttributeItem.Items.Add("NoSelection");
|
169 |
|
|
foreach (DataRow dr in SymbolList.Rows)
|
170 |
|
|
{
|
171 |
|
|
if(dr["SymbolName"].ToString().ToUpper().Equals(SppidSymbolName.ToUpper()))
|
172 |
|
|
{
|
173 |
|
|
repositoryAttributeItem.Items.Add(dr["SymbolAttribute"].ToString());
|
174 |
|
|
}
|
175 |
|
|
}
|
176 |
|
|
//repositoryAttributeItem.Items.Add("");
|
177 |
|
|
}
|
178 |
|
|
}
|
179 |
3610fd3f
|
LJIYEON
|
|
180 |
|
|
private void GridViewKeyword_CustomDrawColumnHeader(object sender, ColumnHeaderCustomDrawEventArgs e)
|
181 |
|
|
{
|
182 |
|
|
if (e.Column == null || (e.Column.AppearanceHeader.BackColor == Color.Empty && !e.Column.AppearanceHeader.Options.UseBackColor))
|
183 |
|
|
|
184 |
|
|
return;
|
185 |
|
|
|
186 |
|
|
Rectangle rect = e.Bounds;
|
187 |
|
|
|
188 |
|
|
rect.Inflate(-1, -1);
|
189 |
|
|
|
190 |
|
|
// Fill the title color.
|
191 |
|
|
|
192 |
|
|
e.Graphics.FillRectangle(new SolidBrush(e.Column.AppearanceHeader.BackColor), rect);
|
193 |
|
|
|
194 |
|
|
e.Appearance.DrawString(e.Cache, e.Info.Caption, e.Info.CaptionRect);
|
195 |
|
|
|
196 |
|
|
// Draw filter and sort buttons.
|
197 |
|
|
|
198 |
|
|
foreach (DrawElementInfo info in e.Info.InnerElements)
|
199 |
|
|
|
200 |
|
|
{
|
201 |
|
|
|
202 |
|
|
if (!info.Visible) continue;
|
203 |
|
|
|
204 |
|
|
ObjectPainter.DrawObject(e.Cache, info.ElementPainter, info.ElementInfo);
|
205 |
|
|
|
206 |
|
|
}
|
207 |
|
|
|
208 |
|
|
e.Handled = true;
|
209 |
|
|
}
|
210 |
|
|
|
211 |
|
|
public void InitData()
|
212 |
|
|
{
|
213 |
|
|
DataTable dt = DB.SelectValveGroupItemsSetting();
|
214 |
|
|
DataTable typeDT = gridValveGroup.DataSource as DataTable;
|
215 |
|
|
foreach (DataRow row in dt.Rows)
|
216 |
|
|
{
|
217 |
|
|
//int index = row["OID"];
|
218 |
|
|
string GroupType = row["GroupType"].ToString();
|
219 |
|
|
string TagIdentifier = row["TagIdentifier"].ToString();
|
220 |
|
|
string AttributeName = row["AttributeName"].ToString();
|
221 |
|
|
string SppidSymbolName = row["SppidSymbolName"].ToString();
|
222 |
|
|
|
223 |
|
|
typeDT.Rows.Add(GroupType, TagIdentifier, AttributeName, SppidSymbolName, null);
|
224 |
|
|
}
|
225 |
b267209c
|
LJIYEON
|
|
226 |
3610fd3f
|
LJIYEON
|
}
|
227 |
b267209c
|
LJIYEON
|
|
228 |
3610fd3f
|
LJIYEON
|
private void removeSymbolButton_Click(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
|
229 |
|
|
{
|
230 |
|
|
DataTable dt = gridValveGroup.DataSource as DataTable;
|
231 |
353c2919
|
LJIYEON
|
DataRow rows = dt.Rows[gridViewValveGroup.FocusedRowHandle];
|
232 |
|
|
if (rows != null)
|
233 |
|
|
dt.Rows.Remove(rows);
|
234 |
3610fd3f
|
LJIYEON
|
}
|
235 |
|
|
|
236 |
|
|
public void SetSymbol(RepositoryItemTreeListLookUpEdit treeListLookUpEdit)
|
237 |
|
|
{
|
238 |
|
|
string imgPath = ID2Info.ImageDirPath;
|
239 |
|
|
string[] filesPath = Directory.GetFiles(imgPath, "*.png", SearchOption.AllDirectories);
|
240 |
|
|
|
241 |
|
|
DataTable dt = new DataTable();
|
242 |
|
|
dt.Columns.Add("ID", typeof(int));
|
243 |
|
|
dt.Columns.Add("ParentID", typeof(int));
|
244 |
|
|
dt.Columns.Add("Name", typeof(string));
|
245 |
|
|
dt.Columns.Add("Level", typeof(int));
|
246 |
|
|
dt.Columns.Add("Image", typeof(Image));
|
247 |
|
|
dt.PrimaryKey = new DataColumn[] { dt.Columns["ID"] };
|
248 |
|
|
|
249 |
|
|
treeListLookUpEdit.DataSource = dt;
|
250 |
|
|
treeListLookUpEdit.ValueMember = "Name";
|
251 |
|
|
treeListLookUpEdit.DisplayMember = "Name";
|
252 |
|
|
treeListLookUpEdit.TreeList.Columns["Level"].Visible = false;
|
253 |
|
|
treeListLookUpEdit.NullText = "";
|
254 |
|
|
|
255 |
b267209c
|
LJIYEON
|
treeListLookUpEdit.EditValueChanging += new DevExpress.XtraEditors.Controls.ChangingEventHandler(TreeList_BeforeCheckNode);
|
256 |
|
|
|
257 |
3610fd3f
|
LJIYEON
|
treeListLookUpEdit.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup;
|
258 |
|
|
|
259 |
|
|
bool bLine = true;
|
260 |
|
|
List<string> level1Index = new List<string>();
|
261 |
|
|
foreach (var path in filesPath)
|
262 |
|
|
{
|
263 |
|
|
if (Path.GetFileNameWithoutExtension(path).Contains("_display"))
|
264 |
|
|
continue;
|
265 |
|
|
|
266 |
|
|
string root = path.Remove(0, imgPath.Length);
|
267 |
|
|
string[] split = root.Split(new string[] { @"\" }, StringSplitOptions.None);
|
268 |
|
|
string level1 = split[0];
|
269 |
|
|
if (!level1Index.Contains(level1))
|
270 |
|
|
{
|
271 |
|
|
level1Index.Add(level1);
|
272 |
|
|
dt.Rows.Add(level1Index.IndexOf(level1) + 1, 0, level1, 0);
|
273 |
|
|
}
|
274 |
|
|
|
275 |
|
|
int parentId = level1Index.IndexOf(level1) + 1;
|
276 |
|
|
string level2 = split[1];
|
277 |
|
|
//combobox image size 변경
|
278 |
|
|
Image image = Image.FromFile(Path.Combine(imgPath, root));
|
279 |
|
|
Bitmap imgbitmap = new Bitmap(image);
|
280 |
|
|
Image resizedImage = resizeImage(imgbitmap, new Size(200, 200));
|
281 |
|
|
|
282 |
|
|
dt.Rows.Add(filesPath.ToList().IndexOf(path) + 10000, parentId, Path.GetFileNameWithoutExtension(path), 1, resizedImage);
|
283 |
|
|
|
284 |
|
|
if (Path.GetFileNameWithoutExtension(path) == "Connect To Process" && bLine)
|
285 |
|
|
{
|
286 |
|
|
bLine = false;
|
287 |
|
|
dt.Rows.Add(filesPath.ToList().IndexOf(path) + 20000, parentId, "Primary", 1, resizedImage);
|
288 |
|
|
dt.Rows.Add(filesPath.ToList().IndexOf(path) + 30000, parentId, "Secondary", 1, resizedImage);
|
289 |
|
|
}
|
290 |
|
|
}
|
291 |
|
|
}
|
292 |
b267209c
|
LJIYEON
|
|
293 |
3610fd3f
|
LJIYEON
|
public static Image resizeImage(Image imgToResize, Size size)
|
294 |
|
|
{
|
295 |
|
|
return (Image)(new Bitmap(imgToResize, size));
|
296 |
|
|
}
|
297 |
|
|
|
298 |
|
|
private void btnAddSymbol_Click(object sender, EventArgs e)
|
299 |
|
|
{
|
300 |
|
|
if (currentValveGroupInfo == null)
|
301 |
|
|
{
|
302 |
|
|
currentValveGroupInfo = new ValveGroupInfo();
|
303 |
|
|
}
|
304 |
|
|
|
305 |
|
|
DataTable dt = gridValveGroup.DataSource as DataTable;
|
306 |
|
|
dt.Rows.Add(null, null, null, null, null);
|
307 |
|
|
gridViewValveGroup.Columns["GroupType"].BestFit();
|
308 |
|
|
}
|
309 |
|
|
|
310 |
|
|
|
311 |
|
|
|
312 |
|
|
public void ReNumbering(ValveGroupInfo valveGroupInfo)
|
313 |
|
|
{
|
314 |
|
|
DataTable dt = gridValveGroup.DataSource as DataTable;
|
315 |
|
|
valveGroupInfo.ValveGroupItems.Clear();
|
316 |
|
|
for (int i = 0; i < dt.Rows.Count; i++)
|
317 |
|
|
{
|
318 |
|
|
DataRow row = dt.Rows[i];
|
319 |
|
|
// row["Index"] = i + 1;
|
320 |
|
|
valveGroupInfo.ValveGroupItems.Add(new ValveGroupItem()
|
321 |
|
|
{
|
322 |
|
|
OID = Guid.NewGuid().ToString(),
|
323 |
|
|
GroupType = row["GroupType"].ToString(),
|
324 |
|
|
TagIdentifier = row["TagIdentifier"].ToString(),
|
325 |
|
|
AttributeName = row["AttributeName"].ToString(),
|
326 |
|
|
SppidSymbolName = row["SppidSymbolName"].ToString()
|
327 |
|
|
});
|
328 |
|
|
}
|
329 |
|
|
}
|
330 |
|
|
|
331 |
|
|
private void gridViewType_BeforeLeaveRow(object sender, DevExpress.XtraGrid.Views.Base.RowAllowEventArgs e)
|
332 |
|
|
{
|
333 |
|
|
ReNumbering(currentValveGroupInfo);
|
334 |
|
|
}
|
335 |
|
|
private void gridViewSymbol_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
|
336 |
|
|
{
|
337 |
b267209c
|
LJIYEON
|
//Valves (CV, PRV..)", "Traps (ST, DT..)", "Reliefs (PSV..)
|
338 |
|
|
if (e.Column.FieldName == "GroupType")
|
339 |
|
|
{
|
340 |
|
|
DevExpress.XtraGrid.Views.Base.ColumnView columnView = sender as DevExpress.XtraGrid.Views.Base.ColumnView;
|
341 |
|
|
if (!string.IsNullOrEmpty(e.Value.ToString()))
|
342 |
|
|
{
|
343 |
|
|
string selectItem = e.Value.ToString();
|
344 |
|
|
DataTable dt = gridValveGroup.DataSource as DataTable;
|
345 |
|
|
if (selectItem.Contains("Valves"))
|
346 |
|
|
{
|
347 |
|
|
dt.Rows[columnView.FocusedRowHandle]["TagIdentifier"] = "CV";
|
348 |
|
|
}
|
349 |
|
|
else if (selectItem.Contains("Traps"))
|
350 |
|
|
{
|
351 |
|
|
dt.Rows[columnView.FocusedRowHandle]["TagIdentifier"] = "ST";
|
352 |
|
|
}
|
353 |
|
|
else if (selectItem.Contains("Reliefs"))
|
354 |
|
|
{
|
355 |
|
|
dt.Rows[columnView.FocusedRowHandle]["TagIdentifier"] = "PSV";
|
356 |
|
|
}
|
357 |
|
|
}
|
358 |
|
|
}
|
359 |
|
|
|
360 |
|
|
//ReNumbering(currentValveGroupInfo);
|
361 |
3610fd3f
|
LJIYEON
|
}
|
362 |
|
|
private void TreeList_BeforeCheckNode(object sender, DevExpress.XtraEditors.Controls.ChangingEventArgs e)
|
363 |
|
|
{
|
364 |
|
|
DevExpress.XtraEditors.TreeListLookUpEdit treeListLookUpEdit = sender as DevExpress.XtraEditors.TreeListLookUpEdit;
|
365 |
|
|
if (treeListLookUpEdit.Properties.TreeList.FocusedNode == null)
|
366 |
|
|
return;
|
367 |
|
|
|
368 |
|
|
if (treeListLookUpEdit.Properties.TreeList.FocusedNode.Level == 0)
|
369 |
|
|
e.Cancel = true;
|
370 |
|
|
|
371 |
b267209c
|
LJIYEON
|
|
372 |
3610fd3f
|
LJIYEON
|
}
|
373 |
b267209c
|
LJIYEON
|
|
374 |
3610fd3f
|
LJIYEON
|
private void btnSave_Click(object sender, EventArgs e)
|
375 |
|
|
{
|
376 |
|
|
if (currentValveGroupInfo == null)
|
377 |
|
|
{
|
378 |
|
|
currentValveGroupInfo = new ValveGroupInfo();
|
379 |
|
|
}
|
380 |
|
|
|
381 |
|
|
ReNumbering(currentValveGroupInfo);
|
382 |
|
|
if(currentValveGroupInfo.ValveGroupItems.Find(x => x.TagIdentifier == string.Empty || x.AttributeName == string.Empty || x.SppidSymbolName == string.Empty) != null)
|
383 |
|
|
{
|
384 |
bfbc9f6c
|
이지연
|
IEnumerable<ValveGroupItem> lstvalue = currentValveGroupInfo.ValveGroupItems.Where(x => x.TagIdentifier == string.Empty || x.SppidSymbolName == string.Empty);
|
385 |
54b6df95
|
LJIYEON
|
//Scope Break
|
386 |
|
|
foreach(ValveGroupItem vg in lstvalue)
|
387 |
|
|
{
|
388 |
bfbc9f6c
|
이지연
|
if(vg.GroupType != "Scope Break" )
|
389 |
54b6df95
|
LJIYEON
|
{
|
390 |
|
|
MessageBox.Show("Please save after entering data.", "ID2 " + ID2Info.ProgramName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
391 |
|
|
return;
|
392 |
|
|
}
|
393 |
|
|
else
|
394 |
|
|
{
|
395 |
|
|
if(vg.SppidSymbolName == string.Empty)
|
396 |
|
|
{
|
397 |
|
|
MessageBox.Show("Please save after entering data.", "ID2 " + ID2Info.ProgramName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
398 |
|
|
return;
|
399 |
|
|
}
|
400 |
|
|
}
|
401 |
|
|
}
|
402 |
|
|
|
403 |
3610fd3f
|
LJIYEON
|
}
|
404 |
|
|
|
405 |
|
|
if (DB.SaveValveGroupItemsSetting(currentValveGroupInfo.ValveGroupItems))
|
406 |
|
|
MessageBox.Show("Save was successful", "ID2 " + ID2Info.ProgramName, MessageBoxButtons.OK, MessageBoxIcon.Information);
|
407 |
|
|
else
|
408 |
|
|
MessageBox.Show("Failed to save", "ID2 " + ID2Info.ProgramName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
409 |
|
|
}
|
410 |
|
|
|
411 |
|
|
private void btnClose_Click(object sender, EventArgs e)
|
412 |
|
|
{
|
413 |
|
|
DialogResult = DialogResult.Cancel;
|
414 |
|
|
}
|
415 |
|
|
}
|
416 |
|
|
} |