hytos / ID2.Manager / ID2.Manager / Main.cs @ fe57f64a
이력 | 보기 | 이력해설 | 다운로드 (66.9 KB)
1 |
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 |
|
11 |
using System.IO; |
12 |
using System.Reflection; |
13 |
|
14 |
using ID2.Manager.Controls; |
15 |
using ID2.Manager.Common; |
16 |
using ID2.Manager.Classes; |
17 |
using ID2.Manager.Data.Models; |
18 |
using ID2.Manager.Forms; |
19 |
using ID2.Manager.Controller.Controllers; |
20 |
using static ID2.Manager.Data.Models.Documents; |
21 |
|
22 |
using Telerik.WinControls; |
23 |
using Telerik.WinControls.UI; |
24 |
using Telerik.WinControls.Data; |
25 |
|
26 |
using GemBox.Spreadsheet; |
27 |
|
28 |
using Newtonsoft.Json; |
29 |
using System.Diagnostics; |
30 |
|
31 |
namespace ID2.Manager |
32 |
{ |
33 |
public partial class Main : RadRibbonForm |
34 |
{ |
35 |
readonly Informations informations = Informations.Instance; |
36 |
List<MarkupText> Markups = new List<MarkupText>(); |
37 |
List<Documents> documents = new List<Documents>(); |
38 |
List<Documents> orgDocuments = null; |
39 |
|
40 |
private readonly Color _SummaryColor = Color.FromArgb(255, 108, 55); |
41 |
|
42 |
public Main() |
43 |
{ |
44 |
InitializeComponent(); |
45 |
|
46 |
|
47 |
//Telerik.WinControls.RadControlSpy.RadControlSpyForm radControlSpyForm = new Telerik.WinControls.RadControlSpy.RadControlSpyForm(); |
48 |
//radControlSpyForm.Show(); |
49 |
|
50 |
SpreadsheetInfo.SetLicense(Properties.Settings.Default.GemBoxLicense); |
51 |
|
52 |
this.Load += Main_Load; |
53 |
this.radButtonElementSave.Click += RadButtonElementSave_Click; |
54 |
this.radButtonElementExcelImport.Click += RadButtonElementExcelImport_Click; |
55 |
this.radButtonElementExcelExport.Click += RadButtonElementExcelExport_Click; |
56 |
|
57 |
this.radCheckBox1.CheckStateChanged += RadCheckBox_CheckStateChanged; |
58 |
this.radCheckBox2.CheckStateChanged += RadCheckBox_CheckStateChanged; |
59 |
this.radCheckBox3.CheckStateChanged += RadCheckBox_CheckStateChanged; |
60 |
this.radCheckBox4.CheckStateChanged += RadCheckBox_CheckStateChanged; |
61 |
|
62 |
this.radTextBoxDocumentNo.KeyDown += RadTextBoxDocumentNo_KeyDown; |
63 |
this.radButtonSearch.Click += RadButtonSearch_Click; |
64 |
this.radButtonID2.Click += RadButtonID2_Click; |
65 |
|
66 |
this.radGridViewDocuments.ViewCellFormatting += RadGridViewDocuments_ViewCellFormatting; |
67 |
this.radGridViewDocuments.CellBeginEdit += RadGridViewDocuments_CellBeginEdit; |
68 |
this.radGridViewDocuments.CommandCellClick += RadGridViewDocuments_CommandCellClick; |
69 |
|
70 |
this.radGridViewDocuments.MasterView.TableHeaderRow.MinHeight = 36; |
71 |
this.radGridViewDocuments.TableElement.RowHeaderColumnWidth = 36; |
72 |
this.radGridViewDocuments.MasterView.TableSearchRow.IsVisible = false; |
73 |
|
74 |
var openProjectView = new OpenProjectView() |
75 |
{ |
76 |
Dock = DockStyle.Fill |
77 |
}; |
78 |
this.backstageViewPageOpenProject.Controls.Add(openProjectView); |
79 |
openProjectView.OpenProjectClick += OpenProjectView_OpenProjectClick; |
80 |
this.backstageButtonItemUserRegistration.Click += BackstageButtonItemUserRegistration_Click; |
81 |
this.backstageButtonItemExit.Click += BackstageButtonItemExit_Click; |
82 |
this.radRibbonBarBackstageViewID2Manager.BackstageViewOpened += RadRibbonBarBackstageViewID2Manager_BackstageViewOpened; |
83 |
this.radRibbonBarBackstageViewID2Manager.BackstageViewClosed += RadRibbonBarBackstageViewID2Manager_BackstageViewClosed; |
84 |
|
85 |
this.InitColumnGroupsViewDefinition(this.radGridViewDocuments); |
86 |
|
87 |
this.Initialize(); |
88 |
} |
89 |
|
90 |
#region Init, Load |
91 |
private void Initialize() |
92 |
{ |
93 |
IEnumerable<UserInfo> allUserList = new UserController().GetAllUserInfo(); |
94 |
allUserList.ToList().ForEach(x => informations.UserList.Add(x.DeepCopy(x))); |
95 |
|
96 |
this.radLabelElementUser.Text = $"{informations.ActiveUser.ID} {informations.ActiveUser.Name}"; |
97 |
|
98 |
if ((new string[] { "Manager", "User" }).Contains(informations.ActiveUser.Role) && string.IsNullOrEmpty(informations.ActiveUser.RefProjectID)) |
99 |
{ |
100 |
this.backstageViewPageOpenProject.Controls[0].Visible = true; |
101 |
this.backstageTabItemOpenProject.Visibility = ElementVisibility.Visible; |
102 |
this.backstageButtonItemUserRegistration.Visibility = ElementVisibility.Visible; |
103 |
} |
104 |
else |
105 |
{ |
106 |
foreach(Control ctrl in this.backstageViewPageOpenProject.Controls) |
107 |
{ |
108 |
ctrl.Visible = false; |
109 |
} |
110 |
this.backstageTabItemOpenProject.Visibility = ElementVisibility.Collapsed; |
111 |
this.backstageButtonItemUserRegistration.Visibility = ElementVisibility.Collapsed; |
112 |
} |
113 |
} |
114 |
|
115 |
protected override void OnLoad(EventArgs e) |
116 |
{ |
117 |
if (informations.ActiveUser != null && !string.IsNullOrEmpty(informations.ActiveUser.RefProjectID)) |
118 |
{ |
119 |
informations.ActiveProject = new ProjectController().GetProjectInfo(informations.ActiveUser.RefProjectID); |
120 |
informations.ProjectList = new ProjectController().GetAllProjectList().ToList(); |
121 |
|
122 |
this.LoadProject(); |
123 |
} |
124 |
else |
125 |
{ |
126 |
this.radRibbonBarBackstageViewID2Manager.ShowPopup(this.GetBackstageLocation(), this.ID2ManagerRadRibbonBar.RibbonBarElement); |
127 |
} |
128 |
|
129 |
base.OnLoad(e); |
130 |
} |
131 |
|
132 |
public Point GetBackstageLocation() |
133 |
{ |
134 |
Point location = this.ID2ManagerRadRibbonBar.RibbonBarElement.ApplicationButtonElement.ControlBoundingRectangle.Location; |
135 |
location.Offset(new Point(0, this.ID2ManagerRadRibbonBar.RibbonBarElement.ApplicationButtonElement.ControlBoundingRectangle.Height)); |
136 |
location.Offset(this.ID2ManagerRadRibbonBar.Location); |
137 |
|
138 |
return location; |
139 |
} |
140 |
|
141 |
private void Main_Load(object sender, EventArgs e) |
142 |
{ |
143 |
InitializeSearch(); |
144 |
InitializeGridViewDetail(); |
145 |
|
146 |
this.radGridViewDocuments.DataSource = this.documents; |
147 |
|
148 |
} |
149 |
|
150 |
private void InitializeSearch() |
151 |
{ |
152 |
var font1 = ThemeResolutionService.GetCustomFont("TelerikWebUI"); |
153 |
|
154 |
lbSearch.Text = "\ue13E"; |
155 |
btnSearchNext.Text = "\ue006"; |
156 |
btnSearchPrevious.Text = "\ue004"; |
157 |
|
158 |
var chkbox = new RadCheckBoxElement(); |
159 |
chkbox.Text = "Match Case"; |
160 |
chkbox.CheckStateChanged += (snd, evt) => { radGridViewDocuments.MasterView.TableSearchRow.CaseSensitive = chkbox.Checked; }; |
161 |
|
162 |
btnMatchCase.HostedItem = chkbox; |
163 |
|
164 |
var chkbox1 = new RadCheckBoxElement(); |
165 |
chkbox1.Text = "Show All Detail"; |
166 |
chkbox1.CheckStateChanged += (snd, evt) => |
167 |
{ |
168 |
radGridViewDocuments.MasterView.ChildRows.ForAll(x=>x.IsExpanded = chkbox1.Checked); |
169 |
}; |
170 |
|
171 |
btnShowAllDetail.HostedItem = chkbox1; |
172 |
|
173 |
var chkbox2 = new RadCheckBoxElement(); |
174 |
chkbox2.Text = "Search from current position"; |
175 |
chkbox2.CheckStateChanged += (snd, evt) => { radGridViewDocuments.MasterView.TableSearchRow.SearchFromCurrentPosition = chkbox.Checked; }; |
176 |
|
177 |
btnSearchFormCurrent.HostedItem = chkbox2; |
178 |
|
179 |
var columns = radGridViewDocuments.Columns.Where(x => x.AllowSearching).Select(x => |
180 |
new FilterColumn |
181 |
{ |
182 |
Name = x.HeaderText, |
183 |
FieldName = x.FieldName, |
184 |
IsSelect = x.AllowSearching |
185 |
}); |
186 |
|
187 |
var panel = new StackLayoutElement(); |
188 |
panel.Orientation = Orientation.Vertical; |
189 |
|
190 |
var btnComboColumns = new RadCheckedDropDownListElement(); |
191 |
btnComboColumns.ShowCheckAllItems = true; |
192 |
btnComboColumns.CheckAllItem.Checked = true; |
193 |
btnComboColumns.AutoCompleteEditableAreaElement.NullText = "Search in Columns"; |
194 |
btnComboColumns.AutoCompleteEditableAreaElement.AutoCompleteTextBox.IsReadOnly = true; |
195 |
btnComboColumns.DropDownMinSize = new Size(200, 200); |
196 |
btnComboColumns.DropDownSizingMode = SizingMode.UpDownAndRightBottom; |
197 |
btnComboColumns.DisplayMember = "Name"; |
198 |
btnComboColumns.CheckedMember = "IsSelect"; |
199 |
btnComboColumns.ValueMember = "FieldName"; |
200 |
btnComboColumns.TextBox.CustomFont = font1.Name; |
201 |
btnComboColumns.TextBox.Text = "\ue13A"; |
202 |
|
203 |
btnComboColumns.DataSource = columns; |
204 |
|
205 |
txtFullSearch.TextBoxElement.ClearButton.Click += (snd, evt) => |
206 |
{ |
207 |
radGridViewDocuments.MasterTemplate.Refresh(null); |
208 |
}; |
209 |
|
210 |
btnComboColumns.PopupOpening += (snd, evt) => |
211 |
{ |
212 |
(snd as RadCheckedDropDownListElement).CheckAllItem.Checked = (snd as RadCheckedDropDownListElement).Items.All(x => (x.DataBoundItem as FilterColumn).IsSelect); |
213 |
}; |
214 |
|
215 |
btnComboColumns.PopupClosed += (snd, evt) => |
216 |
{ |
217 |
foreach (RadCheckedListDataItem item in btnComboColumns.Items) |
218 |
{ |
219 |
radGridViewDocuments.Columns[item.Value.ToString()].AllowSearching = item.Checked; |
220 |
} |
221 |
}; |
222 |
|
223 |
btnFilters.HostedItem = btnComboColumns; |
224 |
} |
225 |
|
226 |
private void InitializeGridViewDetail() |
227 |
{ |
228 |
|
229 |
this.radGridViewDocuments.CreateCell += RadGridViewDocuments_CreateCell; |
230 |
this.radGridViewDocuments.ChildViewExpanded += RadGridViewDocuments_ChildViewExpanded; |
231 |
} |
232 |
|
233 |
private void RadGridViewDocuments_ChildViewExpanded(object sender, ChildViewExpandedEventArgs e) |
234 |
{ |
235 |
//e.ChildRow.ChildViewInfos[0].ChildRows[0].Height = 152; |
236 |
//e.ChildRow.ChildViewInfos[2].ChildRows[0].Height = 152; |
237 |
e.ChildRow.Height = 224; |
238 |
} |
239 |
|
240 |
private void RadGridViewDocuments_CreateCell(object sender, GridViewCreateCellEventArgs e) |
241 |
{ |
242 |
//if (e.CellType == typeof(GridDetailViewCellElement)) |
243 |
//{ |
244 |
// //e.CellElement = new DetailGridViewElement(e.Column, e.Row); |
245 |
//} |
246 |
} |
247 |
#endregion |
248 |
|
249 |
private void OpenProjectView_OpenProjectClick(object sender, EventArgs e) |
250 |
{ |
251 |
//if (e is ProjectEventArgs) |
252 |
//{ |
253 |
// var projectGroup = (e as ProjectEventArgs).ProjectInfo; |
254 |
// var projects = (e as ProjectEventArgs).ProjectList; |
255 |
|
256 |
// if (projectGroup != null) |
257 |
// { |
258 |
// informations.ActiveProject = projectGroup; |
259 |
// } |
260 |
|
261 |
// if (projects != null) |
262 |
// { |
263 |
// informations.ProjectList = projects; |
264 |
// } |
265 |
//} |
266 |
|
267 |
this.radRibbonBarBackstageViewID2Manager.Tag = e; |
268 |
this.radRibbonBarBackstageViewID2Manager.HidePopup(); |
269 |
} |
270 |
|
271 |
private void RadRibbonBarBackstageViewID2Manager_BackstageViewOpened(object sender, EventArgs e) |
272 |
{ |
273 |
this.radRibbonBarBackstageViewID2Manager.SelectedItem = this.backstageTabItemOpenProject; |
274 |
|
275 |
foreach ( Control ctrl in this.backstageViewPageOpenProject.Controls) |
276 |
{ |
277 |
if (ctrl is OpenProjectView) |
278 |
{ |
279 |
var openProjectView = ctrl as OpenProjectView; |
280 |
openProjectView.GetProjectGroups(); |
281 |
break; |
282 |
} |
283 |
} |
284 |
} |
285 |
|
286 |
private void RadRibbonBarBackstageViewID2Manager_BackstageViewClosed(object sender, EventArgs e) |
287 |
{ |
288 |
if (this.radRibbonBarBackstageViewID2Manager.Tag is ProjectEventArgs) |
289 |
{ |
290 |
var prjArgs = this.radRibbonBarBackstageViewID2Manager.Tag as ProjectEventArgs; |
291 |
|
292 |
informations.ActiveProject = prjArgs.ProjectInfo; |
293 |
informations.ProjectList = prjArgs.ProjectList; |
294 |
|
295 |
this.radRibbonBarBackstageViewID2Manager.Tag = null; |
296 |
|
297 |
this.LoadProject(); |
298 |
} |
299 |
} |
300 |
|
301 |
private void LoadProject() |
302 |
{ |
303 |
#region 도면 |
304 |
//Project List |
305 |
if (this.radDropDownListProject.Items.Count > 0) |
306 |
this.radDropDownListProject.Items.Clear(); |
307 |
informations.ProjectList.Where(x => x.GroupID.Equals(informations.ActiveProject.ProjectID)).ToList() |
308 |
.ForEach(x => |
309 |
{ |
310 |
this.radDropDownListProject.Items.Add(new RadListDataItem(x.Name, x.Code)); |
311 |
}); |
312 |
var allProject = new RadListDataItem("== 전체 ==", string.Empty); |
313 |
this.radDropDownListProject.Items.Insert(0, allProject); |
314 |
allProject.Selected = true; |
315 |
|
316 |
//담당자 List |
317 |
if (this.radDropDownListPersonInCharge.Items.Count > 0) |
318 |
this.radDropDownListPersonInCharge.Items.Clear(); |
319 |
informations.UserList.ForEach(x => |
320 |
{ |
321 |
if ((new string[] { "Manager", "User" }).Contains(x.Role) && string.IsNullOrEmpty(x.RefProjectID)) |
322 |
this.radDropDownListPersonInCharge.Items.Add(new RadListDataItem(x.Name, x.ID)); |
323 |
}); |
324 |
var allUser = new RadListDataItem("== 전체 ==", string.Empty); |
325 |
this.radDropDownListPersonInCharge.Items.Insert(0, allUser); |
326 |
allUser.Selected = true; |
327 |
|
328 |
//난이도 |
329 |
if (this.radDropDownListJobLevel.Items.Count > 0) |
330 |
this.radDropDownListJobLevel.Items.Clear(); |
331 |
informations.JobLevel.ForEach(x => |
332 |
{ |
333 |
this.radDropDownListJobLevel.Items.Add(new RadListDataItem(x, x)); |
334 |
}); |
335 |
var allJobLevel = new RadListDataItem("== 전체 ==", string.Empty); |
336 |
this.radDropDownListJobLevel.Items.Insert(0, allJobLevel); |
337 |
allJobLevel.Selected = true; |
338 |
|
339 |
//도면번호 조회조건 |
340 |
this.radTextBoxDocumentNo.Text = string.Empty; |
341 |
#endregion |
342 |
|
343 |
#region 검토 |
344 |
//ID2 작업가능 |
345 |
if (this.radDropDownListIsID2Work.Items.Count > 0) |
346 |
this.radDropDownListIsID2Work.Items.Clear(); |
347 |
informations.IsYesNo.ForEach(x => |
348 |
{ |
349 |
this.radDropDownListIsID2Work.Items.Add(new RadListDataItem(x, x)); |
350 |
}); |
351 |
var allIsID2Work = new RadListDataItem("== 전체 ==", string.Empty); |
352 |
this.radDropDownListIsID2Work.Items.Insert(0, allIsID2Work); |
353 |
allIsID2Work.Selected = true; |
354 |
#endregion |
355 |
|
356 |
#region 작업 |
357 |
//ID2 Status |
358 |
if (this.radDropDownListID2Status.Items.Count > 0) |
359 |
this.radDropDownListID2Status.Items.Clear(); |
360 |
informations.JobStatus.ForEach(x => |
361 |
{ |
362 |
this.radDropDownListID2Status.Items.Add(new RadListDataItem(x, x)); |
363 |
}); |
364 |
var allID2Status = new RadListDataItem("== 전체 ==", string.Empty); |
365 |
this.radDropDownListID2Status.Items.Insert(0, allID2Status); |
366 |
allID2Status.Selected = true; |
367 |
|
368 |
//AVEVA Status |
369 |
if (this.radDropDownListAVEVAStatus.Items.Count > 0) |
370 |
this.radDropDownListAVEVAStatus.Items.Clear(); |
371 |
informations.JobStatus.ForEach(x => |
372 |
{ |
373 |
this.radDropDownListAVEVAStatus.Items.Add(new RadListDataItem(x, x)); |
374 |
}); |
375 |
var allAVEVAStatus = new RadListDataItem("== 전체 ==", string.Empty); |
376 |
this.radDropDownListAVEVAStatus.Items.Insert(0, allAVEVAStatus); |
377 |
allAVEVAStatus.Selected = true; |
378 |
#endregion |
379 |
|
380 |
#region 확인 |
381 |
//도프텍 결과 |
382 |
if (this.radDropDownListProdIsResult.Items.Count > 0) |
383 |
this.radDropDownListProdIsResult.Items.Clear(); |
384 |
informations.ValidationResult.ForEach(x => |
385 |
{ |
386 |
this.radDropDownListProdIsResult.Items.Add(new RadListDataItem(x, x)); |
387 |
}); |
388 |
var allProdIsResult = new RadListDataItem("== 전체 ==", string.Empty); |
389 |
this.radDropDownListProdIsResult.Items.Insert(0, allProdIsResult); |
390 |
allProdIsResult.Selected = true; |
391 |
|
392 |
//삼성 결과 |
393 |
if (this.radDropDownListClientIsResult.Items.Count > 0) |
394 |
this.radDropDownListClientIsResult.Items.Clear(); |
395 |
informations.ValidationResult.ForEach(x => |
396 |
{ |
397 |
this.radDropDownListClientIsResult.Items.Add(new RadListDataItem(x, x)); |
398 |
}); |
399 |
var allClientIsResult = new RadListDataItem("== 전체 ==", string.Empty); |
400 |
this.radDropDownListClientIsResult.Items.Insert(0, allClientIsResult); |
401 |
allClientIsResult.Selected = true; |
402 |
#endregion |
403 |
|
404 |
this.GetDocList(); |
405 |
this.DocumentListBinding(); |
406 |
|
407 |
Markups = this.documents.Where(x=>!string.IsNullOrWhiteSpace(x.MarkupText)).Select(x => new MarkupText { DocumentNo = x.DocumentNo, Text = x.MarkupText }).ToList(); |
408 |
|
409 |
this.radGridViewDocuments.Templates[0].DataSource = Markups; |
410 |
|
411 |
if (!this.radGridViewDocuments.Relations.Contains("MarkupTextRelation")) |
412 |
{ |
413 |
GridViewRelation relation = new GridViewRelation(this.radGridViewDocuments.MasterTemplate); |
414 |
relation.ChildTemplate = this.radGridViewDocuments.Templates[0]; |
415 |
relation.RelationName = "MarkupTextRelation"; |
416 |
relation.ParentColumnNames.Add("DocumentNo"); |
417 |
relation.ChildColumnNames.Add("DocumentNo"); |
418 |
this.radGridViewDocuments.Relations.Add(relation); |
419 |
} |
420 |
} |
421 |
|
422 |
#region Document List 조회 |
423 |
public void GetDocList() |
424 |
{ |
425 |
if (this.radDropDownListProject.SelectedValue != null) |
426 |
{ |
427 |
string projectCode = this.radDropDownListProject.SelectedValue.ToString(); |
428 |
string personIncharge = this.radDropDownListPersonInCharge.SelectedValue.ToString(); |
429 |
string jobLevel = this.radDropDownListJobLevel.SelectedValue.ToString();// |
430 |
string documentNo = this.radTextBoxDocumentNo.Text.Trim(); |
431 |
|
432 |
string isID2Work = this.radDropDownListIsID2Work.SelectedValue.ToString();// |
433 |
|
434 |
string id2Status = this.radDropDownListID2Status.SelectedValue.ToString();// |
435 |
string avevaStatus = this.radDropDownListAVEVAStatus.SelectedValue.ToString();// |
436 |
|
437 |
string prodIsResult = this.radDropDownListProdIsResult.SelectedValue.ToString();// |
438 |
string clientIsResult = this.radDropDownListClientIsResult.SelectedValue.ToString();// |
439 |
|
440 |
this.documents = new DocumentController().GetAllDocuments(projectCode, personIncharge, jobLevel, documentNo, isID2Work, id2Status, avevaStatus, prodIsResult, clientIsResult).ToList(); |
441 |
this.orgDocuments = JsonConvert.DeserializeObject<List<Documents>>(JsonConvert.SerializeObject(this.documents)); |
442 |
} |
443 |
} |
444 |
|
445 |
public void GetDocListbyID2() |
446 |
{ |
447 |
if (this.radDropDownListProject.SelectedValue != null) |
448 |
{ |
449 |
string projectCode = this.radDropDownListProject.SelectedValue.ToString(); |
450 |
string personIncharge = this.radDropDownListPersonInCharge.SelectedValue.ToString(); |
451 |
string jobLevel = this.radDropDownListJobLevel.SelectedValue.ToString(); |
452 |
string documentNo = this.radTextBoxDocumentNo.Text.Trim(); |
453 |
|
454 |
string isID2Work = this.radDropDownListIsID2Work.SelectedValue.ToString(); |
455 |
|
456 |
string id2Status = this.radDropDownListID2Status.SelectedValue.ToString(); |
457 |
string avevaStatus = this.radDropDownListAVEVAStatus.SelectedValue.ToString(); |
458 |
|
459 |
string prodIsResult = this.radDropDownListProdIsResult.SelectedValue.ToString(); |
460 |
string clientIsResult = this.radDropDownListClientIsResult.SelectedValue.ToString(); |
461 |
|
462 |
var id2Prjs = informations.ProjectList.Where(x => x.GroupID.Equals(informations.ActiveProject.ProjectID)).Select(x => x.ID2Info).ToList(); |
463 |
this.documents = new DocumentController().GetAllDocuments(id2Prjs, projectCode, personIncharge, jobLevel, documentNo, isID2Work, id2Status, avevaStatus, prodIsResult, clientIsResult).ToList(); |
464 |
this.orgDocuments = JsonConvert.DeserializeObject<List<Documents>>(JsonConvert.SerializeObject(this.documents)); |
465 |
} |
466 |
} |
467 |
|
468 |
public void DocumentListBinding() |
469 |
{ |
470 |
GridViewComboBoxColumn ColProjects = this.radGridViewDocuments.Columns["RefProjectCode"] as GridViewComboBoxColumn; |
471 |
ColProjects.DataSource = informations.ProjectList.Where(x => x.GroupID.Equals(informations.ActiveProject.ProjectID)).ToList(); |
472 |
ColProjects.DisplayMember = "Name"; |
473 |
ColProjects.ValueMember = "Code"; |
474 |
|
475 |
var workUsers = informations.UserList.Where(x => (new string[] { "Manager", "User" }).Contains(x.Role) && string.IsNullOrEmpty(x.RefProjectID)); |
476 |
var clientUsers = informations.UserList.Where(x => !string.IsNullOrEmpty(x.RefProjectID)); |
477 |
|
478 |
GridViewComboBoxColumn ColPersonInCharge = this.radGridViewDocuments.Columns["PersonInCharge"] as GridViewComboBoxColumn; |
479 |
ColPersonInCharge.DataSource = workUsers; |
480 |
ColPersonInCharge.DisplayMember = "Name"; |
481 |
ColPersonInCharge.ValueMember = "ID"; |
482 |
|
483 |
GridViewComboBoxColumn ColToCreator = this.radGridViewDocuments.Columns["ToCreator"] as GridViewComboBoxColumn; |
484 |
ColToCreator.DataSource = workUsers; |
485 |
ColToCreator.DisplayMember = "Name"; |
486 |
ColToCreator.ValueMember = "ID"; |
487 |
|
488 |
GridViewComboBoxColumn ColFrCreator = this.radGridViewDocuments.Columns["FrCreator"] as GridViewComboBoxColumn; |
489 |
ColFrCreator.DataSource = clientUsers; |
490 |
ColFrCreator.DisplayMember = "Name"; |
491 |
ColFrCreator.ValueMember = "ID"; |
492 |
|
493 |
GridViewComboBoxColumn ColProdReviewer = this.radGridViewDocuments.Columns["ProdReviewer"] as GridViewComboBoxColumn; |
494 |
ColProdReviewer.DataSource = workUsers; |
495 |
ColProdReviewer.DisplayMember = "Name"; |
496 |
ColProdReviewer.ValueMember = "ID"; |
497 |
|
498 |
GridViewComboBoxColumn ColClientReviewer = this.radGridViewDocuments.Columns["ClientReviewer"] as GridViewComboBoxColumn; |
499 |
ColClientReviewer.DataSource = clientUsers; |
500 |
ColClientReviewer.DisplayMember = "Name"; |
501 |
ColClientReviewer.ValueMember = "ID"; |
502 |
|
503 |
//Data |
504 |
if (this.radGridViewDocuments.DataSource != null) |
505 |
this.radGridViewDocuments.DataSource = null; |
506 |
|
507 |
/* |
508 |
var info = informations.ProjectList.Where(x => x.Name.Equals("APAO")).FirstOrDefault().ID2Info; |
509 |
var id2Datas = new DocumentController(info).GetID2DrawingsByProject(info); |
510 |
var test = from doc in this.documents |
511 |
join id2 in id2Datas on doc.DocumentNo equals id2.DOCNAME into gj |
512 |
from docs in gj.DefaultIfEmpty() |
513 |
select new Documents() |
514 |
{ |
515 |
DocumentNo = doc.DocumentNo, |
516 |
ID2EndDate = docs?.DATETIME == null ? (DateTime?)null : Convert.ToDateTime(docs?.DATETIME) |
517 |
//ProdRemarks = docs.DATETIME ?? null |
518 |
}; |
519 |
*/ |
520 |
|
521 |
this.radGridViewDocuments.DataSource = this.documents; |
522 |
|
523 |
if (this.radGridViewDocuments.SummaryRowsBottom != null) |
524 |
this.radGridViewDocuments.SummaryRowsBottom.Clear(); |
525 |
|
526 |
string totalCount = String.Format("{0:#,###}", this.documents.Count()); |
527 |
|
528 |
//Summary |
529 |
GridViewSummaryRowItem summaryRowItem = new GridViewSummaryRowItem() |
530 |
{ |
531 |
new GridViewSummaryItem("DocumentNo", "{0:#,###} / " + totalCount, GridAggregateFunction.Count) |
532 |
}; |
533 |
this.radGridViewDocuments.SummaryRowsBottom.Add(summaryRowItem); |
534 |
this.radGridViewDocuments.MasterView.SummaryRows[0].PinPosition = PinnedRowPosition.Bottom; |
535 |
this.radGridViewDocuments.MasterTemplate.BottomPinnedRowsMode = GridViewBottomPinnedRowsMode.Fixed; |
536 |
} |
537 |
#endregion |
538 |
|
539 |
#region Button, Checkbox event |
540 |
private void RadCheckBox_CheckStateChanged(object sender, EventArgs e) |
541 |
{ |
542 |
if (sender is RadCheckBox) |
543 |
{ |
544 |
RadCheckBox checkBox = sender as RadCheckBox; |
545 |
|
546 |
if (checkBox.Tag != null) |
547 |
{ |
548 |
ColumnGroupsViewDefinition columnGroupsView = this.radGridViewDocuments.MasterTemplate.ViewDefinition as ColumnGroupsViewDefinition; |
549 |
GridViewColumnGroup colGroup = columnGroupsView.GetAllGroups().Where(x => x.Name.Equals(checkBox.Tag.ToString())).FirstOrDefault(); |
550 |
if (colGroup != null) |
551 |
colGroup.IsVisible = checkBox.Checked; |
552 |
} |
553 |
} |
554 |
|
555 |
//ColumnGroupsViewDefinition columnGroupsView = this.radGridViewDocuments.MasterTemplate.ViewDefinition = columnGroupsView; |
556 |
} |
557 |
|
558 |
private void RadTextBoxDocumentNo_KeyDown(object sender, KeyEventArgs e) |
559 |
{ |
560 |
if (e.KeyCode == Keys.Enter) |
561 |
{ |
562 |
this.radButtonSearch.Focus(); |
563 |
this.radButtonSearch.PerformClick(); |
564 |
} |
565 |
} |
566 |
|
567 |
private void RadButtonSearch_Click(object sender, EventArgs e) |
568 |
{ |
569 |
this.GetDocList(); |
570 |
this.DocumentListBinding(); |
571 |
} |
572 |
|
573 |
private void RadButtonID2_Click(object sender, EventArgs e) |
574 |
{ |
575 |
this.GetDocListbyID2(); |
576 |
this.DocumentListBinding(); |
577 |
} |
578 |
|
579 |
private void BackstageButtonItemUserRegistration_Click(object sender, EventArgs e) |
580 |
{ |
581 |
using (var frm = new SetupUser()) |
582 |
{ |
583 |
if (frm.ShowDialog(this) == DialogResult.OK) |
584 |
{ |
585 |
|
586 |
} |
587 |
} |
588 |
} |
589 |
|
590 |
private void BackstageButtonItemExit_Click(object sender, EventArgs e) |
591 |
{ |
592 |
Application.Exit(); |
593 |
} |
594 |
#endregion |
595 |
|
596 |
#region Grid event |
597 |
private void RadGridViewDocuments_CommandCellClick(object sender, GridViewCellEventArgs e) |
598 |
{ |
599 |
if (e.Row is GridViewNewRowInfo) |
600 |
{ |
601 |
|
602 |
} |
603 |
else |
604 |
{ |
605 |
string extension = string.Empty; |
606 |
|
607 |
switch (e.Column.Name) |
608 |
{ |
609 |
case "AutoCADLink": |
610 |
{ |
611 |
Controls.AutoCADViewer viewer = null; |
612 |
foreach (var control in this.radSplitContainerViewer.SplitPanels[0].Controls) |
613 |
{ |
614 |
if (control is Controls.AutoCADViewer _viewer) |
615 |
{ |
616 |
viewer = _viewer; |
617 |
break; |
618 |
} |
619 |
} |
620 |
|
621 |
if (viewer == null) |
622 |
{ |
623 |
viewer = new Controls.AutoCADViewer() { Dock = DockStyle.Fill }; |
624 |
this.radSplitContainerViewer.SplitPanels[0].Controls.Add(viewer); |
625 |
} |
626 |
else |
627 |
{ |
628 |
viewer.Visible = true; |
629 |
} |
630 |
|
631 |
if (e.Row.DataBoundItem is Documents doc) |
632 |
{ |
633 |
extension = "dwg"; |
634 |
string filePath = Path.Combine(informations.FindID2LocalPath(doc.RefProjectCode), "drawings", "Native", $"{doc.DocumentNo}.{extension}"); |
635 |
|
636 |
if (File.Exists(filePath) && viewer != null) viewer.ReadDWG(filePath); |
637 |
} |
638 |
} |
639 |
break; |
640 |
case "PDFLink": |
641 |
Controls.PDFViewer pdfviewer = null; |
642 |
foreach (var control in this.radSplitContainerViewer.SplitPanels[1].Controls) |
643 |
{ |
644 |
if (control is Controls.PDFViewer _viewer) |
645 |
{ |
646 |
pdfviewer = _viewer; |
647 |
break; |
648 |
} |
649 |
} |
650 |
|
651 |
if (pdfviewer == null) |
652 |
{ |
653 |
pdfviewer = new Controls.PDFViewer() { Dock = DockStyle.Fill }; |
654 |
this.radSplitContainerViewer.SplitPanels[1].Controls.Add(pdfviewer); |
655 |
} |
656 |
else |
657 |
{ |
658 |
pdfviewer.Visible = true; |
659 |
} |
660 |
|
661 |
break; |
662 |
case "MarkupLink": |
663 |
{ |
664 |
if (e.Row.DataBoundItem is Documents doc) |
665 |
{ |
666 |
if (!string.IsNullOrWhiteSpace(doc.RefProjectCode) && !string.IsNullOrWhiteSpace(doc.DocumentNo) && !string.IsNullOrWhiteSpace(doc.PersonInCharge)) |
667 |
{ |
668 |
bool result = MarkusHelper.Start(doc.RefProjectCode, doc.DocumentNo, doc.PersonInCharge); |
669 |
} |
670 |
} |
671 |
} |
672 |
break; |
673 |
case "AVEVALink": |
674 |
case "AVEVAConnection": |
675 |
MessageBox.Show($"{e.Column.Name} 실행"); |
676 |
break; |
677 |
case "ReviewFileName"://일단주석 |
678 |
MessageBox.Show($"{e.Column.Name} 실행"); |
679 |
break; |
680 |
case "SystemLink": |
681 |
MessageBox.Show($"{e.Column.Name} 실행"); |
682 |
break; |
683 |
case "ToCapturePath": |
684 |
case "FrCapturePath": |
685 |
|
686 |
if (e.Row.DataBoundItem is Documents dd) |
687 |
{ |
688 |
using (var frm = new ImageView(dd.DocID)) |
689 |
{ |
690 |
frm.ShowDialog(this); |
691 |
} |
692 |
} |
693 |
break; |
694 |
case "ID2Connection": |
695 |
try |
696 |
{ |
697 |
if (e.Row.DataBoundItem is Documents doc) |
698 |
{ |
699 |
ID2Helper.OpenPID(doc.DocumentNo, string.Empty, Properties.Settings.Default.ID2Port); |
700 |
|
701 |
try |
702 |
{ |
703 |
if (doc.ID2StartDate == null) |
704 |
{ |
705 |
var returnDoc = new DocumentController().SetDocumentDataField(new Documents() |
706 |
{ |
707 |
DocID = doc.DocID, |
708 |
ID2StartDate = DateTime.Now |
709 |
}, informations.ActiveUser.ID); |
710 |
|
711 |
if (returnDoc != null) |
712 |
{ |
713 |
doc.ID2StartDate = returnDoc.ID2StartDate; |
714 |
} |
715 |
} |
716 |
} |
717 |
catch { } |
718 |
} |
719 |
} |
720 |
catch (Exception ex) |
721 |
{ |
722 |
RadMessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, RadMessageIcon.Error); |
723 |
} |
724 |
break; |
725 |
} |
726 |
} |
727 |
} |
728 |
|
729 |
private void RadGridViewDocuments_CellBeginEdit(object sender, GridViewCellCancelEventArgs e) |
730 |
{ |
731 |
if (e.ActiveEditor is RadDropDownListEditor) |
732 |
{ |
733 |
switch (e.Column.Name) |
734 |
{ |
735 |
case "JobLevel": |
736 |
GridViewComboBoxColumn ColJobLevel = this.radGridViewDocuments.Columns[e.Column.Name] as GridViewComboBoxColumn; |
737 |
ColJobLevel.DataSource = informations.JobLevel; |
738 |
break; |
739 |
case "IsTypical": |
740 |
case "ToIsDiscussion": |
741 |
case "ToIsMarkup": |
742 |
case "FrIsMarkup": |
743 |
case "IsID2Work": |
744 |
case "DTIsGateWay": |
745 |
case "DTIsImport": |
746 |
case "DTIsRegSystem": |
747 |
GridViewComboBoxColumn ColYesNo = this.radGridViewDocuments.Columns[e.Column.Name] as GridViewComboBoxColumn; |
748 |
ColYesNo.DataSource = (new string[] { string.Empty }).Union<string>(informations.IsYesNo); |
749 |
break; |
750 |
case "ID2Status": |
751 |
case "AVEVAStatus": |
752 |
GridViewComboBoxColumn ColJobStatus = this.radGridViewDocuments.Columns[e.Column.Name] as GridViewComboBoxColumn; |
753 |
ColJobStatus.DataSource = (new string[] { string.Empty }).Union<string>(informations.JobStatus); |
754 |
break; |
755 |
case "FrReviewStatus"://삼성의견status |
756 |
GridViewComboBoxColumn ColClientStatus = this.radGridViewDocuments.Columns[e.Column.Name] as GridViewComboBoxColumn; |
757 |
ColClientStatus.DataSource = (new string[] { string.Empty }).Union<string>(informations.ClientStatus); |
758 |
break; |
759 |
case "ProdIsResult": |
760 |
case "ClientIsResult": |
761 |
GridViewComboBoxColumn ColResult = this.radGridViewDocuments.Columns[e.Column.Name] as GridViewComboBoxColumn; |
762 |
ColResult.DataSource = (new string[] { string.Empty }).Union<string>(informations.ValidationResult); |
763 |
break; |
764 |
} |
765 |
} |
766 |
} |
767 |
|
768 |
private void RadGridViewDocuments_ViewCellFormatting(object sender, CellFormattingEventArgs e) |
769 |
{ |
770 |
if (e.Row is GridViewDataRowInfo) |
771 |
{ |
772 |
if (e.CellElement is GridRowHeaderCellElement) |
773 |
{ |
774 |
if (e.CellElement.RowIndex > -1) |
775 |
e.CellElement.Text = (e.CellElement.RowIndex + 1).ToString(); |
776 |
} |
777 |
else |
778 |
{ |
779 |
var result = e.Row.DataBoundItem as Documents; |
780 |
if (result != null || e.Row is GridViewNewRowInfo) |
781 |
{ |
782 |
switch (e.CellElement.ColumnInfo.Name) |
783 |
{ |
784 |
case "AutoCADLink": |
785 |
case "PDFLink": |
786 |
case "MarkupLink": |
787 |
case "AVEVALink": |
788 |
case "AVEVAConnection": |
789 |
case "ReviewFileName"://일단주석 |
790 |
case "SystemLink": |
791 |
case "ToCapturePath": |
792 |
case "FrCapturePath": |
793 |
case "ID2Connection": |
794 |
this.GetCommandColBtnElement(e.CellElement.Children[0], e.CellElement.ColumnInfo.Name); |
795 |
break; |
796 |
} |
797 |
} |
798 |
else |
799 |
{ |
800 |
|
801 |
} |
802 |
} |
803 |
} |
804 |
else if (e.Row is GridViewSummaryRowInfo) |
805 |
{ |
806 |
if (e.CellElement is GridRowHeaderCellElement) |
807 |
{ |
808 |
e.CellElement.Text = "Count"; |
809 |
} |
810 |
else if (e.CellElement is GridSummaryCellElement) |
811 |
{ |
812 |
e.CellElement.ForeColor = this._SummaryColor; |
813 |
e.CellElement.TextAlignment = ContentAlignment.BottomRight; |
814 |
e.CellElement.Font = new Font(e.CellElement.Font, FontStyle.Bold); |
815 |
} |
816 |
else |
817 |
{ |
818 |
|
819 |
} |
820 |
} |
821 |
else |
822 |
{ |
823 |
|
824 |
} |
825 |
} |
826 |
|
827 |
private RadButtonElement GetCommandColBtnElement(RadElement elem, string colName) |
828 |
{ |
829 |
RadButtonElement btnElem = null; |
830 |
Bitmap bitmap = null; ; |
831 |
|
832 |
switch (colName) |
833 |
{ |
834 |
case "AutoCADLink": |
835 |
bitmap = new Bitmap(Properties.Resources.cad18); |
836 |
break; |
837 |
case "PDFLink": |
838 |
bitmap = new Bitmap(Properties.Resources.pdf18); |
839 |
break; |
840 |
case "MarkupLink": |
841 |
bitmap = new Bitmap(Properties.Resources.markus18); |
842 |
break; |
843 |
case "AVEVALink": |
844 |
case "AVEVAConnection": |
845 |
bitmap = new Bitmap(Properties.Resources.aveva_net18); |
846 |
break; |
847 |
case "ReviewFileName"://일단주석 |
848 |
bitmap = new Bitmap(Properties.Resources.pdf18); |
849 |
break; |
850 |
case "SystemLink": |
851 |
bitmap = new Bitmap(Properties.Resources.link18_yellow); |
852 |
break; |
853 |
case "ToCapturePath": |
854 |
case "FrCapturePath": |
855 |
bitmap = new Bitmap(Properties.Resources.files18); |
856 |
break; |
857 |
case "ID2Connection": |
858 |
bitmap = new Bitmap(Properties.Resources.id218); |
859 |
break; |
860 |
} |
861 |
|
862 |
switch (colName) |
863 |
{ |
864 |
case "AutoCADLink": |
865 |
case "PDFLink": |
866 |
case "MarkupLink": |
867 |
case "AVEVALink": |
868 |
case "AVEVAConnection": |
869 |
case "ReviewFileName"://일단주석 |
870 |
case "SystemLink": |
871 |
case "ToCapturePath": |
872 |
case "FrCapturePath": |
873 |
case "ID2Connection": |
874 |
btnElem = (RadButtonElement)elem; |
875 |
btnElem.Margin = new Padding(0); |
876 |
btnElem.Padding = new Padding(0); |
877 |
btnElem.BorderElement.Opacity = 0; |
878 |
btnElem.Alignment = ContentAlignment.MiddleCenter; |
879 |
btnElem.DisplayStyle = DisplayStyle.Image; |
880 |
btnElem.Image = bitmap; |
881 |
btnElem.ImageAlignment = ContentAlignment.MiddleCenter; |
882 |
btnElem.MaxSize = bitmap.Size; |
883 |
break; |
884 |
} |
885 |
|
886 |
return btnElem; |
887 |
} |
888 |
#endregion |
889 |
|
890 |
#region Excel |
891 |
private UserInfo GetUser(string user) |
892 |
{ |
893 |
UserInfo userInfo = informations.UserList.Where(x => x.ID.Equals(user)).FirstOrDefault(); |
894 |
if (userInfo != null) return userInfo; |
895 |
|
896 |
userInfo = informations.UserList.Where(x => x.Name.Equals(user)).FirstOrDefault(); |
897 |
if (userInfo != null) return userInfo; |
898 |
|
899 |
return userInfo ?? new UserInfo(); |
900 |
} |
901 |
|
902 |
private ProjectInfo GetProject(string project) |
903 |
{ |
904 |
ProjectInfo prjInfo = informations.ProjectList.Where(x => x.ProjectID.Equals(project)).FirstOrDefault(); |
905 |
if (prjInfo != null) return prjInfo; |
906 |
|
907 |
prjInfo = informations.ProjectList.FirstOrDefault(x => x.Name.Equals(project)); |
908 |
if (prjInfo != null) return prjInfo; |
909 |
|
910 |
return prjInfo ?? new ProjectInfo(); |
911 |
} |
912 |
|
913 |
private void RadButtonElementExcelImport_Click(object sender, EventArgs e) |
914 |
{ |
915 |
using (OpenFileDialog ofd = new OpenFileDialog() |
916 |
{ |
917 |
Filter = "Excel files (*.xlsx)|*.xlsx", |
918 |
Title = "Open an Excel File", |
919 |
RestoreDirectory = true |
920 |
}) |
921 |
{ |
922 |
if (ofd.ShowDialog() == DialogResult.OK) |
923 |
{ |
924 |
//Error Message |
925 |
StringBuilder sbErrMsg = new StringBuilder(); |
926 |
|
927 |
var exFile = ExcelFile.Load(ofd.FileName); |
928 |
var ws = exFile.Worksheets[0]; |
929 |
|
930 |
int rowCount = ws.Rows.Count; |
931 |
int columnCount = ws.CalculateMaxUsedColumns(); |
932 |
int exRow = 8; |
933 |
|
934 |
#region Excel 유효성검사 |
935 |
|
936 |
//Excel 포멧체크 |
937 |
if (rowCount < 10 || columnCount != 45) |
938 |
{ |
939 |
RadMessageBox.Show("Please, check the excel.\n", "Information", MessageBoxButtons.OK, RadMessageIcon.Info); |
940 |
return; |
941 |
} |
942 |
|
943 |
#region 엑셀 필수값 체크(도면 : 이름,담당자, 난이도, Typical) |
944 |
ws.Rows.SelectMany(row => row.AllocatedCells) |
945 |
.Where(col => col.Column.Index > 5 && col.Column.Index < 10 && col.Row.Index > exRow && col.Value == null) |
946 |
.ToList() |
947 |
.ForEach(p => sbErrMsg.Append(", " + p.Column.Name + p.Row.Name)); |
948 |
|
949 |
if (sbErrMsg.Length > 0) |
950 |
{ |
951 |
string errMsg = sbErrMsg.ToString().Substring(2); |
952 |
if (errMsg.Length > 100) |
953 |
{ |
954 |
errMsg = $"{errMsg.Substring(0, 100)}..."; |
955 |
} |
956 |
|
957 |
RadMessageBox.Show($"Please, check null value in excel.\n{errMsg}", "Information", MessageBoxButtons.OK, RadMessageIcon.Info); |
958 |
return; |
959 |
} |
960 |
#endregion |
961 |
|
962 |
#region 엑셀 도명명 중복 값 체크 |
963 |
ws.Rows.SelectMany(row => row.AllocatedCells) |
964 |
.Where(col => col.Column.Index == 6 && col.Row.Index > exRow) |
965 |
.GroupBy(g => g.Row.Index) |
966 |
.Select(p => new { |
967 |
rowIndex = p.Key, |
968 |
docNo = p.Select(x => x.Value.ToString()).FirstOrDefault() |
969 |
}) |
970 |
.GroupBy(g => g.docNo) |
971 |
.Where(p => p.Count() > 1) |
972 |
.Select(p => p.Select(x => (x.rowIndex + 1).ToString()) |
973 |
.Aggregate((x, y) => x.ToString() + "," + y.ToString()) |
974 |
.ToString()) |
975 |
.ToList().ForEach(p => sbErrMsg.Append("\n" + p.ToString())); |
976 |
if (sbErrMsg.Length > 0) |
977 |
{ |
978 |
sbErrMsg.Insert(0, "\n중복 된 도면명 Excel row : "); |
979 |
string errMsg = sbErrMsg.ToString(); |
980 |
if (errMsg.Length > 100) |
981 |
{ |
982 |
errMsg = $"{errMsg.Substring(0, 100)}..."; |
983 |
} |
984 |
|
985 |
RadMessageBox.Show($"Please, check the duplicate value in excel.\n{errMsg}", "Information", MessageBoxButtons.OK, RadMessageIcon.Info); |
986 |
return; |
987 |
} |
988 |
#endregion |
989 |
|
990 |
#endregion |
991 |
|
992 |
List<Documents> appendDocuments = new List<Documents>(); |
993 |
|
994 |
ws.Rows.Where(row => row.Index > exRow) |
995 |
.ToList() |
996 |
.ForEach(p => appendDocuments.Add(new Documents() |
997 |
{ |
998 |
//UID = string.Empty, |
999 |
//Type = this.radTextBoxInsulationType.Text, |
1000 |
//TempFrom = ws.Rows[exRow].Cells[p.Column.Index].Value == null ? 0 : Convert.ToSingle(ws.Rows[exRow].Cells[p.Column.Index].Value), |
1001 |
//TempTo = ws.Rows[exRow + 2].Cells[p.Column.Index].Value == null ? 0 : Convert.ToSingle(ws.Rows[exRow + 2].Cells[p.Column.Index].Value), |
1002 |
//NPS = ws.Rows[p.Row.Index].Cells[0].Value == null ? 0 : Convert.ToSingle(ws.Rows[p.Row.Index].Cells[0].Value), |
1003 |
//Thickness = p.Value == null ? 0 : Convert.ToSingle(p.Value) |
1004 |
|
1005 |
RefProjectCode = ws.Rows[p.Index].Cells[5].Value == null ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(), |
1006 |
DocumentNo = ws.Rows[p.Index].Cells[6].Value == null ? string.Empty : ws.Rows[p.Index].Cells[6].Value.ToString(), |
1007 |
PersonInCharge = ws.Rows[p.Index].Cells[7].Value == null ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[7].Value.ToString()).ID, |
1008 |
JobLevel = ws.Rows[p.Index].Cells[8].Value == null ? string.Empty : ws.Rows[p.Index].Cells[8].Value.ToString(), |
1009 |
IsTypical = ws.Rows[p.Index].Cells[9].Value == null ? string.Empty : ws.Rows[p.Index].Cells[9].Value.ToString(), |
1010 |
RevisonNo = ws.Rows[p.Index].Cells[10].Value == null ? string.Empty : ws.Rows[p.Index].Cells[10].Value.ToString(), |
1011 |
ToIsDiscussion = ws.Rows[p.Index].Cells[11].Value == null ? string.Empty : ws.Rows[p.Index].Cells[11].Value.ToString(), |
1012 |
ToRemarks = ws.Rows[p.Index].Cells[12].Value == null ? string.Empty : ws.Rows[p.Index].Cells[12].Value.ToString(), |
1013 |
ToCreator = ws.Rows[p.Index].Cells[13].Value == null ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[13].Value.ToString()).ID, |
1014 |
//ToCapturePath = ws.Rows[p.Index].Cells[5].Value == null ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(), |
1015 |
//ToIsMarkup = ws.Rows[p.Index].Cells[5].Value == null ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(), |
1016 |
FrReviewStatus = ws.Rows[p.Index].Cells[16].Value == null ? string.Empty : ws.Rows[p.Index].Cells[16].Value.ToString(), |
1017 |
FrRemarks = ws.Rows[p.Index].Cells[17].Value == null ? string.Empty : ws.Rows[p.Index].Cells[17].Value.ToString(), |
1018 |
FrCreator = ws.Rows[p.Index].Cells[18].Value == null ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[18].Value.ToString()).ID, |
1019 |
//FrCapturePath = ws.Rows[p.Index].Cells[5].Value == null ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(), |
1020 |
//FrIsMarkup = ws.Rows[p.Index].Cells[5].Value == null ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(), |
1021 |
IsID2Work = ws.Rows[p.Index].Cells[21].Value == null ? string.Empty : ws.Rows[p.Index].Cells[21].Value.ToString(), |
1022 |
//ID2Connection = ws.Rows[p.Index].Cells[5].Value == null ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(), |
1023 |
ID2StartDate = ws.Rows[p.Index].Cells[23].Value == null ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[23].Value?.ToString()), |
1024 |
ID2EndDate = ws.Rows[p.Index].Cells[24].Value == null ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[24].Value?.ToString()), |
1025 |
//ID2JobTime = ws.Rows[p.Index].Cells[5].Value == null ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(), |
1026 |
ID2Status = ws.Rows[p.Index].Cells[26].Value == null ? string.Empty : ws.Rows[p.Index].Cells[26].Value.ToString(), |
1027 |
ID2Issues = ws.Rows[p.Index].Cells[27].Value == null ? string.Empty : ws.Rows[p.Index].Cells[27].Value.ToString(), |
1028 |
//AVEVAConnection = ws.Rows[p.Index].Cells[5].Value == null ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(), |
1029 |
AVEVAConvertDate = ws.Rows[p.Index].Cells[29].Value == null ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[29].Value.ToString()), |
1030 |
AVEVAReviewDate = ws.Rows[p.Index].Cells[30].Value == null ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[30].Value.ToString()), |
1031 |
AVEVAStatus = ws.Rows[p.Index].Cells[31].Value == null ? string.Empty : ws.Rows[p.Index].Cells[31].Value.ToString(), |
1032 |
AVEVAIssues = ws.Rows[p.Index].Cells[32].Value == null ? string.Empty : ws.Rows[p.Index].Cells[32].Value.ToString(), |
1033 |
ProdReviewer = ws.Rows[p.Index].Cells[35].Value == null ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[35].Value.ToString()).ID, |
1034 |
ProdIsResult = ws.Rows[p.Index].Cells[36].Value == null ? string.Empty : ws.Rows[p.Index].Cells[36].Value.ToString(), |
1035 |
ProdRemarks = ws.Rows[p.Index].Cells[37].Value == null ? string.Empty : ws.Rows[p.Index].Cells[37].Value.ToString(), |
1036 |
ClientReviewer = ws.Rows[p.Index].Cells[38].Value == null ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[38].Value.ToString()).ID, |
1037 |
ClientIsResult = ws.Rows[p.Index].Cells[39].Value == null ? string.Empty : ws.Rows[p.Index].Cells[39].Value.ToString(), |
1038 |
ClientRemarks = ws.Rows[p.Index].Cells[40].Value == null ? string.Empty : ws.Rows[p.Index].Cells[40].Value.ToString(), |
1039 |
DTIsGateWay = ws.Rows[p.Index].Cells[41].Value == null ? string.Empty : ws.Rows[p.Index].Cells[41].Value.ToString(), |
1040 |
DTIsImport = ws.Rows[p.Index].Cells[42].Value == null ? string.Empty : ws.Rows[p.Index].Cells[42].Value.ToString(), |
1041 |
DTIsRegSystem = ws.Rows[p.Index].Cells[43].Value == null ? string.Empty : ws.Rows[p.Index].Cells[43].Value.ToString(), |
1042 |
DTRemarks = ws.Rows[p.Index].Cells[44].Value == null ? string.Empty : ws.Rows[p.Index].Cells[44].Value.ToString() |
1043 |
})); |
1044 |
|
1045 |
this.documents.AddRange(appendDocuments); |
1046 |
if (this.orgDocuments == null) this.orgDocuments = new List<Documents>(); |
1047 |
this.DocumentListBinding(); |
1048 |
|
1049 |
//foreach (Documents appDoc in appendDocuments) |
1050 |
//{ |
1051 |
// GridViewRowInfo rowInfo = this.radGridViewDocuments.Rows.AddNew(); |
1052 |
|
1053 |
// foreach (FieldInfo fieldInfo in appDoc.GetType().GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)) |
1054 |
// { |
1055 |
// if (fieldInfo.GetValue(appDoc) != null) |
1056 |
// { |
1057 |
// var cols = rowInfo.Cells.Where(x => fieldInfo.Name.Contains($"<{x.ColumnInfo.Name}>")); |
1058 |
|
1059 |
// if (cols.Any()) |
1060 |
// { |
1061 |
// cols.FirstOrDefault().Value = fieldInfo.GetValue(appDoc); |
1062 |
// } |
1063 |
// } |
1064 |
// } |
1065 |
//} |
1066 |
} |
1067 |
} |
1068 |
} |
1069 |
|
1070 |
private void RadButtonElementExcelExport_Click(object sender, EventArgs e) |
1071 |
{ |
1072 |
string sPrefixName = "Samsung Elec Task Management"; |
1073 |
string extension = ".xlsx"; |
1074 |
|
1075 |
using (SaveFileDialog sfd = new SaveFileDialog() |
1076 |
{ |
1077 |
FileName = $"{sPrefixName}_{DateTime.Now:yyyyMMddhhmmss}{extension}", |
1078 |
Filter = "Excel|*.xlsx", |
1079 |
Title = "Save an Excel File", |
1080 |
CheckFileExists = false, |
1081 |
CheckPathExists = true, |
1082 |
OverwritePrompt = true |
1083 |
}) |
1084 |
{ |
1085 |
if (sfd.ShowDialog() == DialogResult.OK) |
1086 |
{ |
1087 |
string fileName = $"{sPrefixName}{extension}"; |
1088 |
string templateFolder = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "Template"); |
1089 |
string templateFilePath = Path.Combine(templateFolder, fileName); |
1090 |
if (!File.Exists(templateFilePath)) |
1091 |
{ |
1092 |
RadMessageBox.Show(this, $"There is no {fileName} in {templateFolder}", "Error", MessageBoxButtons.OK, RadMessageIcon.Error); |
1093 |
return; |
1094 |
} |
1095 |
|
1096 |
if (this.radGridViewDocuments.Rows.Count > 0) |
1097 |
{ |
1098 |
var templateExcelFile = ExcelFile.Load(templateFilePath); |
1099 |
var templateWorksheets = templateExcelFile.Worksheets; |
1100 |
var templateWorksheet = templateWorksheets[0]; |
1101 |
|
1102 |
int rowIndex = 9; |
1103 |
//int colIndex = 1; |
1104 |
|
1105 |
foreach (var row in this.radGridViewDocuments.Rows) |
1106 |
{ |
1107 |
var doc = row.DataBoundItem as Documents; |
1108 |
|
1109 |
templateWorksheet.Cells[rowIndex, 0].Value = doc.Seq; |
1110 |
//templateWorksheet.Cells[rowIndex, 1].Value = doc.DocumentNo; |
1111 |
//templateWorksheet.Cells[rowIndex, 2].Value = doc.DocumentNo; |
1112 |
//templateWorksheet.Cells[rowIndex, 3].Value = doc.DocumentNo; |
1113 |
//templateWorksheet.Cells[rowIndex, 4].Value = doc.DocumentNo; |
1114 |
templateWorksheet.Cells[rowIndex, 5].Value = doc.RefProjectCode; |
1115 |
templateWorksheet.Cells[rowIndex, 6].Value = doc.DocumentNo; |
1116 |
templateWorksheet.Cells[rowIndex, 7].Value = this.GetUser(doc.PersonInCharge).Name; |
1117 |
templateWorksheet.Cells[rowIndex, 8].Value = doc.JobLevel; |
1118 |
templateWorksheet.Cells[rowIndex, 9].Value = doc.IsTypical; |
1119 |
templateWorksheet.Cells[rowIndex, 10].Value = doc.RevisonNo; |
1120 |
templateWorksheet.Cells[rowIndex, 11].Value = doc.ToIsDiscussion; |
1121 |
templateWorksheet.Cells[rowIndex, 12].Value = doc.ToRemarks; |
1122 |
templateWorksheet.Cells[rowIndex, 13].Value = this.GetUser(doc.ToCreator).Name; |
1123 |
templateWorksheet.Cells[rowIndex, 14].Value = doc.ToCapturePath; |
1124 |
templateWorksheet.Cells[rowIndex, 15].Value = doc.ToIsMarkup; |
1125 |
templateWorksheet.Cells[rowIndex, 16].Value = doc.FrReviewStatus; |
1126 |
templateWorksheet.Cells[rowIndex, 17].Value = doc.FrRemarks; |
1127 |
templateWorksheet.Cells[rowIndex, 18].Value = this.GetUser(doc.FrCreator).Name; |
1128 |
templateWorksheet.Cells[rowIndex, 19].Value = doc.FrCapturePath; |
1129 |
templateWorksheet.Cells[rowIndex, 20].Value = doc.FrIsMarkup; |
1130 |
templateWorksheet.Cells[rowIndex, 21].Value = doc.IsID2Work; |
1131 |
templateWorksheet.Cells[rowIndex, 22].Value = doc.ID2Connection; |
1132 |
templateWorksheet.Cells[rowIndex, 23].Value = $"{doc.ID2StartDate:yyyy/MM/dd hh:mm:ss}"; |
1133 |
templateWorksheet.Cells[rowIndex, 24].Value = $"{doc.ID2EndDate:yyyy/MM/dd hh:mm:ss}"; |
1134 |
templateWorksheet.Cells[rowIndex, 25].Value = doc.ID2JobTime; |
1135 |
templateWorksheet.Cells[rowIndex, 26].Value = doc.ID2Status; |
1136 |
templateWorksheet.Cells[rowIndex, 27].Value = doc.ID2Issues; |
1137 |
templateWorksheet.Cells[rowIndex, 28].Value = doc.AVEVAConnection; |
1138 |
templateWorksheet.Cells[rowIndex, 29].Value = $"{doc.AVEVAConvertDate:yyyy/MM/dd}"; |
1139 |
templateWorksheet.Cells[rowIndex, 30].Value = $"{doc.AVEVAReviewDate:yyyy/MM/dd}"; |
1140 |
templateWorksheet.Cells[rowIndex, 31].Value = doc.AVEVAStatus; |
1141 |
templateWorksheet.Cells[rowIndex, 32].Value = doc.AVEVAIssues; |
1142 |
//templateWorksheet.Cells[rowIndex, 33].Value = doc.DocumentNo; |
1143 |
//templateWorksheet.Cells[rowIndex, 34].Value = doc.DocumentNo; |
1144 |
templateWorksheet.Cells[rowIndex, 35].Value = this.GetUser(doc.ProdReviewer).Name; |
1145 |
templateWorksheet.Cells[rowIndex, 36].Value = doc.ProdIsResult; |
1146 |
templateWorksheet.Cells[rowIndex, 37].Value = doc.ProdRemarks; |
1147 |
templateWorksheet.Cells[rowIndex, 38].Value = this.GetUser(doc.ClientReviewer).Name; |
1148 |
templateWorksheet.Cells[rowIndex, 39].Value = doc.ClientIsResult; |
1149 |
templateWorksheet.Cells[rowIndex, 40].Value = doc.ClientRemarks; |
1150 |
templateWorksheet.Cells[rowIndex, 41].Value = doc.DTIsGateWay; |
1151 |
templateWorksheet.Cells[rowIndex, 42].Value = doc.DTIsImport; |
1152 |
templateWorksheet.Cells[rowIndex, 43].Value = doc.DTIsRegSystem; |
1153 |
templateWorksheet.Cells[rowIndex, 44].Value = doc.DTRemarks; |
1154 |
rowIndex++; |
1155 |
} |
1156 |
|
1157 |
templateExcelFile.Save(sfd.FileName); |
1158 |
RadMessageBox.Show("Exporting 'ID2 Document List' is complete", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info); |
1159 |
} |
1160 |
} |
1161 |
} |
1162 |
} |
1163 |
#endregion |
1164 |
|
1165 |
#region Save event |
1166 |
private void RadButtonElementSave_Click(object sender, EventArgs e) |
1167 |
{ |
1168 |
List <Documents> setDocuments = new List<Documents>(); |
1169 |
List<Documents> delDocuments = new List<Documents>(); |
1170 |
|
1171 |
var worker = new DocumentsWorker(this.documents, this.orgDocuments, setDocuments, delDocuments, this.radGridViewDocuments); |
1172 |
worker.OnWorkCompletedHandler += () => |
1173 |
{ |
1174 |
bool result = new DocumentController().SetDocumentData(setDocuments, delDocuments); |
1175 |
|
1176 |
bool markusResult = new MarkusInfoController().SetMarkusInfo(this.documents); |
1177 |
|
1178 |
if (result && markusResult) |
1179 |
{ |
1180 |
RadMessageBox.Show("Save is complete", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info); |
1181 |
|
1182 |
this.GetDocList(); |
1183 |
} |
1184 |
else if(!result) |
1185 |
{ |
1186 |
RadMessageBox.Show("Save is not complete", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error); |
1187 |
} |
1188 |
else if (!markusResult) |
1189 |
{ |
1190 |
RadMessageBox.Show("Markus Data Save is not complete", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error); |
1191 |
} |
1192 |
}; |
1193 |
worker.StartWork(); |
1194 |
} |
1195 |
#endregion |
1196 |
|
1197 |
#region ColumnGroup |
1198 |
private void InitColumnGroupsViewDefinition(RadGridView gridView) |
1199 |
{ |
1200 |
ColumnGroupsViewDefinition columnGroupsView = new ColumnGroupsViewDefinition(); |
1201 |
|
1202 |
List<string> docLinkColNames = new List<string>() { "AutoCADLink", "PDFLink", "MarkupLink", "AVEVALink" }; |
1203 |
List<string> docInfoColNames = new List<string>() { "RefProjectCode", "DocumentNo", "PersonInCharge", "JobLevel", "IsTypical", "RevisonNo" }; |
1204 |
List<string> rvToColNames = new List<string>() { "ToIsDiscussion", "ToRemarks", "ToCreator", "ToCapturePath", "ToIsMarkup" }; |
1205 |
List<string> rvFrColNames = new List<string>() { "FrReviewStatus", "FrRemarks", "FrCreator", "FrCapturePath", "FrIsMarkup" }; |
1206 |
List<string> rvEtcColNames = new List<string>() { "IsID2Work" }; |
1207 |
List<string> wkID2ColNames = new List<string>() { "ID2Connection", "ID2StartDate", "ID2EndDate", "ID2JobTime", "ID2Status", "ID2Issues" }; |
1208 |
List<string> wkAVEVAColNames = new List<string>() { "AVEVAConnection", "AVEVAConvertDate", "AVEVAReviewDate", "AVEVAStatus", "AVEVAIssues" }; |
1209 |
List<string> valLinkColNames = new List<string>() { "ReviewFileName", "SystemLink" }; |
1210 |
List<string> valProdColNames = new List<string>() { "ProdReviewer", "ProdIsResult", "ProdRemarks" }; |
1211 |
List<string> valCntColNames = new List<string>() { "ClientReviewer", "ClientIsResult", "ClientRemarks" }; |
1212 |
List<string> dtColNames = new List<string>() { "DTIsGateWay", "DTIsImport", "DTIsRegSystem", "DTRemarks" }; |
1213 |
|
1214 |
//도면 |
1215 |
GridViewColumnGroup docColGrp = new GridViewColumnGroup("도면 "); |
1216 |
GridViewColumnGroup docLinkColGrp = new GridViewColumnGroup("파일링크"); |
1217 |
GridViewColumnGroup docInfoColGrp = new GridViewColumnGroup("도면정보"); |
1218 |
|
1219 |
GridViewColumnGroupRow docLinkColGrpRow = new GridViewColumnGroupRow(); |
1220 |
docLinkColGrpRow.ColumnNames.AddRange(docLinkColNames); |
1221 |
|
1222 |
GridViewColumnGroupRow docInfoColGrpRow = new GridViewColumnGroupRow(); |
1223 |
docInfoColGrpRow.ColumnNames.AddRange(docInfoColNames); |
1224 |
|
1225 |
docLinkColGrp.Rows.Add(docLinkColGrpRow); |
1226 |
docColGrp.Groups.Add(docLinkColGrp); |
1227 |
docInfoColGrp.Rows.Add(docInfoColGrpRow); |
1228 |
docColGrp.Groups.Add(docInfoColGrp); |
1229 |
|
1230 |
//검토 |
1231 |
GridViewColumnGroup rvColGrp = new GridViewColumnGroup("검토", "review"); |
1232 |
GridViewColumnGroup rvToColGrp = new GridViewColumnGroup("도프텍"); |
1233 |
GridViewColumnGroup rvFrColGrp = new GridViewColumnGroup("삼성"); |
1234 |
GridViewColumnGroup rvEtcColGrp = new GridViewColumnGroup("기타"); |
1235 |
|
1236 |
GridViewColumnGroupRow rvToColGrpRow = new GridViewColumnGroupRow(); |
1237 |
rvToColGrpRow.ColumnNames.AddRange(rvToColNames); |
1238 |
|
1239 |
GridViewColumnGroupRow rvFrColGrpRow = new GridViewColumnGroupRow(); |
1240 |
rvFrColGrpRow.ColumnNames.AddRange(rvFrColNames); |
1241 |
|
1242 |
GridViewColumnGroupRow rvEtcColGrpRow = new GridViewColumnGroupRow(); |
1243 |
rvEtcColGrpRow.ColumnNames.AddRange(rvEtcColNames); |
1244 |
|
1245 |
rvToColGrp.Rows.Add(rvToColGrpRow); |
1246 |
rvFrColGrp.Rows.Add(rvFrColGrpRow); |
1247 |
rvEtcColGrp.Rows.Add(rvEtcColGrpRow); |
1248 |
|
1249 |
|
1250 |
rvColGrp.Groups.Add(rvToColGrp); |
1251 |
rvColGrp.Groups.Add(rvFrColGrp); |
1252 |
rvColGrp.Groups.Add(rvEtcColGrp); |
1253 |
|
1254 |
|
1255 |
//작업 |
1256 |
GridViewColumnGroup wkColGrp = new GridViewColumnGroup("작업", "work"); |
1257 |
GridViewColumnGroup wkID2ColGrp = new GridViewColumnGroup("ID2"); |
1258 |
GridViewColumnGroup wkAVEVAColGrp = new GridViewColumnGroup("AVEVA"); |
1259 |
|
1260 |
GridViewColumnGroupRow wkID2ColGrpRow = new GridViewColumnGroupRow(); |
1261 |
wkID2ColGrpRow.ColumnNames.AddRange(wkID2ColNames); |
1262 |
|
1263 |
GridViewColumnGroupRow wkAVEVAColGrpRow = new GridViewColumnGroupRow(); |
1264 |
wkAVEVAColGrpRow.ColumnNames.AddRange(wkAVEVAColNames); |
1265 |
|
1266 |
wkID2ColGrp.Rows.Add(wkID2ColGrpRow); |
1267 |
wkAVEVAColGrp.Rows.Add(wkAVEVAColGrpRow); |
1268 |
|
1269 |
wkColGrp.Groups.Add(wkID2ColGrp); |
1270 |
wkColGrp.Groups.Add(wkAVEVAColGrp); |
1271 |
|
1272 |
|
1273 |
//Validation |
1274 |
GridViewColumnGroup valColGrp = new GridViewColumnGroup("Validation", "validation"); |
1275 |
GridViewColumnGroup valLinkColGrp = new GridViewColumnGroup("파일링크"); |
1276 |
GridViewColumnGroup valProdColGrp = new GridViewColumnGroup("도프텍"); |
1277 |
GridViewColumnGroup valCntColGrp = new GridViewColumnGroup("삼성전자"); |
1278 |
|
1279 |
GridViewColumnGroupRow valLinkColGrpRow = new GridViewColumnGroupRow(); |
1280 |
valLinkColGrpRow.ColumnNames.AddRange(valLinkColNames); |
1281 |
|
1282 |
GridViewColumnGroupRow valProdColGrpRow = new GridViewColumnGroupRow(); |
1283 |
valProdColGrpRow.ColumnNames.AddRange(valProdColNames); |
1284 |
|
1285 |
GridViewColumnGroupRow valCntColGrpRow = new GridViewColumnGroupRow(); |
1286 |
valCntColGrpRow.ColumnNames.AddRange(valCntColNames); |
1287 |
|
1288 |
valLinkColGrp.Rows.Add(valLinkColGrpRow); |
1289 |
valProdColGrp.Rows.Add(valProdColGrpRow); |
1290 |
valCntColGrp.Rows.Add(valCntColGrpRow); |
1291 |
|
1292 |
valColGrp.Groups.Add(valLinkColGrp); |
1293 |
valColGrp.Groups.Add(valProdColGrp); |
1294 |
valColGrp.Groups.Add(valCntColGrp); |
1295 |
|
1296 |
//AVEVA Net |
1297 |
GridViewColumnGroup dtColGrp = new GridViewColumnGroup("AVEVA Net\n(Digital Twin)", "avevanet"); |
1298 |
|
1299 |
GridViewColumnGroupRow dtColGrpRow = new GridViewColumnGroupRow(); |
1300 |
dtColGrpRow.ColumnNames.AddRange(dtColNames); |
1301 |
|
1302 |
dtColGrp.Rows.Add(dtColGrpRow); |
1303 |
|
1304 |
//Group 추가 |
1305 |
columnGroupsView.ColumnGroups.Add(docColGrp); |
1306 |
columnGroupsView.ColumnGroups.Add(rvColGrp); |
1307 |
columnGroupsView.ColumnGroups.Add(wkColGrp); |
1308 |
columnGroupsView.ColumnGroups.Add(valColGrp); |
1309 |
columnGroupsView.ColumnGroups.Add(dtColGrp); |
1310 |
|
1311 |
gridView.MasterTemplate.ViewDefinition = columnGroupsView; |
1312 |
} |
1313 |
#endregion |
1314 |
|
1315 |
class DocumentsWorker : BaseWorker |
1316 |
{ |
1317 |
public delegate void OnWorkCompleted(); |
1318 |
public OnWorkCompleted OnWorkCompletedHandler; |
1319 |
|
1320 |
List<Documents> docList { get; set; } |
1321 |
List<Documents> orgList { get; set; } |
1322 |
List<Documents> setList { get; set; } |
1323 |
List<Documents> delList { get; set; } |
1324 |
|
1325 |
public DocumentsWorker(List<Documents> docList, List<Documents> orgDocList, List<Documents> setDocList, List<Documents> delDocList, Control parent = null) : base(parent) |
1326 |
{ |
1327 |
this.docList = docList; |
1328 |
this.orgList = orgDocList; |
1329 |
this.setList = setDocList; |
1330 |
this.delList = delDocList; |
1331 |
} |
1332 |
protected override void DoWork(BackgroundWorker worker) |
1333 |
{ |
1334 |
//수정리스트 |
1335 |
this.docList.Where(x => !this.orgList.Any(y => y.Equals(x))) |
1336 |
.ToList().ForEach(x => this.setList.Add(x)); |
1337 |
//삭제리스트 |
1338 |
this.delList.AddRange(this.orgList.Except(this.docList, new DocumentsKeyComparer())); |
1339 |
} |
1340 |
|
1341 |
protected override void WorkCompleted() |
1342 |
{ |
1343 |
if (this.OnWorkCompletedHandler != null) this.OnWorkCompletedHandler(); |
1344 |
} |
1345 |
} |
1346 |
|
1347 |
private void txtFullSearch_TextChanged(object sender, EventArgs e) |
1348 |
{ |
1349 |
if(string.IsNullOrWhiteSpace(txtFullSearch.Text)) |
1350 |
radGridViewDocuments.MasterTemplate.Refresh(null); |
1351 |
|
1352 |
txtFullSearch.TextBoxElement.ShowClearButton = !string.IsNullOrWhiteSpace(txtFullSearch.Text); |
1353 |
radGridViewDocuments.MasterView.TableSearchRow.Search(txtFullSearch.Text); |
1354 |
|
1355 |
} |
1356 |
|
1357 |
private void btnSearchPrevious_Click(object sender, EventArgs e) |
1358 |
{ |
1359 |
|
1360 |
radGridViewDocuments.MasterView.TableSearchRow.SelectPreviousSearchResult(); |
1361 |
} |
1362 |
|
1363 |
private void btnSearchNext_Click(object sender, EventArgs e) |
1364 |
{ |
1365 |
radGridViewDocuments.MasterView.TableSearchRow.SelectNextSearchResult(); |
1366 |
} |
1367 |
} |
1368 |
} |
1369 |
|
1370 |
public class FilterColumn |
1371 |
{ |
1372 |
public string Name { get; set; } |
1373 |
public string FieldName { get; set; } |
1374 |
public bool IsSelect { get; set; } |
1375 |
} |