hytos / ID2.Manager / ID2.Manager / Main.cs @ 89d122ea
이력 | 보기 | 이력해설 | 다운로드 (89.2 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 |
|
21 |
using Telerik.WinControls; |
22 |
using Telerik.WinControls.UI; |
23 |
using Telerik.WinControls.Data; |
24 |
|
25 |
using GemBox.Spreadsheet; |
26 |
|
27 |
using Newtonsoft.Json; |
28 |
using System.Diagnostics; |
29 |
using ID2.Manager.Common.Helpers; |
30 |
|
31 |
namespace ID2.Manager |
32 |
{ |
33 |
public partial class Main : RadRibbonForm |
34 |
{ |
35 |
readonly Informations informations = Informations.Instance; |
36 |
bool IsID2Manager = false; |
37 |
|
38 |
List<Documents> documents = new List<Documents>(); |
39 |
List<System.Drawing.Image> importImages = new List<System.Drawing.Image>(); |
40 |
|
41 |
List<Documents> orgDocuments = null; |
42 |
int TotalCount = 0; |
43 |
|
44 |
BriefAndImages briefAndImagesReview = new BriefAndImages { Dock = DockStyle.Fill }; |
45 |
BriefAndImages briefAndImagesValidation = new BriefAndImages { Dock = DockStyle.Fill }; |
46 |
|
47 |
private readonly Color _SummaryColor = Color.FromArgb(255, 108, 55); |
48 |
|
49 |
public Main() |
50 |
{ |
51 |
InitializeComponent(); |
52 |
Telerik.WinControls.RadControlSpy.RadControlSpyForm radControlSpyForm = new Telerik.WinControls.RadControlSpy.RadControlSpyForm(); |
53 |
radControlSpyForm.Show(); |
54 |
|
55 |
this.Load += Main_Load; |
56 |
|
57 |
this.radButtonElementRefreshCommand.Click += RadButtonElementRefreshCommand_Click; |
58 |
this.radButtonElementSaveCommand.Click += RadButtonElementSaveCommand_Click; |
59 |
|
60 |
this.radButtonElementSave.Click += RadButtonElementSave_Click; |
61 |
this.radButtonElementSync.Click += RadButtonElementSync_Click; |
62 |
this.radButtonElementNotice.Click += RadButtonElementNotice_Click; |
63 |
this.radButtonElementNoticeUpload.Click += RadButtonElementNoticeUpload_Click; |
64 |
this.radButtonElementExcelImport.Click += RadButtonElementExcelImport_Click; |
65 |
this.radButtonElementExcelExport.Click += RadButtonElementExcelExport_Click; |
66 |
|
67 |
this.radCheckBox1.CheckStateChanged += RadCheckBox_CheckStateChanged; |
68 |
this.radCheckBox2.CheckStateChanged += RadCheckBox_CheckStateChanged; |
69 |
this.radCheckBox3.CheckStateChanged += RadCheckBox_CheckStateChanged; |
70 |
this.radCheckBox4.CheckStateChanged += RadCheckBox_CheckStateChanged; |
71 |
this.radTextBoxDocumentNo.KeyDown += RadTextBoxDocumentNo_KeyDown; |
72 |
this.radButtonSearch.Click += RadButtonSearch_Click; |
73 |
|
74 |
this.radGridViewDocuments.SelectionChanged += RadGridViewDocuments_SelectionChanged; |
75 |
this.radGridViewDocuments.ViewCellFormatting += RadGridViewDocuments_ViewCellFormatting; |
76 |
this.radGridViewDocuments.CreateRow += RadGridViewDocuments_CreateRow; |
77 |
this.radGridViewDocuments.CreateRowInfo += RadGridViewDocuments_CreateRowInfo; |
78 |
this.radGridViewDocuments.CreateCell += RadGridViewDocuments_CreateCell1; |
79 |
this.radGridViewDocuments.CellBeginEdit += RadGridViewDocuments_CellBeginEdit; |
80 |
this.radGridViewDocuments.CommandCellClick += RadGridViewDocuments_CommandCellClick; |
81 |
this.radGridViewDocuments.MasterView.TableSearchRow.SearchProgressChanged += TableSearchRow_SearchProgressChanged; |
82 |
this.radGridViewDocuments.FilterChanged += RadGridViewDocuments_FilterChanged; |
83 |
|
84 |
this.radGridViewDocuments.MasterView.TableHeaderRow.MinHeight = 36; |
85 |
this.radGridViewDocuments.TableElement.RowHeaderColumnWidth = 36; |
86 |
//this.radGridViewDocuments.MasterView.TableSearchRow.InitialSearchResultsTreshold = ; |
87 |
this.radGridViewDocuments.MasterView.TableSearchRow.IsVisible = false; |
88 |
|
89 |
var openProjectView = new OpenProjectView() |
90 |
{ |
91 |
Dock = DockStyle.Fill |
92 |
}; |
93 |
this.backstageViewPageOpenProject.Controls.Add(openProjectView); |
94 |
openProjectView.OpenProjectClick += OpenProjectView_OpenProjectClick; |
95 |
openProjectView.CloseProjectClick += OpenProjectView_OpenProjectClick; |
96 |
this.backstageButtonItemUserRegistration.Click += BackstageButtonItemUserRegistration_Click; |
97 |
this.backstageButtonItemExit.Click += BackstageButtonItemExit_Click; |
98 |
this.radRibbonBarBackstageViewID2Manager.BackstageViewOpened += RadRibbonBarBackstageViewID2Manager_BackstageViewOpened; |
99 |
this.radRibbonBarBackstageViewID2Manager.BackstageViewClosed += RadRibbonBarBackstageViewID2Manager_BackstageViewClosed; |
100 |
|
101 |
this.InitColumnGroupsViewDefinition(this.radGridViewDocuments); |
102 |
|
103 |
this.radPageViewPageReview.Controls.Add(briefAndImagesReview); |
104 |
this.radPageViewPageValidation.Controls.Add(briefAndImagesValidation); |
105 |
|
106 |
this.Initialize(); |
107 |
} |
108 |
|
109 |
private void RadGridViewDocuments_CreateRowInfo(object sender, GridViewCreateRowInfoEventArgs e) |
110 |
{ |
111 |
if (e.RowInfo is GridViewSearchRowInfo) |
112 |
{ |
113 |
e.RowInfo = new SearchRow(e.ViewInfo); |
114 |
} |
115 |
} |
116 |
|
117 |
private void TableSearchRow_SearchProgressChanged(object sender, SearchProgressChangedEventArgs e) |
118 |
{ |
119 |
if (e.SearchFinished) |
120 |
{ |
121 |
|
122 |
} |
123 |
} |
124 |
|
125 |
/// <summary> |
126 |
/// 선택된 행의 AutoCAD와 PDF 파일을 보여준다. |
127 |
/// </summary> |
128 |
/// <param name="sender"></param> |
129 |
/// <param name="e"></param> |
130 |
private void RadGridViewDocuments_SelectionChanged(object sender, EventArgs e) |
131 |
{ |
132 |
void ShowAutoCADFile(string FilePath) |
133 |
{ |
134 |
Controls.AutoCADViewer viewer = null; |
135 |
foreach (var control in this.radPageViewPageAutoCAD.Controls) |
136 |
{ |
137 |
if (control is Controls.AutoCADViewer _viewer) |
138 |
{ |
139 |
viewer = _viewer; |
140 |
break; |
141 |
} |
142 |
} |
143 |
|
144 |
if (viewer == null) |
145 |
{ |
146 |
viewer = new Controls.AutoCADViewer() { Dock = DockStyle.Fill }; |
147 |
this.radPageViewPageAutoCAD.Controls.Add(viewer); |
148 |
} |
149 |
else |
150 |
{ |
151 |
viewer.Visible = true; |
152 |
} |
153 |
|
154 |
if (File.Exists(FilePath) && viewer != null) viewer.ReadDWG(FilePath); |
155 |
} |
156 |
|
157 |
void ShowPDFFile(string FilePath) |
158 |
{ |
159 |
Controls.PDFViewer viewer = null; |
160 |
foreach (var control in this.radPageViewPagePDF.Controls) |
161 |
{ |
162 |
if (control is Controls.PDFViewer _viewer) |
163 |
{ |
164 |
viewer = _viewer; |
165 |
break; |
166 |
} |
167 |
} |
168 |
|
169 |
if (viewer == null) |
170 |
{ |
171 |
viewer = new Controls.PDFViewer() { Dock = DockStyle.Fill }; |
172 |
this.radPageViewPagePDF.Controls.Add(viewer); |
173 |
} |
174 |
else |
175 |
{ |
176 |
viewer.Visible = true; |
177 |
} |
178 |
|
179 |
if (File.Exists(FilePath) && viewer != null) viewer.ReadPDF(FilePath); |
180 |
} |
181 |
|
182 |
if (this.radGridViewDocuments.SelectedRows.Count() > 0 && this.radGridViewDocuments.SelectedRows.First().DataBoundItem is Documents doc) |
183 |
{ |
184 |
string dwgExtension = ".dwg"; |
185 |
string dwgFilePath = Path.Combine(informations.FindID2LocalPath(doc.RefProjectCode), "drawings", "Native", $"{doc.DocumentNo}{dwgExtension}"); |
186 |
ShowAutoCADFile(dwgFilePath); |
187 |
|
188 |
string pdfExtension = ".pdf"; |
189 |
string pdfFilePath = Path.Combine(informations.FindID2LocalPath(doc.RefProjectCode), "drawings", $"{doc.DocumentNo}{pdfExtension}"); |
190 |
ShowPDFFile(pdfFilePath); |
191 |
|
192 |
//if (informations.ActiveUser.ID != doc.PersonInCharge) |
193 |
//{ |
194 |
// var row = this.radGridViewDocuments.SelectedRows.First(); |
195 |
// foreach(var cell in row.Cells) |
196 |
// { |
197 |
// cell.ReadOnly = true; |
198 |
// } |
199 |
//} |
200 |
|
201 |
briefAndImagesReview.Clear(); |
202 |
briefAndImagesValidation.Clear(); |
203 |
|
204 |
//FrRemarks 추가 |
205 |
|
206 |
briefAndImagesReview.DataBindings.Add(new Binding("Brief", doc, "ToRemarks", false, DataSourceUpdateMode.OnValidation, null)); |
207 |
briefAndImagesValidation.DataBindings.Add(new Binding("Brief",doc, "ClientRemarks", false,DataSourceUpdateMode.OnValidation,null)); |
208 |
|
209 |
if (doc.AttFiles != null) |
210 |
{ |
211 |
if (doc.AttFiles.Count(x => x.Category == "toreview") > 0) |
212 |
{ |
213 |
var images = doc.AttFiles.Where(x => x.Category == "toreview").Select(x => x.FileData); |
214 |
briefAndImagesReview.SetToImages(images.ToList()); |
215 |
} |
216 |
|
217 |
if (doc.AttFiles.Count(x => x.Category == "frreview") > 0) |
218 |
{ |
219 |
var images = doc.AttFiles.Where(x => x.Category == "frreview").Select(x => x.FileData); |
220 |
briefAndImagesReview.SetFrImages(images.ToList()); |
221 |
} |
222 |
|
223 |
if (doc.AttFiles.Count(x => x.Category == "prodvalidation") > 0) |
224 |
{ |
225 |
var images = doc.AttFiles.Where(x => x.Category == "prodvalidation").Select(x => x.FileData); |
226 |
briefAndImagesValidation.SetToImages(images.ToList()); |
227 |
} |
228 |
|
229 |
if (doc.AttFiles.Count(x => x.Category == "clientvalidation") > 0) |
230 |
{ |
231 |
var images = doc.AttFiles.Where(x => x.Category == "clientvalidation").Select(x => x.FileData); |
232 |
briefAndImagesValidation.SetFrImages(images.ToList()); |
233 |
} |
234 |
} |
235 |
} |
236 |
} |
237 |
|
238 |
#region Init, Load |
239 |
private void Initialize() |
240 |
{ |
241 |
this.Text = Globals.Name; |
242 |
|
243 |
this.ID2ManagerRadRibbonBar.Expanded = false; |
244 |
|
245 |
this.radLabelElementUser.Text = $"{informations.ActiveUser.ID} {informations.ActiveUser.Name}"; |
246 |
|
247 |
this.IsID2Manager = (new string[] { "Admin", "Manager" }).Contains(informations.ActiveUser.Role) && string.IsNullOrEmpty(informations.ActiveUser.RefProjectID); |
248 |
|
249 |
if (this.IsID2Manager) |
250 |
{ |
251 |
this.radButtonElementNoticeUpload.Enabled = true; |
252 |
|
253 |
this.backstageViewPageOpenProject.Controls[0].Visible = true; |
254 |
this.backstageTabItemOpenProject.Visibility = ElementVisibility.Visible; |
255 |
this.backstageButtonItemUserRegistration.Visibility = ElementVisibility.Visible; |
256 |
} |
257 |
else |
258 |
{ |
259 |
this.radButtonElementNoticeUpload.Enabled = false; |
260 |
|
261 |
if (string.IsNullOrEmpty(informations.ActiveUser.RefProjectID)) |
262 |
{ |
263 |
this.backstageViewPageOpenProject.Controls[0].Visible = true; |
264 |
} |
265 |
else |
266 |
{ |
267 |
foreach (Control ctrl in this.backstageViewPageOpenProject.Controls) |
268 |
{ |
269 |
ctrl.Visible = false; |
270 |
} |
271 |
} |
272 |
this.backstageTabItemOpenProject.Visibility = ElementVisibility.Collapsed; |
273 |
this.backstageButtonItemUserRegistration.Visibility = ElementVisibility.Collapsed; |
274 |
} |
275 |
} |
276 |
|
277 |
protected override void OnLoad(EventArgs e) |
278 |
{ |
279 |
try |
280 |
{ |
281 |
if (informations.ActiveUser != null && !string.IsNullOrEmpty(informations.ActiveUser.RefProjectID)) |
282 |
{ |
283 |
informations.ActiveProject = new ProjectController().GetProjectInfo(informations.ActiveUser.RefProjectID); |
284 |
informations.ProjectList = new ProjectController().GetAllProjectList().ToList(); |
285 |
|
286 |
this.LoadProject(); |
287 |
} |
288 |
else |
289 |
{ |
290 |
this.radRibbonBarBackstageViewID2Manager.ShowPopup(this.GetBackstageLocation(), this.ID2ManagerRadRibbonBar.RibbonBarElement); |
291 |
} |
292 |
} |
293 |
catch (Exception ex) |
294 |
{ |
295 |
Program.logger.Error($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex); |
296 |
RadMessageBox.Show("Failed to load project.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error); |
297 |
} |
298 |
base.OnLoad(e); |
299 |
} |
300 |
|
301 |
public Point GetBackstageLocation() |
302 |
{ |
303 |
Point location = this.ID2ManagerRadRibbonBar.RibbonBarElement.ApplicationButtonElement.ControlBoundingRectangle.Location; |
304 |
location.Offset(new Point(0, this.ID2ManagerRadRibbonBar.RibbonBarElement.ApplicationButtonElement.ControlBoundingRectangle.Height)); |
305 |
location.Offset(this.ID2ManagerRadRibbonBar.Location); |
306 |
|
307 |
return location; |
308 |
} |
309 |
|
310 |
private void Main_Load(object sender, EventArgs e) |
311 |
{ |
312 |
InitializeGrid(); |
313 |
} |
314 |
|
315 |
private void InitializeGrid() |
316 |
{ |
317 |
InitializeSearch(); |
318 |
InitializeGridViewDetail(); |
319 |
|
320 |
//this.radGridViewDocuments.DataSource = new BindingList<Documents>(this.documents); |
321 |
} |
322 |
|
323 |
private void InitializeSearch() |
324 |
{ |
325 |
var font1 = ThemeResolutionService.GetCustomFont("TelerikWebUI"); |
326 |
|
327 |
lbSearch.Text = "\ue13E"; |
328 |
btnSearchNext.Text = "\ue006"; |
329 |
btnSearchPrevious.Text = "\ue004"; |
330 |
|
331 |
var chkbox = new RadCheckBoxElement(); |
332 |
chkbox.Text = "Match Case"; |
333 |
chkbox.CheckStateChanged += (snd, evt) => { radGridViewDocuments.MasterView.TableSearchRow.CaseSensitive = chkbox.Checked; }; |
334 |
|
335 |
btnMatchCase.HostedItem = chkbox; |
336 |
|
337 |
var chkbox1 = new RadCheckBoxElement(); |
338 |
chkbox1.Text = "Show All Detail"; |
339 |
chkbox1.CheckStateChanged += (snd, evt) => |
340 |
{ |
341 |
radGridViewDocuments.MasterView.ChildRows.ForAll(x=>x.IsExpanded = chkbox1.Checked); |
342 |
}; |
343 |
|
344 |
btnShowAllDetail.HostedItem = chkbox1; |
345 |
|
346 |
var chkbox2 = new RadCheckBoxElement(); |
347 |
chkbox2.Text = "Search from current position"; |
348 |
chkbox2.CheckStateChanged += (snd, evt) => { radGridViewDocuments.MasterView.TableSearchRow.SearchFromCurrentPosition = chkbox.Checked; }; |
349 |
|
350 |
btnSearchFormCurrent.HostedItem = chkbox2; |
351 |
|
352 |
var columns = radGridViewDocuments.Columns.Where(x => x.AllowSearching).Select(x => |
353 |
new FilterColumn |
354 |
{ |
355 |
Name = x.HeaderText, |
356 |
FieldName = x.FieldName, |
357 |
IsSelect = x.AllowSearching |
358 |
}); |
359 |
|
360 |
var panel = new StackLayoutElement(); |
361 |
panel.Orientation = Orientation.Vertical; |
362 |
|
363 |
var btnComboColumns = new RadCheckedDropDownListElement(); |
364 |
btnComboColumns.ShowCheckAllItems = true; |
365 |
btnComboColumns.CheckAllItem.Checked = true; |
366 |
btnComboColumns.AutoCompleteEditableAreaElement.NullText = "Search in Columns"; |
367 |
btnComboColumns.AutoCompleteEditableAreaElement.AutoCompleteTextBox.IsReadOnly = true; |
368 |
btnComboColumns.DropDownMinSize = new Size(200, 200); |
369 |
btnComboColumns.DropDownSizingMode = SizingMode.UpDownAndRightBottom; |
370 |
btnComboColumns.DisplayMember = "Name"; |
371 |
btnComboColumns.CheckedMember = "IsSelect"; |
372 |
btnComboColumns.ValueMember = "FieldName"; |
373 |
btnComboColumns.TextBox.CustomFont = font1.Name; |
374 |
btnComboColumns.TextBox.Text = "\ue13A"; |
375 |
|
376 |
btnComboColumns.DataSource = columns; |
377 |
|
378 |
txtFullSearch.TextBoxElement.ClearButton.Click += (snd, evt) => |
379 |
{ |
380 |
radGridViewDocuments.MasterTemplate.Refresh(null); |
381 |
}; |
382 |
|
383 |
btnComboColumns.PopupOpening += (snd, evt) => |
384 |
{ |
385 |
(snd as RadCheckedDropDownListElement).CheckAllItem.Checked = (snd as RadCheckedDropDownListElement).Items.All(x => (x.DataBoundItem as FilterColumn).IsSelect); |
386 |
}; |
387 |
|
388 |
btnComboColumns.PopupClosed += (snd, evt) => |
389 |
{ |
390 |
foreach (RadCheckedListDataItem item in btnComboColumns.Items) |
391 |
{ |
392 |
if (radGridViewDocuments.Columns[item.Value.ToString()] != null) |
393 |
{ |
394 |
radGridViewDocuments.Columns[item.Value.ToString()].AllowSearching = item.Checked; |
395 |
} |
396 |
} |
397 |
}; |
398 |
|
399 |
btnFilters.HostedItem = btnComboColumns; |
400 |
} |
401 |
|
402 |
private void InitializeGridViewDetail() |
403 |
{ |
404 |
this.radGridViewDocuments.ChildViewExpanded += RadGridViewDocuments_ChildViewExpanded; |
405 |
} |
406 |
|
407 |
private void RadGridViewDocuments_ChildViewExpanded(object sender, ChildViewExpandedEventArgs e) |
408 |
{ |
409 |
//e.ChildRow.ChildViewInfos[0].ChildRows[0].Height = 152; |
410 |
//e.ChildRow.ChildViewInfos[2].ChildRows[0].Height = 152; |
411 |
e.ChildRow.Height = 224; |
412 |
} |
413 |
|
414 |
#endregion |
415 |
|
416 |
private void OpenProjectView_OpenProjectClick(object sender, EventArgs e) |
417 |
{ |
418 |
this.radRibbonBarBackstageViewID2Manager.Tag = e; |
419 |
this.radRibbonBarBackstageViewID2Manager.HidePopup(); |
420 |
} |
421 |
|
422 |
private void RadRibbonBarBackstageViewID2Manager_BackstageViewOpened(object sender, EventArgs e) |
423 |
{ |
424 |
this.radRibbonBarBackstageViewID2Manager.SelectedItem = this.backstageTabItemOpenProject; |
425 |
|
426 |
foreach ( Control ctrl in this.backstageViewPageOpenProject.Controls) |
427 |
{ |
428 |
if (ctrl is OpenProjectView) |
429 |
{ |
430 |
var openProjectView = ctrl as OpenProjectView; |
431 |
openProjectView.GetProjectGroups(); |
432 |
break; |
433 |
} |
434 |
} |
435 |
} |
436 |
|
437 |
private void RadRibbonBarBackstageViewID2Manager_BackstageViewClosed(object sender, EventArgs e) |
438 |
{ |
439 |
try |
440 |
{ |
441 |
if (this.radRibbonBarBackstageViewID2Manager.Tag is ProjectEventArgs) |
442 |
{ |
443 |
var prjArgs = this.radRibbonBarBackstageViewID2Manager.Tag as ProjectEventArgs; |
444 |
|
445 |
informations.ActiveProject = prjArgs.ProjectInfo; |
446 |
|
447 |
this.radRibbonBarBackstageViewID2Manager.Tag = null; |
448 |
|
449 |
this.LoadProject(); |
450 |
} |
451 |
} |
452 |
catch (Exception ex) |
453 |
{ |
454 |
Program.logger.Error($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex); |
455 |
RadMessageBox.Show("Failed to load project.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error); |
456 |
} |
457 |
} |
458 |
|
459 |
private void LoadProject() |
460 |
{ |
461 |
try |
462 |
{ |
463 |
#region 도면 |
464 |
//Project List |
465 |
if (this.radDropDownListProject.Items.Count > 0) |
466 |
this.radDropDownListProject.Items.Clear(); |
467 |
informations.ProjectList.Where(x => x.GroupID.Equals(informations.ActiveProject.ProjectID)).ToList() |
468 |
.ForEach(x => |
469 |
{ |
470 |
this.radDropDownListProject.Items.Add(new RadListDataItem(x.Name, x.Code)); |
471 |
}); |
472 |
var allProject = new RadListDataItem("== 전체 ==", string.Empty); |
473 |
this.radDropDownListProject.Items.Insert(0, allProject); |
474 |
allProject.Selected = true; |
475 |
|
476 |
//담당자 List |
477 |
if (this.radDropDownListPersonInCharge.Items.Count > 0) |
478 |
this.radDropDownListPersonInCharge.Items.Clear(); |
479 |
informations.UserList.ForEach(x => |
480 |
{ |
481 |
if ((new string[] { "Manager", "User" }).Contains(x.Role) && string.IsNullOrEmpty(x.RefProjectID)) |
482 |
this.radDropDownListPersonInCharge.Items.Add(new RadListDataItem(x.Name, x.ID)); |
483 |
}); |
484 |
var allUser = new RadListDataItem("== 전체 ==", string.Empty); |
485 |
this.radDropDownListPersonInCharge.Items.Insert(0, allUser); |
486 |
allUser.Selected = true; |
487 |
|
488 |
//난이도 |
489 |
if (this.radDropDownListJobLevel.Items.Count > 0) |
490 |
this.radDropDownListJobLevel.Items.Clear(); |
491 |
informations.JobLevel.ForEach(x => |
492 |
{ |
493 |
this.radDropDownListJobLevel.Items.Add(new RadListDataItem(x, x)); |
494 |
}); |
495 |
var allJobLevel = new RadListDataItem("== 전체 ==", string.Empty); |
496 |
this.radDropDownListJobLevel.Items.Insert(0, allJobLevel); |
497 |
allJobLevel.Selected = true; |
498 |
|
499 |
//도면번호 조회조건 |
500 |
this.radTextBoxDocumentNo.Text = string.Empty; |
501 |
#endregion |
502 |
|
503 |
#region 검토 |
504 |
//문의(DOF) |
505 |
if (this.radDropDownListToIsDiscussion.Items.Count > 0) |
506 |
this.radDropDownListToIsDiscussion.Items.Clear(); |
507 |
informations.IsYesNo.ForEach(x => |
508 |
{ |
509 |
this.radDropDownListToIsDiscussion.Items.Add(new RadListDataItem(x, x)); |
510 |
}); |
511 |
var allToIsDiscussion = new RadListDataItem("== 전체 ==", string.Empty); |
512 |
this.radDropDownListToIsDiscussion.Items.Insert(0, allToIsDiscussion); |
513 |
allToIsDiscussion.Selected = true; |
514 |
|
515 |
//회신(DS) |
516 |
if (this.radDropDownListFrReviewStatus.Items.Count > 0) |
517 |
this.radDropDownListFrReviewStatus.Items.Clear(); |
518 |
informations.ClientStatus.ForEach(x => |
519 |
{ |
520 |
this.radDropDownListFrReviewStatus.Items.Add(new RadListDataItem(x, x)); |
521 |
}); |
522 |
var allFrReviewStatus = new RadListDataItem("== 전체 ==", string.Empty); |
523 |
this.radDropDownListFrReviewStatus.Items.Insert(0, allFrReviewStatus); |
524 |
allFrReviewStatus.Selected = true; |
525 |
|
526 |
//ID2 작업가능 |
527 |
if (this.radDropDownListIsID2Work.Items.Count > 0) |
528 |
this.radDropDownListIsID2Work.Items.Clear(); |
529 |
informations.IsYesNo.ForEach(x => |
530 |
{ |
531 |
var item = new RadListDataItem(x, x); |
532 |
if (x.Equals("Yes")) |
533 |
item.Selected = true; |
534 |
this.radDropDownListIsID2Work.Items.Add(item); |
535 |
|
536 |
}); |
537 |
var allIsID2Work = new RadListDataItem("== 전체 ==", string.Empty); |
538 |
this.radDropDownListIsID2Work.Items.Insert(0, allIsID2Work); |
539 |
#endregion |
540 |
|
541 |
#region 작업 |
542 |
//ID2 Status |
543 |
if (this.radDropDownListID2Status.Items.Count > 0) |
544 |
this.radDropDownListID2Status.Items.Clear(); |
545 |
informations.JobStatus.ForEach(x => |
546 |
{ |
547 |
this.radDropDownListID2Status.Items.Add(new RadListDataItem(x, x)); |
548 |
}); |
549 |
var allID2Status = new RadListDataItem("== 전체 ==", string.Empty); |
550 |
this.radDropDownListID2Status.Items.Insert(0, allID2Status); |
551 |
allID2Status.Selected = true; |
552 |
|
553 |
//AVEVA Status |
554 |
if (this.radDropDownListAVEVAStatus.Items.Count > 0) |
555 |
this.radDropDownListAVEVAStatus.Items.Clear(); |
556 |
informations.JobStatus.ForEach(x => |
557 |
{ |
558 |
this.radDropDownListAVEVAStatus.Items.Add(new RadListDataItem(x, x)); |
559 |
}); |
560 |
var allAVEVAStatus = new RadListDataItem("== 전체 ==", string.Empty); |
561 |
this.radDropDownListAVEVAStatus.Items.Insert(0, allAVEVAStatus); |
562 |
allAVEVAStatus.Selected = true; |
563 |
#endregion |
564 |
|
565 |
#region 검수 |
566 |
//도프텍 결과 |
567 |
if (this.radDropDownListProdIsResult.Items.Count > 0) |
568 |
this.radDropDownListProdIsResult.Items.Clear(); |
569 |
informations.ValidationResult.ForEach(x => |
570 |
{ |
571 |
this.radDropDownListProdIsResult.Items.Add(new RadListDataItem(x, x)); |
572 |
}); |
573 |
var allProdIsResult = new RadListDataItem("== 전체 ==", string.Empty); |
574 |
this.radDropDownListProdIsResult.Items.Insert(0, allProdIsResult); |
575 |
allProdIsResult.Selected = true; |
576 |
|
577 |
//삼성 결과 |
578 |
if (this.radDropDownListClientIsResult.Items.Count > 0) |
579 |
this.radDropDownListClientIsResult.Items.Clear(); |
580 |
informations.ValidationResult.ForEach(x => |
581 |
{ |
582 |
this.radDropDownListClientIsResult.Items.Add(new RadListDataItem(x, x)); |
583 |
}); |
584 |
var allClientIsResult = new RadListDataItem("== 전체 ==", string.Empty); |
585 |
this.radDropDownListClientIsResult.Items.Insert(0, allClientIsResult); |
586 |
allClientIsResult.Selected = true; |
587 |
#endregion |
588 |
|
589 |
#region AVEVA |
590 |
//Gateway |
591 |
if (this.radDropDownListGateway.Items.Count > 0) |
592 |
this.radDropDownListGateway.Items.Clear(); |
593 |
informations.IsSuccess.ForEach(x => |
594 |
{ |
595 |
this.radDropDownListGateway.Items.Add(new RadListDataItem(x, x)); |
596 |
}); |
597 |
var allDTIsGateWay = new RadListDataItem("== 전체 ==", string.Empty); |
598 |
this.radDropDownListGateway.Items.Insert(0, allDTIsGateWay); |
599 |
allDTIsGateWay.Selected = true; |
600 |
|
601 |
//Registration |
602 |
if (this.radDropDownListRegistration.Items.Count > 0) |
603 |
this.radDropDownListRegistration.Items.Clear(); |
604 |
informations.IsSuccess.ForEach(x => |
605 |
{ |
606 |
this.radDropDownListRegistration.Items.Add(new RadListDataItem(x, x)); |
607 |
}); |
608 |
var allDTIsRegSystem = new RadListDataItem("== 전체 ==", string.Empty); |
609 |
this.radDropDownListRegistration.Items.Insert(0, allDTIsRegSystem); |
610 |
allDTIsRegSystem.Selected = true; |
611 |
#endregion |
612 |
|
613 |
this.GetDocList(); |
614 |
} |
615 |
catch (Exception ex) |
616 |
{ |
617 |
throw ex; |
618 |
} |
619 |
finally |
620 |
{ |
621 |
|
622 |
this.Cursor = Cursors.Default; |
623 |
|
624 |
} |
625 |
|
626 |
} |
627 |
|
628 |
#region Document List 조회 |
629 |
public void GetDocList() |
630 |
{ |
631 |
try |
632 |
{ |
633 |
if (this.radDropDownListProject.SelectedValue != null) |
634 |
{ |
635 |
string projectCode = this.radDropDownListProject.SelectedValue.ToString(); |
636 |
string personIncharge = this.radDropDownListPersonInCharge.SelectedValue.ToString(); |
637 |
string jobLevel = this.radDropDownListJobLevel.SelectedValue.ToString(); |
638 |
string documentNo = this.radTextBoxDocumentNo.Text.Trim(); |
639 |
|
640 |
string isToIsDiscussion = this.radDropDownListToIsDiscussion.SelectedValue.ToString(); |
641 |
string isFrReviewStatus = this.radDropDownListFrReviewStatus.SelectedValue.ToString(); |
642 |
string isID2Work = this.radDropDownListIsID2Work.SelectedValue.ToString(); |
643 |
|
644 |
string id2Status = this.radDropDownListID2Status.SelectedValue.ToString(); |
645 |
string avevaStatus = this.radDropDownListAVEVAStatus.SelectedValue.ToString(); |
646 |
|
647 |
string prodIsResult = this.radDropDownListProdIsResult.SelectedValue.ToString(); |
648 |
string clientIsResult = this.radDropDownListClientIsResult.SelectedValue.ToString(); |
649 |
|
650 |
string isGateWay = this.radDropDownListGateway.SelectedValue.ToString(); |
651 |
string isRegSystem = this.radDropDownListRegistration.SelectedValue.ToString(); |
652 |
|
653 |
var worker = new LoadDocumentsWorker(projectCode, personIncharge, jobLevel, documentNo, isToIsDiscussion, isFrReviewStatus, isID2Work, id2Status, avevaStatus, prodIsResult, clientIsResult, isGateWay, isRegSystem, this.radGridViewDocuments); |
654 |
worker.OnWorkCompletedHandler += (e) => |
655 |
{ |
656 |
var docData = e.Result as DocumentsResult; |
657 |
|
658 |
this.documents = docData.Dwgs; |
659 |
this.orgDocuments = JsonConvert.DeserializeObject<List<Documents>>(JsonConvert.SerializeObject(docData.Dwgs)); |
660 |
this.TotalCount = docData.TotalCount; |
661 |
|
662 |
List<string> projectCodes = new List<string>(); |
663 |
|
664 |
if (!string.IsNullOrWhiteSpace(projectCode)) |
665 |
{ |
666 |
projectCodes.Add(projectCode); |
667 |
} |
668 |
else |
669 |
{ |
670 |
projectCodes = informations.ProjectList.Select(x => x.Code).ToList(); |
671 |
} |
672 |
|
673 |
this.DocumentListBinding(); |
674 |
}; |
675 |
worker.StartWork(); |
676 |
} |
677 |
} |
678 |
catch (Exception ex) |
679 |
{ |
680 |
throw ex; |
681 |
} |
682 |
} |
683 |
|
684 |
public void DocumentListBinding() |
685 |
{ |
686 |
try |
687 |
{ |
688 |
GridViewComboBoxColumn ColProjects = this.radGridViewDocuments.Columns["RefProjectCode"] as GridViewComboBoxColumn; |
689 |
ColProjects.DataSource = informations.ProjectList.Where(x => x.GroupID.Equals(informations.ActiveProject.ProjectID)).ToList(); |
690 |
ColProjects.DisplayMember = "Name"; |
691 |
ColProjects.ValueMember = "Code"; |
692 |
|
693 |
var workUsers = informations.UserList.Where(x => (new string[] { "Manager", "User" }).Contains(x.Role) && string.IsNullOrEmpty(x.RefProjectID)); |
694 |
var clientUsers = informations.UserList.Where(x => !string.IsNullOrEmpty(x.RefProjectID)); |
695 |
|
696 |
GridViewComboBoxColumn ColPersonInCharge = this.radGridViewDocuments.Columns["PersonInCharge"] as GridViewComboBoxColumn; |
697 |
ColPersonInCharge.DataSource = workUsers; |
698 |
ColPersonInCharge.DisplayMember = "Name"; |
699 |
ColPersonInCharge.ValueMember = "ID"; |
700 |
|
701 |
GridViewComboBoxColumn ColWorker = this.radGridViewDocuments.Columns["Worker"] as GridViewComboBoxColumn; |
702 |
ColWorker.DataSource = workUsers; |
703 |
ColWorker.DisplayMember = "Name"; |
704 |
ColWorker.ValueMember = "ID"; |
705 |
|
706 |
GridViewComboBoxColumn ColToCreator = this.radGridViewDocuments.Columns["ToCreator"] as GridViewComboBoxColumn; |
707 |
ColToCreator.DataSource = workUsers; |
708 |
ColToCreator.DisplayMember = "Name"; |
709 |
ColToCreator.ValueMember = "ID"; |
710 |
|
711 |
GridViewComboBoxColumn ColFrCreator = this.radGridViewDocuments.Columns["FrCreator"] as GridViewComboBoxColumn; |
712 |
ColFrCreator.DataSource = clientUsers; |
713 |
ColFrCreator.DisplayMember = "Name"; |
714 |
ColFrCreator.ValueMember = "ID"; |
715 |
|
716 |
GridViewComboBoxColumn ColProdReviewer = this.radGridViewDocuments.Columns["ProdReviewer"] as GridViewComboBoxColumn; |
717 |
ColProdReviewer.DataSource = workUsers; |
718 |
ColProdReviewer.DisplayMember = "Name"; |
719 |
ColProdReviewer.ValueMember = "ID"; |
720 |
|
721 |
GridViewComboBoxColumn ColClientReviewer = this.radGridViewDocuments.Columns["ClientReviewer"] as GridViewComboBoxColumn; |
722 |
ColClientReviewer.DataSource = clientUsers; |
723 |
ColClientReviewer.DisplayMember = "Name"; |
724 |
ColClientReviewer.ValueMember = "ID"; |
725 |
|
726 |
//Data |
727 |
if (this.radGridViewDocuments.DataSource != null) |
728 |
this.radGridViewDocuments.DataSource = null; |
729 |
|
730 |
/* |
731 |
var info = informations.ProjectList.Where(x => x.Name.Equals("APAO")).FirstOrDefault().ID2Info; |
732 |
var id2Datas = new DocumentController(info).GetID2DrawingsByProject(info); |
733 |
var test = from doc in this.documents |
734 |
join id2 in id2Datas on doc.DocumentNo equals id2.DOCNAME into gj |
735 |
from docs in gj.DefaultIfEmpty() |
736 |
select new Documents() |
737 |
{ |
738 |
DocumentNo = doc.DocumentNo, |
739 |
ID2EndDate = docs?.DATETIME == null ? (DateTime?)null : Convert.ToDateTime(docs?.DATETIME) |
740 |
//ProdRemarks = docs.DATETIME ?? null |
741 |
}; |
742 |
*/ |
743 |
|
744 |
this.radGridViewDocuments.FilterDescriptors.Clear(); |
745 |
this.radGridViewDocuments.DataSource = new BindingList<Documents>(this.documents); |
746 |
this.lbSelectAndTotal.Text = $"{this.documents.Count} / {this.TotalCount} (Selected / Total)"; |
747 |
} |
748 |
catch (Exception ex) |
749 |
{ |
750 |
throw ex; |
751 |
} |
752 |
} |
753 |
#endregion |
754 |
|
755 |
#region Button, Checkbox event |
756 |
private void RadCheckBox_CheckStateChanged(object sender, EventArgs e) |
757 |
{ |
758 |
if (sender is RadCheckBox) |
759 |
{ |
760 |
RadCheckBox checkBox = sender as RadCheckBox; |
761 |
|
762 |
if (checkBox.Tag != null) |
763 |
{ |
764 |
ColumnGroupsViewDefinition columnGroupsView = this.radGridViewDocuments.MasterTemplate.ViewDefinition as ColumnGroupsViewDefinition; |
765 |
GridViewColumnGroup colGroup = columnGroupsView.GetAllGroups().Where(x => x.Name.Equals(checkBox.Tag.ToString())).FirstOrDefault(); |
766 |
if (colGroup != null) |
767 |
colGroup.IsVisible = checkBox.Checked; |
768 |
} |
769 |
} |
770 |
|
771 |
//ColumnGroupsViewDefinition columnGroupsView = this.radGridViewDocuments.MasterTemplate.ViewDefinition = columnGroupsView; |
772 |
} |
773 |
|
774 |
private void RadTextBoxDocumentNo_KeyDown(object sender, KeyEventArgs e) |
775 |
{ |
776 |
if (e.KeyCode == Keys.Enter) |
777 |
{ |
778 |
this.radButtonSearch.Focus(); |
779 |
this.radButtonSearch.PerformClick(); |
780 |
} |
781 |
} |
782 |
|
783 |
private void RadButtonSearch_Click(object sender, EventArgs e) |
784 |
{ |
785 |
try |
786 |
{ |
787 |
this.GetDocList(); |
788 |
} |
789 |
catch (Exception ex) |
790 |
{ |
791 |
Program.logger.Error($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex); |
792 |
RadMessageBox.Show("DWG search failed.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error); |
793 |
} |
794 |
} |
795 |
|
796 |
private void BackstageButtonItemUserRegistration_Click(object sender, EventArgs e) |
797 |
{ |
798 |
using (var frm = new SetupUser()) |
799 |
{ |
800 |
if (frm.ShowDialog(this) == DialogResult.OK) |
801 |
{ |
802 |
|
803 |
} |
804 |
} |
805 |
} |
806 |
|
807 |
private void BackstageButtonItemExit_Click(object sender, EventArgs e) |
808 |
{ |
809 |
Application.Exit(); |
810 |
} |
811 |
#endregion |
812 |
|
813 |
#region Grid event |
814 |
private void RadGridViewDocuments_CommandCellClick(object sender, GridViewCellEventArgs e) |
815 |
{ |
816 |
if (e.Row is GridViewNewRowInfo) |
817 |
{ |
818 |
|
819 |
} |
820 |
else |
821 |
{ |
822 |
string extension = string.Empty; |
823 |
|
824 |
switch (e.Column.Name) |
825 |
{ |
826 |
case "MarkupLink": |
827 |
{ |
828 |
if (e.Row.DataBoundItem is Documents doc) |
829 |
{ |
830 |
if (!string.IsNullOrWhiteSpace(doc.RefProjectCode) && !string.IsNullOrWhiteSpace(doc.DocumentNo) && !string.IsNullOrWhiteSpace(informations.ActiveUser.ID)) |
831 |
{ |
832 |
bool result = MarkusHelper.Start(doc.RefProjectCode, doc.DocumentNo, informations.ActiveUser.ID); |
833 |
} |
834 |
} |
835 |
} |
836 |
break; |
837 |
case "AVEVALink": |
838 |
case "AVEVAConnection": |
839 |
MessageBox.Show($"{e.Column.Name} 실행"); |
840 |
break; |
841 |
case "ReviewFileName"://일단주석 |
842 |
MessageBox.Show($"{e.Column.Name} 실행"); |
843 |
break; |
844 |
case "SystemLink": |
845 |
MessageBox.Show($"{e.Column.Name} 실행"); |
846 |
break; |
847 |
case "ToCapture": |
848 |
{ |
849 |
if (e.Row.DataBoundItem is Documents dd) |
850 |
{ |
851 |
using (var frm = new ImageView(dd.DocID, "toreview")) |
852 |
{ |
853 |
frm.ShowDialog(this); |
854 |
} |
855 |
} |
856 |
} |
857 |
break; |
858 |
case "FrCapture": |
859 |
{ |
860 |
if (e.Row.DataBoundItem is Documents dd) |
861 |
{ |
862 |
using (var frm = new ImageView(dd.DocID, "frreview")) |
863 |
{ |
864 |
frm.ShowDialog(this); |
865 |
} |
866 |
} |
867 |
} |
868 |
break; |
869 |
case "ID2Connection": |
870 |
try |
871 |
{ |
872 |
if (e.Row.DataBoundItem is Documents doc) |
873 |
{ |
874 |
ID2Helper.OpenPID(doc.DocumentNo, string.Empty, Properties.Settings.Default.ID2Port); |
875 |
|
876 |
try |
877 |
{ |
878 |
var returnDoc = new DocumentController().SetID2Worker(new Documents() |
879 |
{ |
880 |
DocID = doc.DocID, |
881 |
ID2StartDate = DateTime.Now, |
882 |
Worker = informations.ActiveUser.ID |
883 |
}, informations.ActiveUser.ID); |
884 |
|
885 |
if (returnDoc != null) |
886 |
{ |
887 |
doc.ID2StartDate = returnDoc.ID2StartDate; |
888 |
doc.Worker = returnDoc.Worker; |
889 |
doc.ID2JobTime = returnDoc.ID2JobTime; |
890 |
} |
891 |
} |
892 |
catch { } |
893 |
} |
894 |
} |
895 |
catch (Exception ex) |
896 |
{ |
897 |
RadMessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, RadMessageIcon.Error); |
898 |
} |
899 |
break; |
900 |
} |
901 |
} |
902 |
} |
903 |
|
904 |
private void RadGridViewDocuments_CellBeginEdit(object sender, GridViewCellCancelEventArgs e) |
905 |
{ |
906 |
if (e.ActiveEditor is RadDropDownListEditor) |
907 |
{ |
908 |
switch (e.Column.Name) |
909 |
{ |
910 |
case "JobLevel": |
911 |
GridViewComboBoxColumn colJobLevel = this.radGridViewDocuments.Columns[e.Column.Name] as GridViewComboBoxColumn; |
912 |
colJobLevel.DataSource = informations.JobLevel; |
913 |
break; |
914 |
case "IsTypical": |
915 |
case "ToIsDiscussion": |
916 |
case "ToIsMarkup": |
917 |
case "FrIsMarkup": |
918 |
case "IsID2Work": |
919 |
case "DTIsImport": |
920 |
GridViewComboBoxColumn colYesNo = this.radGridViewDocuments.Columns[e.Column.Name] as GridViewComboBoxColumn; |
921 |
colYesNo.DataSource = (new string[] { string.Empty }).Union<string>(informations.IsYesNo); |
922 |
break; |
923 |
case "DTIsGateWay": |
924 |
case "DTIsRegSystem": |
925 |
GridViewComboBoxColumn colSuccess = this.radGridViewDocuments.Columns[e.Column.Name] as GridViewComboBoxColumn; |
926 |
colSuccess.DataSource = (new string[] { string.Empty }).Union<string>(informations.IsSuccess); |
927 |
break; |
928 |
case "ID2Status": |
929 |
case "AVEVAStatus": |
930 |
GridViewComboBoxColumn ColJobStatus = this.radGridViewDocuments.Columns[e.Column.Name] as GridViewComboBoxColumn; |
931 |
ColJobStatus.DataSource = (new string[] { string.Empty }).Union<string>(informations.JobStatus); |
932 |
break; |
933 |
case "FrReviewStatus"://삼성의견status |
934 |
GridViewComboBoxColumn ColClientStatus = this.radGridViewDocuments.Columns[e.Column.Name] as GridViewComboBoxColumn; |
935 |
ColClientStatus.DataSource = (new string[] { string.Empty }).Union<string>(informations.ClientStatus); |
936 |
break; |
937 |
case "ProdIsResult": |
938 |
case "ClientIsResult": |
939 |
GridViewComboBoxColumn ColResult = this.radGridViewDocuments.Columns[e.Column.Name] as GridViewComboBoxColumn; |
940 |
ColResult.DataSource = (new string[] { string.Empty }).Union<string>(informations.ValidationResult); |
941 |
break; |
942 |
} |
943 |
} |
944 |
} |
945 |
|
946 |
private void RadGridViewDocuments_CreateRow(object sender, GridViewCreateRowEventArgs e) |
947 |
{ |
948 |
if (e.RowType == typeof(GridDetailViewRowElement)) |
949 |
{ |
950 |
//if (e.RowInfo.ChildRows.Count() > 0) |
951 |
//{ |
952 |
e.RowElement = new RowDetailViewRowElement(); |
953 |
|
954 |
//} |
955 |
//else |
956 |
//{ |
957 |
// e.RowElement = null; |
958 |
//} |
959 |
} |
960 |
} |
961 |
|
962 |
|
963 |
private void RadGridViewDocuments_CreateCell1(object sender, GridViewCreateCellEventArgs e) |
964 |
{ |
965 |
if (e.CellType == typeof(GridDetailViewCellElement)) |
966 |
{ |
967 |
//if (e.Row.RowInfo.ChildRows.Count() > 0) |
968 |
//{ |
969 |
e.CellElement = new MarkupDetailCellElement(e.Column, e.Row); |
970 |
//} |
971 |
} |
972 |
} |
973 |
|
974 |
|
975 |
private void RadGridViewDocuments_ViewCellFormatting(object sender, CellFormattingEventArgs e) |
976 |
{ |
977 |
if (e.Row is GridViewDataRowInfo) |
978 |
{ |
979 |
if (e.CellElement is GridRowHeaderCellElement) |
980 |
{ |
981 |
// if (e.CellElement.RowIndex > -1) |
982 |
// e.CellElement.Text = (e.CellElement.RowIndex + 1).ToString(); |
983 |
} |
984 |
else |
985 |
{ |
986 |
var result = e.Row.DataBoundItem as Documents; |
987 |
if (result != null || e.Row is GridViewNewRowInfo) |
988 |
{ |
989 |
switch (e.CellElement.ColumnInfo.Name) |
990 |
{ |
991 |
case "AutoCADLink": |
992 |
case "PDFLink": |
993 |
case "MarkupLink": |
994 |
case "AVEVALink": |
995 |
case "AVEVAConnection": |
996 |
case "ReviewFileName"://일단주석 |
997 |
case "SystemLink": |
998 |
case "ToCapture": |
999 |
case "FrCapture": |
1000 |
case "ID2Connection": |
1001 |
this.GetCommandColBtnElement(e.CellElement.Children[0], e.CellElement.ColumnInfo.Name); |
1002 |
break; |
1003 |
} |
1004 |
} |
1005 |
else |
1006 |
{ |
1007 |
|
1008 |
} |
1009 |
} |
1010 |
} |
1011 |
//else if (e.Row is GridViewSummaryRowInfo) |
1012 |
//{ |
1013 |
// if (e.CellElement is GridRowHeaderCellElement) |
1014 |
// { |
1015 |
// e.CellElement.Text = "Count"; |
1016 |
// } |
1017 |
// else if (e.CellElement is GridSummaryCellElement) |
1018 |
// { |
1019 |
// e.CellElement.ForeColor = this._SummaryColor; |
1020 |
// e.CellElement.TextAlignment = ContentAlignment.BottomRight; |
1021 |
// e.CellElement.Font = new Font(e.CellElement.Font, FontStyle.Bold); |
1022 |
// } |
1023 |
// else |
1024 |
// { |
1025 |
|
1026 |
// } |
1027 |
//} |
1028 |
else if(e.Row is GridViewDetailsRowInfo) |
1029 |
{ |
1030 |
if(e.CellElement is MarkupDetailCellElement element) |
1031 |
{ |
1032 |
//element.UpdateInfo(); |
1033 |
} |
1034 |
} |
1035 |
else |
1036 |
{ |
1037 |
|
1038 |
} |
1039 |
} |
1040 |
|
1041 |
private RadButtonElement GetCommandColBtnElement(RadElement elem, string colName) |
1042 |
{ |
1043 |
RadButtonElement btnElem = null; |
1044 |
Bitmap bitmap = null; ; |
1045 |
|
1046 |
switch (colName) |
1047 |
{ |
1048 |
case "AutoCADLink": |
1049 |
bitmap = new Bitmap(Properties.Resources.cad18); |
1050 |
break; |
1051 |
case "PDFLink": |
1052 |
bitmap = new Bitmap(Properties.Resources.pdf18); |
1053 |
break; |
1054 |
case "MarkupLink": |
1055 |
bitmap = new Bitmap(Properties.Resources.markus18); |
1056 |
break; |
1057 |
case "AVEVALink": |
1058 |
case "AVEVAConnection": |
1059 |
bitmap = new Bitmap(Properties.Resources.aveva_net18); |
1060 |
break; |
1061 |
case "ReviewFileName"://일단주석 |
1062 |
bitmap = new Bitmap(Properties.Resources.pdf18); |
1063 |
break; |
1064 |
case "SystemLink": |
1065 |
bitmap = new Bitmap(Properties.Resources.link18_yellow); |
1066 |
break; |
1067 |
case "ToCapture": |
1068 |
case "FrCapture": |
1069 |
bitmap = new Bitmap(Properties.Resources.files18); |
1070 |
break; |
1071 |
case "ID2Connection": |
1072 |
bitmap = new Bitmap(Properties.Resources.id218); |
1073 |
break; |
1074 |
} |
1075 |
|
1076 |
switch (colName) |
1077 |
{ |
1078 |
case "AutoCADLink": |
1079 |
case "PDFLink": |
1080 |
case "MarkupLink": |
1081 |
case "AVEVALink": |
1082 |
case "AVEVAConnection": |
1083 |
case "ReviewFileName"://일단주석 |
1084 |
case "SystemLink": |
1085 |
case "ToCapture": |
1086 |
case "FrCapture": |
1087 |
case "ID2Connection": |
1088 |
btnElem = (RadButtonElement)elem; |
1089 |
btnElem.Margin = new Padding(0); |
1090 |
btnElem.Padding = new Padding(0); |
1091 |
btnElem.BorderElement.Opacity = 0; |
1092 |
btnElem.Alignment = ContentAlignment.MiddleCenter; |
1093 |
btnElem.DisplayStyle = DisplayStyle.Image; |
1094 |
btnElem.Image = bitmap; |
1095 |
btnElem.ImageAlignment = ContentAlignment.MiddleCenter; |
1096 |
btnElem.MaxSize = bitmap.Size; |
1097 |
break; |
1098 |
} |
1099 |
|
1100 |
return btnElem; |
1101 |
} |
1102 |
|
1103 |
private void RadGridViewDocuments_FilterChanged(object sender, GridViewCollectionChangedEventArgs e) |
1104 |
{ |
1105 |
this.lbSelectAndTotal.Text = $"{e.GridViewTemplate.DataView.Count} / {this.TotalCount} (Selected / Total)"; |
1106 |
} |
1107 |
#endregion |
1108 |
|
1109 |
#region Excel |
1110 |
private UserInfo GetUser(string user) |
1111 |
{ |
1112 |
UserInfo userInfo = informations.UserList.Where(x => x.ID.Equals(user)).FirstOrDefault(); |
1113 |
if (userInfo != null) return userInfo; |
1114 |
|
1115 |
userInfo = informations.UserList.Where(x => x.Name.Equals(user)).FirstOrDefault(); |
1116 |
if (userInfo != null) return userInfo; |
1117 |
|
1118 |
return userInfo ?? new UserInfo(); |
1119 |
} |
1120 |
|
1121 |
private ProjectInfo GetProject(string project) |
1122 |
{ |
1123 |
ProjectInfo prjInfo = informations.ProjectList.Where(x => x.ProjectID.Equals(project)).FirstOrDefault(); |
1124 |
if (prjInfo != null) return prjInfo; |
1125 |
|
1126 |
prjInfo = informations.ProjectList.FirstOrDefault(x => x.Name.Equals(project)); |
1127 |
if (prjInfo != null) return prjInfo; |
1128 |
|
1129 |
return prjInfo ?? new ProjectInfo(); |
1130 |
} |
1131 |
|
1132 |
private void RadButtonElementExcelImport_Click(object sender, EventArgs e) |
1133 |
{ |
1134 |
var form = new Forms.SelectExcelData(); |
1135 |
|
1136 |
var dialogResult = form.ShowDialog(); |
1137 |
|
1138 |
if (dialogResult == DialogResult.OK) |
1139 |
{ |
1140 |
using (ID2Excel excel = new ID2Excel()) |
1141 |
{ |
1142 |
var result = excel.ExcelDataImport(form.SelectItems); |
1143 |
|
1144 |
if (result.Error != null) |
1145 |
{ |
1146 |
|
1147 |
RadMessageBox.Show(result.Error, "Information", MessageBoxButtons.OK, RadMessageIcon.Info); |
1148 |
} |
1149 |
else |
1150 |
{ |
1151 |
this.importImages = result.Images; |
1152 |
this.documents.AddRange(result.documents); |
1153 |
if (this.orgDocuments == null) this.orgDocuments = new List<Documents>(); |
1154 |
this.DocumentListBinding(); |
1155 |
//briefAndImagesReview.SetImages(this.importImages); |
1156 |
} |
1157 |
|
1158 |
} |
1159 |
} |
1160 |
} |
1161 |
|
1162 |
private void RadButtonElementExcelImport_Click_gembox(object sender, EventArgs e) |
1163 |
{ |
1164 |
using (OpenFileDialog ofd = new OpenFileDialog() |
1165 |
{ |
1166 |
Filter = "Excel files (*.xlsx)|*.xlsx", |
1167 |
Title = "Open an Excel File", |
1168 |
RestoreDirectory = true |
1169 |
}) |
1170 |
{ |
1171 |
if (ofd.ShowDialog() == DialogResult.OK) |
1172 |
{ |
1173 |
//Error Message |
1174 |
StringBuilder sbErrMsg = new StringBuilder(); |
1175 |
|
1176 |
using(ID2Excel excel = new ID2Excel()) |
1177 |
{ |
1178 |
var result = excel.GemboxImport(ofd.FileName); |
1179 |
|
1180 |
if(result.Error != null) |
1181 |
{ |
1182 |
|
1183 |
RadMessageBox.Show(result.Error, "Information", MessageBoxButtons.OK, RadMessageIcon.Info); |
1184 |
} |
1185 |
else |
1186 |
{ |
1187 |
this.documents.AddRange(result.documents); |
1188 |
if (this.orgDocuments == null) this.orgDocuments = new List<Documents>(); |
1189 |
this.DocumentListBinding(); |
1190 |
} |
1191 |
|
1192 |
} |
1193 |
|
1194 |
|
1195 |
//foreach (Documents appDoc in appendDocuments) |
1196 |
//{ |
1197 |
// GridViewRowInfo rowInfo = this.radGridViewDocuments.Rows.AddNew(); |
1198 |
|
1199 |
// foreach (FieldInfo fieldInfo in appDoc.GetType().GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)) |
1200 |
// { |
1201 |
// if (fieldInfo.GetValue(appDoc) != null) |
1202 |
// { |
1203 |
// var cols = rowInfo.Cells.Where(x => fieldInfo.Name.Contains($"<{x.ColumnInfo.Name}>")); |
1204 |
|
1205 |
// if (cols.Any()) |
1206 |
// { |
1207 |
// cols.FirstOrDefault().Value = fieldInfo.GetValue(appDoc); |
1208 |
// } |
1209 |
// } |
1210 |
// } |
1211 |
//} |
1212 |
} |
1213 |
} |
1214 |
} |
1215 |
|
1216 |
private void RadButtonElementExcelImport_Click_old(object sender, EventArgs e) |
1217 |
{ |
1218 |
using (OpenFileDialog ofd = new OpenFileDialog() |
1219 |
{ |
1220 |
Filter = "Excel files (*.xlsx)|*.xlsx", |
1221 |
Title = "Open an Excel File", |
1222 |
RestoreDirectory = true |
1223 |
}) |
1224 |
{ |
1225 |
if (ofd.ShowDialog() == DialogResult.OK) |
1226 |
{ |
1227 |
//Error Message |
1228 |
StringBuilder sbErrMsg = new StringBuilder(); |
1229 |
|
1230 |
var exFile = ExcelFile.Load(ofd.FileName); |
1231 |
var ws = exFile.Worksheets[0]; |
1232 |
|
1233 |
int rowCount = ws.Rows.Count; |
1234 |
int columnCount = ws.CalculateMaxUsedColumns(); |
1235 |
int exRow = 8; |
1236 |
|
1237 |
#region Excel 유효성검사 |
1238 |
|
1239 |
//Excel 포멧체크 |
1240 |
if (rowCount < 10 || columnCount != 45) |
1241 |
{ |
1242 |
RadMessageBox.Show("Please, check the excel.\n", "Information", MessageBoxButtons.OK, RadMessageIcon.Info); |
1243 |
return; |
1244 |
} |
1245 |
|
1246 |
#region 엑셀 필수값 체크(도면 : 이름,담당자, 난이도, Typical) |
1247 |
ws.Rows.SelectMany(row => row.AllocatedCells) |
1248 |
.Where(col => col.Column.Index > 5 && col.Column.Index < 10 && col.Row.Index > exRow && col.Value == null) |
1249 |
.ToList() |
1250 |
.ForEach(p => sbErrMsg.Append(", " + p.Column.Name + p.Row.Name)); |
1251 |
|
1252 |
if (sbErrMsg.Length > 0) |
1253 |
{ |
1254 |
string errMsg = sbErrMsg.ToString().Substring(2); |
1255 |
if (errMsg.Length > 100) |
1256 |
{ |
1257 |
errMsg = $"{errMsg.Substring(0, 100)}..."; |
1258 |
} |
1259 |
|
1260 |
RadMessageBox.Show($"Please, check null value in excel.\n{errMsg}", "Information", MessageBoxButtons.OK, RadMessageIcon.Info); |
1261 |
return; |
1262 |
} |
1263 |
#endregion |
1264 |
|
1265 |
#region 엑셀 도명명 중복 값 체크 |
1266 |
ws.Rows.SelectMany(row => row.AllocatedCells) |
1267 |
.Where(col => col.Column.Index == 6 && col.Row.Index > exRow) |
1268 |
.GroupBy(g => g.Row.Index) |
1269 |
.Select(p => new { |
1270 |
rowIndex = p.Key, |
1271 |
docNo = p.Select(x => x.Value.ToString()).FirstOrDefault() |
1272 |
}) |
1273 |
.GroupBy(g => g.docNo) |
1274 |
.Where(p => p.Count() > 1) |
1275 |
.Select(p => p.Select(x => (x.rowIndex + 1).ToString()) |
1276 |
.Aggregate((x, y) => x.ToString() + "," + y.ToString()) |
1277 |
.ToString()) |
1278 |
.ToList().ForEach(p => sbErrMsg.Append("\n" + p.ToString())); |
1279 |
if (sbErrMsg.Length > 0) |
1280 |
{ |
1281 |
sbErrMsg.Insert(0, "\n중복 된 도면명 Excel row : "); |
1282 |
string errMsg = sbErrMsg.ToString(); |
1283 |
if (errMsg.Length > 100) |
1284 |
{ |
1285 |
errMsg = $"{errMsg.Substring(0, 100)}..."; |
1286 |
} |
1287 |
|
1288 |
RadMessageBox.Show($"Please, check the duplicate value in excel.\n{errMsg}", "Information", MessageBoxButtons.OK, RadMessageIcon.Info); |
1289 |
return; |
1290 |
} |
1291 |
#endregion |
1292 |
|
1293 |
#endregion |
1294 |
|
1295 |
List<Documents> appendDocuments = new List<Documents>(); |
1296 |
|
1297 |
ws.Rows.Where(row => row.Index > exRow) |
1298 |
.ToList() |
1299 |
.ForEach(p => appendDocuments.Add(new Documents() |
1300 |
{ |
1301 |
//UID = string.Empty, |
1302 |
//Type = this.radTextBoxInsulationType.Text, |
1303 |
//TempFrom = ws.Rows[exRow].Cells[p.Column.Index].Value == null ? 0 : Convert.ToSingle(ws.Rows[exRow].Cells[p.Column.Index].Value), |
1304 |
//TempTo = ws.Rows[exRow + 2].Cells[p.Column.Index].Value == null ? 0 : Convert.ToSingle(ws.Rows[exRow + 2].Cells[p.Column.Index].Value), |
1305 |
//NPS = ws.Rows[p.Row.Index].Cells[0].Value == null ? 0 : Convert.ToSingle(ws.Rows[p.Row.Index].Cells[0].Value), |
1306 |
//Thickness = p.Value == null ? 0 : Convert.ToSingle(p.Value) |
1307 |
|
1308 |
RefProjectCode = ws.Rows[p.Index].Cells[5].Value == null ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(), |
1309 |
DocumentNo = ws.Rows[p.Index].Cells[6].Value == null ? string.Empty : ws.Rows[p.Index].Cells[6].Value.ToString(), |
1310 |
PersonInCharge = ws.Rows[p.Index].Cells[7].Value == null ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[7].Value.ToString()).ID, |
1311 |
JobLevel = ws.Rows[p.Index].Cells[8].Value == null ? string.Empty : ws.Rows[p.Index].Cells[8].Value.ToString(), |
1312 |
IsTypical = ws.Rows[p.Index].Cells[9].Value == null ? string.Empty : ws.Rows[p.Index].Cells[9].Value.ToString(), |
1313 |
RevisonNo = ws.Rows[p.Index].Cells[10].Value == null ? string.Empty : ws.Rows[p.Index].Cells[10].Value.ToString(), |
1314 |
ToIsDiscussion = ws.Rows[p.Index].Cells[11].Value == null ? string.Empty : ws.Rows[p.Index].Cells[11].Value.ToString(), |
1315 |
ToRemarks = ws.Rows[p.Index].Cells[12].Value == null ? string.Empty : ws.Rows[p.Index].Cells[12].Value.ToString(), |
1316 |
ToCreator = ws.Rows[p.Index].Cells[13].Value == null ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[13].Value.ToString()).ID, |
1317 |
//ToCapture = ws.Rows[p.Index].Cells[5].Value == null ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(), |
1318 |
//ToIsMarkup = ws.Rows[p.Index].Cells[5].Value == null ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(), |
1319 |
FrReviewStatus = ws.Rows[p.Index].Cells[16].Value == null ? string.Empty : ws.Rows[p.Index].Cells[16].Value.ToString(), |
1320 |
FrRemarks = ws.Rows[p.Index].Cells[17].Value == null ? string.Empty : ws.Rows[p.Index].Cells[17].Value.ToString(), |
1321 |
FrCreator = ws.Rows[p.Index].Cells[18].Value == null ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[18].Value.ToString()).ID, |
1322 |
//FrCapture = ws.Rows[p.Index].Cells[5].Value == null ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(), |
1323 |
//FrIsMarkup = ws.Rows[p.Index].Cells[5].Value == null ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(), |
1324 |
IsID2Work = ws.Rows[p.Index].Cells[21].Value == null ? string.Empty : ws.Rows[p.Index].Cells[21].Value.ToString(), |
1325 |
//ID2Connection = ws.Rows[p.Index].Cells[5].Value == null ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(), |
1326 |
ID2StartDate = ws.Rows[p.Index].Cells[23].Value == null ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[23].Value?.ToString()), |
1327 |
ID2EndDate = ws.Rows[p.Index].Cells[24].Value == null ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[24].Value?.ToString()), |
1328 |
//ID2JobTime = ws.Rows[p.Index].Cells[5].Value == null ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(), |
1329 |
ID2Status = ws.Rows[p.Index].Cells[26].Value == null ? string.Empty : ws.Rows[p.Index].Cells[26].Value.ToString(), |
1330 |
ID2Issues = ws.Rows[p.Index].Cells[27].Value == null ? string.Empty : ws.Rows[p.Index].Cells[27].Value.ToString(), |
1331 |
//AVEVAConnection = ws.Rows[p.Index].Cells[5].Value == null ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(), |
1332 |
AVEVAConvertDate = ws.Rows[p.Index].Cells[29].Value == null ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[29].Value.ToString()), |
1333 |
AVEVAReviewDate = ws.Rows[p.Index].Cells[30].Value == null ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[30].Value.ToString()), |
1334 |
AVEVAStatus = ws.Rows[p.Index].Cells[31].Value == null ? string.Empty : ws.Rows[p.Index].Cells[31].Value.ToString(), |
1335 |
AVEVAIssues = ws.Rows[p.Index].Cells[32].Value == null ? string.Empty : ws.Rows[p.Index].Cells[32].Value.ToString(), |
1336 |
ProdReviewer = ws.Rows[p.Index].Cells[35].Value == null ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[35].Value.ToString()).ID, |
1337 |
ProdIsResult = ws.Rows[p.Index].Cells[36].Value == null ? string.Empty : ws.Rows[p.Index].Cells[36].Value.ToString(), |
1338 |
ProdRemarks = ws.Rows[p.Index].Cells[37].Value == null ? string.Empty : ws.Rows[p.Index].Cells[37].Value.ToString(), |
1339 |
ClientReviewer = ws.Rows[p.Index].Cells[38].Value == null ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[38].Value.ToString()).ID, |
1340 |
ClientIsResult = ws.Rows[p.Index].Cells[39].Value == null ? string.Empty : ws.Rows[p.Index].Cells[39].Value.ToString(), |
1341 |
ClientRemarks = ws.Rows[p.Index].Cells[40].Value == null ? string.Empty : ws.Rows[p.Index].Cells[40].Value.ToString(), |
1342 |
DTIsGateWay = ws.Rows[p.Index].Cells[41].Value == null ? string.Empty : ws.Rows[p.Index].Cells[41].Value.ToString(), |
1343 |
DTIsImport = ws.Rows[p.Index].Cells[42].Value == null ? string.Empty : ws.Rows[p.Index].Cells[42].Value.ToString(), |
1344 |
DTIsRegSystem = ws.Rows[p.Index].Cells[43].Value == null ? string.Empty : ws.Rows[p.Index].Cells[43].Value.ToString(), |
1345 |
DTRemarks = ws.Rows[p.Index].Cells[44].Value == null ? string.Empty : ws.Rows[p.Index].Cells[44].Value.ToString() |
1346 |
})); |
1347 |
|
1348 |
this.documents.AddRange(appendDocuments); |
1349 |
if (this.orgDocuments == null) this.orgDocuments = new List<Documents>(); |
1350 |
this.DocumentListBinding(); |
1351 |
|
1352 |
//foreach (Documents appDoc in appendDocuments) |
1353 |
//{ |
1354 |
// GridViewRowInfo rowInfo = this.radGridViewDocuments.Rows.AddNew(); |
1355 |
|
1356 |
// foreach (FieldInfo fieldInfo in appDoc.GetType().GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)) |
1357 |
// { |
1358 |
// if (fieldInfo.GetValue(appDoc) != null) |
1359 |
// { |
1360 |
// var cols = rowInfo.Cells.Where(x => fieldInfo.Name.Contains($"<{x.ColumnInfo.Name}>")); |
1361 |
|
1362 |
// if (cols.Any()) |
1363 |
// { |
1364 |
// cols.FirstOrDefault().Value = fieldInfo.GetValue(appDoc); |
1365 |
// } |
1366 |
// } |
1367 |
// } |
1368 |
//} |
1369 |
} |
1370 |
} |
1371 |
} |
1372 |
|
1373 |
private void RadButtonElementExcelExport_Click(object sender, EventArgs e) |
1374 |
{ |
1375 |
string sPrefixName = "Samsung Elec Task Management"; |
1376 |
string extension = ".xlsx"; |
1377 |
|
1378 |
using (SaveFileDialog sfd = new SaveFileDialog() |
1379 |
{ |
1380 |
FileName = $"{sPrefixName}_{DateTime.Now:yyyyMMddhhmmss}{extension}", |
1381 |
Filter = "Excel|*.xlsx", |
1382 |
Title = "Save an Excel File", |
1383 |
CheckFileExists = false, |
1384 |
CheckPathExists = true, |
1385 |
OverwritePrompt = true |
1386 |
}) |
1387 |
{ |
1388 |
if (sfd.ShowDialog() == DialogResult.OK) |
1389 |
{ |
1390 |
string fileName = $"{sPrefixName}{extension}"; |
1391 |
string templateFolder = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "Template"); |
1392 |
string templateFilePath = Path.Combine(templateFolder, fileName); |
1393 |
if (!File.Exists(templateFilePath)) |
1394 |
{ |
1395 |
RadMessageBox.Show(this, $"There is no {fileName} in {templateFolder}", "Error", MessageBoxButtons.OK, RadMessageIcon.Error); |
1396 |
return; |
1397 |
} |
1398 |
|
1399 |
if (this.radGridViewDocuments.Rows.Count > 0) |
1400 |
{ |
1401 |
var templateExcelFile = ExcelFile.Load(templateFilePath); |
1402 |
var templateWorksheets = templateExcelFile.Worksheets; |
1403 |
var templateWorksheet = templateWorksheets[0]; |
1404 |
|
1405 |
int rowIndex = 9; |
1406 |
//int colIndex = 1; |
1407 |
|
1408 |
foreach (var row in this.radGridViewDocuments.Rows) |
1409 |
{ |
1410 |
var doc = row.DataBoundItem as Documents; |
1411 |
|
1412 |
templateWorksheet.Cells[rowIndex, 0].Value = doc.Seq; |
1413 |
//templateWorksheet.Cells[rowIndex, 1].Value = doc.DocumentNo; |
1414 |
//templateWorksheet.Cells[rowIndex, 2].Value = doc.DocumentNo; |
1415 |
//templateWorksheet.Cells[rowIndex, 3].Value = doc.DocumentNo; |
1416 |
//templateWorksheet.Cells[rowIndex, 4].Value = doc.DocumentNo; |
1417 |
templateWorksheet.Cells[rowIndex, 5].Value = doc.RefProjectCode; |
1418 |
templateWorksheet.Cells[rowIndex, 6].Value = doc.DocumentNo; |
1419 |
templateWorksheet.Cells[rowIndex, 7].Value = this.GetUser(doc.PersonInCharge).Name; |
1420 |
templateWorksheet.Cells[rowIndex, 8].Value = doc.JobLevel; |
1421 |
templateWorksheet.Cells[rowIndex, 9].Value = doc.IsTypical; |
1422 |
templateWorksheet.Cells[rowIndex, 10].Value = doc.RevisonNo; |
1423 |
templateWorksheet.Cells[rowIndex, 11].Value = doc.ToIsDiscussion; |
1424 |
templateWorksheet.Cells[rowIndex, 12].Value = doc.ToRemarks; |
1425 |
templateWorksheet.Cells[rowIndex, 13].Value = this.GetUser(doc.ToCreator).Name; |
1426 |
templateWorksheet.Cells[rowIndex, 14].Value = doc.ToCapture; |
1427 |
templateWorksheet.Cells[rowIndex, 15].Value = doc.ToIsMarkup; |
1428 |
templateWorksheet.Cells[rowIndex, 16].Value = doc.FrReviewStatus; |
1429 |
templateWorksheet.Cells[rowIndex, 17].Value = doc.FrRemarks; |
1430 |
templateWorksheet.Cells[rowIndex, 18].Value = this.GetUser(doc.FrCreator).Name; |
1431 |
templateWorksheet.Cells[rowIndex, 19].Value = doc.FrCapture; |
1432 |
templateWorksheet.Cells[rowIndex, 20].Value = doc.FrIsMarkup; |
1433 |
templateWorksheet.Cells[rowIndex, 21].Value = doc.IsID2Work; |
1434 |
templateWorksheet.Cells[rowIndex, 22].Value = doc.ID2Connection; |
1435 |
templateWorksheet.Cells[rowIndex, 23].Value = $"{doc.ID2StartDate:yyyy/MM/dd hh:mm:ss}"; |
1436 |
templateWorksheet.Cells[rowIndex, 24].Value = $"{doc.ID2EndDate:yyyy/MM/dd hh:mm:ss}"; |
1437 |
templateWorksheet.Cells[rowIndex, 25].Value = doc.ID2JobTime; |
1438 |
templateWorksheet.Cells[rowIndex, 26].Value = doc.ID2Status; |
1439 |
templateWorksheet.Cells[rowIndex, 27].Value = doc.ID2Issues; |
1440 |
templateWorksheet.Cells[rowIndex, 28].Value = doc.AVEVAConnection; |
1441 |
templateWorksheet.Cells[rowIndex, 29].Value = $"{doc.AVEVAConvertDate:yyyy/MM/dd}"; |
1442 |
templateWorksheet.Cells[rowIndex, 30].Value = $"{doc.AVEVAReviewDate:yyyy/MM/dd}"; |
1443 |
templateWorksheet.Cells[rowIndex, 31].Value = doc.AVEVAStatus; |
1444 |
templateWorksheet.Cells[rowIndex, 32].Value = doc.AVEVAIssues; |
1445 |
//templateWorksheet.Cells[rowIndex, 33].Value = doc.DocumentNo; |
1446 |
//templateWorksheet.Cells[rowIndex, 34].Value = doc.DocumentNo; |
1447 |
templateWorksheet.Cells[rowIndex, 35].Value = this.GetUser(doc.ProdReviewer).Name; |
1448 |
templateWorksheet.Cells[rowIndex, 36].Value = doc.ProdIsResult; |
1449 |
templateWorksheet.Cells[rowIndex, 37].Value = doc.ProdRemarks; |
1450 |
templateWorksheet.Cells[rowIndex, 38].Value = this.GetUser(doc.ClientReviewer).Name; |
1451 |
templateWorksheet.Cells[rowIndex, 39].Value = doc.ClientIsResult; |
1452 |
templateWorksheet.Cells[rowIndex, 40].Value = doc.ClientRemarks; |
1453 |
templateWorksheet.Cells[rowIndex, 41].Value = doc.DTIsGateWay; |
1454 |
templateWorksheet.Cells[rowIndex, 42].Value = doc.DTIsImport; |
1455 |
templateWorksheet.Cells[rowIndex, 43].Value = doc.DTIsRegSystem; |
1456 |
templateWorksheet.Cells[rowIndex, 44].Value = doc.DTRemarks; |
1457 |
rowIndex++; |
1458 |
} |
1459 |
|
1460 |
templateExcelFile.Save(sfd.FileName); |
1461 |
RadMessageBox.Show("Exporting 'ID2 Document List' is complete", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info); |
1462 |
} |
1463 |
} |
1464 |
} |
1465 |
} |
1466 |
#endregion |
1467 |
|
1468 |
#region Save event |
1469 |
|
1470 |
private void SetSaved() |
1471 |
{ |
1472 |
try |
1473 |
{ |
1474 |
if (RadMessageBox.Show("Do you want to Save?", Globals.Name, MessageBoxButtons.YesNo, RadMessageIcon.Question) == DialogResult.Yes) |
1475 |
{ |
1476 |
var worker = new SetDocumentsWorker(this.documents, this.orgDocuments, this.radGridViewDocuments); |
1477 |
worker.OnWorkCompletedHandler += (e) => |
1478 |
{ |
1479 |
bool result = (bool)e.Result; |
1480 |
|
1481 |
bool markusResult = new MarkusInfoController().SetMarkusInfo(this.documents); |
1482 |
|
1483 |
bool markusMembersResult = new MarkusInfoController().SetMembers(informations.UserList); |
1484 |
|
1485 |
if (result && markusResult && markusMembersResult) |
1486 |
{ |
1487 |
RadMessageBox.Show("Save is complete", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info); |
1488 |
|
1489 |
this.GetDocList(); |
1490 |
} |
1491 |
else if (!result) |
1492 |
{ |
1493 |
RadMessageBox.Show("Save is not complete", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error); |
1494 |
} |
1495 |
else if (!markusResult) |
1496 |
{ |
1497 |
RadMessageBox.Show("Markus Data Save is not complete", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error); |
1498 |
} |
1499 |
else if (!markusMembersResult) |
1500 |
{ |
1501 |
RadMessageBox.Show("Markus Members Save is not complete", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error); |
1502 |
} |
1503 |
}; |
1504 |
worker.StartWork(); |
1505 |
} |
1506 |
} |
1507 |
catch (Exception ex) |
1508 |
{ |
1509 |
throw ex; |
1510 |
} |
1511 |
} |
1512 |
|
1513 |
private void RadButtonElementSaveCommand_Click(object sender, EventArgs e) |
1514 |
{ |
1515 |
try |
1516 |
{ |
1517 |
this.SetSaved(); |
1518 |
} |
1519 |
catch (Exception ex) |
1520 |
{ |
1521 |
Program.logger.Error($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex); |
1522 |
RadMessageBox.Show("DWG save failed.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error); |
1523 |
} |
1524 |
} |
1525 |
|
1526 |
private void RadButtonElementSave_Click(object sender, EventArgs e) |
1527 |
{ |
1528 |
try |
1529 |
{ |
1530 |
this.SetSaved(); |
1531 |
} |
1532 |
catch (Exception ex) |
1533 |
{ |
1534 |
Program.logger.Error($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex); |
1535 |
RadMessageBox.Show("DWG save failed.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error); |
1536 |
} |
1537 |
} |
1538 |
|
1539 |
private void RadButtonElementSync_Click(object sender, EventArgs e) |
1540 |
{ |
1541 |
try |
1542 |
{ |
1543 |
if (RadMessageBox.Show("Do you want to ID2 Sync?", Globals.Name, MessageBoxButtons.YesNo, RadMessageIcon.Question) == DialogResult.Yes) |
1544 |
{ |
1545 |
var worker = new SyncDocumentsWorker(this.radGridViewDocuments); |
1546 |
worker.OnWorkCompletedHandler += (arg) => |
1547 |
{ |
1548 |
if ((bool)arg.Result) |
1549 |
{ |
1550 |
this.GetDocList(); |
1551 |
|
1552 |
RadMessageBox.Show("Sync with ID2 completed.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info); |
1553 |
} |
1554 |
}; |
1555 |
worker.StartWork(); |
1556 |
} |
1557 |
} |
1558 |
catch (Exception ex) |
1559 |
{ |
1560 |
Program.logger.Error($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex); |
1561 |
RadMessageBox.Show("Failed to sync with id2.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error); |
1562 |
} |
1563 |
} |
1564 |
|
1565 |
private void RadButtonElementNotice_Click(object sender, EventArgs e) |
1566 |
{ |
1567 |
try |
1568 |
{ |
1569 |
AttFileInfo notiFileInfo = new AttFileController().GetAttFileInfo(informations.ActiveProject.ProjectID, "notice"); |
1570 |
|
1571 |
if (notiFileInfo == null) |
1572 |
{ |
1573 |
RadMessageBox.Show("No notice.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info); |
1574 |
} |
1575 |
else |
1576 |
{ |
1577 |
string noticePath = Path.Combine(Globals.ProgramDataFolder, "NoticeFiles"); |
1578 |
string noticeFileFullName = Path.Combine(noticePath, $"{notiFileInfo.FileID}{notiFileInfo.FileExtension}"); |
1579 |
|
1580 |
System.IO.FileInfo finfo = new System.IO.FileInfo(noticeFileFullName); |
1581 |
|
1582 |
if (!finfo.Directory.Exists) |
1583 |
{ |
1584 |
Directory.CreateDirectory(noticePath); |
1585 |
} |
1586 |
|
1587 |
if (!finfo.Exists) |
1588 |
{ |
1589 |
var arrayBinary = notiFileInfo.FileData.ToArray(); |
1590 |
|
1591 |
using (MemoryStream ms = new MemoryStream(arrayBinary)) |
1592 |
{ |
1593 |
ms.Write(arrayBinary, 0, arrayBinary.Length); |
1594 |
ms.Seek(0, SeekOrigin.Begin); |
1595 |
|
1596 |
using (FileStream fs = finfo.Create()) |
1597 |
{ |
1598 |
ms.CopyTo(fs); |
1599 |
} |
1600 |
} |
1601 |
} |
1602 |
|
1603 |
try |
1604 |
{ |
1605 |
ProcessStartInfo startInfo = new ProcessStartInfo |
1606 |
{ |
1607 |
FileName = finfo.FullName, |
1608 |
UseShellExecute = true, |
1609 |
CreateNoWindow = false, |
1610 |
WindowStyle = ProcessWindowStyle.Normal |
1611 |
}; |
1612 |
|
1613 |
using (Process process = new Process()) |
1614 |
{ |
1615 |
process.StartInfo = startInfo; |
1616 |
process.Start(); |
1617 |
} |
1618 |
//Process.Start(finfo.FullName); |
1619 |
} |
1620 |
catch (Exception ex) |
1621 |
{ |
1622 |
throw ex; |
1623 |
} |
1624 |
|
1625 |
//using (MemoryStream ms = new MemoryStream(arrayBinary)) |
1626 |
//{ |
1627 |
// ProcessStartInfo startInfo = new ProcessStartInfo |
1628 |
// { |
1629 |
// FileName = Path.Combine(attFileInfo.FilePath, attFileInfo.FileName), |
1630 |
// RedirectStandardInput = true, |
1631 |
// UseShellExecute = false, |
1632 |
// CreateNoWindow = true, |
1633 |
// WindowStyle = ProcessWindowStyle.Hidden |
1634 |
// }; |
1635 |
|
1636 |
// using (Process process = new Process()) |
1637 |
// { |
1638 |
// process.StartInfo = startInfo; |
1639 |
// process.Start(); |
1640 |
|
1641 |
// // Write the memory stream contents to the process standard input |
1642 |
// byte[] buffer = ms.ToArray(); |
1643 |
// process.StandardInput.BaseStream.Write(buffer, 0, buffer.Length); |
1644 |
// process.StandardInput.Close(); |
1645 |
|
1646 |
// process.WaitForExit(); |
1647 |
// } |
1648 |
//} |
1649 |
} |
1650 |
} |
1651 |
catch (Exception ex) |
1652 |
{ |
1653 |
Program.logger.Error($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex); |
1654 |
RadMessageBox.Show("Notification lookup failed.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error); |
1655 |
} |
1656 |
} |
1657 |
|
1658 |
private void RadButtonElementNoticeUpload_Click(object sender, EventArgs e) |
1659 |
{ |
1660 |
string GetContentType(string filePath) |
1661 |
{ |
1662 |
string extension = Path.GetExtension(filePath).ToLower(); |
1663 |
|
1664 |
switch (extension) |
1665 |
{ |
1666 |
case ".txt": |
1667 |
return "text/plain"; |
1668 |
case ".pdf": |
1669 |
return "application/pdf"; |
1670 |
case ".jpg": |
1671 |
case ".jpeg": |
1672 |
return "image/jpeg"; |
1673 |
case ".png": |
1674 |
return "image/png"; |
1675 |
default: |
1676 |
return "application/octet-stream"; |
1677 |
} |
1678 |
} |
1679 |
|
1680 |
using (OpenFileDialog ofd = new OpenFileDialog() |
1681 |
{ |
1682 |
Filter = "PDF files (*.pdf)|*.pdf|All files (*.*)|*.*", |
1683 |
//Title = "Open an Excel File", |
1684 |
RestoreDirectory = true |
1685 |
}) |
1686 |
{ |
1687 |
try |
1688 |
{ |
1689 |
if (ofd.ShowDialog() == DialogResult.OK) |
1690 |
{ |
1691 |
System.IO.FileInfo fileInfo = new System.IO.FileInfo(ofd.FileName); |
1692 |
if (fileInfo.Exists) |
1693 |
{ |
1694 |
AttFileInfo attFile = new AttFileInfo() |
1695 |
{ |
1696 |
RefID = informations.ActiveProject.ProjectID, |
1697 |
Category = "notice", |
1698 |
FileType = GetContentType(fileInfo.FullName), |
1699 |
FileName = fileInfo.Name, |
1700 |
FilePath = fileInfo.DirectoryName, |
1701 |
FileExtension = fileInfo.Extension |
1702 |
}; |
1703 |
|
1704 |
using (var stream = new FileStream(ofd.FileName, FileMode.Open, FileAccess.Read)) |
1705 |
{ |
1706 |
using (var reader = new BinaryReader(stream)) |
1707 |
{ |
1708 |
attFile.FileData = reader.ReadBytes((int)stream.Length); |
1709 |
} |
1710 |
} |
1711 |
|
1712 |
bool result = new AttFileController().SetAttFiles(new List<AttFileInfo>() { attFile }, informations.ActiveUser.ID); |
1713 |
|
1714 |
if (result) |
1715 |
{ |
1716 |
RadMessageBox.Show("An Notice has been posted.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info); |
1717 |
} |
1718 |
} |
1719 |
} |
1720 |
} |
1721 |
catch (Exception ex) |
1722 |
{ |
1723 |
Program.logger.Error($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex); |
1724 |
RadMessageBox.Show("Failed to register the Notice.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error); |
1725 |
} |
1726 |
} |
1727 |
} |
1728 |
|
1729 |
private void RadButtonElementRefreshCommand_Click(object sender, EventArgs e) |
1730 |
{ |
1731 |
bool isReload = false; |
1732 |
|
1733 |
try |
1734 |
{ |
1735 |
if (RadMessageBox.Show($"Do you want to reload the project?", Globals.Name, MessageBoxButtons.YesNo, RadMessageIcon.Question) == DialogResult.Yes) |
1736 |
{ |
1737 |
if (informations.ActiveUser != null && !string.IsNullOrEmpty(informations.ActiveUser.RefProjectID)) |
1738 |
{ |
1739 |
informations.ActiveProject = new ProjectController().GetProjectInfo(informations.ActiveUser.RefProjectID); |
1740 |
informations.ProjectList = new ProjectController().GetAllProjectList().ToList(); |
1741 |
|
1742 |
isReload = true; |
1743 |
} |
1744 |
else if (informations.ActiveProject != null) |
1745 |
{ |
1746 |
informations.ProjectList = new ProjectController().GetAllProjectList().ToList(); |
1747 |
|
1748 |
isReload = true; |
1749 |
} |
1750 |
else |
1751 |
{ |
1752 |
RadMessageBox.Show("Select a project.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info); |
1753 |
this.radRibbonBarBackstageViewID2Manager.ShowPopup(this.GetBackstageLocation(), this.ID2ManagerRadRibbonBar.RibbonBarElement); |
1754 |
} |
1755 |
} |
1756 |
|
1757 |
if (isReload) |
1758 |
{ |
1759 |
this.LoadProject(); |
1760 |
} |
1761 |
} |
1762 |
catch (Exception ex) |
1763 |
{ |
1764 |
Program.logger.Error($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex); |
1765 |
RadMessageBox.Show("Failed to reload the project.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error); |
1766 |
} |
1767 |
} |
1768 |
#endregion |
1769 |
|
1770 |
#region ColumnGroup |
1771 |
private void InitColumnGroupsViewDefinition(RadGridView gridView) |
1772 |
{ |
1773 |
ColumnGroupsViewDefinition columnGroupsView = new ColumnGroupsViewDefinition(); |
1774 |
|
1775 |
List<string> docLinkColNames = new List<string>() { "AutoCADLink", "PDFLink", "MarkupLink", "AVEVALink" }; |
1776 |
List<string> docInfoColNames = new List<string>() { "RefProjectCode", "DocumentNo", "PersonInCharge", "Worker", "JobLevel", "IsTypical", "RevisonNo" }; |
1777 |
List<string> rvToColNames = new List<string>() { "ToIsDiscussion", "ToRemarks", "ToCreator", "ToCapture", "ToIsMarkup" }; |
1778 |
List<string> rvFrColNames = new List<string>() { "FrReviewStatus", "FrRemarks", "FrCreator", "FrCapture", "FrIsMarkup" }; |
1779 |
List<string> rvEtcColNames = new List<string>() { "IsID2Work" }; |
1780 |
List<string> wkID2ColNames = new List<string>() { "ID2Connection", "ID2StartDate", "ID2EndDate", "ID2JobTime", "ID2Status", "ID2Issues" }; |
1781 |
List<string> wkAVEVAColNames = new List<string>() { "AVEVAConnection", "AVEVAConvertDate", "AVEVAReviewDate", "AVEVAStatus", "AVEVAIssues" }; |
1782 |
List<string> valLinkColNames = new List<string>() { "ReviewFileName", "SystemLink" }; |
1783 |
List<string> valProdColNames = new List<string>() { "ProdReviewer", "ProdIsResult", "ProdRemarks" }; |
1784 |
List<string> valCntColNames = new List<string>() { "ClientReviewer", "ClientIsResult", "ClientRemarks" }; |
1785 |
List<string> dtColNames = new List<string>() { "DTIsGateWay", "DTIsImport", "DTIsRegSystem", "DTRemarks" }; |
1786 |
|
1787 |
//도면 |
1788 |
GridViewColumnGroup docColGrp = new GridViewColumnGroup("도면 "); |
1789 |
GridViewColumnGroup docLinkColGrp = new GridViewColumnGroup("파일링크"); |
1790 |
GridViewColumnGroup docInfoColGrp = new GridViewColumnGroup("도면정보"); |
1791 |
|
1792 |
GridViewColumnGroupRow docLinkColGrpRow = new GridViewColumnGroupRow(); |
1793 |
docLinkColGrpRow.ColumnNames.AddRange(docLinkColNames); |
1794 |
|
1795 |
GridViewColumnGroupRow docInfoColGrpRow = new GridViewColumnGroupRow(); |
1796 |
docInfoColGrpRow.ColumnNames.AddRange(docInfoColNames); |
1797 |
|
1798 |
docLinkColGrp.Rows.Add(docLinkColGrpRow); |
1799 |
docColGrp.Groups.Add(docLinkColGrp); |
1800 |
docInfoColGrp.Rows.Add(docInfoColGrpRow); |
1801 |
docColGrp.Groups.Add(docInfoColGrp); |
1802 |
|
1803 |
//검토 |
1804 |
GridViewColumnGroup rvColGrp = new GridViewColumnGroup("검토", "review"); |
1805 |
GridViewColumnGroup rvToColGrp = new GridViewColumnGroup("도프텍"); |
1806 |
GridViewColumnGroup rvFrColGrp = new GridViewColumnGroup("삼성"); |
1807 |
GridViewColumnGroup rvEtcColGrp = new GridViewColumnGroup("기타"); |
1808 |
|
1809 |
GridViewColumnGroupRow rvToColGrpRow = new GridViewColumnGroupRow(); |
1810 |
rvToColGrpRow.ColumnNames.AddRange(rvToColNames); |
1811 |
|
1812 |
GridViewColumnGroupRow rvFrColGrpRow = new GridViewColumnGroupRow(); |
1813 |
rvFrColGrpRow.ColumnNames.AddRange(rvFrColNames); |
1814 |
|
1815 |
GridViewColumnGroupRow rvEtcColGrpRow = new GridViewColumnGroupRow(); |
1816 |
rvEtcColGrpRow.ColumnNames.AddRange(rvEtcColNames); |
1817 |
|
1818 |
rvToColGrp.Rows.Add(rvToColGrpRow); |
1819 |
rvFrColGrp.Rows.Add(rvFrColGrpRow); |
1820 |
rvEtcColGrp.Rows.Add(rvEtcColGrpRow); |
1821 |
|
1822 |
|
1823 |
rvColGrp.Groups.Add(rvToColGrp); |
1824 |
rvColGrp.Groups.Add(rvFrColGrp); |
1825 |
rvColGrp.Groups.Add(rvEtcColGrp); |
1826 |
|
1827 |
|
1828 |
//작업 |
1829 |
GridViewColumnGroup wkColGrp = new GridViewColumnGroup("작업", "work"); |
1830 |
GridViewColumnGroup wkID2ColGrp = new GridViewColumnGroup("ID2"); |
1831 |
GridViewColumnGroup wkAVEVAColGrp = new GridViewColumnGroup("AVEVA"); |
1832 |
|
1833 |
GridViewColumnGroupRow wkID2ColGrpRow = new GridViewColumnGroupRow(); |
1834 |
wkID2ColGrpRow.ColumnNames.AddRange(wkID2ColNames); |
1835 |
|
1836 |
GridViewColumnGroupRow wkAVEVAColGrpRow = new GridViewColumnGroupRow(); |
1837 |
wkAVEVAColGrpRow.ColumnNames.AddRange(wkAVEVAColNames); |
1838 |
|
1839 |
wkID2ColGrp.Rows.Add(wkID2ColGrpRow); |
1840 |
wkAVEVAColGrp.Rows.Add(wkAVEVAColGrpRow); |
1841 |
|
1842 |
wkColGrp.Groups.Add(wkID2ColGrp); |
1843 |
wkColGrp.Groups.Add(wkAVEVAColGrp); |
1844 |
|
1845 |
|
1846 |
//Validation |
1847 |
GridViewColumnGroup valColGrp = new GridViewColumnGroup("Validation", "validation"); |
1848 |
GridViewColumnGroup valLinkColGrp = new GridViewColumnGroup("파일링크"); |
1849 |
GridViewColumnGroup valProdColGrp = new GridViewColumnGroup("도프텍"); |
1850 |
GridViewColumnGroup valCntColGrp = new GridViewColumnGroup("삼성전자"); |
1851 |
|
1852 |
GridViewColumnGroupRow valLinkColGrpRow = new GridViewColumnGroupRow(); |
1853 |
valLinkColGrpRow.ColumnNames.AddRange(valLinkColNames); |
1854 |
|
1855 |
GridViewColumnGroupRow valProdColGrpRow = new GridViewColumnGroupRow(); |
1856 |
valProdColGrpRow.ColumnNames.AddRange(valProdColNames); |
1857 |
|
1858 |
GridViewColumnGroupRow valCntColGrpRow = new GridViewColumnGroupRow(); |
1859 |
valCntColGrpRow.ColumnNames.AddRange(valCntColNames); |
1860 |
|
1861 |
valLinkColGrp.Rows.Add(valLinkColGrpRow); |
1862 |
valProdColGrp.Rows.Add(valProdColGrpRow); |
1863 |
valCntColGrp.Rows.Add(valCntColGrpRow); |
1864 |
|
1865 |
valColGrp.Groups.Add(valLinkColGrp); |
1866 |
valColGrp.Groups.Add(valProdColGrp); |
1867 |
valColGrp.Groups.Add(valCntColGrp); |
1868 |
|
1869 |
//AVEVA Net |
1870 |
GridViewColumnGroup dtColGrp = new GridViewColumnGroup("AVEVA Net\n(Digital Twin)", "avevanet"); |
1871 |
|
1872 |
GridViewColumnGroupRow dtColGrpRow = new GridViewColumnGroupRow(); |
1873 |
dtColGrpRow.ColumnNames.AddRange(dtColNames); |
1874 |
|
1875 |
dtColGrp.Rows.Add(dtColGrpRow); |
1876 |
|
1877 |
//Group 추가 |
1878 |
columnGroupsView.ColumnGroups.Add(docColGrp); |
1879 |
columnGroupsView.ColumnGroups.Add(rvColGrp); |
1880 |
columnGroupsView.ColumnGroups.Add(wkColGrp); |
1881 |
columnGroupsView.ColumnGroups.Add(valColGrp); |
1882 |
columnGroupsView.ColumnGroups.Add(dtColGrp); |
1883 |
|
1884 |
gridView.MasterTemplate.ViewDefinition = columnGroupsView; |
1885 |
} |
1886 |
#endregion |
1887 |
|
1888 |
private void txtFullSearch_TextChanged(object sender, EventArgs e) |
1889 |
{ |
1890 |
if(string.IsNullOrWhiteSpace(txtFullSearch.Text)) |
1891 |
radGridViewDocuments.MasterTemplate.Refresh(null); |
1892 |
|
1893 |
txtFullSearch.TextBoxElement.ShowClearButton = !string.IsNullOrWhiteSpace(txtFullSearch.Text); |
1894 |
radGridViewDocuments.MasterView.TableSearchRow.Search(txtFullSearch.Text); |
1895 |
} |
1896 |
|
1897 |
private void btnSearchPrevious_Click(object sender, EventArgs e) |
1898 |
{ |
1899 |
radGridViewDocuments.MasterView.TableSearchRow.SelectPreviousSearchResult(); |
1900 |
} |
1901 |
|
1902 |
private void btnSearchNext_Click(object sender, EventArgs e) |
1903 |
{ |
1904 |
radGridViewDocuments.MasterView.TableSearchRow.SelectNextSearchResult(); |
1905 |
} |
1906 |
|
1907 |
private void txtFullSearch_KeyDown(object sender, KeyEventArgs e) |
1908 |
{ |
1909 |
if(e.KeyCode == Keys.Enter) |
1910 |
{ |
1911 |
radGridViewDocuments.MasterView.TableSearchRow.SelectNextSearchResult(); |
1912 |
} |
1913 |
} |
1914 |
} |
1915 |
} |
1916 |
|
1917 |
public class FilterColumn |
1918 |
{ |
1919 |
public string Name { get; set; } |
1920 |
public string FieldName { get; set; } |
1921 |
public bool IsSelect { get; set; } |
1922 |
} |