hytos / ID2.Manager / ID2.Manager / Main.cs @ b2c03c2e
이력 | 보기 | 이력해설 | 다운로드 (141 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 |
using System.Diagnostics; |
14 | |
15 |
using ID2.Manager.Controls; |
16 |
using ID2.Manager.Common; |
17 |
using ID2.Manager.Classes; |
18 |
using ID2.Manager.Data.Models; |
19 |
using ID2.Manager.Forms; |
20 |
using ID2.Manager.Controller.Controllers; |
21 |
using ID2.Manager.Common.Helpers; |
22 |
using static ID2.Manager.Data.Models.Documents; |
23 | |
24 |
using Telerik.WinControls; |
25 |
using Telerik.WinControls.UI; |
26 |
using Telerik.WinControls.Enumerations; |
27 | |
28 |
using GemBox.Spreadsheet; |
29 | |
30 |
using Newtonsoft.Json; |
31 | |
32 |
namespace ID2.Manager |
33 |
{ |
34 |
public partial class Main : RadRibbonForm |
35 |
{ |
36 |
protected override CreateParams CreateParams |
37 |
{ |
38 |
get |
39 |
{ |
40 |
CreateParams cp = base.CreateParams; |
41 |
cp.ExStyle |= 0x02000000; |
42 |
return cp; |
43 |
} |
44 |
} |
45 | |
46 |
private string dockLayoutPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), Application.ProductName, |
47 |
"dock.xml"); |
48 | |
49 |
readonly Informations informations = Informations.Instance; |
50 |
bool IsID2Manager = false; |
51 |
List<Documents> documents = new List<Documents>(); |
52 |
List<System.Drawing.Image> importImages = new List<System.Drawing.Image>(); |
53 | |
54 |
List<Documents> orgDocuments = null; |
55 |
int TotalCount = 0; |
56 |
int SearchCount = 0; |
57 | |
58 |
BriefAndImages briefAndImagesReview = new BriefAndImages { Dock = DockStyle.Fill }; |
59 |
IssueImagesAndAnswer issueImagesAndAnswerWork = new IssueImagesAndAnswer { Dock = DockStyle.Fill }; |
60 | |
61 |
|
62 |
//#if DEBUG |
63 |
// Telerik.WinControls.RadControlSpy.RadControlSpyForm radControlSpyForm = new Telerik.WinControls.RadControlSpy.RadControlSpyForm(); |
64 |
//#endif |
65 |
private readonly Color _SummaryColor = Color.FromArgb(255, 108, 55); |
66 | |
67 |
public Main() |
68 |
{ |
69 |
InitializeComponent(); |
70 |
var verification = new Controls.Classify(this.radProgressBarElement) { Dock = DockStyle.Fill }; |
71 |
this.LayoutValidation.Controls.Add(verification); |
72 |
this.DockMainTabStrip.Select(); |
73 | |
74 |
var appDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), Application.ProductName); |
75 | |
76 |
if (!Directory.Exists(appDataPath)) |
77 |
{ |
78 |
Directory.CreateDirectory(appDataPath); |
79 |
} |
80 | |
81 |
ID2.Manager.Common.Helpers.TableLayoutPanelHelper.SetDoubleBuffered(this); |
82 | |
83 |
this.FormClosing += Main_FormClosing; |
84 |
this.radButtonElementRefreshCommand.Click += RadButtonElementRefreshCommand_Click; |
85 |
this.radButtonElementSaveCommand.Click += RadButtonElementSaveCommand_Click; |
86 |
this.btnDockLayoutReset.Click += BtnDockLayoutReset_Click; |
87 |
this.radButtonElementFilterClear.Click += RadButtonElementFilterClear_Click; |
88 |
this.radButtonElementSave.Click += RadButtonElementSave_Click; |
89 |
this.radButtonElementSync.Click += RadButtonElementSync_Click; |
90 |
this.radButtonElementNotice.Click += RadButtonElementNotice_Click; |
91 |
this.radButtonElementNoticeUpload.Click += RadButtonElementNoticeUpload_Click; |
92 |
this.radButtonElementExcelImport.Click += RadButtonElementExcelImport_Click; |
93 |
this.radButtonElementExcelExport.Click += RadButtonElementExcelExport_Click; |
94 |
this.radButtonElementDelete.Click += RadButtonElementDelete_Click; |
95 |
this.radButtonElementLevel.Click += RadButtonElementLevel_Click; |
96 |
this.radButtonElementConvert.Click += RadButtonElementConvert_Click; |
97 | |
98 |
this.radButtonDateClear.Click += RadButtonDateClear_Click; |
99 | |
100 |
this.radDropDownListTeam.SelectedIndexChanged += RadDropDownList_SelectedIndexChanged; |
101 |
this.radDropDownListProject.SelectedIndexChanged += RadDropDownList_SelectedIndexChanged; |
102 |
this.radDropDownListPersonInCharge.SelectedIndexChanged += RadDropDownList_SelectedIndexChanged; |
103 |
this.radDropDownListJobLevel.SelectedIndexChanged += RadDropDownList_SelectedIndexChanged; |
104 |
this.radDropDownListToIsDiscussion.SelectedIndexChanged += RadDropDownList_SelectedIndexChanged; |
105 |
this.radDropDownListFrReviewStatus.SelectedIndexChanged += RadDropDownList_SelectedIndexChanged; |
106 |
this.radDropDownListID2Status.SelectedIndexChanged += RadDropDownList_SelectedIndexChanged; |
107 |
this.radDropDownListID2Issues.SelectedIndexChanged += RadDropDownList_SelectedIndexChanged; |
108 |
this.radDropDownListAVEVAStatus.SelectedIndexChanged += RadDropDownList_SelectedIndexChanged; |
109 |
this.radDropDownListAVEVAIssues.SelectedIndexChanged += RadDropDownList_SelectedIndexChanged; |
110 |
this.radDropDownListProdIsResult.SelectedIndexChanged += RadDropDownList_SelectedIndexChanged; |
111 |
this.radDropDownListClientIsResult.SelectedIndexChanged += RadDropDownList_SelectedIndexChanged; |
112 |
this.radDropDownListGateway.SelectedIndexChanged += RadDropDownList_SelectedIndexChanged; |
113 |
this.radDropDownListRegistration.SelectedIndexChanged += RadDropDownList_SelectedIndexChanged; |
114 | |
115 |
this.radCollapsiblePanelCondition.Collapsed += RadCollapsiblePanelCondition_Collapsed; |
116 |
this.radCollapsiblePanelCondition.Expanded += RadCollapsiblePanelCondition_Expanded; |
117 | |
118 |
this.radCheckBoxLink.CheckStateChanged += RadCheckBoxFreezed_CheckStateChanged; |
119 |
this.radCheckBoxDocInfo.CheckStateChanged += RadCheckBoxFreezed_CheckStateChanged; |
120 | |
121 |
this.radCheckBoxReview.CheckStateChanged += RadCheckBox_CheckStateChanged; |
122 |
this.radCheckBoxWork.CheckStateChanged += RadCheckBox_CheckStateChanged; |
123 |
this.radCheckBoxVaildation.CheckStateChanged += RadCheckBox_CheckStateChanged; |
124 |
this.radCheckBoxAVEVANet.CheckStateChanged += RadCheckBox_CheckStateChanged; |
125 |
this.radTextBoxDocumentNo.KeyDown += RadTextBoxDocumentNo_KeyDown; |
126 |
this.radTextBoxDocumentNo.KeyUp += RadTextBoxDocumentNo_KeyUp; |
127 |
this.radButtonSearch.Click += RadButtonSearch_Click; |
128 |
#region 테마 설정 |
129 |
this.radMenuItemControlDefault.Click += RadMenuItemTheme_Click; |
130 |
this.radMenuItemOffice2013Dark.Click += RadMenuItemTheme_Click; |
131 |
this.radMenuItemTelerikMetro.Click += RadMenuItemTheme_Click; |
132 |
this.radMenuItemVisualStudio2012Dark.Click += RadMenuItemTheme_Click; |
133 |
this.radMenuItemVisualStudio2012Light.Click += RadMenuItemTheme_Click; |
134 |
this.radMenuItemWindows8.Click += RadMenuItemTheme_Click; |
135 |
#endregion |
136 | |
137 |
//this.radGridViewDocuments.DefaultValuesNeeded += RadGridViewDocuments_DefaultValuesNeeded; |
138 |
this.radGridViewDocuments.UserAddedRow += RadGridViewDocuments_UserAddedRow; |
139 |
this.radGridViewDocuments.SelectionChanged += RadGridViewDocuments_SelectionChanged; |
140 |
this.radGridViewDocuments.ViewCellFormatting += RadGridViewDocuments_ViewCellFormatting; |
141 |
this.radGridViewDocuments.CreateRowInfo += RadGridViewDocuments_CreateRowInfo; |
142 |
this.radGridViewDocuments.CellBeginEdit += RadGridViewDocuments_CellBeginEdit; |
143 |
this.radGridViewDocuments.CellEndEdit += RadGridViewDocuments_CellEndEdit; |
144 |
this.radGridViewDocuments.CommandCellClick += RadGridViewDocuments_CommandCellClick; |
145 |
this.radGridViewDocuments.MasterView.TableSearchRow.SearchProgressChanged += TableSearchRow_SearchProgressChanged; |
146 |
//this.radGridViewDocuments.FilterChanging += RadGridViewDocuments_FilterChanging; |
147 |
this.radGridViewDocuments.FilterChanged += RadGridViewDocuments_FilterChanged; |
148 |
//this.radGridViewDocuments.CellValidated += RadGridViewDocuments_CellValidated; |
149 |
this.radGridViewDocuments.HeaderCellToggleStateChanged += RadGridViewDocuments_HeaderCellToggleStateChanged; |
150 |
this.radGridViewDocuments.ValueChanging += RadGridViewDocuments_ValueChanging; |
151 |
this.radGridViewDocuments.ValueChanged += RadGridViewDocuments_ValueChanged; |
152 |
this.radGridViewDocuments.MultiSelect = true; |
153 |
this.radGridViewDocuments.EnableHotTracking = true; |
154 |
this.radGridViewDocuments.MasterView.TableHeaderRow.MinHeight = 36; |
155 |
this.radGridViewDocuments.TableElement.RowHeaderColumnWidth = 36; |
156 |
//this.radGridViewDocuments.MasterView.TableSearchRow.InitialSearchResultsTreshold = ; |
157 |
this.radGridViewDocuments.MasterView.TableSearchRow.IsVisible = false; |
158 | |
159 |
var openProjectView = new OpenProjectView() |
160 |
{ |
161 |
Dock = DockStyle.Fill |
162 |
}; |
163 | |
164 |
this.backstageViewPageOpenProject.Controls.Add(openProjectView); |
165 |
openProjectView.OpenProjectClick += OpenProjectView_OpenProjectClick; |
166 |
openProjectView.CloseProjectClick += OpenProjectView_OpenProjectClick; |
167 |
this.backstageButtonItemSelectDB.Click += BackstageButtonItemSelectDB_Click; |
168 |
this.backstageButtonItemUserRegistration.Click += BackstageButtonItemUserRegistration_Click; |
169 |
this.backstageButtonItemExit.Click += BackstageButtonItemExit_Click; |
170 |
this.radRibbonBarBackstageViewID2Manager.BackstageViewOpened += RadRibbonBarBackstageViewID2Manager_BackstageViewOpened; |
171 |
this.radRibbonBarBackstageViewID2Manager.BackstageViewClosed += RadRibbonBarBackstageViewID2Manager_BackstageViewClosed; |
172 | |
173 |
this.InitColumnGroupsViewDefinition(this.radGridViewDocuments); |
174 | |
175 |
this.radPageViewPageReview.Controls.Add(briefAndImagesReview); |
176 |
this.radPageViewPageWork.Controls.Add(issueImagesAndAnswerWork); |
177 | |
178 |
briefAndImagesReview.RemoveImage += BriefAndImages_RemoveImage; |
179 |
issueImagesAndAnswerWork.RemoveImage += IssueImagesAndAnswer_RemoveImage; |
180 |
this.Initialize(); |
181 |
} |
182 | |
183 |
/// <summary> |
184 |
/// 사용자가 선택한 테마를 적용한다. |
185 |
/// </summary> |
186 |
/// <param name="sender"></param> |
187 |
/// <param name="e"></param> |
188 |
private void RadMenuItemTheme_Click(object sender, EventArgs e) |
189 |
{ |
190 |
string theme = (sender as RadMenuItem).Text; |
191 |
if(theme != this.radDropDownButtonElementTheme.Text) |
192 |
{ |
193 |
this.radDropDownButtonElementTheme.Text = theme; |
194 |
Classes.ID2Helper.IniWriteValue(Program.IniFilePath, "App", "Theme", theme); |
195 |
if (!string.IsNullOrEmpty(theme)) |
196 |
{ |
197 |
Telerik.WinControls.ThemeResolutionService.ApplicationThemeName = theme; |
198 |
Program.ThemeName = theme; |
199 |
} |
200 |
} |
201 |
} |
202 | |
203 |
private void BtnDockLayoutReset_Click(object sender, EventArgs e) |
204 |
{ |
205 |
this.LoadDockingLayout(true); |
206 |
} |
207 | |
208 |
private void BriefAndImages_RemoveImage(object sender, AttImageInfo e) |
209 |
{ |
210 |
try |
211 |
{ |
212 |
if (e is AttImageInfo) |
213 |
{ |
214 |
if (this.radGridViewDocuments.SelectedRows.Count() > 0 && this.radGridViewDocuments.SelectedRows.First().DataBoundItem is Documents doc) |
215 |
{ |
216 |
var reslut = doc.AttFiles.RemoveAll(x => x.FileID == e.ID); |
217 | |
218 |
if (reslut > 0) |
219 |
{ |
220 |
switch (e.Category) |
221 |
{ |
222 |
case "toreview": |
223 |
doc.ToCapture -= reslut; |
224 |
break; |
225 |
case "frreview": |
226 |
doc.FrCapture -= reslut; |
227 |
break; |
228 |
} |
229 |
} |
230 |
else |
231 |
{ |
232 |
MessageBox.Show("삭제오류"); |
233 |
} |
234 |
} |
235 |
} |
236 |
} |
237 |
catch (Exception ex) |
238 |
{ |
239 |
Program.logger.Error("BriefAndImages_RemoveImage", ex); |
240 |
} |
241 |
} |
242 | |
243 |
private void IssueImagesAndAnswer_RemoveImage(object sender, AttImageInfo e) |
244 |
{ |
245 |
try |
246 |
{ |
247 |
if (e is AttImageInfo) |
248 |
{ |
249 |
if (this.radGridViewDocuments.SelectedRows.Count() > 0 && this.radGridViewDocuments.SelectedRows.First().DataBoundItem is Documents doc) |
250 |
{ |
251 |
var reslut = doc.AttFiles.RemoveAll(x => x.FileID == e.ID); |
252 | |
253 |
if (reslut > 0) |
254 |
{ |
255 |
switch (e.Category) |
256 |
{ |
257 |
case "id2work": |
258 |
doc.ID2Capture -= reslut; |
259 |
break; |
260 |
} |
261 |
} |
262 |
else |
263 |
{ |
264 |
MessageBox.Show("삭제오류"); |
265 |
} |
266 |
} |
267 |
} |
268 |
} |
269 |
catch (Exception ex) |
270 |
{ |
271 |
Program.logger.Error("IssueImagesAndAnswer_RemoveImage", ex); |
272 |
} |
273 |
} |
274 | |
275 |
private void SaveDockingLayout() |
276 |
{ |
277 |
try |
278 |
{ |
279 |
this.DockMain.SaveToXml(dockLayoutPath); |
280 |
} |
281 |
catch (Exception ex) |
282 |
{ |
283 |
System.Diagnostics.Debug.WriteLine("SaveDockingLayout Error.", ex); |
284 |
} |
285 |
} |
286 | |
287 |
private void LoadDockingLayout(bool IsDefaultLayoutLoad = false) |
288 |
{ |
289 |
try |
290 |
{ |
291 |
bool IsUseLayoutLoad = false; |
292 | |
293 |
try |
294 |
{ |
295 |
var dockLayoutFile = new FileInfo(dockLayoutPath); |
296 | |
297 | |
298 |
if (!IsDefaultLayoutLoad && dockLayoutFile.Exists) |
299 |
{ |
300 |
this.DockMain.LoadFromXml(dockLayoutPath); |
301 |
IsUseLayoutLoad = true; |
302 |
} |
303 | |
304 |
} |
305 |
catch (Exception ex) |
306 |
{ |
307 |
Program.logger.Error($"dock Layout File load Error. File Path : {dockLayoutPath}", ex); |
308 |
} |
309 | |
310 |
if (!IsUseLayoutLoad) |
311 |
{ |
312 |
var layout = Properties.Resources.DefalutDockLayout; |
313 | |
314 |
using (MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(layout))) |
315 |
{ |
316 |
this.DockMain.LoadFromXml(stream); |
317 |
} |
318 |
} |
319 | |
320 |
this.DockMain.DocumentTabsVisible = true; |
321 | |
322 |
this.DockMain.DockWindows.ForAll(x => |
323 |
{ |
324 |
x.DockManager.ShowDocumentPinButton = false; |
325 |
x.DockManager.ShowDocumentCloseButton = false; |
326 |
}); |
327 | |
328 |
this.DockMain.AutoHideWindowDisplaying += DockMain_AutoHideWindowDisplaying; |
329 | |
330 |
this.DockMain.DockStateChanged += (snd, evt) => |
331 |
{ |
332 |
if (evt.DockWindow.Name == DockWindowMain.Name || evt.DockWindow.Name == DockClassify.Name) |
333 |
{ |
334 | |
335 |
} |
336 | |
337 |
}; |
338 | |
339 |
this.DockMain.DockWindowClosed += (snd, evt) => |
340 |
{ |
341 |
evt.DockWindow.DockState = Telerik.WinControls.UI.Docking.DockState.AutoHide; |
342 | |
343 |
//Telerik.WinControls.UI.Docking.AutoHidePosition tabPosition = Telerik.WinControls.UI.Docking.AutoHidePosition.Right; |
344 | |
345 | |
346 |
//List<DockWindow> dockWindows = new List<DockWindow>(); |
347 | |
348 |
//var autoHideWindows = this.DockMain.DockWindows.Where(x => x.DockState == Telerik.WinControls.UI.Docking.DockState.AutoHide).ToList(); |
349 | |
350 | |
351 |
//if (evt.DockWindow.AccessibleName == DockWindowMain.AccessibleName || evt.DockWindow.Name == DockValidation.AccessibleName) |
352 |
//{ |
353 |
// dockWindows.AddRange(autoHideWindows.Where(x => x.AccessibleName == DockWindowMain.AccessibleName && evt.DockWindow.Name == DockValidation.AccessibleName)); |
354 | |
355 |
// tabPosition = Telerik.WinControls.UI.Docking.AutoHidePosition.Bottom; |
356 | |
357 |
// dockWindows.Add(evt.DockWindow); |
358 |
//} |
359 |
//else |
360 |
//{ |
361 |
// dockWindows.AddRange(autoHideWindows.Where(x => x.AccessibleName != DockWindowMain.AccessibleName || evt.DockWindow.Name != DockValidation.AccessibleName)); |
362 | |
363 |
// dockWindows.Add(evt.DockWindow); |
364 |
//} |
365 | |
366 | |
367 |
//this.DockMain.AutoHideWindows(dockWindows, tabPosition); |
368 |
}; |
369 |
} |
370 |
catch (Exception ex) |
371 |
{ |
372 |
Program.logger.Error($"dock Layout load Error. File Path : {dockLayoutPath}", ex); |
373 |
} |
374 |
} |
375 | |
376 |
private void DockMain_AutoHideWindowDisplaying(object sender, Telerik.WinControls.UI.Docking.AutoHideWindowDisplayingEventArgs e) |
377 |
{ |
378 | |
379 |
} |
380 | |
381 |
private void Main_FormClosing(object sender, FormClosingEventArgs e) |
382 |
{ |
383 |
SaveDockingLayout(); |
384 |
} |
385 | |
386 |
protected override bool ProcessCmdKey(ref Message msg, Keys keyData) |
387 |
{ |
388 |
if (keyData == (Keys.F10 | Keys.Control)) |
389 |
{ |
390 |
//#if DEBUG |
391 |
// radControlSpyForm.Show(); |
392 |
//#endif |
393 |
} |
394 | |
395 |
if (keyData == (Keys.V | Keys.Control)) |
396 |
{ |
397 |
System.Diagnostics.Debug.WriteLine("KeyDown CTRL + V"); |
398 | |
399 |
if (Clipboard.ContainsImage()) |
400 |
{ |
401 |
var IsDoftech = true; |
402 |
var selectReview = true; |
403 |
string category = ""; |
404 |
byte[] imageBytes = null; |
405 | |
406 |
Image clipboardImage = Clipboard.GetImage(); |
407 | |
408 |
using (MemoryStream stream = new MemoryStream()) |
409 |
{ |
410 |
clipboardImage.Save(stream, System.Drawing.Imaging.ImageFormat.Png); |
411 |
imageBytes = stream.ToArray(); |
412 |
} |
413 | |
414 |
if (this.radGridViewDocuments.SelectedRows.Count() > 0 && this.radGridViewDocuments.SelectedRows.First().DataBoundItem is Documents doc) |
415 |
{ |
416 | |
417 |
/// 도프텍 or 삼성 |
418 |
if (!string.IsNullOrEmpty(informations.ActiveUser.RefProjectID)) |
419 |
{ |
420 |
IsDoftech = false; |
421 |
} |
422 | |
423 |
/// 검토 or 검증 |
424 |
if (radPageViewComment.SelectedPage != radPageViewPageReview) |
425 |
{ |
426 |
selectReview = false; |
427 |
} |
428 | |
429 |
if (IsDoftech && selectReview) |
430 |
{ |
431 |
category = "toreview"; |
432 |
} |
433 |
else if (!IsDoftech && selectReview) |
434 |
{ |
435 |
category = "frreview"; |
436 |
} |
437 |
else |
438 |
{ |
439 |
category = "id2work"; |
440 |
} |
441 | |
442 |
AttFileInfo newFile = new AttFileInfo |
443 |
{ |
444 |
FileID = Guid.NewGuid().ToString(), |
445 |
Category = category, |
446 |
FileType = "image/png", |
447 |
FileName = "ClipBoard", |
448 |
FilePath = "ClipBoard", |
449 |
FileExtension = ".png", |
450 |
CreatedDate = DateTime.Now, |
451 |
Creator = informations.ActiveUser.ID, |
452 |
FileData = imageBytes |
453 | |
454 |
}; |
455 | |
456 |
if (doc.AttFiles == null) |
457 |
{ |
458 |
doc.AttFiles = new List<AttFileInfo>(); |
459 |
} |
460 | |
461 |
doc.AttFiles.Add(newFile); |
462 | |
463 |
var imageInfo = new AttImageInfo { ID = newFile.FileID, Data = newFile.FileData }; |
464 | |
465 |
switch (category) |
466 |
{ |
467 |
case "toreview": |
468 |
briefAndImagesReview.AddToImage(imageInfo, true); |
469 |
++doc.ToCapture; |
470 |
break; |
471 |
case "frreview": |
472 |
briefAndImagesReview.AddFrImage(imageInfo, true); |
473 |
++doc.FrCapture; |
474 |
break; |
475 |
case "id2work": |
476 |
issueImagesAndAnswerWork.AddImage(imageInfo, true); |
477 |
++doc.ID2Capture; |
478 |
break; |
479 |
} |
480 |
} |
481 |
} |
482 |
} |
483 | |
484 |
return base.ProcessCmdKey(ref msg, keyData); |
485 |
} |
486 | |
487 |
private void RadGridViewDocuments_CreateRowInfo(object sender, GridViewCreateRowInfoEventArgs e) |
488 |
{ |
489 |
if (e.RowInfo is GridViewSearchRowInfo) |
490 |
{ |
491 |
var row = new SearchRow(e.ViewInfo); |
492 |
e.RowInfo = row; |
493 |
} |
494 | |
495 |
//System.Diagnostics.Debug.WriteLine(e.RowInfo.GetType().Name); |
496 |
} |
497 | |
498 |
private void TableSearchRow_SearchProgressChanged(object sender, SearchProgressChangedEventArgs e) |
499 |
{ |
500 |
if (e.SearchFinished) |
501 |
{ |
502 | |
503 |
} |
504 |
} |
505 | |
506 |
/// <summary> |
507 |
/// 선택한 Document와 상세 편집 창을 연동시킨다. |
508 |
/// </summary> |
509 |
/// <param name="doc"></param> |
510 |
public void BindingDocumentToDetailEditor(Documents doc) |
511 |
{ |
512 |
briefAndImagesReview.Clear(); |
513 |
issueImagesAndAnswerWork.Clear(); |
514 | |
515 |
//FrRemarks 추가 |
516 | |
517 |
briefAndImagesReview.DataBindings.Add(new Binding("BriefDoftech", doc, "ToRemarks", false, DataSourceUpdateMode.OnPropertyChanged, null)); |
518 |
briefAndImagesReview.DataBindings.Add(new Binding("BriefSec", doc, "FrRemarks", false, DataSourceUpdateMode.OnPropertyChanged, null)); |
519 | |
520 |
issueImagesAndAnswerWork.DataBindings.Add(new Binding("IssueText", doc, "ID2Issues", false, DataSourceUpdateMode.OnPropertyChanged, null)); |
521 |
issueImagesAndAnswerWork.DataBindings.Add(new Binding("ReplyModificationText", doc, "ReplyModifications", false, DataSourceUpdateMode.OnPropertyChanged, null)); |
522 | |
523 |
if (doc.AttFiles != null) |
524 |
{ |
525 |
if (doc.AttFiles.Any(x => x.Category == "toreview")) |
526 |
{ |
527 |
var images = doc.AttFiles.Where(x => x.Category == "toreview").Select(x => new AttImageInfo { ID = x.FileID, Category = x.Category, Data = x.FileData }); |
528 |
briefAndImagesReview.SetToImages(images.ToList()); |
529 |
} |
530 | |
531 |
if (doc.AttFiles.Any(x => x.Category == "frreview")) |
532 |
{ |
533 |
var images = doc.AttFiles.Where(x => x.Category == "frreview").Select(x => new AttImageInfo { ID = x.FileID, Category = x.Category, Data = x.FileData }); |
534 |
briefAndImagesReview.SetFrImages(images.ToList()); |
535 |
} |
536 | |
537 |
if (doc.AttFiles.Any(x => x.Category == "id2work")) |
538 |
{ |
539 |
var images = doc.AttFiles.Where(x => x.Category == "id2work").Select(x => new AttImageInfo { ID = x.FileID, Category = x.Category, Data = x.FileData }); |
540 |
issueImagesAndAnswerWork.SetImages(images.ToList()); |
541 |
} |
542 |
} |
543 |
} |
544 | |
545 |
private void RadGridViewDocuments_DefaultValuesNeeded(object sender, GridViewRowEventArgs e) |
546 |
{ |
547 |
//if (e.Row is GridViewNewRowInfo) |
548 |
//{ |
549 |
// e.Row.Cells["RefProjectCode"].ReadOnly = false; |
550 |
// e.Row.Cells["DocumentNo"].ReadOnly = false; |
551 |
//} |
552 | |
553 |
//BindingDocumentToDetailEditor(new Documents()); |
554 |
} |
555 | |
556 |
private void RadGridViewDocuments_UserAddedRow(object sender, GridViewRowEventArgs e) |
557 |
{ |
558 |
if (e.Row.DataBoundItem is Documents doc) |
559 |
{ |
560 |
this.lbSelectAndTotal.Text = $"{this.radGridViewDocuments.MasterTemplate.DataView.Count} / {this.SearchCount} / {this.TotalCount} (Filter / Search / Total)"; |
561 |
} |
562 |
} |
563 | |
564 |
/// <summary> |
565 |
/// 선택된 행의 AutoCAD와 PDF 파일을 보여준다. |
566 |
/// </summary> |
567 |
/// <param name="sender"></param> |
568 |
/// <param name="e"></param> |
569 |
private void RadGridViewDocuments_SelectionChanged(object sender, EventArgs e) |
570 |
{ |
571 |
if (this.radGridViewDocuments.SelectedRows.Any() && this.radGridViewDocuments.SelectedRows.First().DataBoundItem is Documents doc) |
572 |
{ |
573 |
//if (informations.ActiveUser.ID != doc.PersonInCharge) |
574 |
//{ |
575 |
// var row = this.radGridViewDocuments.SelectedRows.First(); |
576 |
// foreach(var cell in row.Cells) |
577 |
// { |
578 |
// cell.ReadOnly = true; |
579 |
// } |
580 |
//} |
581 |
BindingDocumentToDetailEditor(doc); |
582 |
} |
583 |
} |
584 | |
585 |
#region Init, Load |
586 |
private void Initialize() |
587 |
{ |
588 |
this.Text = $"{Globals.Name} (Ver : {Application.ProductVersion})"; |
589 | |
590 |
this.ID2ManagerRadRibbonBar.Expanded = false; |
591 | |
592 |
this.radLabelElementUser.Text = $"{informations.ActiveUser.ID} {informations.ActiveUser.Name}"; |
593 |
} |
594 | |
595 |
protected override void OnLoad(EventArgs e) |
596 |
{ |
597 |
try |
598 |
{ |
599 |
LoadDockingLayout(); |
600 |
this.radDropDownButtonElementTheme.Text = Program.ThemeName; |
601 | |
602 |
this.IsID2Manager = (new string[] { "Admin", "Manager" }).Contains(informations.ActiveUser.Role) && string.IsNullOrEmpty(informations.ActiveUser.RefProjectID); |
603 | |
604 |
InitializeGrid(); |
605 | |
606 |
bool isID2DB = this.IsID2Connection(); |
607 |
this.SetMenus(isID2DB); |
608 | |
609 |
if (isID2DB) |
610 |
{ |
611 |
if (informations.ActiveUser != null && !string.IsNullOrEmpty(informations.ActiveUser.RefProjectID)) |
612 |
{ |
613 |
informations.ActiveProject = new ProjectController().GetProjectInfo(informations.ActiveUser.RefProjectID); |
614 |
informations.ProjectList = new ProjectController().GetAllProjectList().ToList(); |
615 | |
616 |
this.LoadProject(true); |
617 |
} |
618 |
else |
619 |
{ |
620 |
informations.ProjectList = new ProjectController().GetAllProjectList().ToList(); |
621 | |
622 |
foreach (Control ctrl in this.backstageViewPageOpenProject.Controls) |
623 |
{ |
624 |
if (ctrl is OpenProjectView) |
625 |
{ |
626 |
var openProjectView = ctrl as OpenProjectView; |
627 |
openProjectView.GetProjectGroups(); |
628 |
break; |
629 |
} |
630 |
} |
631 | |
632 |
this.radRibbonBarBackstageViewID2Manager.ShowPopup(this.GetBackstageLocation(), this.ID2ManagerRadRibbonBar.RibbonBarElement); |
633 |
} |
634 |
} |
635 |
else |
636 |
{ |
637 |
this.radRibbonBarBackstageViewID2Manager.ShowPopup(this.GetBackstageLocation(), this.ID2ManagerRadRibbonBar.RibbonBarElement); |
638 |
RadMessageBox.Show(this, $"Please select db file.", "Error", MessageBoxButtons.OK, RadMessageIcon.Info); |
639 |
} |
640 |
} |
641 |
catch (Exception ex) |
642 |
{ |
643 |
Program.logger.Error($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex); |
644 |
RadMessageBox.Show("Failed to load project.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error); |
645 |
} |
646 | |
647 |
base.OnLoad(e); |
648 |
} |
649 | |
650 |
private bool IsID2Connection() |
651 |
{ |
652 |
bool isSuccess = false; |
653 | |
654 |
try |
655 |
{ |
656 |
isSuccess = Globals.IsProjectDBConnstr(); |
657 | |
658 |
if (isSuccess) |
659 |
{ |
660 |
var id2Project = new ID2Controller().GetID2ProjectList(); |
661 |
} |
662 |
} |
663 |
catch (Exception ex) |
664 |
{ |
665 |
Program.logger.Error($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex); |
666 |
isSuccess = false; |
667 |
} |
668 | |
669 |
return isSuccess; |
670 |
} |
671 | |
672 |
private void SetMenus(bool isid2) |
673 |
{ |
674 |
if (isid2) |
675 |
{ |
676 |
if (this.IsID2Manager) |
677 |
{ |
678 |
this.radButtonElementNoticeUpload.Enabled = true; |
679 | |
680 |
this.backstageViewPageOpenProject.Controls[0].Visible = true; |
681 |
this.backstageTabItemOpenProject.Visibility = ElementVisibility.Visible; |
682 |
this.backstageButtonItemUserRegistration.Visibility = ElementVisibility.Visible; |
683 | |
684 |
this.ribbonTabProjMgt.Visibility = ElementVisibility.Visible; |
685 |
} |
686 |
else |
687 |
{ |
688 |
this.radButtonElementNoticeUpload.Enabled = false; |
689 | |
690 |
if (string.IsNullOrEmpty(informations.ActiveUser.RefProjectID)) |
691 |
{ |
692 |
this.backstageViewPageOpenProject.Controls[0].Visible = true; |
693 |
} |
694 |
else |
695 |
{ |
696 |
foreach (Control ctrl in this.backstageViewPageOpenProject.Controls) |
697 |
{ |
698 |
ctrl.Visible = false; |
699 |
} |
700 |
} |
701 |
this.backstageTabItemOpenProject.Visibility = ElementVisibility.Collapsed; |
702 |
this.backstageButtonItemUserRegistration.Visibility = ElementVisibility.Collapsed; |
703 | |
704 |
this.ribbonTabProjMgt.Visibility = ElementVisibility.Collapsed; |
705 |
} |
706 |
} |
707 |
else |
708 |
{ |
709 |
this.radButtonElementNoticeUpload.Enabled = false; |
710 | |
711 |
this.backstageButtonItemSelectDB.Visibility = ElementVisibility.Visible; |
712 |
foreach (Control ctrl in this.backstageViewPageOpenProject.Controls) |
713 |
{ |
714 |
ctrl.Visible = false; |
715 |
} |
716 |
this.backstageTabItemOpenProject.Visibility = ElementVisibility.Collapsed; |
717 |
this.backstageButtonItemUserRegistration.Visibility = ElementVisibility.Collapsed; |
718 | |
719 |
this.ribbonTabProjMgt.Visibility = ElementVisibility.Collapsed; |
720 |
} |
721 |
} |
722 | |
723 |
public Point GetBackstageLocation() |
724 |
{ |
725 |
Point location = this.ID2ManagerRadRibbonBar.RibbonBarElement.ApplicationButtonElement.ControlBoundingRectangle.Location; |
726 |
location.Offset(new Point(0, this.ID2ManagerRadRibbonBar.RibbonBarElement.ApplicationButtonElement.ControlBoundingRectangle.Height)); |
727 |
location.Offset(this.ID2ManagerRadRibbonBar.Location); |
728 | |
729 |
return location; |
730 |
} |
731 | |
732 |
private void InitializeGrid() |
733 |
{ |
734 |
InitializeColumns(); |
735 |
InitializeSearch(); |
736 |
InitializeGridViewDetail(); |
737 | |
738 |
//this.radGridViewDocuments.DataSource = new BindingList<Documents>(this.documents); |
739 |
} |
740 | |
741 |
private void InitializeColumns() |
742 |
{ |
743 |
bool isClient = !string.IsNullOrEmpty(informations.ActiveUser.RefProjectID); |
744 |
GridViewColumnCollection cols = this.radGridViewDocuments.Columns; |
745 | |
746 |
cols.ForAll(x => |
747 |
{ |
748 |
if (!x.ReadOnly) |
749 |
{ |
750 |
switch (x.Name) |
751 |
{ |
752 |
case "FrReviewStatus": |
753 |
case "FrRemarks": |
754 |
case "FrCreator": |
755 |
case "ClientReviewer": |
756 |
case "ClientIsResult": |
757 |
case "ClientRemarks": |
758 |
x.ReadOnly = !isClient; |
759 |
break; |
760 |
default: |
761 |
x.ReadOnly = isClient; |
762 |
break; |
763 |
} |
764 |
} |
765 |
}); |
766 |
} |
767 | |
768 |
private void InitializeSearch() |
769 |
{ |
770 | |
771 |
var font1 = ThemeResolutionService.GetCustomFont("TelerikWebUI"); |
772 | |
773 |
lbSearch.Text = "\ue13E"; |
774 |
btnSearchNext.Text = "\ue006"; |
775 |
btnSearchPrevious.Text = "\ue004"; |
776 | |
777 |
var chkbox = new RadCheckBoxElement(); |
778 |
chkbox.Text = "Match Case"; |
779 |
chkbox.CheckStateChanged += (snd, evt) => { radGridViewDocuments.MasterView.TableSearchRow.CaseSensitive = chkbox.Checked; }; |
780 | |
781 |
btnMatchCase.HostedItem = chkbox; |
782 | |
783 |
var chkbox1 = new RadCheckBoxElement(); |
784 |
chkbox1.Text = "Show All Detail"; |
785 |
chkbox1.CheckStateChanged += (snd, evt) => |
786 |
{ |
787 |
radGridViewDocuments.MasterView.ChildRows.ForAll(x => x.IsExpanded = chkbox1.Checked); |
788 |
}; |
789 | |
790 |
btnShowAllDetail.HostedItem = chkbox1; |
791 | |
792 |
var chkbox2 = new RadCheckBoxElement(); |
793 |
chkbox2.Text = "Search from current position"; |
794 |
chkbox2.CheckStateChanged += (snd, evt) => { radGridViewDocuments.MasterView.TableSearchRow.SearchFromCurrentPosition = chkbox.Checked; }; |
795 | |
796 |
btnSearchFormCurrent.HostedItem = chkbox2; |
797 | |
798 |
var columns = radGridViewDocuments.Columns.Where(x => x.AllowSearching).Select(x => |
799 |
new FilterColumn |
800 |
{ |
801 |
Name = x.HeaderText, |
802 |
FieldName = x.FieldName, |
803 |
IsSelect = x.AllowSearching |
804 |
}).ToList(); |
805 | |
806 |
var panel = new StackLayoutElement(); |
807 |
panel.Orientation = Orientation.Vertical; |
808 | |
809 |
var btnComboColumns = new RadCheckedDropDownListElement(); |
810 |
btnComboColumns.ShowCheckAllItems = true; |
811 |
btnComboColumns.CheckAllItem.Checked = true; |
812 |
btnComboColumns.AutoCompleteEditableAreaElement.NullText = "Search in Columns"; |
813 |
btnComboColumns.AutoCompleteEditableAreaElement.AutoCompleteTextBox.IsReadOnly = true; |
814 |
btnComboColumns.DropDownMinSize = new Size(200, 200); |
815 |
btnComboColumns.DropDownSizingMode = SizingMode.UpDownAndRightBottom; |
816 |
btnComboColumns.DisplayMember = "Name"; |
817 |
btnComboColumns.CheckedMember = "IsSelect"; |
818 |
btnComboColumns.ValueMember = "FieldName"; |
819 |
btnComboColumns.TextBox.CustomFont = font1.Name; |
820 |
btnComboColumns.TextBox.Text = "\ue13A"; |
821 | |
822 |
columns.Add(new FilterColumn { FieldName = "CREATE_USER", Name = "Markus User", IsSelect = true }); |
823 |
columns.Add(new FilterColumn { FieldName = "TEXT", Name = "Markus Text", IsSelect = true }); |
824 | |
825 |
btnComboColumns.DataSource = columns; |
826 | |
827 |
txtFullSearch.TextBoxElement.ClearButton.Click += (snd, evt) => |
828 |
{ |
829 |
radGridViewDocuments.MasterTemplate.Refresh(null); |
830 |
}; |
831 | |
832 |
btnComboColumns.PopupOpening += (snd, evt) => |
833 |
{ |
834 |
(snd as RadCheckedDropDownListElement).CheckAllItem.Checked = (snd as RadCheckedDropDownListElement).Items.All(x => (x.DataBoundItem as FilterColumn).IsSelect); |
835 |
}; |
836 | |
837 |
btnComboColumns.PopupClosed += (snd, evt) => |
838 |
{ |
839 |
foreach (RadCheckedListDataItem item in btnComboColumns.Items) |
840 |
{ |
841 |
if (radGridViewDocuments.Columns[item.Value.ToString()] != null) |
842 |
{ |
843 |
radGridViewDocuments.Columns[item.Value.ToString()].AllowSearching = item.Checked; |
844 |
} |
845 | |
846 |
foreach (var template in radGridViewDocuments.Templates) |
847 |
{ |
848 |
if (template.Columns[item.Value.ToString()] != null) |
849 |
{ |
850 |
template.Columns[item.Value.ToString()].AllowSearching = item.Checked; |
851 |
} |
852 |
} |
853 |
} |
854 |
}; |
855 | |
856 |
btnFilters.HostedItem = btnComboColumns; |
857 |
} |
858 | |
859 |
private void InitializeGridViewDetail() |
860 |
{ |
861 |
DetailGridViewTemplate markupList = new DetailGridViewTemplate(); |
862 | |
863 |
GridViewTextBoxColumn userColumn = new GridViewTextBoxColumn("CREATE_USER"); |
864 |
GridViewTextBoxColumn textColumn = new GridViewTextBoxColumn("TEXT"); |
865 | |
866 |
userColumn.MinWidth = 110; |
867 |
userColumn.AutoSizeMode = BestFitColumnMode.AllCells; |
868 |
userColumn.AllowSearching = true; |
869 |
textColumn.AutoSizeMode = BestFitColumnMode.AllCells; |
870 |
textColumn.AllowSearching = true; |
871 | |
872 |
markupList.Columns.AddRange(userColumn, textColumn); |
873 |
markupList.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; |
874 | |
875 |
this.radGridViewDocuments.MasterTemplate.Templates.Add(markupList); |
876 |
markupList.HierarchyDataProvider = new GridViewEventDataProvider(markupList); |
877 | |
878 |
this.radGridViewDocuments.ChildViewExpanded += RadGridViewDocuments_ChildViewExpanded; |
879 |
this.radGridViewDocuments.RowSourceNeeded += RadGridViewDocuments_RowSourceNeeded; |
880 |
} |
881 | |
882 |
private void RadGridViewDocuments_RowSourceNeeded(object sender, GridViewRowSourceNeededEventArgs e) |
883 |
{ |
884 |
if (e.Template.HierarchyLevel == 1) |
885 |
{ |
886 |
if (e.ParentRow.DataBoundItem is Documents documents) |
887 |
{ |
888 |
if (documents.Markups != null) |
889 |
{ |
890 |
foreach (var makrup in documents.Markups) |
891 |
{ |
892 |
GridViewRowInfo row = e.Template.Rows.NewRow(); |
893 | |
894 |
row.Cells["CREATE_USER"].Value = makrup.CREATE_USER; |
895 |
row.Cells["TEXT"].Value = makrup.TEXT; |
896 |
e.SourceCollection.Add(row); |
897 |
} |
898 | |
899 |
e.Template.BestFitColumns(BestFitColumnMode.AllCells); |
900 |
} |
901 |
} |
902 |
} |
903 |
} |
904 | |
905 |
private void RadGridViewDocuments_ChildViewExpanded(object sender, ChildViewExpandedEventArgs e) |
906 |
{ |
907 |
if (e.IsExpanded) |
908 |
{ |
909 |
} |
910 |
} |
911 | |
912 |
#endregion |
913 | |
914 |
private void OpenProjectView_OpenProjectClick(object sender, EventArgs e) |
915 |
{ |
916 |
this.radRibbonBarBackstageViewID2Manager.Tag = e; |
917 |
this.radRibbonBarBackstageViewID2Manager.HidePopup(); |
918 |
} |
919 | |
920 |
private void RadRibbonBarBackstageViewID2Manager_BackstageViewOpened(object sender, EventArgs e) |
921 |
{ |
922 |
this.radRibbonBarBackstageViewID2Manager.SelectedItem = this.backstageTabItemOpenProject; |
923 | |
924 |
foreach (Control ctrl in this.backstageViewPageOpenProject.Controls) |
925 |
{ |
926 |
if (ctrl is OpenProjectView) |
927 |
{ |
928 |
var openProjectView = ctrl as OpenProjectView; |
929 |
openProjectView.GetProjectGroups(); |
930 |
break; |
931 |
} |
932 |
} |
933 |
} |
934 | |
935 |
private void RadRibbonBarBackstageViewID2Manager_BackstageViewClosed(object sender, EventArgs e) |
936 |
{ |
937 |
try |
938 |
{ |
939 |
if (this.radRibbonBarBackstageViewID2Manager.Tag is ProjectEventArgs) |
940 |
{ |
941 |
var prjArgs = this.radRibbonBarBackstageViewID2Manager.Tag as ProjectEventArgs; |
942 | |
943 |
informations.ActiveProject = prjArgs.ProjectInfo; |
944 | |
945 |
this.radRibbonBarBackstageViewID2Manager.Tag = null; |
946 | |
947 |
this.LoadProject(true); |
948 |
} |
949 |
} |
950 |
catch (Exception ex) |
951 |
{ |
952 |
Program.logger.Error($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex); |
953 |
RadMessageBox.Show("Failed to load project.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error); |
954 |
} |
955 |
} |
956 | |
957 |
private void LoadProject(bool isFilterClear) |
958 |
{ |
959 |
this.radLabelElementUser.Text = $"{informations.ActiveUser.ID} {informations.ActiveUser.Name}"; |
960 | |
961 |
try |
962 |
{ |
963 |
#region Date |
964 |
//Date Type |
965 |
if (this.radCheckedDropDownListDateType.DataSource != null) |
966 |
this.radCheckedDropDownListDateType.DataSource = null; |
967 | |
968 |
this.radCheckedDropDownListDateType.DataSource = informations.DateType; |
969 |
this.radCheckedDropDownListDateType.DisplayMember = "Value"; |
970 |
this.radCheckedDropDownListDateType.ValueMember = "Key"; |
971 | |
972 |
//FromDate |
973 |
this.radDateTimePickerFr.NullableValue = null; |
974 |
this.radDateTimePickerFr.SetToNullValue(); |
975 | |
976 |
//ToDate |
977 |
this.radDateTimePickerTo.NullableValue = null; |
978 |
this.radDateTimePickerTo.SetToNullValue(); |
979 |
#endregion |
980 | |
981 |
#region 도면 |
982 |
//Team List |
983 |
if (this.radDropDownListTeam.Items.Count > 0) |
984 |
this.radDropDownListTeam.Items.Clear(); |
985 |
informations.ProjectList.Where(x => x.GroupID.Equals(informations.ActiveProject.ProjectID) && !string.IsNullOrEmpty(x.Team)) |
986 |
.GroupBy(g => g.Team) |
987 |
.OrderBy(o => o.Key) |
988 |
.Select(x => x.Key) |
989 |
.ForAll(x => |
990 |
{ |
991 |
this.radDropDownListTeam.Items.Add(new RadListDataItem(x, x)); |
992 |
}); |
993 |
var allTeam = new RadListDataItem("== 전체 ==", string.Empty); |
994 |
this.radDropDownListTeam.Items.Insert(0, allTeam); |
995 |
allTeam.Selected = true; |
996 | |
997 |
//Project List |
998 |
if (this.radDropDownListProject.Items.Count > 0) |
999 |
this.radDropDownListProject.Items.Clear(); |
1000 |
informations.ProjectList.Where(x => x.GroupID.Equals(informations.ActiveProject.ProjectID)).ToList() |
1001 |
.ForEach(x => |
1002 |
{ |
1003 |
this.radDropDownListProject.Items.Add(new RadListDataItem(x.Name, x.Code)); |
1004 |
}); |
1005 |
var allProject = new RadListDataItem("== 전체 ==", string.Empty); |
1006 |
this.radDropDownListProject.Items.Insert(0, allProject); |
1007 |
allProject.Selected = true; |
1008 | |
1009 |
//담당자 List |
1010 |
if (this.radDropDownListPersonInCharge.Items.Count > 0) |
1011 |
this.radDropDownListPersonInCharge.Items.Clear(); |
1012 |
informations.UserList.ForEach(x => |
1013 |
{ |
1014 |
if ((new string[] { "Manager", "User" }).Contains(x.Role) && string.IsNullOrEmpty(x.RefProjectID)) |
1015 |
this.radDropDownListPersonInCharge.Items.Add(new RadListDataItem(x.Name, x.ID)); |
1016 |
}); |
1017 |
var allUser = new RadListDataItem("== 전체 ==", string.Empty); |
1018 |
this.radDropDownListPersonInCharge.Items.Insert(0, allUser); |
1019 |
allUser.Selected = true; |
1020 | |
1021 |
//난이도 |
1022 |
if (this.radDropDownListJobLevel.Items.Count > 0) |
1023 |
this.radDropDownListJobLevel.Items.Clear(); |
1024 |
informations.JobLevel.ForEach(x => |
1025 |
{ |
1026 |
this.radDropDownListJobLevel.Items.Add(new RadListDataItem(x, x)); |
1027 |
}); |
1028 |
var allJobLevel = new RadListDataItem("== 전체 ==", string.Empty); |
1029 |
this.radDropDownListJobLevel.Items.Insert(0, allJobLevel); |
1030 |
allJobLevel.Selected = true; |
1031 | |
1032 |
//도면번호 조회조건 |
1033 |
this.radTextBoxDocumentNo.Text = string.Empty; |
1034 |
#endregion |
1035 | |
1036 |
#region 검토 |
1037 |
//문의(DOF) |
1038 |
if (this.radDropDownListToIsDiscussion.Items.Count > 0) |
1039 |
this.radDropDownListToIsDiscussion.Items.Clear(); |
1040 |
informations.IsYesNo.ForEach(x => |
1041 |
{ |
1042 |
this.radDropDownListToIsDiscussion.Items.Add(new RadListDataItem(x, x)); |
1043 |
}); |
1044 |
var allToIsDiscussion = new RadListDataItem("== 전체 ==", string.Empty); |
1045 |
this.radDropDownListToIsDiscussion.Items.Insert(0, allToIsDiscussion); |
1046 |
allToIsDiscussion.Selected = true; |
1047 | |
1048 |
//회신(DS) |
1049 |
if (this.radDropDownListFrReviewStatus.Items.Count > 0) |
1050 |
this.radDropDownListFrReviewStatus.Items.Clear(); |
1051 |
informations.ClientStatus.ForEach(x => |
1052 |
{ |
1053 |
this.radDropDownListFrReviewStatus.Items.Add(new RadListDataItem(x, x)); |
1054 |
}); |
1055 |
var allFrReviewStatus = new RadListDataItem("== 전체 ==", string.Empty); |
1056 |
this.radDropDownListFrReviewStatus.Items.Insert(0, allFrReviewStatus); |
1057 |
allFrReviewStatus.Selected = true; |
1058 |
#endregion |
1059 | |
1060 |
#region 작업 |
1061 |
//ID2 Status |
1062 |
{ |
1063 |
if (this.radDropDownListID2Status.Items.Count > 0) |
1064 |
this.radDropDownListID2Status.Items.Clear(); |
1065 |
informations.JobStatus.ForEach(x => |
1066 |
{ |
1067 |
this.radDropDownListID2Status.Items.Add(new RadListDataItem(x, x)); |
1068 |
}); |
1069 |
var allID2Status = new RadListDataItem("== 전체 ==", string.Empty); |
1070 |
this.radDropDownListID2Status.Items.Insert(0, allID2Status); |
1071 |
allID2Status.Selected = true; |
1072 |
} |
1073 | |
1074 |
//ID2 Issues |
1075 |
{ |
1076 |
if (this.radDropDownListID2Issues.Items.Count > 0) |
1077 |
this.radDropDownListID2Issues.Items.Clear(); |
1078 |
informations.IsYesNo.ForEach(x => |
1079 |
{ |
1080 |
this.radDropDownListID2Issues.Items.Add(new RadListDataItem(x, x)); |
1081 |
}); |
1082 |
var allID2Issues = new RadListDataItem("== 전체 ==", string.Empty); |
1083 |
this.radDropDownListID2Issues.Items.Insert(0, allID2Issues); |
1084 |
allID2Issues.Selected = true; |
1085 |
} |
1086 | |
1087 |
//AVEVA Status |
1088 |
{ |
1089 |
if (this.radDropDownListAVEVAStatus.Items.Count > 0) |
1090 |
this.radDropDownListAVEVAStatus.Items.Clear(); |
1091 |
informations.JobStatus.ForEach(x => |
1092 |
{ |
1093 |
this.radDropDownListAVEVAStatus.Items.Add(new RadListDataItem(x, x)); |
1094 |
}); |
1095 |
var allAVEVAStatus = new RadListDataItem("== 전체 ==", string.Empty); |
1096 |
this.radDropDownListAVEVAStatus.Items.Insert(0, allAVEVAStatus); |
1097 |
allAVEVAStatus.Selected = true; |
1098 |
} |
1099 | |
1100 |
//AVEVA Issues |
1101 |
{ |
1102 |
if (this.radDropDownListAVEVAIssues.Items.Count > 0) |
1103 |
this.radDropDownListAVEVAIssues.Items.Clear(); |
1104 |
informations.IsYesNo.ForEach(x => |
1105 |
{ |
1106 |
this.radDropDownListAVEVAIssues.Items.Add(new RadListDataItem(x, x)); |
1107 |
}); |
1108 |
var allAVEVAIssues = new RadListDataItem("== 전체 ==", string.Empty); |
1109 |
this.radDropDownListAVEVAIssues.Items.Insert(0, allAVEVAIssues); |
1110 |
allAVEVAIssues.Selected = true; |
1111 |
} |
1112 | |
1113 |
#endregion |
1114 | |
1115 |
#region 검수 |
1116 |
//도프텍 결과 |
1117 |
if (this.radDropDownListProdIsResult.Items.Count > 0) |
1118 |
this.radDropDownListProdIsResult.Items.Clear(); |
1119 |
informations.ValidationResult.ForEach(x => |
1120 |
{ |
1121 |
this.radDropDownListProdIsResult.Items.Add(new RadListDataItem(x, x)); |
1122 |
}); |
1123 |
var allProdIsResult = new RadListDataItem("== 전체 ==", string.Empty); |
1124 |
this.radDropDownListProdIsResult.Items.Insert(0, allProdIsResult); |
1125 |
allProdIsResult.Selected = true; |
1126 | |
1127 |
//삼성 결과 |
1128 |
if (this.radDropDownListClientIsResult.Items.Count > 0) |
1129 |
this.radDropDownListClientIsResult.Items.Clear(); |
1130 |
informations.ValidationResult.ForEach(x => |
1131 |
{ |
1132 |
this.radDropDownListClientIsResult.Items.Add(new RadListDataItem(x, x)); |
1133 |
}); |
1134 |
var allClientIsResult = new RadListDataItem("== 전체 ==", string.Empty); |
1135 |
this.radDropDownListClientIsResult.Items.Insert(0, allClientIsResult); |
1136 |
allClientIsResult.Selected = true; |
1137 |
#endregion |
1138 | |
1139 |
#region AVEVA |
1140 |
//Gateway |
1141 |
if (this.radDropDownListGateway.Items.Count > 0) |
1142 |
this.radDropDownListGateway.Items.Clear(); |
1143 |
informations.IsYesNo.ForEach(x => |
1144 |
{ |
1145 |
this.radDropDownListGateway.Items.Add(new RadListDataItem(x, x)); |
1146 |
}); |
1147 |
var allDTIsGateWay = new RadListDataItem("== 전체 ==", string.Empty); |
1148 |
this.radDropDownListGateway.Items.Insert(0, allDTIsGateWay); |
1149 |
allDTIsGateWay.Selected = true; |
1150 | |
1151 |
//Registration |
1152 |
if (this.radDropDownListRegistration.Items.Count > 0) |
1153 |
this.radDropDownListRegistration.Items.Clear(); |
1154 |
informations.IsYesNo.ForEach(x => |
1155 |
{ |
1156 |
this.radDropDownListRegistration.Items.Add(new RadListDataItem(x, x)); |
1157 |
}); |
1158 |
var allDTIsRegSystem = new RadListDataItem("== 전체 ==", string.Empty); |
1159 |
this.radDropDownListRegistration.Items.Insert(0, allDTIsRegSystem); |
1160 |
allDTIsRegSystem.Selected = true; |
1161 |
#endregion |
1162 | |
1163 |
this.GetDocList(isFilterClear); |
1164 |
} |
1165 |
catch (Exception ex) |
1166 |
{ |
1167 |
throw ex; |
1168 |
} |
1169 |
finally |
1170 |
{ |
1171 | |
1172 |
this.Cursor = Cursors.Default; |
1173 | |
1174 |
} |
1175 | |
1176 |
} |
1177 | |
1178 |
#region Document List 조회 |
1179 |
public void GetDocList(bool isFilterClear) |
1180 |
{ |
1181 |
try |
1182 |
{ |
1183 |
if (this.radDropDownListProject.SelectedValue != null) |
1184 |
{ |
1185 |
string team = this.radDropDownListTeam.SelectedValue.ToString(); |
1186 | |
1187 |
List<string> dateTypes = this.radCheckedDropDownListDateType.CheckedItems.Select(x => x.Value.ToString()).ToList(); |
1188 |
DateTime? frDate = this.radDateTimePickerFr.Value.Equals(this.radDateTimePickerFr.NullDate) ? (DateTime?)null : this.radDateTimePickerFr.Value; |
1189 |
DateTime? toDate = this.radDateTimePickerTo.Value.Equals(this.radDateTimePickerTo.NullDate) ? (DateTime?)null : this.radDateTimePickerTo.Value; |
1190 | |
1191 |
string projectCode = this.radDropDownListProject.SelectedValue.ToString(); |
1192 |
string personIncharge = this.radDropDownListPersonInCharge.SelectedValue.ToString(); |
1193 |
string jobLevel = this.radDropDownListJobLevel.SelectedValue.ToString(); |
1194 |
string documentNo = this.radTextBoxDocumentNo.Text.Trim(); |
1195 | |
1196 |
string isToIsDiscussion = this.radDropDownListToIsDiscussion.SelectedValue.ToString(); |
1197 |
string isFrReviewStatus = this.radDropDownListFrReviewStatus.SelectedValue.ToString(); |
1198 | |
1199 |
string id2Status = this.radDropDownListID2Status.SelectedValue.ToString(); |
1200 |
string id2Issues = this.radDropDownListID2Issues.SelectedValue.ToString(); |
1201 |
string avevaStatus = this.radDropDownListAVEVAStatus.SelectedValue.ToString(); |
1202 |
string avevaIssues = this.radDropDownListAVEVAIssues.SelectedValue.ToString(); |
1203 | |
1204 |
string prodIsResult = this.radDropDownListProdIsResult.SelectedValue.ToString(); |
1205 |
string clientIsResult = this.radDropDownListClientIsResult.SelectedValue.ToString(); |
1206 | |
1207 |
string isGateWay = this.radDropDownListGateway.SelectedValue.ToString(); |
1208 |
string isRegSystem = this.radDropDownListRegistration.SelectedValue.ToString(); |
1209 | |
1210 |
var worker = new LoadDocumentsWorker(dateTypes, frDate, toDate, team, projectCode, personIncharge, jobLevel, documentNo, isToIsDiscussion, isFrReviewStatus, id2Status, id2Issues, avevaStatus, avevaIssues, prodIsResult, clientIsResult, isGateWay, isRegSystem, this.radGridViewDocuments); |
1211 |
worker.OnWorkCompletedHandler += (e) => |
1212 |
{ |
1213 |
var docData = e.Result as DocumentsResult; |
1214 | |
1215 |
this.documents = docData.Dwgs; |
1216 |
this.orgDocuments = JsonConvert.DeserializeObject<List<Documents>>(JsonConvert.SerializeObject(docData.Dwgs)); |
1217 |
this.TotalCount = docData.TotalCount; |
1218 |
this.SearchCount = docData.Dwgs.Count; |
1219 | |
1220 |
List<string> projectCodes = new List<string>(); |
1221 | |
1222 |
if (!string.IsNullOrWhiteSpace(projectCode)) |
1223 |
{ |
1224 |
projectCodes.Add(projectCode); |
1225 |
} |
1226 |
else |
1227 |
{ |
1228 |
projectCodes = informations.ProjectList.Select(x => x.Code).ToList(); |
1229 |
} |
1230 | |
1231 |
this.DocumentListBinding(isFilterClear); |
1232 |
}; |
1233 | |
1234 |
(btnShowAllDetail.HostedItem as RadCheckBoxElement).Checked = false; |
1235 |
worker.StartWork(); |
1236 |
} |
1237 |
} |
1238 |
catch (Exception ex) |
1239 |
{ |
1240 |
throw ex; |
1241 |
} |
1242 |
} |
1243 | |
1244 |
public void DocumentListBinding(bool isFilterClear) |
1245 |
{ |
1246 |
try |
1247 |
{ |
1248 |
GridViewComboBoxColumn ColProjects = this.radGridViewDocuments.Columns["RefProjectCode"] as GridViewComboBoxColumn; |
1249 |
ColProjects.DataSource = informations.ProjectList.Where(x => x.GroupID.Equals(informations.ActiveProject.ProjectID)).ToList(); |
1250 |
ColProjects.DisplayMember = "Name"; |
1251 |
ColProjects.ValueMember = "Code"; |
1252 | |
1253 |
var workUsers = informations.UserList.Where(x => (new string[] { "Manager", "User" }).Contains(x.Role) && string.IsNullOrEmpty(x.RefProjectID)); |
1254 |
var clientUsers = informations.UserList.Where(x => !string.IsNullOrEmpty(x.RefProjectID)); |
1255 |
var emptyUser = new UserInfo() { ID = null, Name = null }; |
1256 | |
1257 |
GridViewComboBoxColumn ColPersonInCharge = this.radGridViewDocuments.Columns["PersonInCharge"] as GridViewComboBoxColumn; |
1258 |
ColPersonInCharge.DataSource = workUsers.Prepend(emptyUser); |
1259 |
ColPersonInCharge.DisplayMember = "Name"; |
1260 |
ColPersonInCharge.ValueMember = "ID"; |
1261 | |
1262 |
GridViewComboBoxColumn ColWorker = this.radGridViewDocuments.Columns["Worker"] as GridViewComboBoxColumn; |
1263 |
ColWorker.DataSource = workUsers.Prepend(emptyUser); |
1264 |
ColWorker.DisplayMember = "Name"; |
1265 |
ColWorker.ValueMember = "ID"; |
1266 | |
1267 |
GridViewComboBoxColumn ColAVEVAPersonInCharge = this.radGridViewDocuments.Columns["AVEVAPersonInCharge"] as GridViewComboBoxColumn; |
1268 |
ColAVEVAPersonInCharge.DataSource = workUsers.Prepend(emptyUser); |
1269 |
ColAVEVAPersonInCharge.DisplayMember = "Name"; |
1270 |
ColAVEVAPersonInCharge.ValueMember = "ID"; |
1271 | |
1272 |
GridViewComboBoxColumn ColAVEVAWorker = this.radGridViewDocuments.Columns["AVEVAWorker"] as GridViewComboBoxColumn; |
1273 |
ColAVEVAWorker.DataSource = workUsers.Prepend(emptyUser); |
1274 |
ColAVEVAWorker.DisplayMember = "Name"; |
1275 |
ColAVEVAWorker.ValueMember = "ID"; |
1276 | |
1277 |
GridViewComboBoxColumn ColReplyRequester = this.radGridViewDocuments.Columns["ReplyRequester"] as GridViewComboBoxColumn; |
1278 |
ColReplyRequester.DataSource = workUsers; |
1279 |
ColReplyRequester.DisplayMember = "Name"; |
1280 |
ColReplyRequester.ValueMember = "ID"; |
1281 | |
1282 |
GridViewComboBoxColumn ColToCreator = this.radGridViewDocuments.Columns["ToCreator"] as GridViewComboBoxColumn; |
1283 |
ColToCreator.DataSource = workUsers; |
1284 |
ColToCreator.DisplayMember = "Name"; |
1285 |
ColToCreator.ValueMember = "ID"; |
1286 | |
1287 |
GridViewComboBoxColumn ColFrCreator = this.radGridViewDocuments.Columns["FrCreator"] as GridViewComboBoxColumn; |
1288 |
ColFrCreator.DataSource = clientUsers; |
1289 |
ColFrCreator.DisplayMember = "Name"; |
1290 |
ColFrCreator.ValueMember = "ID"; |
1291 | |
1292 |
GridViewComboBoxColumn ColProdReviewer = this.radGridViewDocuments.Columns["ProdReviewer"] as GridViewComboBoxColumn; |
1293 |
ColProdReviewer.DataSource = workUsers.Prepend(emptyUser); |
1294 |
ColProdReviewer.DisplayMember = "Name"; |
1295 |
ColProdReviewer.ValueMember = "ID"; |
1296 | |
1297 |
GridViewComboBoxColumn ColClientReviewer = this.radGridViewDocuments.Columns["ClientReviewer"] as GridViewComboBoxColumn; |
1298 |
ColClientReviewer.DataSource = clientUsers; |
1299 |
ColClientReviewer.DisplayMember = "Name"; |
1300 |
ColClientReviewer.ValueMember = "ID"; |
1301 | |
1302 |
//Data |
1303 |
if (this.radGridViewDocuments.DataSource != null) |
1304 |
this.radGridViewDocuments.DataSource = null; |
1305 | |
1306 |
/* |
1307 |
var info = informations.ProjectList.Where(x => x.Name.Equals("APAO")).FirstOrDefault().ID2Info; |
1308 |
var id2Datas = new DocumentController(info).GetID2DrawingsByProject(info); |
1309 |
var test = from doc in this.documents |
1310 |
join id2 in id2Datas on doc.DocumentNo equals id2.DOCNAME into gj |
1311 |
from docs in gj.DefaultIfEmpty() |
1312 |
select new Documents() |
1313 |
{ |
1314 |
DocumentNo = doc.DocumentNo, |
1315 |
ID2EndDate = docs?.DATETIME == null ? (DateTime?)null : Convert.ToDateTime(docs?.DATETIME) |
1316 |
//ProdRemarks = docs.DATETIME ?? null |
1317 |
}; |
1318 |
*/ |
1319 | |
1320 |
if (isFilterClear) |
1321 |
this.radGridViewDocuments.FilterDescriptors.Clear(); |
1322 |
this.radGridViewDocuments.DataSource = new BindingList<Documents>(this.documents); |
1323 |
this.lbSelectAndTotal.Text = $"{this.radGridViewDocuments.MasterTemplate.DataView.Count} / {this.SearchCount} / {this.TotalCount} (Filter / Search / Total)"; |
1324 | |
1325 |
var classify = this.LayoutValidation.Controls[0] as Classify; |
1326 |
classify.DocumentListBinding(this.documents); |
1327 |
} |
1328 |
catch (Exception ex) |
1329 |
{ |
1330 |
throw ex; |
1331 |
} |
1332 |
} |
1333 |
#endregion |
1334 | |
1335 |
#region 조회조건, filter Event |
1336 |
private void RadButtonDateClear_Click(object sender, EventArgs e) |
1337 |
{ |
1338 |
//DateType |
1339 |
this.radCheckedDropDownListDateType.CheckedItems.Clear(); |
1340 |
//FromDate |
1341 |
this.radDateTimePickerFr.SetToNullValue(); |
1342 |
//ToDate |
1343 |
this.radDateTimePickerTo.SetToNullValue(); |
1344 |
} |
1345 | |
1346 |
private void RadDropDownList_SelectedIndexChanged(object sender, Telerik.WinControls.UI.Data.PositionChangedEventArgs e) |
1347 |
{ |
1348 |
if (sender is RadDropDownList ddl) |
1349 |
{ |
1350 |
if (ddl.SelectedValue != null) |
1351 |
{ |
1352 |
if (string.IsNullOrEmpty(ddl.SelectedValue.ToString())) |
1353 |
{ |
1354 |
ddl.BackColor = Color.White; |
1355 |
ddl.ForeColor = Color.Black; |
1356 |
ddl.Font = new Font("Segoe UI", 8.25F, FontStyle.Regular); |
1357 |
} |
1358 |
else |
1359 |
{ |
1360 |
ddl.BackColor = Color.DarkSlateBlue; |
1361 |
ddl.ForeColor = Color.Yellow; |
1362 |
ddl.Font = new Font("Segoe UI", 8.25F, FontStyle.Bold); |
1363 |
} |
1364 |
} |
1365 |
} |
1366 |
} |
1367 | |
1368 |
private void RadCollapsiblePanelCondition_Collapsed(object sender, EventArgs e) |
1369 |
{ |
1370 |
this.radCollapsiblePanelCondition.HeaderText = "Show"; |
1371 |
this.LayoutMain.RowStyles[0] = new RowStyle() { SizeType = SizeType.Absolute, Height = 30F }; |
1372 |
} |
1373 | |
1374 |
private void RadCollapsiblePanelCondition_Expanded(object sender, EventArgs e) |
1375 |
{ |
1376 |
this.radCollapsiblePanelCondition.HeaderText = "Hide"; |
1377 |
this.LayoutMain.RowStyles[0] = new RowStyle() { SizeType = SizeType.Absolute, Height = 210F }; |
1378 |
} |
1379 | |
1380 |
private void RadCheckBoxFreezed_CheckStateChanged(object sender, EventArgs e) |
1381 |
{ |
1382 |
if (sender is RadCheckBox checkBox) |
1383 |
{ |
1384 |
if (checkBox.Tag != null) |
1385 |
{ |
1386 |
ColumnGroupsViewDefinition columnGroupsView = this.radGridViewDocuments.MasterTemplate.ViewDefinition as ColumnGroupsViewDefinition; |
1387 |
GridViewColumnGroup colGroup = columnGroupsView.GetAllGroups().Where(x => x.Name.Equals(checkBox.Tag.ToString())).FirstOrDefault(); |
1388 |
if (colGroup != null) |
1389 |
colGroup.IsPinned = checkBox.Checked; |
1390 |
} |
1391 |
} |
1392 |
} |
1393 | |
1394 |
private void RadCheckBox_CheckStateChanged(object sender, EventArgs e) |
1395 |
{ |
1396 |
if (sender is RadCheckBox checkBox) |
1397 |
{ |
1398 |
if (checkBox.Tag != null) |
1399 |
{ |
1400 |
ColumnGroupsViewDefinition columnGroupsView = this.radGridViewDocuments.MasterTemplate.ViewDefinition as ColumnGroupsViewDefinition; |
1401 |
GridViewColumnGroup colGroup = columnGroupsView.GetAllGroups().Where(x => x.Name.Equals(checkBox.Tag.ToString())).FirstOrDefault(); |
1402 |
if (colGroup != null) |
1403 |
colGroup.IsVisible = checkBox.Checked; |
1404 |
} |
1405 |
} |
1406 | |
1407 |
//ColumnGroupsViewDefinition columnGroupsView = this.radGridViewDocuments.MasterTemplate.ViewDefinition = columnGroupsView; |
1408 |
} |
1409 | |
1410 |
private void RadTextBoxDocumentNo_KeyDown(object sender, KeyEventArgs e) |
1411 |
{ |
1412 |
if (e.KeyCode == Keys.Enter) |
1413 |
{ |
1414 |
this.radButtonSearch.Focus(); |
1415 |
this.radButtonSearch.PerformClick(); |
1416 |
} |
1417 |
} |
1418 | |
1419 |
private void RadTextBoxDocumentNo_KeyUp(object sender, KeyEventArgs e) |
1420 |
{ |
1421 |
if (sender is RadTextBox txtBox) |
1422 |
{ |
1423 |
if (txtBox.Text.Length > 0) |
1424 |
{ |
1425 |
txtBox.BackColor = Color.DarkSlateBlue; |
1426 |
txtBox.ForeColor = Color.Yellow; |
1427 |
txtBox.Font = new Font("Segoe UI", 8.25F, FontStyle.Bold); |
1428 |
} |
1429 |
else |
1430 |
{ |
1431 |
txtBox.BackColor = Color.White; |
1432 |
txtBox.ForeColor = Color.Black; |
1433 |
txtBox.Font = new Font("Segoe UI", 8.25F, FontStyle.Regular); |
1434 |
} |
1435 |
} |
1436 |
} |
1437 | |
1438 |
private void RadButtonSearch_Click(object sender, EventArgs e) |
1439 |
{ |
1440 |
try |
1441 |
{ |
1442 |
BeginInvoke(new Action(() => |
1443 |
{ |
1444 |
this.radCollapsiblePanelCondition.Collapse(); |
1445 |
})); |
1446 | |
1447 |
this.GetDocList(false); |
1448 |
} |
1449 |
catch (Exception ex) |
1450 |
{ |
1451 |
Program.logger.Error($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex); |
1452 |
RadMessageBox.Show("DWG search failed.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error); |
1453 |
} |
1454 |
} |
1455 |
#endregion |
1456 | |
1457 |
#region Backstage Button Event |
1458 |
private void BackstageButtonItemSelectDB_Click(object sender, EventArgs e) |
1459 |
{ |
1460 |
using (var frm = new SetID2ProjectDB()) |
1461 |
{ |
1462 |
if (frm.ShowDialog(this) == DialogResult.OK) |
1463 |
{ |
1464 |
if (informations.ActiveUser != null && !string.IsNullOrEmpty(informations.ActiveUser.RefProjectID)) |
1465 |
{ |
1466 |
this.radRibbonBarBackstageViewID2Manager.HidePopup(); |
1467 | |
1468 |
informations.ActiveProject = new ProjectController().GetProjectInfo(informations.ActiveUser.RefProjectID); |
1469 |
informations.ProjectList = new ProjectController().GetAllProjectList().ToList(); |
1470 | |
1471 |
this.LoadProject(true); |
1472 |
} |
1473 |
else |
1474 |
{ |
1475 |
informations.ProjectList = new ProjectController().GetAllProjectList().ToList(); |
1476 |
bool isID2 = this.IsID2Connection(); |
1477 |
this.SetMenus(isID2); |
1478 | |
1479 |
foreach (Control ctrl in this.backstageViewPageOpenProject.Controls) |
1480 |
{ |
1481 |
if (ctrl is OpenProjectView) |
1482 |
{ |
1483 |
var openProjectView = ctrl as OpenProjectView; |
1484 |
openProjectView.GetProjectGroups(); |
1485 |
break; |
1486 |
} |
1487 |
} |
1488 |
} |
1489 |
} |
1490 |
} |
1491 |
} |
1492 | |
1493 |
private void BackstageButtonItemUserRegistration_Click(object sender, EventArgs e) |
1494 |
{ |
1495 |
using (var frm = new SetupUser()) |
1496 |
{ |
1497 |
if (frm.ShowDialog(this) == DialogResult.OK) |
1498 |
{ |
1499 | |
1500 |
} |
1501 |
} |
1502 |
} |
1503 | |
1504 |
private void BackstageButtonItemExit_Click(object sender, EventArgs e) |
1505 |
{ |
1506 |
Application.Exit(); |
1507 |
} |
1508 |
#endregion |
1509 | |
1510 |
#region Grid event |
1511 |
private void RadGridViewDocuments_CommandCellClick(object sender, GridViewCellEventArgs e) |
1512 |
{ |
1513 |
if (e.Row is GridViewNewRowInfo) |
1514 |
{ |
1515 | |
1516 |
} |
1517 |
else |
1518 |
{ |
1519 |
string dwgExtension = ".dwg"; |
1520 |
switch (e.Column.Name) |
1521 |
{ |
1522 |
case "AutoCADLink": |
1523 |
{ |
1524 |
if (e.Row.DataBoundItem is Documents doc) |
1525 |
{ |
1526 |
string ID2DrawingFolder = System.IO.Path.Combine(informations.FindID2LocalPath(doc.RefProjectCode), "drawings", "Native"); |
1527 |
string dwgFilePath = System.IO.Path.Combine(ID2DrawingFolder, $"{doc.DocumentNo}{dwgExtension}"); |
1528 |
System.Diagnostics.Process.Start(dwgFilePath); |
1529 |
} |
1530 |
} |
1531 |
break; |
1532 |
case "MarkupLink": |
1533 |
{ |
1534 |
if (e.Row.DataBoundItem is Documents doc) |
1535 |
{ |
1536 |
if (!string.IsNullOrWhiteSpace(doc.RefProjectCode) && !string.IsNullOrWhiteSpace(doc.DocumentNo) && !string.IsNullOrWhiteSpace(informations.ActiveUser.ID)) |
1537 |
{ |
1538 |
bool result = MarkusHelper.Start(doc.RefProjectCode, doc.DocumentNo, informations.ActiveUser.ID); |
1539 |
} |
1540 |
} |
1541 |
} |
1542 |
break; |
1543 |
case "AVEVALink": |
1544 |
RadMessageBox.Show($"{e.Column.Name} 실행", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info); |
1545 |
break; |
1546 |
case "ID2Connection": |
1547 |
try |
1548 |
{ |
1549 |
if (e.Row.DataBoundItem is Documents doc) |
1550 |
{ |
1551 |
ID2Helper.OpenPID(doc.DocumentNo, string.Empty, Properties.Settings.Default.ID2Port); |
1552 | |
1553 |
try |
1554 |
{ |
1555 |
var returnDoc = new DocumentController().SetID2Worker(new Documents() |
1556 |
{ |
1557 |
DocID = doc.DocID, |
1558 |
ID2StartDate = DateTime.Now, |
1559 |
Worker = informations.ActiveUser.ID |
1560 |
}, informations.ActiveUser.ID); |
1561 | |
1562 |
if (returnDoc != null) |
1563 |
{ |
1564 |
doc.ID2StartDate = returnDoc.ID2StartDate; |
1565 |
doc.Worker = returnDoc.Worker; |
1566 |
} |
1567 |
} |
1568 |
catch { } |
1569 |
} |
1570 |
} |
1571 |
catch (Exception ex) |
1572 |
{ |
1573 |
RadMessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, RadMessageIcon.Error); |
1574 |
} |
1575 |
break; |
1576 |
} |
1577 |
} |
1578 |
} |
1579 | |
1580 |
private void RadGridViewDocuments_CellBeginEdit(object sender, GridViewCellCancelEventArgs e) |
1581 |
{ |
1582 |
if (e.ActiveEditor is RadDropDownListEditor) |
1583 |
{ |
1584 |
switch (e.Column.Name) |
1585 |
{ |
1586 |
//case "RefProjectCode": |
1587 |
// GridViewComboBoxColumn ColProjects = this.radGridViewDocuments.Columns[e.Column.Name] as GridViewComboBoxColumn; |
1588 |
// ColProjects.DataSource = informations.ProjectList.Where(x => x.GroupID.Equals(informations.ActiveProject.ProjectID)).ToList(); |
1589 |
// ColProjects.DisplayMember = "Name"; |
1590 |
// ColProjects.ValueMember = "Code"; |
1591 |
// break; |
1592 |
//case "PersonInCharge": |
1593 |
//case "Worker": |
1594 |
//case "AVEVAPersonInCharge": |
1595 |
//case "AVEVAWorker": |
1596 |
//case "ReplyRequester": |
1597 |
//case "ToCreator": |
1598 |
//case "ProdReviewer": |
1599 |
// var workUsers = informations.UserList.Where(x => (new string[] { "Manager", "User" }).Contains(x.Role) && string.IsNullOrEmpty(x.RefProjectID)); |
1600 |
// GridViewComboBoxColumn ColProdUsers = this.radGridViewDocuments.Columns[e.Column.Name] as GridViewComboBoxColumn; |
1601 |
// ColProdUsers.DataSource = workUsers; |
1602 |
// ColProdUsers.DisplayMember = "Name"; |
1603 |
// ColProdUsers.ValueMember = "ID"; |
1604 |
// break; |
1605 |
//case "FrCreator": |
1606 |
//case "ClientReviewer": |
1607 |
// var clientUsers = informations.UserList.Where(x => !string.IsNullOrEmpty(x.RefProjectID)); |
1608 |
// GridViewComboBoxColumn ColClientUsers = this.radGridViewDocuments.Columns[e.Column.Name] as GridViewComboBoxColumn; |
1609 |
// ColClientUsers.DataSource = clientUsers; |
1610 |
// ColClientUsers.DisplayMember = "Name"; |
1611 |
// ColClientUsers.ValueMember = "ID"; |
1612 |
// break; |
1613 |
case "JobLevel": |
1614 |
GridViewComboBoxColumn colJobLevel = this.radGridViewDocuments.Columns[e.Column.Name] as GridViewComboBoxColumn; |
1615 |
colJobLevel.DataSource = informations.JobLevel; |
1616 |
break; |
1617 |
case "ToIsDiscussion": |
1618 |
case "IsConvert": |
1619 |
case "DTIsImport": |
1620 |
case "DTIsGateWay": |
1621 |
case "DTIsRegSystem": |
1622 |
GridViewComboBoxColumn colYesNo = this.radGridViewDocuments.Columns[e.Column.Name] as GridViewComboBoxColumn; |
1623 |
colYesNo.DataSource = (new string[] { string.Empty }).Union<string>(informations.IsYesNo); |
1624 |
break; |
1625 |
case "ID2Status": |
1626 |
case "AVEVAStatus": |
1627 |
GridViewComboBoxColumn ColJobStatus = this.radGridViewDocuments.Columns[e.Column.Name] as GridViewComboBoxColumn; |
1628 |
ColJobStatus.DataSource = (new string[] { string.Empty }).Union<string>(informations.JobStatus); |
1629 |
break; |
1630 |
case "FrReviewStatus"://삼성의견status |
1631 |
GridViewComboBoxColumn ColClientStatus = this.radGridViewDocuments.Columns[e.Column.Name] as GridViewComboBoxColumn; |
1632 |
ColClientStatus.DataSource = (new string[] { string.Empty }).Union<string>(informations.ClientStatus); |
1633 |
break; |
1634 |
case "ProdIsResult": |
1635 |
case "ClientIsResult": |
1636 |
GridViewComboBoxColumn ColResult = this.radGridViewDocuments.Columns[e.Column.Name] as GridViewComboBoxColumn; |
1637 |
ColResult.DataSource = (new string[] { string.Empty }).Union<string>(informations.ValidationResult); |
1638 |
break; |
1639 |
} |
1640 |
} |
1641 |
} |
1642 | |
1643 |
private void RadGridViewDocuments_ViewCellFormatting(object sender, CellFormattingEventArgs e) |
1644 |
{ |
1645 |
if (e.Row is GridViewNewRowInfo) |
1646 |
{ |
1647 |
switch (e.CellElement.ColumnInfo.Name) |
1648 |
{ |
1649 |
case "DocumentNo": |
1650 |
e.Row.Cells[e.CellElement.ColumnInfo.Name].ReadOnly = false; |
1651 |
break; |
1652 |
} |
1653 |
} |
1654 |
else if (e.Row is GridViewDataRowInfo) |
1655 |
{ |
1656 |
if (e.CellElement is GridRowHeaderCellElement) |
1657 |
{ |
1658 |
// if (e.CellElement.RowIndex > -1) |
1659 |
// e.CellElement.Text = (e.CellElement.RowIndex + 1).ToString(); |
1660 |
} |
1661 |
else if (e.CellElement is GridGroupExpanderCellElement expanderCellElement) |
1662 |
{ |
1663 |
if ((e.Row.DataBoundItem as Documents).Markups == null) |
1664 |
{ |
1665 |
expanderCellElement.Enabled = false; |
1666 |
} |
1667 |
else |
1668 |
{ |
1669 |
expanderCellElement.Enabled = true; |
1670 |
} |
1671 |
} |
1672 |
else |
1673 |
{ |
1674 |
var result = e.Row.DataBoundItem as Documents; |
1675 |
if (result != null || e.Row is GridViewNewRowInfo) |
1676 |
{ |
1677 |
switch (e.CellElement.ColumnInfo.Name) |
1678 |
{ |
1679 |
case "AutoCADLink": |
1680 |
case "PDFLink": |
1681 |
case "AVEVALink": |
1682 |
case "ID2Connection": |
1683 |
case "Compare": |
1684 |
this.GetCommandColBtnElement(e.CellElement.Children[0], e.CellElement.ColumnInfo.Name, false); |
1685 |
break; |
1686 |
case "MarkupLink": |
1687 |
this.GetCommandColBtnElement(e.CellElement.Children[0], e.CellElement.ColumnInfo.Name, result.Markups == null ? false : true); |
1688 |
break; |
1689 |
case "ToCapture": |
1690 |
if (result.ToCapture > 0) |
1691 |
{ |
1692 |
e.CellElement.Image = Properties.Resources.files18; |
1693 |
} |
1694 |
break; |
1695 |
case "FrCapture": |
1696 |
if (result.FrCapture > 0) |
1697 |
{ |
1698 |
e.CellElement.Image = Properties.Resources.files18; |
1699 |
} |
1700 |
break; |
1701 |
case "ID2Capture": |
1702 |
if (result.ID2Capture > 0) |
1703 |
{ |
1704 |
e.CellElement.Image = Properties.Resources.files18; |
1705 |
} |
1706 |
break; |
1707 |
case "DocumentNo": |
1708 |
if (result.DocID == null) |
1709 |
{ |
1710 |
e.Row.Cells[e.CellElement.ColumnInfo.Name].ReadOnly = false; |
1711 |
} |
1712 |
else |
1713 |
{ |
1714 |
e.Row.Cells[e.CellElement.ColumnInfo.Name].ReadOnly = true; |
1715 |
} |
1716 |
break; |
1717 |
} |
1718 |
} |
1719 |
else |
1720 |
{ |
1721 | |
1722 |
} |
1723 |
} |
1724 |
} |
1725 |
else if (e.Row is GridViewDetailsRowInfo) |
1726 |
{ |
1727 |
if (e.CellElement is GridDetailViewCellElement detailViewCellElement) |
1728 |
{ |
1729 |
detailViewCellElement.Padding = new Padding(10, 2, 2, 2); |
1730 |
detailViewCellElement.BackColor = Color.FromArgb(214, 214, 214); |
1731 |
detailViewCellElement.BackColor2 = Color.FromArgb(214, 214, 214); |
1732 |
} |
1733 |
} |
1734 |
//else if (e.Row is GridViewNewRowInfo) |
1735 |
//{ |
1736 |
// switch (e.CellElement.ColumnInfo.Name) |
1737 |
// { |
1738 |
// case "RefProjectCode": |
1739 |
// case "DocumentNo": |
1740 |
// e.CellElement.ColumnInfo.ReadOnly = false; |
1741 |
// break; |
1742 |
// } |
1743 |
//} |
1744 |
//else if (e.Row is GridViewSummaryRowInfo) |
1745 |
//{ |
1746 |
// if (e.CellElement is GridRowHeaderCellElement) |
1747 |
// { |
1748 |
// e.CellElement.Text = "Count"; |
1749 |
// } |
1750 |
// else if (e.CellElement is GridSummaryCellElement) |
1751 |
// { |
1752 |
// e.CellElement.ForeColor = this._SummaryColor; |
1753 |
// e.CellElement.TextAlignment = ContentAlignment.BottomRight; |
1754 |
// e.CellElement.Font = new Font(e.CellElement.Font, FontStyle.Bold); |
1755 |
// } |
1756 |
// else |
1757 |
// { |
1758 | |
1759 |
// } |
1760 |
//} |
1761 |
else |
1762 |
{ |
1763 | |
1764 |
} |
1765 |
} |
1766 | |
1767 |
private RadButtonElement GetCommandColBtnElement(RadElement elem, string colName, bool isData) |
1768 |
{ |
1769 |
RadButtonElement btnElem = null; |
1770 |
Bitmap bitmap = null; ; |
1771 | |
1772 |
switch (colName) |
1773 |
{ |
1774 |
case "AutoCADLink": |
1775 |
bitmap = new Bitmap(Properties.Resources.cad18); |
1776 |
break; |
1777 |
case "PDFLink": |
1778 |
bitmap = new Bitmap(Properties.Resources.pdf18); |
1779 |
break; |
1780 |
case "MarkupLink": |
1781 |
if (isData) |
1782 |
{ |
1783 |
bitmap = new Bitmap(Properties.Resources.markus18_on); |
1784 |
} |
1785 |
else |
1786 |
{ |
1787 |
bitmap = new Bitmap(Properties.Resources.markus18); |
1788 |
} |
1789 |
break; |
1790 |
case "AVEVALink": |
1791 |
bitmap = new Bitmap(Properties.Resources.aveva_net18); |
1792 |
break; |
1793 |
case "ID2Connection": |
1794 |
bitmap = new Bitmap(Properties.Resources.id218); |
1795 |
break; |
1796 |
case "Compare": |
1797 |
bitmap = new Bitmap(Properties.Resources.compare18); |
1798 |
break; |
1799 |
} |
1800 | |
1801 |
switch (colName) |
1802 |
{ |
1803 |
case "AutoCADLink": |
1804 |
case "PDFLink": |
1805 |
case "MarkupLink": |
1806 |
case "AVEVALink": |
1807 |
case "ID2Connection": |
1808 |
case "Compare": |
1809 |
btnElem = (RadButtonElement)elem; |
1810 |
btnElem.Margin = new Padding(0); |
1811 |
btnElem.Padding = new Padding(0); |
1812 |
btnElem.BorderElement.Opacity = 0; |
1813 |
btnElem.Alignment = ContentAlignment.MiddleCenter; |
1814 |
btnElem.DisplayStyle = DisplayStyle.Image; |
1815 |
btnElem.Image = bitmap; |
1816 |
btnElem.ImageAlignment = ContentAlignment.MiddleCenter; |
1817 |
btnElem.MaxSize = bitmap.Size; |
1818 |
break; |
1819 |
} |
1820 | |
1821 |
return btnElem; |
1822 |
} |
1823 | |
1824 |
private void RadGridViewDocuments_FilterChanging(object sender, GridViewCollectionChangingEventArgs e) |
1825 |
{ |
1826 | |
1827 |
} |
1828 | |
1829 |
private void RadGridViewDocuments_FilterChanged(object sender, GridViewCollectionChangedEventArgs e) |
1830 |
{ |
1831 |
this.radGridViewDocuments.ClearSelection(); |
1832 |
if (e.GridViewTemplate.DataView.Count > 0) |
1833 |
{ |
1834 |
e.GridViewTemplate.DataView[0].IsSelected = true; |
1835 |
} |
1836 | |
1837 |
this.lbSelectAndTotal.Text = $"{e.GridViewTemplate.DataView.Count} / {this.SearchCount} / {this.TotalCount} (Filter / Search / Total)"; |
1838 |
this.lbChecked.Text = $"Checked : {this.GetCheckedRows(true).Count()}"; |
1839 |
} |
1840 | |
1841 |
private void RadGridViewDocuments_CellValidated(object sender, CellValidatedEventArgs e) |
1842 |
{ |
1843 |
//if(e.Column is GridViewCheckBoxColumn && radGridViewDocuments.SelectedRows?.Count() > 1) |
1844 |
//{ |
1845 |
// radGridViewDocuments.SelectedRows.ForAll(x => |
1846 |
// { |
1847 |
// x.Cells[0].Value = e.Value; |
1848 |
// }); |
1849 |
//} |
1850 | |
1851 |
//if (e.Column is GridViewComboBoxColumn) |
1852 |
//{ |
1853 |
// bool isChecked = e.Row.Cells["Checked"].Value != null && Convert.ToBoolean(e.Row.Cells["Checked"].Value); |
1854 | |
1855 |
// if (isChecked) |
1856 |
// { |
1857 |
// //this.GetCheckedDatas(true) |
1858 |
// var chkDatas = documents.Where(x=>x.Checked).ToList(); |
1859 |
// if (chkDatas.Any()) |
1860 |
// { |
1861 |
// string colValue = e.Row.Cells[e.Column.Name].Value == null ? string.Empty : (string)e.Row.Cells[e.Column.Name].Value; |
1862 |
// radGridViewDocuments.MasterTemplate.BeginUpdate(); |
1863 |
// //radGridViewDocuments.SuspendLayout(); |
1864 |
// //radGridViewDocuments.SuspendUpdate(); |
1865 |
// switch (e.Column.Name) |
1866 |
// { |
1867 |
// case "RefProjectCode": |
1868 |
// chkDatas.ParallelForAll(x => x.RefProjectCode = colValue); |
1869 |
// break; |
1870 |
// case "PersonInCharge": |
1871 |
// chkDatas.ParallelForAll(x => x.PersonInCharge = colValue); |
1872 |
// break; |
1873 |
// case "Worker": |
1874 |
// chkDatas.ParallelForAll(x => x.Worker = colValue); |
1875 |
// break; |
1876 |
// case "JobLevel": |
1877 |
// chkDatas.ParallelForAll(x => x.JobLevel = colValue); |
1878 |
// break; |
1879 |
// case "ToIsDiscussion": |
1880 |
// chkDatas.ParallelForAll(x => x.ToIsDiscussion = colValue); |
1881 |
// break; |
1882 |
// case "ToCreator": |
1883 |
// chkDatas.ParallelForAll(x => x.ToCreator = colValue); |
1884 |
// break; |
1885 |
// case "FrReviewStatus": |
1886 |
// chkDatas.ParallelForAll(x => x.FrReviewStatus = colValue); |
1887 |
// break; |
1888 |
// case "FrCreator": |
1889 |
// chkDatas.ParallelForAll(x => x.FrCreator = colValue); |
1890 |
// break; |
1891 |
// case "ID2Status": |
1892 |
// chkDatas.ParallelForAll(x => x.ID2Status = colValue); |
1893 |
// break; |
1894 |
// case "ReplyRequester": |
1895 |
// chkDatas.ParallelForAll(x => x.ReplyRequester = colValue); |
1896 |
// break; |
1897 |
// case "IsConvert": |
1898 |
// chkDatas.ParallelForAll(x => x.IsConvert = colValue); |
1899 |
// break; |
1900 |
// case "AVEVAPersonInCharge": |
1901 |
// chkDatas.ParallelForAll(x => x.AVEVAPersonInCharge = colValue); |
1902 |
// break; |
1903 |
// case "AVEVAWorker": |
1904 |
// chkDatas.ParallelForAll(x => x.AVEVAWorker = colValue); |
1905 |
// break; |
1906 |
// case "AVEVAStatus": |
1907 |
// chkDatas.ParallelForAll(x => x.AVEVAStatus = colValue); |
1908 |
// break; |
1909 |
// case "ProdReviewer": |
1910 |
// chkDatas.ParallelForAll(x => x.ProdReviewer = colValue); |
1911 |
// break; |
1912 |
// case "ProdIsResult": |
1913 |
// chkDatas.ParallelForAll(x => x.ProdIsResult = colValue); |
1914 |
// break; |
1915 |
// case "ClientReviewer": |
1916 |
// chkDatas.ParallelForAll(x => x.ClientReviewer = colValue); |
1917 |
// break; |
1918 |
// case "ClientIsResult": |
1919 |
// chkDatas.ParallelForAll(x => x.ClientIsResult = colValue); |
1920 |
// break; |
1921 |
// case "DTIsGateWay": |
1922 |
// chkDatas.ParallelForAll(x => x.DTIsGateWay = colValue); |
1923 |
// break; |
1924 |
// case "DTIsImport": |
1925 |
// chkDatas.ParallelForAll(x => x.DTIsImport = colValue); |
1926 |
// break; |
1927 |
// case "DTIsRegSystem": |
1928 |
// chkDatas.ParallelForAll(x => x.DTIsRegSystem = colValue); |
1929 |
// break; |
1930 |
// } |
1931 |
// //radGridViewDocuments.ResumeLayout(); |
1932 |
// //radGridViewDocuments.ResumeUpdate(); |
1933 |
// radGridViewDocuments.MasterTemplate.EndUpdate(); |
1934 | |
1935 | |
1936 |
// } |
1937 |
// } |
1938 |
//} |
1939 |
} |
1940 | |
1941 |
private void RadGridViewDocuments_CellEndEdit(object sender, GridViewCellEventArgs e) |
1942 |
{ |
1943 |
if (e.Column is GridViewComboBoxColumn) |
1944 |
{ |
1945 |
var chkDatas = this.GetCheckedDatas(true); |
1946 | |
1947 |
if (chkDatas.Any()) |
1948 |
{ |
1949 |
RadScrollBarElement vScroll = radGridViewDocuments.TableElement.VScrollBar; |
1950 |
int vPosition = vScroll.Value; |
1951 |
bool isvMaxValue = vPosition == vScroll.Maximum - vScroll.LargeChange + 1; |
1952 | |
1953 |
RadScrollBarElement hScroll = radGridViewDocuments.TableElement.HScrollBar; |
1954 |
int hPosition = hScroll.Value; |
1955 |
bool ishMaxValue = hPosition == hScroll.Maximum - hScroll.LargeChange + 1; |
1956 | |
1957 |
radGridViewDocuments.TableElement.UpdateView(); |
1958 | |
1959 |
object colValue = e.Row.Cells[e.Column.Name].Value; |
1960 | |
1961 |
radGridViewDocuments.BeginUpdate(); |
1962 |
radGridViewDocuments.MasterTemplate.BeginUpdate(); |
1963 |
|
1964 |
chkDatas.ForAll(x => |
1965 |
{ |
1966 |
x.SuspendUpdate = true; |
1967 |
x.GetType().GetProperty(e.Column.Name).SetValue(x, colValue); |
1968 |
x.SuspendUpdate = false; |
1969 |
}); |
1970 | |
1971 |
this.ResumeLayout(true); |
1972 |
radGridViewDocuments.MasterTemplate.EndUpdate(); |
1973 |
radGridViewDocuments.EndUpdate(); |
1974 | |
1975 |
if (vPosition > 0) |
1976 |
{ |
1977 |
if (isvMaxValue) |
1978 |
{ |
1979 |
vPosition = vScroll.Maximum - vScroll.LargeChange + 1; |
1980 |
} |
1981 |
radGridViewDocuments.TableElement.VScrollBar.Value = vPosition; |
1982 |
} |
1983 | |
1984 |
if (hPosition > 0) |
1985 |
{ |
1986 |
if (ishMaxValue) |
1987 |
{ |
1988 |
hPosition = hScroll.Maximum - hScroll.LargeChange + 1; |
1989 |
} |
1990 |
radGridViewDocuments.TableElement.HScrollBar.Value = hPosition; |
1991 |
} |
1992 |
} |
1993 |
} |
1994 |
} |
1995 | |
1996 |
private void RadGridViewDocuments_HeaderCellToggleStateChanged(object sender, GridViewHeaderCellEventArgs e) |
1997 |
{ |
1998 |
if (sender is RadElement elem) |
1999 |
{ |
2000 |
if (elem.IsMouseOverElement)//header를 직접 눌렀을 경우 - 미리 예상해야함 |
2001 |
{ |
2002 |
//on, off 에 따라서 보여지는 거 다 체크이거나 다 언체크 |
2003 | |
2004 |
//this.radGridViewDocuments.FilterDescriptors |
2005 |
var selectedRows = this.radGridViewDocuments.SelectedRows; |
2006 | |
2007 |
if (selectedRows.Count > 1) |
2008 |
{ |
2009 |
var chkRows = this.GetCheckedRows(true); |
2010 |
var selectedCheckedRows = selectedRows.AsEnumerable<GridViewRowInfo>() |
2011 |
.Where(x => |
2012 |
{ |
2013 |
return x.Cells["Checked"].Value != null && Convert.ToBoolean(x.Cells["Checked"].Value); |
2014 |
}); |
2015 |
var selectedUncheckedRows = selectedRows.Except(selectedCheckedRows); |
2016 | |
2017 |
int checkedCount = 0; |
2018 | |
2019 |
if (e.State == ToggleState.On) |
2020 |
{ |
2021 |
checkedCount = chkRows.Count() + selectedUncheckedRows.Count(); |
2022 |
} |
2023 |
else |
2024 |
{ |
2025 |
checkedCount = chkRows.Count() - selectedCheckedRows.Count(); |
2026 |
} |
2027 | |
2028 |
this.lbChecked.Text = $"Checked : {checkedCount}"; |
2029 |
} |
2030 |
else |
2031 |
{ |
2032 |
if (e.State == ToggleState.On) |
2033 |
{ |
2034 |
this.lbChecked.Text = $"Checked : {this.radGridViewDocuments.MasterTemplate.DataView.Count}"; |
2035 |
} |
2036 |
else |
2037 |
{ |
2038 |
this.lbChecked.Text = $"Checked : {0}"; |
2039 |
} |
2040 |
} |
2041 |
} |
2042 |
else//filter 나 item check box 체크 등 다른 이유로 헤더에 체크가 됐을 경우는 get... 이거로 해도 됨 |
2043 |
{ |
2044 |
this.lbChecked.Text = $"Checked : {this.GetCheckedRows(true).Count()}"; |
2045 |
} |
2046 |
} |
2047 |
} |
2048 | |
2049 |
private void RadGridViewDocuments_ValueChanging(object sender, ValueChangingEventArgs e) |
2050 |
{ |
2051 |
if (sender is GridViewCellInfo) |
2052 |
{ |
2053 |
if ((sender as GridViewCellInfo).ColumnInfo is GridViewCheckBoxColumn) |
2054 |
{ |
2055 |
if (this.radGridViewDocuments.SelectedRows.Count() > 1) |
2056 |
{ |
2057 |
if (!this.radGridViewDocuments.SelectedRows.Contains((sender as GridViewCellInfo).RowInfo)) |
2058 |
{ |
2059 |
e.Cancel = true; |
2060 |
} |
2061 |
} |
2062 |
} |
2063 |
} |
2064 |
} |
2065 | |
2066 |
private void RadGridViewDocuments_ValueChanged(object sender, EventArgs e) |
2067 |
{ |
2068 |
if (sender is BaseGridEditor baseEditor) |
2069 |
{ |
2070 |
if (baseEditor.OwnerElement is GridDataCellElement cellElem) |
2071 |
{ |
2072 |
if (!(cellElem.RowInfo is GridViewNewRowInfo)) |
2073 |
{ |
2074 |
switch (cellElem.ColumnInfo.Name) |
2075 |
{ |
2076 |
case "Checked": |
2077 |
this.radGridViewDocuments.EndEdit(); |
2078 |
this.lbChecked.Text = $"Checked : {this.GetCheckedRows(true).Count()}"; |
2079 |
break; |
2080 |
case "RefProjectCode": |
2081 |
case "PersonInCharge": |
2082 |
case "Worker": |
2083 |
case "JobLevel": |
2084 |
case "ToIsDiscussion": |
2085 |
case "ToCreator": |
2086 |
case "FrReviewStatus": |
2087 |
case "FrCreator": |
2088 |
case "ID2Status": |
2089 |
case "ReplyRequester": |
2090 |
case "IsConvert": |
2091 |
case "AVEVAPersonInCharge": |
2092 |
case "AVEVAWorker": |
2093 |
case "AVEVAStatus": |
2094 |
case "ProdReviewer": |
2095 |
case "ProdIsResult": |
2096 |
case "ClientReviewer": |
2097 |
case "ClientIsResult": |
2098 |
case "DTIsGateWay": |
2099 |
case "DTIsImport": |
2100 |
case "DTIsRegSystem": |
2101 |
this.radGridViewDocuments.EndEdit(); |
2102 |
break; |
2103 |
} |
2104 |
} |
2105 |
} |
2106 |
} |
2107 |
} |
2108 |
#endregion |
2109 | |
2110 |
/* |
2111 |
private void GetCheckedList() |
2112 |
{ |
2113 |
RadGridView grid = this.radGridViewDocuments; |
2114 | |
2115 |
//var checkers = grid.Rows.Where(x => |
2116 |
//{ |
2117 |
// return x.Cells["Checked"].Value != null && Convert.ToBoolean(x.Cells["Checked"].Value); |
2118 |
//}).Select(x => x.DataBoundItem as Documents).ToList(); |
2119 | |
2120 |
//var viewRows = new Queue<GridViewRowInfo>(this.radGridViewDocuments.MasterTemplate.DataView.Where(x => x.Cells["spq"); |
2121 |
var viewRows = grid.MasterTemplate.DataView; |
2122 | |
2123 |
var checkers = viewRows.Where(x => |
2124 |
{ |
2125 |
return x.Cells["Checked"].Value != null && Convert.ToBoolean(x.Cells["Checked"].Value); |
2126 |
}).ToList(); |
2127 | |
2128 |
var rows = new GridViewDataRowInfo[checkers.Count]; |
2129 |
checkers.CopyTo(rows, 0); |
2130 | |
2131 |
if (rows.Length > 0) |
2132 |
{ |
2133 |
grid.BeginUpdate(); |
2134 | |
2135 |
int nLoop = 0; |
2136 |
rows.ForAll(x => |
2137 |
{ |
2138 |
grid.Rows.Remove(rows[nLoop]); |
2139 |
nLoop++; |
2140 |
}); |
2141 | |
2142 |
grid.EndUpdate(); |
2143 |
} |
2144 | |
2145 | |
2146 |
//grid.Rows.re grid.Rows.ToList().Intersect(checkers) |
2147 | |
2148 | |
2149 |
//RadMessageBox.Show($"{checkers.Count()}", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info); |
2150 |
//RadMessageBox.Show($"{this.documents.Count}", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info); |
2151 |
this.lbSelectAndTotal.Text = $"{grid.MasterTemplate.DataView.Count} / {this.TotalCount} (Selected / Total)"; |
2152 |
} |
2153 |
*/ |
2154 |
private IEnumerable<GridViewRowInfo> GetCheckedRows(bool isView) |
2155 |
{ |
2156 |
try |
2157 |
{ |
2158 |
RadGridView grid = this.radGridViewDocuments; |
2159 |
var viewRows = isView ? grid.MasterTemplate.DataView : grid.Rows.AsEnumerable<GridViewRowInfo>(); |
2160 |
return viewRows.Where(x => |
2161 |
{ |
2162 |
return x.Cells["Checked"].Value != null && Convert.ToBoolean(x.Cells["Checked"].Value); |
2163 |
}); |
2164 |
} |
2165 |
catch (Exception ex) |
2166 |
{ |
2167 |
throw ex; |
2168 |
} |
2169 |
} |
2170 | |
2171 |
private IEnumerable<Documents> GetCheckedDatas(bool isView) |
2172 |
{ |
2173 |
return this.GetCheckedRows(isView).Where(x => x.DataBoundItem is Documents) |
2174 |
.Select(x => x.DataBoundItem as Documents); |
2175 |
} |
2176 | |
2177 |
//private IEnumerable<Documents> GetCheckedDatas(bool isView) |
2178 |
//{ |
2179 |
// return this.documents.Where(x => x.Checked); |
2180 |
//} |
2181 | |
2182 |
private void SetSaved() |
2183 |
{ |
2184 |
this.radGridViewDocuments.EndEdit(); |
2185 | |
2186 |
try |
2187 |
{ |
2188 |
if (RadMessageBox.Show("Do you want to Save?", Globals.Name, MessageBoxButtons.YesNo, RadMessageIcon.Question) == DialogResult.Yes) |
2189 |
{ |
2190 |
#region 유효성검사 |
2191 | |
2192 |
#region 필수값 체크(Team, DWG_ID) |
2193 | |
2194 |
if (this.documents.Any(x => string.IsNullOrEmpty(x.RefProjectCode))) |
2195 |
{ |
2196 |
RadMessageBox.Show($"Please, check the required value (Team).", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info); |
2197 |
return; |
2198 |
} |
2199 | |
2200 |
if (this.documents.Any(x => string.IsNullOrEmpty(x.DocumentNo))) |
2201 |
{ |
2202 |
RadMessageBox.Show($"Please, check the required value (DWG_ID).", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info); |
2203 |
return; |
2204 |
} |
2205 | |
2206 |
#endregion |
2207 | |
2208 |
#endregion |
2209 | |
2210 |
#region document no 중복 유효성 체크 |
2211 |
int dupDwgNoCount = 0; |
2212 |
dupDwgNoCount = this.documents.GroupBy(g => new { g.RefProjectCode, g.DocumentNo }) |
2213 |
.Where(x => x.Count() > 1) |
2214 |
.Select(x => x.Key).ToList().Count; |
2215 | |
2216 |
if (dupDwgNoCount > 0) |
2217 |
{ |
2218 |
RadMessageBox.Show($"Duplicate Dwg No exists.({dupDwgNoCount})", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info); |
2219 |
return; |
2220 |
} |
2221 |
#endregion |
2222 | |
2223 |
var worker = new SetDocumentsWorker(this.documents, this.orgDocuments, this.radGridViewDocuments); |
2224 |
worker.OnWorkCompletedHandler += (e) => |
2225 |
{ |
2226 |
bool isDwg = false; |
2227 |
bool isMarkusPrj = false; |
2228 |
bool isMarkusDwg = false; |
2229 |
bool isMarkusUser = false; |
2230 | |
2231 |
(isDwg, isMarkusPrj, isMarkusDwg, isMarkusUser) = ((bool, bool, bool, bool))e.Result; |
2232 | |
2233 |
if (!isDwg) |
2234 |
{ |
2235 |
RadMessageBox.Show("Save is not complete.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error); |
2236 |
} |
2237 |
else if (!isMarkusPrj) |
2238 |
{ |
2239 |
RadMessageBox.Show("Markus Projects Save is not complete.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error); |
2240 |
} |
2241 |
else if (!isMarkusDwg) |
2242 |
{ |
2243 |
RadMessageBox.Show("Markus Data Save is not complete.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error); |
2244 |
} |
2245 |
else if (!isMarkusUser) |
2246 |
{ |
2247 |
RadMessageBox.Show("Markus Members Save is not complete.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error); |
2248 |
} |
2249 |
else |
2250 |
{ |
2251 |
RadMessageBox.Show("Save is complete", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info); |
2252 |
this.GetDocList(false); |
2253 |
} |
2254 |
}; |
2255 |
worker.StartWork(); |
2256 |
} |
2257 |
} |
2258 |
catch (Exception ex) |
2259 |
{ |
2260 |
throw ex; |
2261 |
} |
2262 |
} |
2263 | |
2264 |
#region Quick Toolbar Button Event |
2265 |
private void RadButtonElementSaveCommand_Click(object sender, EventArgs e) |
2266 |
{ |
2267 |
try |
2268 |
{ |
2269 |
this.SetSaved(); |
2270 |
} |
2271 |
catch (Exception ex) |
2272 |
{ |
2273 |
Program.logger.Error($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex); |
2274 |
RadMessageBox.Show("DWG save failed.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error); |
2275 |
} |
2276 |
} |
2277 | |
2278 |
private void RadButtonElementRefreshCommand_Click(object sender, EventArgs e) |
2279 |
{ |
2280 |
bool isReload = false; |
2281 | |
2282 |
try |
2283 |
{ |
2284 |
if (RadMessageBox.Show($"Do you want to reload the project?", Globals.Name, MessageBoxButtons.YesNo, RadMessageIcon.Question) == DialogResult.Yes) |
2285 |
{ |
2286 |
if (informations.ActiveUser != null && !string.IsNullOrEmpty(informations.ActiveUser.RefProjectID)) |
2287 |
{ |
2288 |
informations.ActiveProject = new ProjectController().GetProjectInfo(informations.ActiveUser.RefProjectID); |
2289 |
informations.ProjectList = new ProjectController().GetAllProjectList().ToList(); |
2290 | |
2291 |
isReload = true; |
2292 |
} |
2293 |
else if (informations.ActiveProject != null) |
2294 |
{ |
2295 |
informations.ProjectList = new ProjectController().GetAllProjectList().ToList(); |
2296 | |
2297 |
isReload = true; |
2298 |
} |
2299 |
else |
2300 |
{ |
2301 |
RadMessageBox.Show("Select a project.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info); |
2302 |
this.radRibbonBarBackstageViewID2Manager.ShowPopup(this.GetBackstageLocation(), this.ID2ManagerRadRibbonBar.RibbonBarElement); |
2303 |
} |
2304 |
} |
2305 | |
2306 |
if (isReload) |
2307 |
{ |
2308 |
this.LoadProject(false); |
2309 |
} |
2310 |
} |
2311 |
catch (Exception ex) |
2312 |
{ |
2313 |
Program.logger.Error($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex); |
2314 |
RadMessageBox.Show("Failed to reload the project.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error); |
2315 |
} |
2316 |
} |
2317 |
#endregion |
2318 | |
2319 |
#region Home Tab Event |
2320 | |
2321 |
private void RadButtonElementSave_Click(object sender, EventArgs e) |
2322 |
{ |
2323 |
try |
2324 |
{ |
2325 |
this.SetSaved(); |
2326 |
} |
2327 |
catch (Exception ex) |
2328 |
{ |
2329 |
Program.logger.Error($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex); |
2330 |
RadMessageBox.Show("DWG save failed.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error); |
2331 |
} |
2332 |
} |
2333 | |
2334 |
private void RadButtonElementSync_Click(object sender, EventArgs e) |
2335 |
{ |
2336 |
try |
2337 |
{ |
2338 |
if (RadMessageBox.Show("Do you want to ID2 Sync?", Globals.Name, MessageBoxButtons.YesNo, RadMessageIcon.Question) == DialogResult.Yes) |
2339 |
{ |
2340 |
var worker = new SyncDocumentsWorker(this.radGridViewDocuments); |
2341 |
worker.OnWorkCompletedHandler += (arg) => |
2342 |
{ |
2343 |
if ((bool)arg.Result) |
2344 |
{ |
2345 |
this.GetDocList(false); |
2346 | |
2347 |
RadMessageBox.Show("Sync with ID2 completed.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info); |
2348 |
} |
2349 |
}; |
2350 |
worker.StartWork(); |
2351 |
} |
2352 |
} |
2353 |
catch (Exception ex) |
2354 |
{ |
2355 |
Program.logger.Error($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex); |
2356 |
RadMessageBox.Show("Failed to sync with id2.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error); |
2357 |
} |
2358 |
} |
2359 | |
2360 |
private void RadButtonElementNotice_Click(object sender, EventArgs e) |
2361 |
{ |
2362 |
try |
2363 |
{ |
2364 |
AttFileInfo notiFileInfo = new AttFileController().GetAttFileInfo(informations.ActiveProject.ProjectID, "notice"); |
2365 | |
2366 |
if (notiFileInfo == null) |
2367 |
{ |
2368 |
RadMessageBox.Show("No notice.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info); |
2369 |
} |
2370 |
else |
2371 |
{ |
2372 |
string noticePath = Path.Combine(Globals.ProgramDataFolder, "NoticeFiles"); |
2373 |
string noticeFileFullName = Path.Combine(noticePath, $"{notiFileInfo.FileID}{notiFileInfo.FileExtension}"); |
2374 | |
2375 |
FileInfo finfo = new FileInfo(noticeFileFullName); |
2376 | |
2377 |
if (!finfo.Directory.Exists) |
2378 |
{ |
2379 |
Directory.CreateDirectory(noticePath); |
2380 |
} |
2381 | |
2382 |
if (!finfo.Exists) |
2383 |
{ |
2384 |
var arrayBinary = notiFileInfo.FileData.ToArray(); |
2385 | |
2386 |
using (MemoryStream ms = new MemoryStream(arrayBinary)) |
2387 |
{ |
2388 |
ms.Write(arrayBinary, 0, arrayBinary.Length); |
2389 |
ms.Seek(0, SeekOrigin.Begin); |
2390 | |
2391 |
using (FileStream fs = finfo.Create()) |
2392 |
{ |
2393 |
ms.CopyTo(fs); |
2394 |
} |
2395 |
} |
2396 |
} |
2397 | |
2398 |
try |
2399 |
{ |
2400 |
ProcessStartInfo startInfo = new ProcessStartInfo |
2401 |
{ |
2402 |
FileName = finfo.FullName, |
2403 |
UseShellExecute = true, |
2404 |
CreateNoWindow = false, |
2405 |
WindowStyle = ProcessWindowStyle.Normal |
2406 |
}; |
2407 | |
2408 |
using (Process process = new Process()) |
2409 |
{ |
2410 |
process.StartInfo = startInfo; |
2411 |
process.Start(); |
2412 |
} |
2413 |
//Process.Start(finfo.FullName); |
2414 |
} |
2415 |
catch (Exception ex) |
2416 |
{ |
2417 |
throw ex; |
2418 |
} |
2419 | |
2420 |
//using (MemoryStream ms = new MemoryStream(arrayBinary)) |
2421 |
//{ |
2422 |
// ProcessStartInfo startInfo = new ProcessStartInfo |
2423 |
// { |
2424 |
// FileName = Path.Combine(attFileInfo.FilePath, attFileInfo.FileName), |
2425 |
// RedirectStandardInput = true, |
2426 |
// UseShellExecute = false, |
2427 |
// CreateNoWindow = true, |
2428 |
// WindowStyle = ProcessWindowStyle.Hidden |
2429 |
// }; |
2430 | |
2431 |
// using (Process process = new Process()) |
2432 |
// { |
2433 |
// process.StartInfo = startInfo; |
2434 |
// process.Start(); |
2435 | |
2436 |
// // Write the memory stream contents to the process standard input |
2437 |
// byte[] buffer = ms.ToArray(); |
2438 |
// process.StandardInput.BaseStream.Write(buffer, 0, buffer.Length); |
2439 |
// process.StandardInput.Close(); |
2440 | |
2441 |
// process.WaitForExit(); |
2442 |
// } |
2443 |
//} |
2444 |
} |
2445 |
} |
2446 |
catch (Exception ex) |
2447 |
{ |
2448 |
Program.logger.Error($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex); |
2449 |
RadMessageBox.Show("Notification lookup failed.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error); |
2450 |
} |
2451 |
} |
2452 | |
2453 |
private void RadButtonElementNoticeUpload_Click(object sender, EventArgs e) |
2454 |
{ |
2455 |
string GetContentType(string filePath) |
2456 |
{ |
2457 |
string extension = Path.GetExtension(filePath).ToLower(); |
2458 | |
2459 |
switch (extension) |
2460 |
{ |
2461 |
case ".txt": |
2462 |
return "text/plain"; |
2463 |
case ".pdf": |
2464 |
return "application/pdf"; |
2465 |
case ".jpg": |
2466 |
case ".jpeg": |
2467 |
return "image/jpeg"; |
2468 |
case ".png": |
2469 |
return "image/png"; |
2470 |
case ".bmp": |
2471 |
return "image/bmp"; |
2472 |
case ".gif": |
2473 |
return "image/gif"; |
2474 |
default: |
2475 |
return "application/octet-stream"; |
2476 |
} |
2477 |
} |
2478 | |
2479 |
using (OpenFileDialog ofd = new OpenFileDialog() |
2480 |
{ |
2481 |
//Filter = "PDF files (*.pdf)|*.pdf|All files (*.*)|*.*", |
2482 |
Filter = "All Images Files (*.png;*.jpeg;*.gif;*.jpg;*.bmp)|*.png;*.jpeg;*.gif;*.jpg;*.bmp" |
2483 |
+ "|PNG Portable Network Graphics (*.png)|*.png" |
2484 |
+ "|JPEG File Interchange Format (*.jpg *.jpeg *jfif)|*.jpg;*.jpeg;*.jfif" |
2485 |
+ "|BMP Windows Bitmap (*.bmp)|*.bmp" |
2486 |
+ "|GIF Graphics Interchange Format (*.gif)|*.gif", |
2487 |
//Title = "Open an Excel File", |
2488 |
RestoreDirectory = true |
2489 |
}) |
2490 |
{ |
2491 |
try |
2492 |
{ |
2493 |
if (ofd.ShowDialog() == DialogResult.OK) |
2494 |
{ |
2495 |
FileInfo fileInfo = new FileInfo(ofd.FileName); |
2496 |
if (fileInfo.Exists) |
2497 |
{ |
2498 |
AttFileInfo attFile = new AttFileInfo() |
2499 |
{ |
2500 |
RefID = informations.ActiveProject.ProjectID, |
2501 |
Category = "notice", |
2502 |
FileType = GetContentType(fileInfo.FullName), |
2503 |
FileName = fileInfo.Name, |
2504 |
FilePath = fileInfo.DirectoryName, |
2505 |
FileExtension = fileInfo.Extension |
2506 |
}; |
2507 | |
2508 |
using (var stream = new FileStream(ofd.FileName, FileMode.Open, FileAccess.Read)) |
2509 |
{ |
2510 |
using (var reader = new BinaryReader(stream)) |
2511 |
{ |
2512 |
attFile.FileData = reader.ReadBytes((int)stream.Length); |
2513 |
} |
2514 |
} |
2515 | |
2516 |
bool result = new AttFileController().SetAttFiles(new List<AttFileInfo>() { attFile }, informations.ActiveUser.ID); |
2517 | |
2518 |
if (result) |
2519 |
{ |
2520 |
RadMessageBox.Show("An Notice has been posted.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info); |
2521 |
} |
2522 |
} |
2523 |
} |
2524 |
} |
2525 |
catch (Exception ex) |
2526 |
{ |
2527 |
Program.logger.Error($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex); |
2528 |
RadMessageBox.Show("Failed to register the Notice.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error); |
2529 |
} |
2530 |
} |
2531 |
} |
2532 | |
2533 |
private void RadButtonElementFilterClear_Click(object sender, EventArgs e) |
2534 |
{ |
2535 |
if (RadMessageBox.Show("Are you sure you want to clear the filter?", Globals.Name, MessageBoxButtons.YesNo, RadMessageIcon.Question) == DialogResult.Yes) |
2536 |
{ |
2537 |
this.radGridViewDocuments.FilterDescriptors.Clear(); |
2538 |
} |
2539 |
} |
2540 |
#endregion |
2541 | |
2542 |
#region Project Manager Tab Event |
2543 | |
2544 |
#region Excel |
2545 |
private UserInfo GetUser(string user) |
2546 |
{ |
2547 |
UserInfo userInfo = informations.UserList.Where(x => x.ID.Equals(user)).FirstOrDefault(); |
2548 |
if (userInfo != null) return userInfo; |
2549 | |
2550 |
userInfo = informations.UserList.Where(x => x.Name.Equals(user)).FirstOrDefault(); |
2551 |
if (userInfo != null) return userInfo; |
2552 | |
2553 |
return userInfo ?? new UserInfo(); |
2554 |
} |
2555 | |
2556 |
private ProjectInfo GetProject(string project) |
2557 |
{ |
2558 |
ProjectInfo prjInfo = informations.ProjectList.Where(x => x.Code.Equals(project)).FirstOrDefault(); |
2559 |
if (prjInfo != null) return prjInfo; |
2560 | |
2561 |
prjInfo = informations.ProjectList.FirstOrDefault(x => x.Name.Equals(project)); |
2562 |
if (prjInfo != null) return prjInfo; |
2563 | |
2564 |
return prjInfo ?? new ProjectInfo(); |
2565 |
} |
2566 | |
2567 |
private void RadButtonElementExcelImport_Click(object sender, EventArgs e) |
2568 |
{ |
2569 |
var form = new Forms.SelectExcelData(); |
2570 | |
2571 |
var dialogResult = form.ShowDialog(); |
2572 | |
2573 |
if (dialogResult == DialogResult.OK) |
2574 |
{ |
2575 |
using (ID2Excel excel = new ID2Excel()) |
2576 |
{ |
2577 |
var result = excel.ExcelDataImport(form.SelectItems); |
2578 | |
2579 |
if (result.Error != null) |
2580 |
{ |
2581 |
RadMessageBox.Show(result.Error, "Information", MessageBoxButtons.OK, RadMessageIcon.Info); |
2582 |
} |
2583 |
else |
2584 |
{ |
2585 |
this.importImages = result.Images;//??? |
2586 | |
2587 |
var intersections = this.documents.Intersect(result.documents, new DocumentsUniqueCompare()); |
2588 |
var subtractions = result.documents.Except(this.documents, new DocumentsUniqueCompare()); |
2589 | |
2590 |
if (intersections.Any()) |
2591 |
{ |
2592 |
var intersectionImports = result.documents.Intersect(this.documents, new DocumentsUniqueCompare()); |
2593 | |
2594 |
intersections.ForAll(x => |
2595 |
{ |
2596 |
var intersectionImport = intersectionImports.FirstOrDefault(o => o.RefProjectCode == x.RefProjectCode && o.DocumentNo == x.DocumentNo); |
2597 |
if (intersectionImport != null) |
2598 |
{ |
2599 |
x.DataCopy(intersectionImport); |
2600 |
} |
2601 |
}); |
2602 |
} |
2603 | |
2604 |
this.documents.AddRange(subtractions); |
2605 |
if (this.orgDocuments == null) this.orgDocuments = new List<Documents>(); |
2606 |
this.DocumentListBinding(false); |
2607 |
//briefAndImagesReview.SetImages(this.importImages); |
2608 | |
2609 |
RadMessageBox.Show("Import is complete", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info); |
2610 |
} |
2611 | |
2612 |
} |
2613 |
} |
2614 |
} |
2615 | |
2616 |
private void RadButtonElementExcelImport_Click_gembox(object sender, EventArgs e) |
2617 |
{ |
2618 |
using (OpenFileDialog ofd = new OpenFileDialog() |
2619 |
{ |
2620 |
Filter = "Excel files (*.xlsx)|*.xlsx", |
2621 |
Title = "Open an Excel File", |
2622 |
RestoreDirectory = true |
2623 |
}) |
2624 |
{ |
2625 |
if (ofd.ShowDialog() == DialogResult.OK) |
2626 |
{ |
2627 |
//Error Message |
2628 |
StringBuilder sbErrMsg = new StringBuilder(); |
2629 | |
2630 |
using (ID2Excel excel = new ID2Excel()) |
2631 |
{ |
2632 |
var result = excel.GemboxImport(ofd.FileName); |
2633 | |
2634 |
if (result.Error != null) |
2635 |
{ |
2636 | |
2637 |
RadMessageBox.Show(result.Error, "Information", MessageBoxButtons.OK, RadMessageIcon.Info); |
2638 |
} |
2639 |
else |
2640 |
{ |
2641 |
this.documents.AddRange(result.documents); |
2642 |
if (this.orgDocuments == null) this.orgDocuments = new List<Documents>(); |
2643 |
this.DocumentListBinding(false); |
2644 |
} |
2645 | |
2646 |
} |
2647 | |
2648 | |
2649 |
//foreach (Documents appDoc in appendDocuments) |
2650 |
//{ |
2651 |
// GridViewRowInfo rowInfo = this.radGridViewDocuments.Rows.AddNew(); |
2652 | |
2653 |
// foreach (FieldInfo fieldInfo in appDoc.GetType().GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)) |
2654 |
// { |
2655 |
// if (fieldInfo.GetValue(appDoc) != null) |
2656 |
// { |
2657 |
// var cols = rowInfo.Cells.Where(x => fieldInfo.Name.Contains($"<{x.ColumnInfo.Name}>")); |
2658 | |
2659 |
// if (cols.Any()) |
2660 |
// { |
2661 |
// cols.FirstOrDefault().Value = fieldInfo.GetValue(appDoc); |
2662 |
// } |
2663 |
// } |
2664 |
// } |
2665 |
//} |
2666 |
} |
2667 |
} |
2668 |
} |
2669 | |
2670 |
private void RadButtonElementExcelExport_Click(object sender, EventArgs e) |
2671 |
{ |
2672 |
string sPrefixName = "Samsung Elec Task Management"; |
2673 |
string extension = ".xlsx"; |
2674 | |
2675 |
using (SaveFileDialog sfd = new SaveFileDialog() |
2676 |
{ |
2677 |
FileName = $"{sPrefixName}_{DateTime.Now:yyyyMMddhhmmss}{extension}", |
2678 |
Filter = "Excel|*.xlsx", |
2679 |
Title = "Save an Excel File", |
2680 |
CheckFileExists = false, |
2681 |
CheckPathExists = true, |
2682 |
OverwritePrompt = true |
2683 |
}) |
2684 |
{ |
2685 |
if (sfd.ShowDialog() == DialogResult.OK) |
2686 |
{ |
2687 |
string fileName = $"{sPrefixName}{extension}"; |
2688 |
string templateFolder = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "Template"); |
2689 |
string templateFilePath = Path.Combine(templateFolder, fileName); |
2690 |
if (!File.Exists(templateFilePath)) |
2691 |
{ |
2692 |
RadMessageBox.Show(this, $"There is no {fileName} in {templateFolder}", "Error", MessageBoxButtons.OK, RadMessageIcon.Error); |
2693 |
return; |
2694 |
} |
2695 | |
2696 |
var templateExcelFile = ExcelFile.Load(templateFilePath); |
2697 |
var templateWorksheets = templateExcelFile.Worksheets; |
2698 |
var templateWorksheet = templateWorksheets[0]; |
2699 | |
2700 |
if (this.radGridViewDocuments.Rows.Count > 0) |
2701 |
{ |
2702 |
int rowIndex = 9; |
2703 |
//int colIndex = 1; |
2704 |
int rowNo = 1; |
2705 | |
2706 |
foreach (var row in this.radGridViewDocuments.MasterTemplate.DataView) |
2707 |
{ |
2708 |
var doc = row.DataBoundItem as Documents; |
2709 | |
2710 |
templateWorksheet.Cells[rowIndex, 0].Value = rowNo++; |
2711 | |
2712 |
templateWorksheet.Cells[rowIndex, 7].Value = doc.RefProjectCode; |
2713 |
templateWorksheet.Cells[rowIndex, 8].Value = doc.System; |
2714 |
templateWorksheet.Cells[rowIndex, 9].Value = doc.SubSystemCode; |
2715 |
templateWorksheet.Cells[rowIndex, 10].Value = doc.DocumentNo; |
2716 |
templateWorksheet.Cells[rowIndex, 11].Value = this.GetUser(doc.PersonInCharge).Name; |
2717 |
templateWorksheet.Cells[rowIndex, 12].Value = this.GetUser(doc.Worker).Name; |
2718 |
templateWorksheet.Cells[rowIndex, 13].Value = this.GetUser(doc.AVEVAPersonInCharge).Name; |
2719 |
templateWorksheet.Cells[rowIndex, 14].Value = this.GetUser(doc.AVEVAWorker).Name; |
2720 |
templateWorksheet.Cells[rowIndex, 15].Value = doc.JobLevel; |
2721 |
templateWorksheet.Cells[rowIndex, 16].Value = doc.RevisonNo; |
2722 |
templateWorksheet.Cells[rowIndex, 17].Value = doc.ToIsDiscussion; |
2723 |
templateWorksheet.Cells[rowIndex, 18].Value = doc.ToRemarks; |
2724 |
templateWorksheet.Cells[rowIndex, 19].Value = this.GetUser(doc.ToCreator).Name; |
2725 |
//toreview-20 |
2726 |
templateWorksheet.Cells[rowIndex, 21].Value = doc.FrReviewStatus; |
2727 |
templateWorksheet.Cells[rowIndex, 22].Value = doc.FrRemarks; |
2728 |
templateWorksheet.Cells[rowIndex, 23].Value = this.GetUser(doc.FrCreator).Name; |
2729 |
//frreview-24 |
2730 |
templateWorksheet.Cells[rowIndex, 25].Value = $"{doc.ID2StartDate:yyyy/MM/dd hh:mm:ss}"; |
2731 |
templateWorksheet.Cells[rowIndex, 26].Value = $"{doc.ID2EndDate:yyyy/MM/dd hh:mm:ss}"; |
2732 |
templateWorksheet.Cells[rowIndex, 27].Value = doc.ID2Status; |
2733 |
templateWorksheet.Cells[rowIndex, 28].Value = doc.ID2Issues; |
2734 |
//id2work-29 |
2735 |
templateWorksheet.Cells[rowIndex, 30].Value = doc.ReplyModifications; |
2736 |
templateWorksheet.Cells[rowIndex, 31].Value = this.GetUser(doc.ReplyRequester).Name; |
2737 |
templateWorksheet.Cells[rowIndex, 32].Value = doc.IsConvert; |
2738 |
templateWorksheet.Cells[rowIndex, 33].Value = $"{doc.AVEVAConvertDate:yyyy/MM/dd}"; |
2739 |
templateWorksheet.Cells[rowIndex, 34].Value = $"{doc.AVEVAWorkDate:yyyy/MM/dd}"; |
2740 |
templateWorksheet.Cells[rowIndex, 35].Value = doc.AVEVAStatus; |
2741 |
templateWorksheet.Cells[rowIndex, 36].Value = doc.AVEVAIssues; |
2742 |
templateWorksheet.Cells[rowIndex, 37].Value = $"{doc.AVEVAReviewDate:yyyy/MM/dd}"; |
2743 |
templateWorksheet.Cells[rowIndex, 38].Value = this.GetUser(doc.ProdReviewer).Name; |
2744 |
templateWorksheet.Cells[rowIndex, 39].Value = doc.ProdIsResult; |
2745 |
templateWorksheet.Cells[rowIndex, 40].Value = doc.ProdRemarks; |
2746 |
templateWorksheet.Cells[rowIndex, 41].Value = this.GetUser(doc.ClientReviewer).Name; |
2747 |
templateWorksheet.Cells[rowIndex, 42].Value = doc.ClientIsResult; |
2748 |
templateWorksheet.Cells[rowIndex, 43].Value = doc.ClientRemarks; |
2749 |
templateWorksheet.Cells[rowIndex, 44].Value = doc.DTIsGateWay; |
2750 |
templateWorksheet.Cells[rowIndex, 45].Value = doc.DTIsImport; |
2751 |
templateWorksheet.Cells[rowIndex, 46].Value = doc.DTIsRegSystem; |
2752 |
templateWorksheet.Cells[rowIndex, 47].Value = doc.DTRemarks; |
2753 | |
2754 |
/* |
2755 |
templateWorksheet.Cells[rowIndex, 0].Value = doc.Seq; |
2756 |
//templateWorksheet.Cells[rowIndex, 1].Value = doc.DocumentNo; |
2757 |
//templateWorksheet.Cells[rowIndex, 2].Value = doc.DocumentNo; |
2758 |
//templateWorksheet.Cells[rowIndex, 3].Value = doc.DocumentNo; |
2759 |
//templateWorksheet.Cells[rowIndex, 4].Value = doc.DocumentNo; |
2760 |
templateWorksheet.Cells[rowIndex, 5].Value = doc.RefProjectCode; |
2761 |
templateWorksheet.Cells[rowIndex, 6].Value = doc.DocumentNo; |
2762 |
templateWorksheet.Cells[rowIndex, 7].Value = this.GetUser(doc.PersonInCharge).Name; |
2763 |
templateWorksheet.Cells[rowIndex, 8].Value = doc.JobLevel; |
2764 |
//templateWorksheet.Cells[rowIndex, 9].Value = doc.IsTypical; |
2765 |
templateWorksheet.Cells[rowIndex, 10].Value = doc.RevisonNo; |
2766 |
templateWorksheet.Cells[rowIndex, 11].Value = doc.ToIsDiscussion; |
2767 |
templateWorksheet.Cells[rowIndex, 12].Value = doc.ToRemarks; |
2768 |
templateWorksheet.Cells[rowIndex, 13].Value = this.GetUser(doc.ToCreator).Name; |
2769 |
//templateWorksheet.Cells[rowIndex, 14].Value = doc.ToCapture; |
2770 |
//templateWorksheet.Cells[rowIndex, 15].Value = doc.ToIsMarkup; |
2771 |
templateWorksheet.Cells[rowIndex, 16].Value = doc.FrReviewStatus; |
2772 |
templateWorksheet.Cells[rowIndex, 17].Value = doc.FrRemarks; |
2773 |
templateWorksheet.Cells[rowIndex, 18].Value = this.GetUser(doc.FrCreator).Name; |
2774 |
//templateWorksheet.Cells[rowIndex, 19].Value = doc.FrCapture; |
2775 |
//templateWorksheet.Cells[rowIndex, 20].Value = doc.FrIsMarkup; |
2776 |
//templateWorksheet.Cells[rowIndex, 21].Value = doc.IsID2Work; |
2777 |
//templateWorksheet.Cells[rowIndex, 22].Value = doc.ID2Connection; |
2778 |
templateWorksheet.Cells[rowIndex, 23].Value = $"{doc.ID2StartDate:yyyy/MM/dd hh:mm:ss}"; |
2779 |
templateWorksheet.Cells[rowIndex, 24].Value = $"{doc.ID2EndDate:yyyy/MM/dd hh:mm:ss}"; |
2780 |
//templateWorksheet.Cells[rowIndex, 25].Value = doc.ID2JobTime; |
2781 |
templateWorksheet.Cells[rowIndex, 26].Value = doc.ID2Status; |
2782 |
templateWorksheet.Cells[rowIndex, 27].Value = doc.ID2Issues; |
2783 |
//templateWorksheet.Cells[rowIndex, 28].Value = doc.AVEVAConnection; |
2784 |
templateWorksheet.Cells[rowIndex, 29].Value = $"{doc.AVEVAConvertDate:yyyy/MM/dd}"; |
2785 |
templateWorksheet.Cells[rowIndex, 30].Value = $"{doc.AVEVAReviewDate:yyyy/MM/dd}"; |
2786 |
//추가필요templateWorksheet.Cells[rowIndex, 30].Value = $"{doc.AVEVAWorkDate:yyyy/MM/dd}"; |
2787 |
templateWorksheet.Cells[rowIndex, 31].Value = doc.AVEVAStatus; |
2788 |
templateWorksheet.Cells[rowIndex, 32].Value = doc.AVEVAIssues; |
2789 |
//templateWorksheet.Cells[rowIndex, 33].Value = doc.DocumentNo; |
2790 |
//templateWorksheet.Cells[rowIndex, 34].Value = doc.DocumentNo; |
2791 |
templateWorksheet.Cells[rowIndex, 35].Value = this.GetUser(doc.ProdReviewer).Name; |
2792 |
templateWorksheet.Cells[rowIndex, 36].Value = doc.ProdIsResult; |
2793 |
templateWorksheet.Cells[rowIndex, 37].Value = doc.ProdRemarks; |
2794 |
templateWorksheet.Cells[rowIndex, 38].Value = this.GetUser(doc.ClientReviewer).Name; |
2795 |
templateWorksheet.Cells[rowIndex, 39].Value = doc.ClientIsResult; |
2796 |
templateWorksheet.Cells[rowIndex, 40].Value = doc.ClientRemarks; |
2797 |
templateWorksheet.Cells[rowIndex, 41].Value = doc.DTIsGateWay; |
2798 |
templateWorksheet.Cells[rowIndex, 42].Value = doc.DTIsImport; |
2799 |
templateWorksheet.Cells[rowIndex, 43].Value = doc.DTIsRegSystem; |
2800 |
templateWorksheet.Cells[rowIndex, 44].Value = doc.DTRemarks; |
2801 |
*/ |
2802 |
rowIndex++; |
2803 |
} |
2804 |
} |
2805 |
templateExcelFile.Save(sfd.FileName); |
2806 |
RadMessageBox.Show("Exporting 'ID2 Document List' is complete", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info); |
2807 |
} |
2808 |
} |
2809 |
} |
2810 |
#endregion |
2811 | |
2812 |
#region DWG |
2813 |
private void RadButtonElementDelete_Click(object sender, EventArgs e) |
2814 |
{ |
2815 |
IEnumerable<Documents> chkDatas = null; |
2816 | |
2817 |
try |
2818 |
{ |
2819 |
chkDatas = this.GetCheckedDatas(true); |
2820 | |
2821 |
if (chkDatas.Any()) |
2822 |
{ |
2823 |
if (RadMessageBox.Show("Do you want to Delete?", Globals.Name, MessageBoxButtons.YesNo, RadMessageIcon.Question) == DialogResult.Yes) |
2824 |
{ |
2825 |
Queue<Documents> qChkData = new Queue<Documents>(chkDatas); |
2826 |
while (qChkData.Any()) |
2827 |
{ |
2828 |
this.documents.Remove(qChkData.Dequeue()); |
2829 |
} |
2830 |
this.DocumentListBinding(false); |
2831 |
RadMessageBox.Show("Delete is complete", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info); |
2832 |
} |
2833 |
} |
2834 |
else |
2835 |
{ |
2836 |
RadMessageBox.Show("Please check the DWG.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info); |
2837 |
} |
2838 |
} |
2839 |
catch (Exception ex) |
2840 |
{ |
2841 |
Program.logger.Error($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex); |
2842 |
RadMessageBox.Show("DWG delete failed.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error); |
2843 |
} |
2844 |
} |
2845 | |
2846 |
private void RadButtonElementLevel_Click(object sender, EventArgs e) |
2847 |
{ |
2848 |
RadMessageBox.Show("도면 Level 자동 조정.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info); |
2849 |
} |
2850 |
#endregion |
2851 | |
2852 |
#region Markup |
2853 |
private void RadButtonElementConvert_Click(object sender, EventArgs e) |
2854 |
{ |
2855 |
if (radGridViewDocuments.SelectedRows?.Count() > 0) |
2856 |
{ |
2857 |
List<Documents> checkedDocList = this.GetCheckedDatas(true).ToList(); |
2858 | |
2859 |
if (checkedDocList.Count > 1) |
2860 |
{ |
2861 |
MarkusConvertWorker convertWorker = new MarkusConvertWorker(checkedDocList.ToList(), radGridViewDocuments); |
2862 | |
2863 |
convertWorker.OnWorkCompletedHandler += (args) => |
2864 |
{ |
2865 |
if (convertWorker.ErrorDocList.Count() > 0) |
2866 |
{ |
2867 |
var ids = string.Join("\n", convertWorker.ErrorDocList.Select(x => x.DocumentNo)); |
2868 |
string message = $"Convert Error.\nPlease check the DWG.\n\n{ids}"; |
2869 | |
2870 |
RadMessageBox.Show(message, Globals.Name, MessageBoxButtons.OK); |
2871 |
} |
2872 |
else |
2873 |
{ |
2874 |
RadMessageBox.Show("Conversion successfully.", Globals.Name, MessageBoxButtons.OK); |
2875 |
} |
2876 |
}; |
2877 | |
2878 |
convertWorker.StartWork(); |
2879 |
} |
2880 |
else |
2881 |
{ |
2882 |
var item = radGridViewDocuments.SelectedRows.First().DataBoundItem as Documents; |
2883 |
MarkusConvert.Call(Properties.Settings.Default.MarkusService, item.RefProjectCode, item.DocumentNo); |
2884 |
} |
2885 |
} |
2886 |
} |
2887 |
#endregion |
2888 | |
2889 |
#endregion |
2890 | |
2891 |
#region ColumnGroup |
2892 |
private void InitColumnGroupsViewDefinition(RadGridView gridView) |
2893 |
{ |
2894 |
ColumnGroupsViewDefinition columnGroupsView = new ColumnGroupsViewDefinition(); |
2895 | |
2896 |
List<string> chkColNames = new List<string>() { "Checked" }; |
2897 | |
2898 |
List<string> docLinkColNames = new List<string>() { "AutoCADLink", "ID2Connection", "PDFLink", "MarkupLink", "AVEVALink", "Compare" }; |
2899 |
List<string> docInfoColNames = new List<string>() { "Team", "RefProjectCode", "System", "DocumentNo", "PersonInCharge", "Worker" }; |
2900 |
List<string> docOtherInfoColNames = new List<string>() { "SubSystemCode", "AVEVAPersonInCharge", "AVEVAWorker", "JobLevel", "Simularity", "RevisonNo" }; |
2901 |
List<string> rvToColNames = new List<string>() { "ToIsDiscussion", "ToRemarks", "ToCreator", "ToCapture" }; |
2902 |
List<string> rvFrColNames = new List<string>() { "FrReviewStatus", "FrRemarks", "FrCreator", "FrCapture" }; |
2903 |
List<string> wkID2ColNames = new List<string>() { "ID2StartDate", "ID2EndDate", "ID2Status", "ID2Issues", "ID2Capture", "ReplyModifications", "ReplyRequester" }; |
2904 |
List<string> wkAVEVAColNames = new List<string>() { "IsConvert", "AVEVAConvertDate", "AVEVAWorkDate", "AVEVAStatus", "AVEVAIssues" }; |
2905 |
List<string> valProdColNames = new List<string>() { "AVEVAReviewDate", "ProdReviewer", "ProdIsResult", "ProdRemarks" }; |
2906 |
List<string> valCntColNames = new List<string>() { "ClientReviewer", "ClientIsResult", "ClientRemarks" }; |
2907 |
List<string> dtColNames = new List<string>() { "DTIsGateWay", "DTIsImport", "DTIsRegSystem", "DTRemarks" }; |
2908 | |
2909 |
//체크 |
2910 |
GridViewColumnGroup chkColGrp = new GridViewColumnGroup("√") { IsPinned = true }; |
2911 |
GridViewColumnGroupRow chkColGrpRow = new GridViewColumnGroupRow(); |
2912 |
chkColGrpRow.ColumnNames.AddRange(chkColNames); |
2913 |
chkColGrp.Rows.Add(chkColGrpRow); |
2914 | |
2915 |
//링크 |
2916 |
GridViewColumnGroup docLinkGrp = new GridViewColumnGroup("프로그램 연동", "link") { IsPinned = true }; |
2917 | |
2918 |
GridViewColumnGroupRow docLinkColGrpRow = new GridViewColumnGroupRow(); |
2919 |
docLinkColGrpRow.ColumnNames.AddRange(docLinkColNames); |
2920 | |
2921 |
docLinkGrp.Rows.Add(docLinkColGrpRow); |
2922 | |
2923 |
//도면 |
2924 |
GridViewColumnGroup docColGrp = new GridViewColumnGroup("도면정보", "docinfo") { IsPinned = true }; |
2925 | |
2926 |
GridViewColumnGroupRow docInfoColGrpRow = new GridViewColumnGroupRow(); |
2927 |
docInfoColGrpRow.ColumnNames.AddRange(docInfoColNames); |
2928 | |
2929 |
docColGrp.Rows.Add(docInfoColGrpRow); |
2930 | |
2931 |
//도면상세 |
2932 |
GridViewColumnGroup docOtherColGrp = new GridViewColumnGroup("도면상세 "); |
2933 | |
2934 |
GridViewColumnGroupRow docOtherInfoColGrpRow = new GridViewColumnGroupRow(); |
2935 |
docOtherInfoColGrpRow.ColumnNames.AddRange(docOtherInfoColNames); |
2936 | |
2937 |
docOtherColGrp.Rows.Add(docOtherInfoColGrpRow); |
2938 | |
2939 |
//검토 |
2940 |
GridViewColumnGroup rvColGrp = new GridViewColumnGroup("검토", "review"); |
2941 |
GridViewColumnGroup rvToColGrp = new GridViewColumnGroup("도프텍"); |
2942 |
GridViewColumnGroup rvFrColGrp = new GridViewColumnGroup("삼성"); |
2943 | |
2944 |
GridViewColumnGroupRow rvToColGrpRow = new GridViewColumnGroupRow(); |
2945 |
rvToColGrpRow.ColumnNames.AddRange(rvToColNames); |
2946 | |
2947 |
GridViewColumnGroupRow rvFrColGrpRow = new GridViewColumnGroupRow(); |
2948 |
rvFrColGrpRow.ColumnNames.AddRange(rvFrColNames); |
2949 | |
2950 |
rvToColGrp.Rows.Add(rvToColGrpRow); |
2951 |
rvFrColGrp.Rows.Add(rvFrColGrpRow); |
2952 | |
2953 |
rvColGrp.Groups.Add(rvToColGrp); |
2954 |
rvColGrp.Groups.Add(rvFrColGrp); |
2955 | |
2956 |
//작업 |
2957 |
GridViewColumnGroup wkColGrp = new GridViewColumnGroup("작업", "work"); |
2958 |
GridViewColumnGroup wkID2ColGrp = new GridViewColumnGroup("ID2"); |
2959 |
GridViewColumnGroup wkAVEVAColGrp = new GridViewColumnGroup("AVEVA"); |
2960 | |
2961 |
GridViewColumnGroupRow wkID2ColGrpRow = new GridViewColumnGroupRow(); |
2962 |
wkID2ColGrpRow.ColumnNames.AddRange(wkID2ColNames); |
2963 | |
2964 |
GridViewColumnGroupRow wkAVEVAColGrpRow = new GridViewColumnGroupRow(); |
2965 |
wkAVEVAColGrpRow.ColumnNames.AddRange(wkAVEVAColNames); |
2966 | |
2967 |
wkID2ColGrp.Rows.Add(wkID2ColGrpRow); |
2968 |
wkAVEVAColGrp.Rows.Add(wkAVEVAColGrpRow); |
2969 | |
2970 |
wkColGrp.Groups.Add(wkID2ColGrp); |
2971 |
wkColGrp.Groups.Add(wkAVEVAColGrp); |
2972 | |
2973 |
//Validation |
2974 |
GridViewColumnGroup valColGrp = new GridViewColumnGroup("Validation", "validation"); |
2975 |
GridViewColumnGroup valProdColGrp = new GridViewColumnGroup("도프텍"); |
2976 |
GridViewColumnGroup valCntColGrp = new GridViewColumnGroup("삼성전자"); |
2977 | |
2978 |
GridViewColumnGroupRow valProdColGrpRow = new GridViewColumnGroupRow(); |
2979 |
valProdColGrpRow.ColumnNames.AddRange(valProdColNames); |
2980 | |
2981 |
GridViewColumnGroupRow valCntColGrpRow = new GridViewColumnGroupRow(); |
2982 |
valCntColGrpRow.ColumnNames.AddRange(valCntColNames); |
2983 | |
2984 |
valProdColGrp.Rows.Add(valProdColGrpRow); |
2985 |
valCntColGrp.Rows.Add(valCntColGrpRow); |
2986 | |
2987 |
valColGrp.Groups.Add(valProdColGrp); |
2988 |
valColGrp.Groups.Add(valCntColGrp); |
2989 | |
2990 |
//AVEVA Net |
2991 |
GridViewColumnGroup dtColGrp = new GridViewColumnGroup("AVEVA Net\n(Digital Twin)", "avevanet"); |
2992 | |
2993 |
GridViewColumnGroupRow dtColGrpRow = new GridViewColumnGroupRow(); |
2994 |
dtColGrpRow.ColumnNames.AddRange(dtColNames); |
2995 | |
2996 |
dtColGrp.Rows.Add(dtColGrpRow); |
2997 | |
2998 |
//Group 추가 |
2999 |
columnGroupsView.ColumnGroups.Add(chkColGrp); |
3000 |
columnGroupsView.ColumnGroups.Add(docLinkGrp); |
3001 |
columnGroupsView.ColumnGroups.Add(docColGrp); |
3002 |
columnGroupsView.ColumnGroups.Add(docOtherColGrp); |
3003 |
columnGroupsView.ColumnGroups.Add(wkColGrp); |
3004 |
columnGroupsView.ColumnGroups.Add(rvColGrp); |
3005 |
columnGroupsView.ColumnGroups.Add(valColGrp); |
3006 |
columnGroupsView.ColumnGroups.Add(dtColGrp); |
3007 | |
3008 |
gridView.MasterTemplate.ViewDefinition = columnGroupsView; |
3009 |
} |
3010 | |
3011 |
#region grid view group |
3012 |
/* |
3013 |
private void InitGridViewDefinition(RadGridView gridView) |
3014 |
{ |
3015 |
ColumnGroupsViewDefinition colGrpViewDef = new ColumnGroupsViewDefinition(); |
3016 |
colGrpViewDef.ColumnGroups.AddRange(new[] |
3017 |
{ |
3018 |
this.SetGridColumnGroup("√", "√", true, true, Enumerable.Empty<GridViewColumnGroup>(),this.SetGridColumnGroupRow(new[] { "Checked" })), |
3019 |
this.SetGridColumnGroup("프로그램 연동", "link", true, true, Enumerable.Empty<GridViewColumnGroup>(), this.SetGridColumnGroupRow(new[] { "AutoCADLink", "ID2Connection", "PDFLink", "MarkupLink", "AVEVALink", "Compare" })), |
3020 |
this.SetGridColumnGroup("도면정보", "docinfo", true, true, Enumerable.Empty<GridViewColumnGroup>(), this.SetGridColumnGroupRow(new[] { "RefProjectCode", "System", "DocumentNo", "PersonInCharge" })), |
3021 |
this.SetGridColumnGroup("도면상세", "도면상세", true, false, Enumerable.Empty<GridViewColumnGroup>(), this.SetGridColumnGroupRow(new[] { "SubSystemCode", "Worker", "AVEVAPersonInCharge", "AVEVAWorker", "JobLevel", "RevisonNo" })), |
3022 |
this.SetGridColumnGroup("작업", "work", true, false, new[] |
3023 |
{ |
3024 |
this.SetGridColumnGroup("ID2","ID2", true, false, Enumerable.Empty<GridViewColumnGroup>(), this.SetGridColumnGroupRow(new[] { "ID2StartDate", "ID2EndDate", "ID2Status", "ID2Issues", "ID2Capture", "ReplyModifications", "ReplyRequester" })), |
3025 |
this.SetGridColumnGroup("AVEVA","AVEVA", true, false, Enumerable.Empty<GridViewColumnGroup>(), this.SetGridColumnGroupRow(new[] { "FrReviewStatus", "FrRemarks", "FrCreator", "FrCapture" })) |
3026 |
}, null), |
3027 |
this.SetGridColumnGroup("검토", "review", true, false, new[] |
3028 |
{ |
3029 |
this.SetGridColumnGroup("도프텍","도프텍", true, false, Enumerable.Empty<GridViewColumnGroup>(), this.SetGridColumnGroupRow(new[] { "ToIsDiscussion", "ToRemarks", "ToCreator", "ToCapture" })), |
3030 |
this.SetGridColumnGroup("삼성","삼성", true, false, Enumerable.Empty<GridViewColumnGroup>(), this.SetGridColumnGroupRow(new[] { "FrReviewStatus", "FrRemarks", "FrCreator", "FrCapture" })) |
3031 |
}, null), |
3032 |
this.SetGridColumnGroup("Validation", "validation", true, false, new[] |
3033 |
{ |
3034 |
this.SetGridColumnGroup("도프텍","도프텍", true, false, Enumerable.Empty<GridViewColumnGroup>(), this.SetGridColumnGroupRow(new[] { "AVEVAReviewDate", "ProdReviewer", "ProdIsResult", "ProdRemarks" })), |
3035 |
this.SetGridColumnGroup("삼성전자","삼성전자", true, false, Enumerable.Empty<GridViewColumnGroup>(), this.SetGridColumnGroupRow(new[] { "ClientReviewer", "ClientIsResult", "ClientRemarks" })) |
3036 |
}, null), |
3037 |
this.SetGridColumnGroup("AVEVA Net\n(Digital Twin)", "avevanet", true, false, Enumerable.Empty<GridViewColumnGroup>(), this.SetGridColumnGroupRow(new[] { "DTIsGateWay", "DTIsImport", "DTIsRegSystem", "DTRemarks" })) |
3038 |
}); |
3039 |
gridView.MasterTemplate.ViewDefinition = colGrpViewDef; |
3040 |
} |
3041 | |
3042 |
private GridViewColumnGroup SetGridColumnGroup(string groupText, string groupName, bool groupShowHeader, bool groupFreezed, IEnumerable<GridViewColumnGroup> groups, GridViewColumnGroupRow columnGroupRow) |
3043 |
{ |
3044 |
GridViewColumnGroup colGrp = new GridViewColumnGroup() |
3045 |
{ |
3046 |
Text = groupText, |
3047 |
Name = groupName, |
3048 |
ShowHeader = groupShowHeader, |
3049 |
IsPinned = groupFreezed |
3050 |
}; |
3051 |
groups.ForAll(x => colGrp.Groups.Add(x)); |
3052 |
colGrp.Rows.Add(columnGroupRow); |
3053 |
return colGrp; |
3054 |
} |
3055 | |
3056 |
private GridViewColumnGroupRow SetGridColumnGroupRow(IEnumerable<string> columnList) |
3057 |
{ |
3058 |
GridViewColumnGroupRow colGrpRow = new GridViewColumnGroupRow(); |
3059 |
colGrpRow.ColumnNames.AddRange(columnList); |
3060 |
return colGrpRow; |
3061 |
} |
3062 |
*/ |
3063 |
#endregion |
3064 | |
3065 |
#endregion |
3066 | |
3067 |
private void txtFullSearch_TextChanged(object sender, EventArgs e) |
3068 |
{ |
3069 |
if (string.IsNullOrWhiteSpace(txtFullSearch.Text)) |
3070 |
radGridViewDocuments.MasterTemplate.Refresh(null); |
3071 | |
3072 |
txtFullSearch.TextBoxElement.ShowClearButton = !string.IsNullOrWhiteSpace(txtFullSearch.Text); |
3073 |
radGridViewDocuments.MasterView.TableSearchRow.Search(txtFullSearch.Text); |
3074 |
} |
3075 | |
3076 |
private void btnSearchPrevious_Click(object sender, EventArgs e) |
3077 |
{ |
3078 |
radGridViewDocuments.MasterView.TableSearchRow.SelectPreviousSearchResult(); |
3079 |
} |
3080 | |
3081 |
private void btnSearchNext_Click(object sender, EventArgs e) |
3082 |
{ |
3083 |
radGridViewDocuments.MasterView.TableSearchRow.SelectNextSearchResult(); |
3084 |
} |
3085 | |
3086 |
private void txtFullSearch_KeyDown(object sender, KeyEventArgs e) |
3087 |
{ |
3088 |
if (e.KeyCode == Keys.Enter) |
3089 |
{ |
3090 |
radGridViewDocuments.MasterView.TableSearchRow.SelectNextSearchResult(); |
3091 |
} |
3092 |
} |
3093 | |
3094 |
private void commandBarSearch_ItemOverflowed(object sender, EventArgs e) |
3095 |
{ |
3096 |
commandBarSearch.OverflowButton.AddRemoveButtonsMenuItem.Visibility = ElementVisibility.Collapsed; |
3097 |
commandBarSearch.OverflowButton.CustomizeButtonMenuItem.Visibility = ElementVisibility.Collapsed; |
3098 |
} |
3099 | |
3100 |
private void commandBarSearch_ItemOutOfOverflow(object sender, EventArgs e) |
3101 |
{ |
3102 |
commandBarSearch.OverflowButton.AddRemoveButtonsMenuItem.Visibility = ElementVisibility.Collapsed; |
3103 |
commandBarSearch.OverflowButton.CustomizeButtonMenuItem.Visibility = ElementVisibility.Collapsed; |
3104 |
} |
3105 |
} |
3106 |
} |
3107 | |
3108 |
public class FilterColumn |
3109 |
{ |
3110 |
public string Name { get; set; } |
3111 |
public string FieldName { get; set; } |
3112 |
public bool IsSelect { get; set; } |
3113 |
} |