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