hytos / ID2.Manager / ID2.Manager / Main.cs @ 7a9c6a5b
이력 | 보기 | 이력해설 | 다운로드 (109 KB)
1 |
using System; |
---|---|
2 |
using System.Collections.Generic; |
3 |
using System.ComponentModel; |
4 |
using System.Data; |
5 |
using System.Drawing; |
6 |
using System.Linq; |
7 |
using System.Text; |
8 |
using System.Threading.Tasks; |
9 |
using System.Windows.Forms; |
10 |
|
11 |
using System.IO; |
12 |
using System.Reflection; |
13 |
|
14 |
using ID2.Manager.Controls; |
15 |
using ID2.Manager.Common; |
16 |
using ID2.Manager.Classes; |
17 |
using ID2.Manager.Data.Models; |
18 |
using ID2.Manager.Forms; |
19 |
using ID2.Manager.Controller.Controllers; |
20 |
|
21 |
using Telerik.WinControls; |
22 |
using Telerik.WinControls.UI; |
23 |
using Telerik.WinControls.Data; |
24 |
|
25 |
using GemBox.Spreadsheet; |
26 |
|
27 |
using Newtonsoft.Json; |
28 |
using System.Diagnostics; |
29 |
using ID2.Manager.Common.Helpers; |
30 |
using Telerik.WinControls.UI.Docking; |
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 |
|
57 |
BriefAndImages briefAndImagesReview = new BriefAndImages { Dock = DockStyle.Fill }; |
58 |
IssueImagesAndAnswer issueImagesAndAnswerWork = new IssueImagesAndAnswer { Dock = DockStyle.Fill }; |
59 |
|
60 |
#if DEBUG |
61 |
Telerik.WinControls.RadControlSpy.RadControlSpyForm radControlSpyForm = new Telerik.WinControls.RadControlSpy.RadControlSpyForm(); |
62 |
#endif |
63 |
private readonly Color _SummaryColor = Color.FromArgb(255, 108, 55); |
64 |
|
65 |
public Main() |
66 |
{ |
67 |
InitializeComponent(); |
68 |
var verification = new Controls.Verification() { Dock = DockStyle.Fill }; |
69 |
verification.OnDocumentSelected += BindingDocumentToDetailEditor; |
70 |
this.LayoutValidation.Controls.Add(verification); |
71 |
this.DockMainTabStrip.Select(); |
72 |
|
73 |
var appDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), Application.ProductName); |
74 |
|
75 |
if(!Directory.Exists(appDataPath)) |
76 |
{ |
77 |
Directory.CreateDirectory(appDataPath); |
78 |
} |
79 |
|
80 |
ID2.Manager.Common.Helpers.TableLayoutPanelHelper.SetDoubleBuffered(this); |
81 |
|
82 |
this.FormClosing += Main_FormClosing; |
83 |
this.radButtonElementRefreshCommand.Click += RadButtonElementRefreshCommand_Click; |
84 |
this.radButtonElementSaveCommand.Click += RadButtonElementSaveCommand_Click; |
85 |
this.btnDockLayoutReset.Click += BtnDockLayoutReset_Click; |
86 |
this.radButtonElementSave.Click += RadButtonElementSave_Click; |
87 |
this.radButtonElementSync.Click += RadButtonElementSync_Click; |
88 |
this.radButtonElementNotice.Click += RadButtonElementNotice_Click; |
89 |
this.radButtonElementNoticeUpload.Click += RadButtonElementNoticeUpload_Click; |
90 |
this.radButtonElementExcelImport.Click += RadButtonElementExcelImport_Click; |
91 |
this.radButtonElementExcelExport.Click += RadButtonElementExcelExport_Click; |
92 |
|
93 |
this.radButtonDateClear.Click += RadButtonDateClear_Click; |
94 |
|
95 |
this.radDropDownListProject.SelectedIndexChanged += RadDropDownList_SelectedIndexChanged; |
96 |
this.radDropDownListPersonInCharge.SelectedIndexChanged += RadDropDownList_SelectedIndexChanged; |
97 |
this.radDropDownListJobLevel.SelectedIndexChanged += RadDropDownList_SelectedIndexChanged; |
98 |
this.radDropDownListToIsDiscussion.SelectedIndexChanged += RadDropDownList_SelectedIndexChanged; |
99 |
this.radDropDownListFrReviewStatus.SelectedIndexChanged += RadDropDownList_SelectedIndexChanged; |
100 |
this.radDropDownListID2Status.SelectedIndexChanged += RadDropDownList_SelectedIndexChanged; |
101 |
this.radDropDownListID2Issues.SelectedIndexChanged += RadDropDownList_SelectedIndexChanged; |
102 |
this.radDropDownListAVEVAStatus.SelectedIndexChanged += RadDropDownList_SelectedIndexChanged; |
103 |
this.radDropDownListAVEVAIssues.SelectedIndexChanged += RadDropDownList_SelectedIndexChanged; |
104 |
this.radDropDownListProdIsResult.SelectedIndexChanged += RadDropDownList_SelectedIndexChanged; |
105 |
this.radDropDownListClientIsResult.SelectedIndexChanged += RadDropDownList_SelectedIndexChanged; |
106 |
this.radDropDownListGateway.SelectedIndexChanged += RadDropDownList_SelectedIndexChanged; |
107 |
this.radDropDownListRegistration.SelectedIndexChanged += RadDropDownList_SelectedIndexChanged; |
108 |
|
109 |
this.radCheckBox1.CheckStateChanged += RadCheckBox_CheckStateChanged; |
110 |
this.radCheckBox2.CheckStateChanged += RadCheckBox_CheckStateChanged; |
111 |
this.radCheckBox3.CheckStateChanged += RadCheckBox_CheckStateChanged; |
112 |
this.radCheckBox4.CheckStateChanged += RadCheckBox_CheckStateChanged; |
113 |
this.radTextBoxDocumentNo.KeyDown += RadTextBoxDocumentNo_KeyDown; |
114 |
this.radTextBoxDocumentNo.KeyUp += RadTextBoxDocumentNo_KeyUp; |
115 |
this.radButtonSearch.Click += RadButtonSearch_Click; |
116 |
|
117 |
this.radGridViewDocuments.DefaultValuesNeeded += RadGridViewDocuments_DefaultValuesNeeded; |
118 |
this.radGridViewDocuments.UserAddedRow += RadGridViewDocuments_UserAddedRow; |
119 |
this.radGridViewDocuments.SelectionChanged += RadGridViewDocuments_SelectionChanged; |
120 |
this.radGridViewDocuments.ViewCellFormatting += RadGridViewDocuments_ViewCellFormatting; |
121 |
this.radGridViewDocuments.CreateRowInfo += RadGridViewDocuments_CreateRowInfo; |
122 |
this.radGridViewDocuments.CellBeginEdit += RadGridViewDocuments_CellBeginEdit; |
123 |
this.radGridViewDocuments.CommandCellClick += RadGridViewDocuments_CommandCellClick; |
124 |
this.radGridViewDocuments.MasterView.TableSearchRow.SearchProgressChanged += TableSearchRow_SearchProgressChanged; |
125 |
this.radGridViewDocuments.FilterChanged += RadGridViewDocuments_FilterChanged; |
126 |
|
127 |
this.radGridViewDocuments.MasterView.TableHeaderRow.MinHeight = 36; |
128 |
this.radGridViewDocuments.TableElement.RowHeaderColumnWidth = 36; |
129 |
//this.radGridViewDocuments.MasterView.TableSearchRow.InitialSearchResultsTreshold = ; |
130 |
this.radGridViewDocuments.MasterView.TableSearchRow.IsVisible = false; |
131 |
|
132 |
var openProjectView = new OpenProjectView() |
133 |
{ |
134 |
Dock = DockStyle.Fill |
135 |
}; |
136 |
|
137 |
this.backstageViewPageOpenProject.Controls.Add(openProjectView); |
138 |
openProjectView.OpenProjectClick += OpenProjectView_OpenProjectClick; |
139 |
openProjectView.CloseProjectClick += OpenProjectView_OpenProjectClick; |
140 |
this.backstageButtonItemSelectDB.Click += BackstageButtonItemSelectDB_Click; |
141 |
this.backstageButtonItemUserRegistration.Click += BackstageButtonItemUserRegistration_Click; |
142 |
this.backstageButtonItemExit.Click += BackstageButtonItemExit_Click; |
143 |
this.radRibbonBarBackstageViewID2Manager.BackstageViewOpened += RadRibbonBarBackstageViewID2Manager_BackstageViewOpened; |
144 |
this.radRibbonBarBackstageViewID2Manager.BackstageViewClosed += RadRibbonBarBackstageViewID2Manager_BackstageViewClosed; |
145 |
|
146 |
this.InitColumnGroupsViewDefinition(this.radGridViewDocuments); |
147 |
|
148 |
this.radPageViewPageReview.Controls.Add(briefAndImagesReview); |
149 |
this.radPageViewPageWork.Controls.Add(issueImagesAndAnswerWork); |
150 |
|
151 |
briefAndImagesReview.RemoveImage += BriefAndImages_RemoveImage; |
152 |
issueImagesAndAnswerWork.RemoveImage += IssueImagesAndAnswer_RemoveImage; |
153 |
this.Initialize(); |
154 |
} |
155 |
|
156 |
private void BtnDockLayoutReset_Click(object sender, EventArgs e) |
157 |
{ |
158 |
this.LoadDockingLayout(true); |
159 |
} |
160 |
|
161 |
private void BriefAndImages_RemoveImage(object sender, AttImageInfo e) |
162 |
{ |
163 |
try |
164 |
{ |
165 |
if (e is AttImageInfo) |
166 |
{ |
167 |
if (this.radGridViewDocuments.SelectedRows.Count() > 0 && this.radGridViewDocuments.SelectedRows.First().DataBoundItem is Documents doc) |
168 |
{ |
169 |
var reslut = doc.AttFiles.RemoveAll(x => x.FileID == e.ID); |
170 |
|
171 |
if (reslut > 0) |
172 |
{ |
173 |
|
174 |
} |
175 |
else |
176 |
{ |
177 |
MessageBox.Show("삭제오류"); |
178 |
} |
179 |
} |
180 |
} |
181 |
} |
182 |
catch (Exception ex) |
183 |
{ |
184 |
Program.logger.Error("BriefAndImages_RemoveImage",ex); |
185 |
} |
186 |
} |
187 |
|
188 |
private void IssueImagesAndAnswer_RemoveImage(object sender, AttImageInfo e) |
189 |
{ |
190 |
try |
191 |
{ |
192 |
if (e is AttImageInfo) |
193 |
{ |
194 |
if (this.radGridViewDocuments.SelectedRows.Count() > 0 && this.radGridViewDocuments.SelectedRows.First().DataBoundItem is Documents doc) |
195 |
{ |
196 |
var reslut = doc.AttFiles.RemoveAll(x => x.FileID == e.ID); |
197 |
|
198 |
if (reslut > 0) |
199 |
{ |
200 |
|
201 |
} |
202 |
else |
203 |
{ |
204 |
MessageBox.Show("삭제오류"); |
205 |
} |
206 |
} |
207 |
} |
208 |
} |
209 |
catch (Exception ex) |
210 |
{ |
211 |
Program.logger.Error("IssueImagesAndAnswer_RemoveImage", ex); |
212 |
} |
213 |
} |
214 |
|
215 |
private void SaveDockingLayout() |
216 |
{ |
217 |
try |
218 |
{ |
219 |
this.DockMain.SaveToXml(dockLayoutPath); |
220 |
} |
221 |
catch (Exception ex) |
222 |
{ |
223 |
System.Diagnostics.Debug.WriteLine("SaveDockingLayout Error.", ex); |
224 |
} |
225 |
} |
226 |
|
227 |
private void LoadDockingLayout(bool IsDefaultLayoutLoad = false) |
228 |
{ |
229 |
try |
230 |
{ |
231 |
bool IsUseLayoutLoad = false; |
232 |
|
233 |
try |
234 |
{ |
235 |
var dockLayoutFile = new FileInfo(dockLayoutPath); |
236 |
|
237 |
|
238 |
if (!IsDefaultLayoutLoad && dockLayoutFile.Exists) |
239 |
{ |
240 |
this.DockMain.LoadFromXml(dockLayoutPath); |
241 |
IsUseLayoutLoad = true; |
242 |
} |
243 |
|
244 |
} |
245 |
catch (Exception ex) |
246 |
{ |
247 |
Program.logger.Error($"dock Layout File load Error. File Path : {dockLayoutPath}", ex); |
248 |
} |
249 |
|
250 |
if(!IsUseLayoutLoad) |
251 |
{ |
252 |
var layout = Properties.Resources.DefalutDockLayout; |
253 |
|
254 |
using (MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(layout))) |
255 |
{ |
256 |
this.DockMain.LoadFromXml(stream); |
257 |
} |
258 |
} |
259 |
|
260 |
this.DockMain.DocumentTabsVisible = true; |
261 |
|
262 |
this.DockMain.DockWindows.ForAll(x => |
263 |
{ |
264 |
x.DockManager.ShowDocumentPinButton = false; |
265 |
x.DockManager.ShowDocumentCloseButton = false; |
266 |
}); |
267 |
|
268 |
this.DockMain.AutoHideWindowDisplaying += DockMain_AutoHideWindowDisplaying; |
269 |
|
270 |
this.DockMain.DockStateChanged+=(snd,evt)=> |
271 |
{ |
272 |
if (evt.DockWindow.Name == DockWindowMain.Name || evt.DockWindow.Name == DockValidation.Name) |
273 |
{ |
274 |
|
275 |
} |
276 |
|
277 |
}; |
278 |
|
279 |
this.DockMain.DockWindowClosed += (snd, evt) => |
280 |
{ |
281 |
evt.DockWindow.DockState = Telerik.WinControls.UI.Docking.DockState.AutoHide; |
282 |
|
283 |
//Telerik.WinControls.UI.Docking.AutoHidePosition tabPosition = Telerik.WinControls.UI.Docking.AutoHidePosition.Right; |
284 |
|
285 |
|
286 |
//List<DockWindow> dockWindows = new List<DockWindow>(); |
287 |
|
288 |
//var autoHideWindows = this.DockMain.DockWindows.Where(x => x.DockState == Telerik.WinControls.UI.Docking.DockState.AutoHide).ToList(); |
289 |
|
290 |
|
291 |
//if (evt.DockWindow.AccessibleName == DockWindowMain.AccessibleName || evt.DockWindow.Name == DockValidation.AccessibleName) |
292 |
//{ |
293 |
// dockWindows.AddRange(autoHideWindows.Where(x => x.AccessibleName == DockWindowMain.AccessibleName && evt.DockWindow.Name == DockValidation.AccessibleName)); |
294 |
|
295 |
// tabPosition = Telerik.WinControls.UI.Docking.AutoHidePosition.Bottom; |
296 |
|
297 |
// dockWindows.Add(evt.DockWindow); |
298 |
//} |
299 |
//else |
300 |
//{ |
301 |
// dockWindows.AddRange(autoHideWindows.Where(x => x.AccessibleName != DockWindowMain.AccessibleName || evt.DockWindow.Name != DockValidation.AccessibleName)); |
302 |
|
303 |
// dockWindows.Add(evt.DockWindow); |
304 |
//} |
305 |
|
306 |
|
307 |
//this.DockMain.AutoHideWindows(dockWindows, tabPosition); |
308 |
}; |
309 |
} |
310 |
catch (Exception ex) |
311 |
{ |
312 |
Program.logger.Error($"dock Layout load Error. File Path : {dockLayoutPath}", ex); |
313 |
} |
314 |
} |
315 |
|
316 |
private void DockMain_AutoHideWindowDisplaying(object sender, Telerik.WinControls.UI.Docking.AutoHideWindowDisplayingEventArgs e) |
317 |
{ |
318 |
|
319 |
} |
320 |
|
321 |
private void Main_FormClosing(object sender, FormClosingEventArgs e) |
322 |
{ |
323 |
SaveDockingLayout(); |
324 |
} |
325 |
|
326 |
protected override bool ProcessCmdKey(ref Message msg, Keys keyData) |
327 |
{ |
328 |
if (keyData == (Keys.F10 | Keys.Control)) |
329 |
{ |
330 |
#if DEBUG |
331 |
radControlSpyForm.Show(); |
332 |
#endif |
333 |
} |
334 |
|
335 |
if (keyData == (Keys.V | Keys.Control)) |
336 |
{ |
337 |
System.Diagnostics.Debug.WriteLine("KeyDown CTRL + V"); |
338 |
|
339 |
if(Clipboard.ContainsImage()) |
340 |
{ |
341 |
var IsDoftech = true; |
342 |
var selectReview = true; |
343 |
string category = ""; |
344 |
byte[] imageBytes = null; |
345 |
|
346 |
Image clipboardImage = Clipboard.GetImage(); |
347 |
|
348 |
using (MemoryStream stream = new MemoryStream()) |
349 |
{ |
350 |
clipboardImage.Save(stream, System.Drawing.Imaging.ImageFormat.Png); |
351 |
imageBytes = stream.ToArray(); |
352 |
} |
353 |
|
354 |
if (this.radGridViewDocuments.SelectedRows.Count() > 0 && this.radGridViewDocuments.SelectedRows.First().DataBoundItem is Documents doc) |
355 |
{ |
356 |
|
357 |
/// 도프텍 or 삼성 |
358 |
if (!string.IsNullOrEmpty(informations.ActiveUser.RefProjectID)) |
359 |
{ |
360 |
IsDoftech = false; |
361 |
} |
362 |
|
363 |
/// 검토 or 검증 |
364 |
if (radPageViewComment.SelectedPage != radPageViewPageReview) |
365 |
{ |
366 |
selectReview = false; |
367 |
} |
368 |
|
369 |
if (IsDoftech && selectReview) |
370 |
{ |
371 |
category = "toreview"; |
372 |
} |
373 |
else if (!IsDoftech && selectReview) |
374 |
{ |
375 |
category = "frreview"; |
376 |
} |
377 |
//else if (IsDoftech && !selectReview) |
378 |
//{ |
379 |
// category = "prodvalidation"; |
380 |
//} |
381 |
//else |
382 |
//{ |
383 |
// category = "clientvalidation"; |
384 |
//} |
385 |
else |
386 |
{ |
387 |
category = "id2work"; |
388 |
} |
389 |
|
390 |
|
391 |
AttFileInfo newFile = new AttFileInfo |
392 |
{ |
393 |
FileID = Guid.NewGuid().ToString(), |
394 |
Category = category, |
395 |
FileType = "image/png", |
396 |
FileName = "ClipBoard", |
397 |
FilePath = "ClipBoard", |
398 |
FileExtension = ".png", |
399 |
CreatedDate = DateTime.Now, |
400 |
Creator = informations.ActiveUser.ID, |
401 |
FileData = imageBytes |
402 |
|
403 |
}; |
404 |
|
405 |
if (doc.AttFiles == null) |
406 |
{ |
407 |
doc.AttFiles = new List<AttFileInfo>(); |
408 |
} |
409 |
|
410 |
doc.AttFiles.Add(newFile); |
411 |
|
412 |
var imageInfo = new AttImageInfo { ID = newFile.FileID, Data = newFile.FileData }; |
413 |
|
414 |
switch (category) |
415 |
{ |
416 |
case "toreview": |
417 |
briefAndImagesReview.AddToImage(imageInfo, true); |
418 |
break; |
419 |
case "frreview": |
420 |
briefAndImagesReview.AddFrImage(imageInfo, true); |
421 |
break; |
422 |
//case "prodvalidation": |
423 |
// briefAndImagesValidation.AddToImage(imageInfo, true); |
424 |
// break; |
425 |
//case "clientvalidation": |
426 |
// briefAndImagesValidation.AddFrImage(imageInfo, true); |
427 |
// break; |
428 |
case "id2work": |
429 |
issueImagesAndAnswerWork.AddImage(imageInfo, true); |
430 |
break; |
431 |
} |
432 |
} |
433 |
} |
434 |
} |
435 |
|
436 |
return base.ProcessCmdKey(ref msg, keyData); |
437 |
} |
438 |
|
439 |
private void RadGridViewDocuments_CreateRowInfo(object sender, GridViewCreateRowInfoEventArgs e) |
440 |
{ |
441 |
if (e.RowInfo is GridViewSearchRowInfo) |
442 |
{ |
443 |
var row = new SearchRow(e.ViewInfo); |
444 |
e.RowInfo = row; |
445 |
} |
446 |
|
447 |
//System.Diagnostics.Debug.WriteLine(e.RowInfo.GetType().Name); |
448 |
} |
449 |
|
450 |
private void TableSearchRow_SearchProgressChanged(object sender, SearchProgressChangedEventArgs e) |
451 |
{ |
452 |
if (e.SearchFinished) |
453 |
{ |
454 |
|
455 |
} |
456 |
} |
457 |
|
458 |
/// <summary> |
459 |
/// 선택한 Document와 상세 편집 창을 연동시킨다. |
460 |
/// </summary> |
461 |
/// <param name="doc"></param> |
462 |
public void BindingDocumentToDetailEditor(Documents doc) |
463 |
{ |
464 |
briefAndImagesReview.Clear(); |
465 |
issueImagesAndAnswerWork.Clear(); |
466 |
|
467 |
//FrRemarks 추가 |
468 |
|
469 |
briefAndImagesReview.DataBindings.Add(new Binding("BriefDoftech", doc, "ToRemarks", false, DataSourceUpdateMode.OnPropertyChanged, null)); |
470 |
briefAndImagesReview.DataBindings.Add(new Binding("BriefSec", doc, "FrRemarks", false, DataSourceUpdateMode.OnPropertyChanged, null)); |
471 |
|
472 |
issueImagesAndAnswerWork.DataBindings.Add(new Binding("IssueText", doc, "ID2Issues", false, DataSourceUpdateMode.OnPropertyChanged, null)); |
473 |
issueImagesAndAnswerWork.DataBindings.Add(new Binding("ReplyModificationText", doc, "ReplyModifications", false, DataSourceUpdateMode.OnPropertyChanged, null)); |
474 |
|
475 |
if (doc.AttFiles != null) |
476 |
{ |
477 |
if (doc.AttFiles.Any(x => x.Category == "toreview")) |
478 |
{ |
479 |
var images = doc.AttFiles.Where(x => x.Category == "toreview").Select(x => new AttImageInfo { ID = x.FileID, Category = x.Category, Data = x.FileData }); |
480 |
briefAndImagesReview.SetToImages(images.ToList()); |
481 |
} |
482 |
|
483 |
if (doc.AttFiles.Any(x => x.Category == "frreview")) |
484 |
{ |
485 |
var images = doc.AttFiles.Where(x => x.Category == "frreview").Select(x => new AttImageInfo { ID = x.FileID, Category = x.Category, Data = x.FileData }); |
486 |
briefAndImagesReview.SetFrImages(images.ToList()); |
487 |
} |
488 |
|
489 |
//if (doc.AttFiles.Any(x => x.Category == "prodvalidation")) |
490 |
//{ |
491 |
// var images = doc.AttFiles.Where(x => x.Category == "prodvalidation").Select(x => new AttImageInfo { ID = x.FileID, Category = x.Category, Data = x.FileData }); |
492 |
// briefAndImagesValidation.SetToImages(images.ToList()); |
493 |
//} |
494 |
|
495 |
//if (doc.AttFiles.Any(x => x.Category == "clientvalidation")) |
496 |
//{ |
497 |
// var images = doc.AttFiles.Where(x => x.Category == "clientvalidation").Select(x => new AttImageInfo { ID = x.FileID, Category = x.Category, Data = x.FileData }); |
498 |
// briefAndImagesValidation.SetFrImages(images.ToList()); |
499 |
//} |
500 |
|
501 |
//수정필요 |
502 |
if (doc.AttFiles.Any(x => x.Category == "id2work")) |
503 |
{ |
504 |
var images = doc.AttFiles.Where(x => x.Category == "id2work").Select(x => new AttImageInfo { ID = x.FileID, Category = x.Category, Data = x.FileData }); |
505 |
issueImagesAndAnswerWork.SetImages(images.ToList()); |
506 |
} |
507 |
} |
508 |
} |
509 |
|
510 |
private void RadGridViewDocuments_DefaultValuesNeeded(object sender, GridViewRowEventArgs e) |
511 |
{ |
512 |
BindingDocumentToDetailEditor(new Documents()); |
513 |
} |
514 |
|
515 |
private void RadGridViewDocuments_UserAddedRow(object sender, GridViewRowEventArgs e) |
516 |
{ |
517 |
if (e.Row.DataBoundItem is Documents doc) |
518 |
{ |
519 |
this.documents.Add(doc); |
520 |
} |
521 |
} |
522 |
|
523 |
/// <summary> |
524 |
/// 선택된 행의 AutoCAD와 PDF 파일을 보여준다. |
525 |
/// </summary> |
526 |
/// <param name="sender"></param> |
527 |
/// <param name="e"></param> |
528 |
private void RadGridViewDocuments_SelectionChanged(object sender, EventArgs e) |
529 |
{ |
530 |
if (this.radGridViewDocuments.SelectedRows.Any() && this.radGridViewDocuments.SelectedRows.First().DataBoundItem is Documents doc) |
531 |
{ |
532 |
//if (informations.ActiveUser.ID != doc.PersonInCharge) |
533 |
//{ |
534 |
// var row = this.radGridViewDocuments.SelectedRows.First(); |
535 |
// foreach(var cell in row.Cells) |
536 |
// { |
537 |
// cell.ReadOnly = true; |
538 |
// } |
539 |
//} |
540 |
BindingDocumentToDetailEditor(doc); |
541 |
} |
542 |
} |
543 |
|
544 |
#region Init, Load |
545 |
private void Initialize() |
546 |
{ |
547 |
this.Text = Globals.Name; |
548 |
|
549 |
this.ID2ManagerRadRibbonBar.Expanded = false; |
550 |
|
551 |
this.radLabelElementUser.Text = $"{informations.ActiveUser.ID} {informations.ActiveUser.Name}"; |
552 |
} |
553 |
|
554 |
protected override void OnLoad(EventArgs e) |
555 |
{ |
556 |
try |
557 |
{ |
558 |
LoadDockingLayout(); |
559 |
InitializeGrid(); |
560 |
|
561 |
bool isID2DB = this.IsID2Connection(); |
562 |
this.SetMenus(isID2DB); |
563 |
|
564 |
if (isID2DB) |
565 |
{ |
566 |
if (informations.ActiveUser != null && !string.IsNullOrEmpty(informations.ActiveUser.RefProjectID)) |
567 |
{ |
568 |
informations.ActiveProject = new ProjectController().GetProjectInfo(informations.ActiveUser.RefProjectID); |
569 |
informations.ProjectList = new ProjectController().GetAllProjectList().ToList(); |
570 |
|
571 |
this.LoadProject(); |
572 |
} |
573 |
else |
574 |
{ |
575 |
informations.ProjectList = new ProjectController().GetAllProjectList().ToList(); |
576 |
|
577 |
foreach (Control ctrl in this.backstageViewPageOpenProject.Controls) |
578 |
{ |
579 |
if (ctrl is OpenProjectView) |
580 |
{ |
581 |
var openProjectView = ctrl as OpenProjectView; |
582 |
openProjectView.GetProjectGroups(); |
583 |
break; |
584 |
} |
585 |
} |
586 |
|
587 |
this.radRibbonBarBackstageViewID2Manager.ShowPopup(this.GetBackstageLocation(), this.ID2ManagerRadRibbonBar.RibbonBarElement); |
588 |
} |
589 |
} |
590 |
else |
591 |
{ |
592 |
this.radRibbonBarBackstageViewID2Manager.ShowPopup(this.GetBackstageLocation(), this.ID2ManagerRadRibbonBar.RibbonBarElement); |
593 |
RadMessageBox.Show(this, $"Please select db file.", "Error", MessageBoxButtons.OK, RadMessageIcon.Info); |
594 |
} |
595 |
} |
596 |
catch (Exception ex) |
597 |
{ |
598 |
Program.logger.Error($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex); |
599 |
RadMessageBox.Show("Failed to load project.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error); |
600 |
} |
601 |
|
602 |
base.OnLoad(e); |
603 |
} |
604 |
|
605 |
private bool IsID2Connection() |
606 |
{ |
607 |
bool isSuccess = false; |
608 |
|
609 |
try |
610 |
{ |
611 |
isSuccess = Globals.IsProjectDBConnstr(); |
612 |
|
613 |
if (isSuccess) |
614 |
{ |
615 |
var id2Project = new ID2Controller().GetID2ProjectList(); |
616 |
} |
617 |
} |
618 |
catch (Exception ex) |
619 |
{ |
620 |
Program.logger.Error($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex); |
621 |
isSuccess = false; |
622 |
} |
623 |
|
624 |
return isSuccess; |
625 |
} |
626 |
|
627 |
private void SetMenus(bool isid2) |
628 |
{ |
629 |
if (isid2) |
630 |
{ |
631 |
this.IsID2Manager = (new string[] { "Admin", "Manager" }).Contains(informations.ActiveUser.Role) && string.IsNullOrEmpty(informations.ActiveUser.RefProjectID); |
632 |
|
633 |
if (this.IsID2Manager) |
634 |
{ |
635 |
this.radButtonElementNoticeUpload.Enabled = true; |
636 |
|
637 |
this.backstageViewPageOpenProject.Controls[0].Visible = true; |
638 |
this.backstageTabItemOpenProject.Visibility = ElementVisibility.Visible; |
639 |
this.backstageButtonItemUserRegistration.Visibility = ElementVisibility.Visible; |
640 |
} |
641 |
else |
642 |
{ |
643 |
this.radButtonElementNoticeUpload.Enabled = false; |
644 |
|
645 |
if (string.IsNullOrEmpty(informations.ActiveUser.RefProjectID)) |
646 |
{ |
647 |
this.backstageViewPageOpenProject.Controls[0].Visible = true; |
648 |
} |
649 |
else |
650 |
{ |
651 |
foreach (Control ctrl in this.backstageViewPageOpenProject.Controls) |
652 |
{ |
653 |
ctrl.Visible = false; |
654 |
} |
655 |
} |
656 |
this.backstageTabItemOpenProject.Visibility = ElementVisibility.Collapsed; |
657 |
this.backstageButtonItemUserRegistration.Visibility = ElementVisibility.Collapsed; |
658 |
} |
659 |
} |
660 |
else |
661 |
{ |
662 |
this.radButtonElementNoticeUpload.Enabled = false; |
663 |
|
664 |
this.backstageButtonItemSelectDB.Visibility = ElementVisibility.Visible; |
665 |
foreach (Control ctrl in this.backstageViewPageOpenProject.Controls) |
666 |
{ |
667 |
ctrl.Visible = false; |
668 |
} |
669 |
this.backstageTabItemOpenProject.Visibility = ElementVisibility.Collapsed; |
670 |
this.backstageButtonItemUserRegistration.Visibility = ElementVisibility.Collapsed; |
671 |
} |
672 |
} |
673 |
|
674 |
public Point GetBackstageLocation() |
675 |
{ |
676 |
Point location = this.ID2ManagerRadRibbonBar.RibbonBarElement.ApplicationButtonElement.ControlBoundingRectangle.Location; |
677 |
location.Offset(new Point(0, this.ID2ManagerRadRibbonBar.RibbonBarElement.ApplicationButtonElement.ControlBoundingRectangle.Height)); |
678 |
location.Offset(this.ID2ManagerRadRibbonBar.Location); |
679 |
|
680 |
return location; |
681 |
} |
682 |
|
683 |
private void InitializeGrid() |
684 |
{ |
685 |
InitializeColumns(); |
686 |
InitializeSearch(); |
687 |
InitializeGridViewDetail(); |
688 |
|
689 |
//this.radGridViewDocuments.DataSource = new BindingList<Documents>(this.documents); |
690 |
} |
691 |
|
692 |
private void InitializeColumns() |
693 |
{ |
694 |
bool isClient = !string.IsNullOrEmpty(informations.ActiveUser.RefProjectID); |
695 |
GridViewColumnCollection cols = this.radGridViewDocuments.Columns; |
696 |
|
697 |
cols.ForAll(x => |
698 |
{ |
699 |
if (!x.ReadOnly) |
700 |
{ |
701 |
switch (x.Name) |
702 |
{ |
703 |
case "FrReviewStatus": |
704 |
case "FrRemarks": |
705 |
case "FrCreator": |
706 |
case "ClientReviewer": |
707 |
case "ClientIsResult": |
708 |
case "ClientRemarks": |
709 |
x.ReadOnly = !isClient; |
710 |
break; |
711 |
default: |
712 |
x.ReadOnly = isClient; |
713 |
break; |
714 |
} |
715 |
} |
716 |
}); |
717 |
} |
718 |
|
719 |
private void InitializeSearch() |
720 |
{ |
721 |
|
722 |
var font1 = ThemeResolutionService.GetCustomFont("TelerikWebUI"); |
723 |
|
724 |
lbSearch.Text = "\ue13E"; |
725 |
btnSearchNext.Text = "\ue006"; |
726 |
btnSearchPrevious.Text = "\ue004"; |
727 |
|
728 |
var chkbox = new RadCheckBoxElement(); |
729 |
chkbox.Text = "Match Case"; |
730 |
chkbox.CheckStateChanged += (snd, evt) => { radGridViewDocuments.MasterView.TableSearchRow.CaseSensitive = chkbox.Checked; }; |
731 |
|
732 |
btnMatchCase.HostedItem = chkbox; |
733 |
|
734 |
var chkbox1 = new RadCheckBoxElement(); |
735 |
chkbox1.Text = "Show All Detail"; |
736 |
chkbox1.CheckStateChanged += (snd, evt) => |
737 |
{ |
738 |
radGridViewDocuments.MasterView.ChildRows.ForAll(x=>x.IsExpanded = chkbox1.Checked); |
739 |
}; |
740 |
|
741 |
btnShowAllDetail.HostedItem = chkbox1; |
742 |
|
743 |
var chkbox2 = new RadCheckBoxElement(); |
744 |
chkbox2.Text = "Search from current position"; |
745 |
chkbox2.CheckStateChanged += (snd, evt) => { radGridViewDocuments.MasterView.TableSearchRow.SearchFromCurrentPosition = chkbox.Checked; }; |
746 |
|
747 |
btnSearchFormCurrent.HostedItem = chkbox2; |
748 |
|
749 |
var columns = radGridViewDocuments.Columns.Where(x => x.AllowSearching).Select(x => |
750 |
new FilterColumn |
751 |
{ |
752 |
Name = x.HeaderText, |
753 |
FieldName = x.FieldName, |
754 |
IsSelect = x.AllowSearching |
755 |
}).ToList(); |
756 |
|
757 |
var panel = new StackLayoutElement(); |
758 |
panel.Orientation = Orientation.Vertical; |
759 |
|
760 |
var btnComboColumns = new RadCheckedDropDownListElement(); |
761 |
btnComboColumns.ShowCheckAllItems = true; |
762 |
btnComboColumns.CheckAllItem.Checked = true; |
763 |
btnComboColumns.AutoCompleteEditableAreaElement.NullText = "Search in Columns"; |
764 |
btnComboColumns.AutoCompleteEditableAreaElement.AutoCompleteTextBox.IsReadOnly = true; |
765 |
btnComboColumns.DropDownMinSize = new Size(200, 200); |
766 |
btnComboColumns.DropDownSizingMode = SizingMode.UpDownAndRightBottom; |
767 |
btnComboColumns.DisplayMember = "Name"; |
768 |
btnComboColumns.CheckedMember = "IsSelect"; |
769 |
btnComboColumns.ValueMember = "FieldName"; |
770 |
btnComboColumns.TextBox.CustomFont = font1.Name; |
771 |
btnComboColumns.TextBox.Text = "\ue13A"; |
772 |
|
773 |
columns.Add(new FilterColumn { FieldName = "CREATE_USER", Name = "Markus User", IsSelect = true }); |
774 |
columns.Add(new FilterColumn { FieldName = "TEXT", Name = "Markus Text", IsSelect = true }); |
775 |
|
776 |
btnComboColumns.DataSource = columns; |
777 |
|
778 |
txtFullSearch.TextBoxElement.ClearButton.Click += (snd, evt) => |
779 |
{ |
780 |
radGridViewDocuments.MasterTemplate.Refresh(null); |
781 |
}; |
782 |
|
783 |
btnComboColumns.PopupOpening += (snd, evt) => |
784 |
{ |
785 |
(snd as RadCheckedDropDownListElement).CheckAllItem.Checked = (snd as RadCheckedDropDownListElement).Items.All(x => (x.DataBoundItem as FilterColumn).IsSelect); |
786 |
}; |
787 |
|
788 |
btnComboColumns.PopupClosed += (snd, evt) => |
789 |
{ |
790 |
foreach (RadCheckedListDataItem item in btnComboColumns.Items) |
791 |
{ |
792 |
if (radGridViewDocuments.Columns[item.Value.ToString()] != null) |
793 |
{ |
794 |
radGridViewDocuments.Columns[item.Value.ToString()].AllowSearching = item.Checked; |
795 |
} |
796 |
|
797 |
foreach (var template in radGridViewDocuments.Templates) |
798 |
{ |
799 |
if (template.Columns[item.Value.ToString()] != null) |
800 |
{ |
801 |
template.Columns[item.Value.ToString()].AllowSearching = item.Checked; |
802 |
} |
803 |
} |
804 |
} |
805 |
}; |
806 |
|
807 |
btnFilters.HostedItem = btnComboColumns; |
808 |
} |
809 |
|
810 |
private void InitializeGridViewDetail() |
811 |
{ |
812 |
DetailGridViewTemplate markupList = new DetailGridViewTemplate(); |
813 |
|
814 |
GridViewTextBoxColumn userColumn = new GridViewTextBoxColumn("CREATE_USER"); |
815 |
GridViewTextBoxColumn textColumn = new GridViewTextBoxColumn("TEXT"); |
816 |
|
817 |
userColumn.MinWidth = 110; |
818 |
userColumn.AutoSizeMode = BestFitColumnMode.AllCells; |
819 |
userColumn.AllowSearching = true; |
820 |
textColumn.AutoSizeMode = BestFitColumnMode.AllCells; |
821 |
textColumn.AllowSearching = true; |
822 |
|
823 |
markupList.Columns.AddRange(userColumn, textColumn); |
824 |
markupList.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; |
825 |
|
826 |
this.radGridViewDocuments.MasterTemplate.Templates.Add(markupList); |
827 |
markupList.HierarchyDataProvider = new GridViewEventDataProvider(markupList); |
828 |
|
829 |
this.radGridViewDocuments.ChildViewExpanded += RadGridViewDocuments_ChildViewExpanded; |
830 |
this.radGridViewDocuments.RowSourceNeeded += RadGridViewDocuments_RowSourceNeeded; |
831 |
} |
832 |
|
833 |
private void RadGridViewDocuments_RowSourceNeeded(object sender, GridViewRowSourceNeededEventArgs e) |
834 |
{ |
835 |
if (e.Template.HierarchyLevel == 1) |
836 |
{ |
837 |
if (e.ParentRow.DataBoundItem is Documents documents) |
838 |
{ |
839 |
if (documents.Markups != null) |
840 |
{ |
841 |
foreach (var makrup in documents.Markups) |
842 |
{ |
843 |
GridViewRowInfo row = e.Template.Rows.NewRow(); |
844 |
|
845 |
row.Cells["CREATE_USER"].Value = makrup.CREATE_USER; |
846 |
row.Cells["TEXT"].Value = makrup.TEXT; |
847 |
e.SourceCollection.Add(row); |
848 |
} |
849 |
|
850 |
e.Template.BestFitColumns(BestFitColumnMode.AllCells); |
851 |
} |
852 |
} |
853 |
} |
854 |
} |
855 |
|
856 |
private void RadGridViewDocuments_ChildViewExpanded(object sender, ChildViewExpandedEventArgs e) |
857 |
{ |
858 |
if (e.IsExpanded) |
859 |
{ |
860 |
} |
861 |
} |
862 |
|
863 |
#endregion |
864 |
|
865 |
private void OpenProjectView_OpenProjectClick(object sender, EventArgs e) |
866 |
{ |
867 |
this.radRibbonBarBackstageViewID2Manager.Tag = e; |
868 |
this.radRibbonBarBackstageViewID2Manager.HidePopup(); |
869 |
} |
870 |
|
871 |
private void RadRibbonBarBackstageViewID2Manager_BackstageViewOpened(object sender, EventArgs e) |
872 |
{ |
873 |
this.radRibbonBarBackstageViewID2Manager.SelectedItem = this.backstageTabItemOpenProject; |
874 |
|
875 |
foreach ( Control ctrl in this.backstageViewPageOpenProject.Controls) |
876 |
{ |
877 |
if (ctrl is OpenProjectView) |
878 |
{ |
879 |
var openProjectView = ctrl as OpenProjectView; |
880 |
openProjectView.GetProjectGroups(); |
881 |
break; |
882 |
} |
883 |
} |
884 |
} |
885 |
|
886 |
private void RadRibbonBarBackstageViewID2Manager_BackstageViewClosed(object sender, EventArgs e) |
887 |
{ |
888 |
try |
889 |
{ |
890 |
if (this.radRibbonBarBackstageViewID2Manager.Tag is ProjectEventArgs) |
891 |
{ |
892 |
var prjArgs = this.radRibbonBarBackstageViewID2Manager.Tag as ProjectEventArgs; |
893 |
|
894 |
informations.ActiveProject = prjArgs.ProjectInfo; |
895 |
|
896 |
this.radRibbonBarBackstageViewID2Manager.Tag = null; |
897 |
|
898 |
this.LoadProject(); |
899 |
} |
900 |
} |
901 |
catch (Exception ex) |
902 |
{ |
903 |
Program.logger.Error($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex); |
904 |
RadMessageBox.Show("Failed to load project.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error); |
905 |
} |
906 |
} |
907 |
|
908 |
private void LoadProject() |
909 |
{ |
910 |
try |
911 |
{ |
912 |
#region Date |
913 |
//Date Type |
914 |
if (this.radCheckedDropDownListDateType.DataSource != null) |
915 |
this.radCheckedDropDownListDateType.DataSource = null; |
916 |
|
917 |
this.radCheckedDropDownListDateType.DataSource = informations.DateType; |
918 |
this.radCheckedDropDownListDateType.DisplayMember = "Value"; |
919 |
this.radCheckedDropDownListDateType.ValueMember = "Key"; |
920 |
|
921 |
//FromDate |
922 |
this.radDateTimePickerFr.NullableValue = null; |
923 |
this.radDateTimePickerFr.SetToNullValue(); |
924 |
|
925 |
//ToDate |
926 |
this.radDateTimePickerTo.NullableValue = null; |
927 |
this.radDateTimePickerTo.SetToNullValue(); |
928 |
#endregion |
929 |
|
930 |
#region 도면 |
931 |
//Project List |
932 |
if (this.radDropDownListProject.Items.Count > 0) |
933 |
this.radDropDownListProject.Items.Clear(); |
934 |
informations.ProjectList.Where(x => x.GroupID.Equals(informations.ActiveProject.ProjectID)).ToList() |
935 |
.ForEach(x => |
936 |
{ |
937 |
this.radDropDownListProject.Items.Add(new RadListDataItem(x.Name, x.Code)); |
938 |
}); |
939 |
var allProject = new RadListDataItem("== 전체 ==", string.Empty); |
940 |
this.radDropDownListProject.Items.Insert(0, allProject); |
941 |
allProject.Selected = true; |
942 |
|
943 |
//담당자 List |
944 |
if (this.radDropDownListPersonInCharge.Items.Count > 0) |
945 |
this.radDropDownListPersonInCharge.Items.Clear(); |
946 |
informations.UserList.ForEach(x => |
947 |
{ |
948 |
if ((new string[] { "Manager", "User" }).Contains(x.Role) && string.IsNullOrEmpty(x.RefProjectID)) |
949 |
this.radDropDownListPersonInCharge.Items.Add(new RadListDataItem(x.Name, x.ID)); |
950 |
}); |
951 |
var allUser = new RadListDataItem("== 전체 ==", string.Empty); |
952 |
this.radDropDownListPersonInCharge.Items.Insert(0, allUser); |
953 |
allUser.Selected = true; |
954 |
|
955 |
//난이도 |
956 |
if (this.radDropDownListJobLevel.Items.Count > 0) |
957 |
this.radDropDownListJobLevel.Items.Clear(); |
958 |
informations.JobLevel.ForEach(x => |
959 |
{ |
960 |
this.radDropDownListJobLevel.Items.Add(new RadListDataItem(x, x)); |
961 |
}); |
962 |
var allJobLevel = new RadListDataItem("== 전체 ==", string.Empty); |
963 |
this.radDropDownListJobLevel.Items.Insert(0, allJobLevel); |
964 |
allJobLevel.Selected = true; |
965 |
|
966 |
//도면번호 조회조건 |
967 |
this.radTextBoxDocumentNo.Text = string.Empty; |
968 |
#endregion |
969 |
|
970 |
#region 검토 |
971 |
//문의(DOF) |
972 |
if (this.radDropDownListToIsDiscussion.Items.Count > 0) |
973 |
this.radDropDownListToIsDiscussion.Items.Clear(); |
974 |
informations.IsYesNo.ForEach(x => |
975 |
{ |
976 |
this.radDropDownListToIsDiscussion.Items.Add(new RadListDataItem(x, x)); |
977 |
}); |
978 |
var allToIsDiscussion = new RadListDataItem("== 전체 ==", string.Empty); |
979 |
this.radDropDownListToIsDiscussion.Items.Insert(0, allToIsDiscussion); |
980 |
allToIsDiscussion.Selected = true; |
981 |
|
982 |
//회신(DS) |
983 |
if (this.radDropDownListFrReviewStatus.Items.Count > 0) |
984 |
this.radDropDownListFrReviewStatus.Items.Clear(); |
985 |
informations.ClientStatus.ForEach(x => |
986 |
{ |
987 |
this.radDropDownListFrReviewStatus.Items.Add(new RadListDataItem(x, x)); |
988 |
}); |
989 |
var allFrReviewStatus = new RadListDataItem("== 전체 ==", string.Empty); |
990 |
this.radDropDownListFrReviewStatus.Items.Insert(0, allFrReviewStatus); |
991 |
allFrReviewStatus.Selected = true; |
992 |
#endregion |
993 |
|
994 |
#region 작업 |
995 |
//ID2 Status |
996 |
{ |
997 |
if (this.radDropDownListID2Status.Items.Count > 0) |
998 |
this.radDropDownListID2Status.Items.Clear(); |
999 |
informations.JobStatus.ForEach(x => |
1000 |
{ |
1001 |
this.radDropDownListID2Status.Items.Add(new RadListDataItem(x, x)); |
1002 |
}); |
1003 |
var allID2Status = new RadListDataItem("== 전체 ==", string.Empty); |
1004 |
this.radDropDownListID2Status.Items.Insert(0, allID2Status); |
1005 |
allID2Status.Selected = true; |
1006 |
} |
1007 |
|
1008 |
//ID2 Issues |
1009 |
{ |
1010 |
if (this.radDropDownListID2Issues.Items.Count > 0) |
1011 |
this.radDropDownListID2Issues.Items.Clear(); |
1012 |
informations.IsYesNo.ForEach(x => |
1013 |
{ |
1014 |
this.radDropDownListID2Issues.Items.Add(new RadListDataItem(x, x)); |
1015 |
}); |
1016 |
var allID2Issues = new RadListDataItem("== 전체 ==", string.Empty); |
1017 |
this.radDropDownListID2Issues.Items.Insert(0, allID2Issues); |
1018 |
allID2Issues.Selected = true; |
1019 |
} |
1020 |
|
1021 |
//AVEVA Status |
1022 |
{ |
1023 |
if (this.radDropDownListAVEVAStatus.Items.Count > 0) |
1024 |
this.radDropDownListAVEVAStatus.Items.Clear(); |
1025 |
informations.JobStatus.ForEach(x => |
1026 |
{ |
1027 |
this.radDropDownListAVEVAStatus.Items.Add(new RadListDataItem(x, x)); |
1028 |
}); |
1029 |
var allAVEVAStatus = new RadListDataItem("== 전체 ==", string.Empty); |
1030 |
this.radDropDownListAVEVAStatus.Items.Insert(0, allAVEVAStatus); |
1031 |
allAVEVAStatus.Selected = true; |
1032 |
} |
1033 |
|
1034 |
//AVEVA Issues |
1035 |
{ |
1036 |
if (this.radDropDownListAVEVAIssues.Items.Count > 0) |
1037 |
this.radDropDownListAVEVAIssues.Items.Clear(); |
1038 |
informations.IsYesNo.ForEach(x => |
1039 |
{ |
1040 |
this.radDropDownListAVEVAIssues.Items.Add(new RadListDataItem(x, x)); |
1041 |
}); |
1042 |
var allAVEVAIssues = new RadListDataItem("== 전체 ==", string.Empty); |
1043 |
this.radDropDownListAVEVAIssues.Items.Insert(0, allAVEVAIssues); |
1044 |
allAVEVAIssues.Selected = true; |
1045 |
} |
1046 |
|
1047 |
#endregion |
1048 |
|
1049 |
#region 검수 |
1050 |
//도프텍 결과 |
1051 |
if (this.radDropDownListProdIsResult.Items.Count > 0) |
1052 |
this.radDropDownListProdIsResult.Items.Clear(); |
1053 |
informations.ValidationResult.ForEach(x => |
1054 |
{ |
1055 |
this.radDropDownListProdIsResult.Items.Add(new RadListDataItem(x, x)); |
1056 |
}); |
1057 |
var allProdIsResult = new RadListDataItem("== 전체 ==", string.Empty); |
1058 |
this.radDropDownListProdIsResult.Items.Insert(0, allProdIsResult); |
1059 |
allProdIsResult.Selected = true; |
1060 |
|
1061 |
//삼성 결과 |
1062 |
if (this.radDropDownListClientIsResult.Items.Count > 0) |
1063 |
this.radDropDownListClientIsResult.Items.Clear(); |
1064 |
informations.ValidationResult.ForEach(x => |
1065 |
{ |
1066 |
this.radDropDownListClientIsResult.Items.Add(new RadListDataItem(x, x)); |
1067 |
}); |
1068 |
var allClientIsResult = new RadListDataItem("== 전체 ==", string.Empty); |
1069 |
this.radDropDownListClientIsResult.Items.Insert(0, allClientIsResult); |
1070 |
allClientIsResult.Selected = true; |
1071 |
#endregion |
1072 |
|
1073 |
#region AVEVA |
1074 |
//Gateway |
1075 |
if (this.radDropDownListGateway.Items.Count > 0) |
1076 |
this.radDropDownListGateway.Items.Clear(); |
1077 |
informations.IsYesNo.ForEach(x => |
1078 |
{ |
1079 |
this.radDropDownListGateway.Items.Add(new RadListDataItem(x, x)); |
1080 |
}); |
1081 |
var allDTIsGateWay = new RadListDataItem("== 전체 ==", string.Empty); |
1082 |
this.radDropDownListGateway.Items.Insert(0, allDTIsGateWay); |
1083 |
allDTIsGateWay.Selected = true; |
1084 |
|
1085 |
//Registration |
1086 |
if (this.radDropDownListRegistration.Items.Count > 0) |
1087 |
this.radDropDownListRegistration.Items.Clear(); |
1088 |
informations.IsYesNo.ForEach(x => |
1089 |
{ |
1090 |
this.radDropDownListRegistration.Items.Add(new RadListDataItem(x, x)); |
1091 |
}); |
1092 |
var allDTIsRegSystem = new RadListDataItem("== 전체 ==", string.Empty); |
1093 |
this.radDropDownListRegistration.Items.Insert(0, allDTIsRegSystem); |
1094 |
allDTIsRegSystem.Selected = true; |
1095 |
#endregion |
1096 |
|
1097 |
this.GetDocList(); |
1098 |
} |
1099 |
catch (Exception ex) |
1100 |
{ |
1101 |
throw ex; |
1102 |
} |
1103 |
finally |
1104 |
{ |
1105 |
|
1106 |
this.Cursor = Cursors.Default; |
1107 |
|
1108 |
} |
1109 |
|
1110 |
} |
1111 |
|
1112 |
#region Document List 조회 |
1113 |
public void GetDocList() |
1114 |
{ |
1115 |
try |
1116 |
{ |
1117 |
if (this.radDropDownListProject.SelectedValue != null) |
1118 |
{ |
1119 |
List<string> dateTypes = this.radCheckedDropDownListDateType.CheckedItems.Select(x => x.Value.ToString()).ToList(); |
1120 |
DateTime? frDate = this.radDateTimePickerFr.Value.Equals(this.radDateTimePickerFr.NullDate) ? (DateTime?)null : this.radDateTimePickerFr.Value; |
1121 |
DateTime? toDate = this.radDateTimePickerTo.Value.Equals(this.radDateTimePickerTo.NullDate) ? (DateTime?)null : this.radDateTimePickerTo.Value; |
1122 |
|
1123 |
string projectCode = this.radDropDownListProject.SelectedValue.ToString(); |
1124 |
string personIncharge = this.radDropDownListPersonInCharge.SelectedValue.ToString(); |
1125 |
string jobLevel = this.radDropDownListJobLevel.SelectedValue.ToString(); |
1126 |
string documentNo = this.radTextBoxDocumentNo.Text.Trim(); |
1127 |
|
1128 |
string isToIsDiscussion = this.radDropDownListToIsDiscussion.SelectedValue.ToString(); |
1129 |
string isFrReviewStatus = this.radDropDownListFrReviewStatus.SelectedValue.ToString(); |
1130 |
|
1131 |
string id2Status = this.radDropDownListID2Status.SelectedValue.ToString(); |
1132 |
string id2Issues = this.radDropDownListID2Issues.SelectedValue.ToString(); |
1133 |
string avevaStatus = this.radDropDownListAVEVAStatus.SelectedValue.ToString(); |
1134 |
string avevaIssues = this.radDropDownListAVEVAIssues.SelectedValue.ToString(); |
1135 |
|
1136 |
string prodIsResult = this.radDropDownListProdIsResult.SelectedValue.ToString(); |
1137 |
string clientIsResult = this.radDropDownListClientIsResult.SelectedValue.ToString(); |
1138 |
|
1139 |
string isGateWay = this.radDropDownListGateway.SelectedValue.ToString(); |
1140 |
string isRegSystem = this.radDropDownListRegistration.SelectedValue.ToString(); |
1141 |
|
1142 |
var worker = new LoadDocumentsWorker(dateTypes, frDate, toDate, projectCode, personIncharge, jobLevel, documentNo, isToIsDiscussion, isFrReviewStatus, id2Status, id2Issues, avevaStatus, avevaIssues, prodIsResult, clientIsResult, isGateWay, isRegSystem, this.radGridViewDocuments); |
1143 |
worker.OnWorkCompletedHandler += (e) => |
1144 |
{ |
1145 |
var docData = e.Result as DocumentsResult; |
1146 |
|
1147 |
this.documents = docData.Dwgs; |
1148 |
this.orgDocuments = JsonConvert.DeserializeObject<List<Documents>>(JsonConvert.SerializeObject(docData.Dwgs)); |
1149 |
this.TotalCount = docData.TotalCount; |
1150 |
|
1151 |
List<string> projectCodes = new List<string>(); |
1152 |
|
1153 |
if (!string.IsNullOrWhiteSpace(projectCode)) |
1154 |
{ |
1155 |
projectCodes.Add(projectCode); |
1156 |
} |
1157 |
else |
1158 |
{ |
1159 |
projectCodes = informations.ProjectList.Select(x => x.Code).ToList(); |
1160 |
} |
1161 |
|
1162 |
this.DocumentListBinding(); |
1163 |
}; |
1164 |
|
1165 |
(btnShowAllDetail.HostedItem as RadCheckBoxElement).Checked = false; |
1166 |
worker.StartWork(); |
1167 |
} |
1168 |
} |
1169 |
catch (Exception ex) |
1170 |
{ |
1171 |
throw ex; |
1172 |
} |
1173 |
} |
1174 |
|
1175 |
public void DocumentListBinding() |
1176 |
{ |
1177 |
try |
1178 |
{ |
1179 |
GridViewComboBoxColumn ColProjects = this.radGridViewDocuments.Columns["RefProjectCode"] as GridViewComboBoxColumn; |
1180 |
ColProjects.DataSource = informations.ProjectList.Where(x => x.GroupID.Equals(informations.ActiveProject.ProjectID)).ToList(); |
1181 |
ColProjects.DisplayMember = "Name"; |
1182 |
ColProjects.ValueMember = "Code"; |
1183 |
|
1184 |
var workUsers = informations.UserList.Where(x => (new string[] { "Manager", "User" }).Contains(x.Role) && string.IsNullOrEmpty(x.RefProjectID)); |
1185 |
var clientUsers = informations.UserList.Where(x => !string.IsNullOrEmpty(x.RefProjectID)); |
1186 |
|
1187 |
GridViewComboBoxColumn ColPersonInCharge = this.radGridViewDocuments.Columns["PersonInCharge"] as GridViewComboBoxColumn; |
1188 |
ColPersonInCharge.DataSource = workUsers; |
1189 |
ColPersonInCharge.DisplayMember = "Name"; |
1190 |
ColPersonInCharge.ValueMember = "ID"; |
1191 |
|
1192 |
GridViewComboBoxColumn ColWorker = this.radGridViewDocuments.Columns["Worker"] as GridViewComboBoxColumn; |
1193 |
ColWorker.DataSource = workUsers; |
1194 |
ColWorker.DisplayMember = "Name"; |
1195 |
ColWorker.ValueMember = "ID"; |
1196 |
|
1197 |
GridViewComboBoxColumn ColAVEVAPersonInCharge = this.radGridViewDocuments.Columns["AVEVAPersonInCharge"] as GridViewComboBoxColumn; |
1198 |
ColAVEVAPersonInCharge.DataSource = workUsers; |
1199 |
ColAVEVAPersonInCharge.DisplayMember = "Name"; |
1200 |
ColAVEVAPersonInCharge.ValueMember = "ID"; |
1201 |
|
1202 |
GridViewComboBoxColumn ColAVEVAWorker = this.radGridViewDocuments.Columns["AVEVAWorker"] as GridViewComboBoxColumn; |
1203 |
ColAVEVAWorker.DataSource = workUsers; |
1204 |
ColAVEVAWorker.DisplayMember = "Name"; |
1205 |
ColAVEVAWorker.ValueMember = "ID"; |
1206 |
|
1207 |
GridViewComboBoxColumn ColReplyRequester = this.radGridViewDocuments.Columns["ReplyRequester"] as GridViewComboBoxColumn; |
1208 |
ColReplyRequester.DataSource = workUsers; |
1209 |
ColReplyRequester.DisplayMember = "Name"; |
1210 |
ColReplyRequester.ValueMember = "ID"; |
1211 |
|
1212 |
GridViewComboBoxColumn ColToCreator = this.radGridViewDocuments.Columns["ToCreator"] as GridViewComboBoxColumn; |
1213 |
ColToCreator.DataSource = workUsers; |
1214 |
ColToCreator.DisplayMember = "Name"; |
1215 |
ColToCreator.ValueMember = "ID"; |
1216 |
|
1217 |
GridViewComboBoxColumn ColFrCreator = this.radGridViewDocuments.Columns["FrCreator"] as GridViewComboBoxColumn; |
1218 |
ColFrCreator.DataSource = clientUsers; |
1219 |
ColFrCreator.DisplayMember = "Name"; |
1220 |
ColFrCreator.ValueMember = "ID"; |
1221 |
|
1222 |
GridViewComboBoxColumn ColProdReviewer = this.radGridViewDocuments.Columns["ProdReviewer"] as GridViewComboBoxColumn; |
1223 |
ColProdReviewer.DataSource = workUsers; |
1224 |
ColProdReviewer.DisplayMember = "Name"; |
1225 |
ColProdReviewer.ValueMember = "ID"; |
1226 |
|
1227 |
GridViewComboBoxColumn ColClientReviewer = this.radGridViewDocuments.Columns["ClientReviewer"] as GridViewComboBoxColumn; |
1228 |
ColClientReviewer.DataSource = clientUsers; |
1229 |
ColClientReviewer.DisplayMember = "Name"; |
1230 |
ColClientReviewer.ValueMember = "ID"; |
1231 |
|
1232 |
//Data |
1233 |
if (this.radGridViewDocuments.DataSource != null) |
1234 |
this.radGridViewDocuments.DataSource = null; |
1235 |
|
1236 |
/* |
1237 |
var info = informations.ProjectList.Where(x => x.Name.Equals("APAO")).FirstOrDefault().ID2Info; |
1238 |
var id2Datas = new DocumentController(info).GetID2DrawingsByProject(info); |
1239 |
var test = from doc in this.documents |
1240 |
join id2 in id2Datas on doc.DocumentNo equals id2.DOCNAME into gj |
1241 |
from docs in gj.DefaultIfEmpty() |
1242 |
select new Documents() |
1243 |
{ |
1244 |
DocumentNo = doc.DocumentNo, |
1245 |
ID2EndDate = docs?.DATETIME == null ? (DateTime?)null : Convert.ToDateTime(docs?.DATETIME) |
1246 |
//ProdRemarks = docs.DATETIME ?? null |
1247 |
}; |
1248 |
*/ |
1249 |
|
1250 |
this.radGridViewDocuments.FilterDescriptors.Clear(); |
1251 |
this.radGridViewDocuments.DataSource = new BindingList<Documents>(this.documents); |
1252 |
this.lbSelectAndTotal.Text = $"{this.documents.Count} / {this.TotalCount} (Selected / Total)"; |
1253 |
|
1254 |
var verification = this.LayoutValidation.Controls[0] as Verification; |
1255 |
verification.DocumentListBinding(this.documents); |
1256 |
} |
1257 |
catch (Exception ex) |
1258 |
{ |
1259 |
throw ex; |
1260 |
} |
1261 |
} |
1262 |
#endregion |
1263 |
|
1264 |
#region Button, Checkbox event |
1265 |
private void RadButtonDateClear_Click(object sender, EventArgs e) |
1266 |
{ |
1267 |
//DateType |
1268 |
this.radCheckedDropDownListDateType.CheckedItems.Clear(); |
1269 |
//FromDate |
1270 |
this.radDateTimePickerFr.SetToNullValue(); |
1271 |
//ToDate |
1272 |
this.radDateTimePickerTo.SetToNullValue(); |
1273 |
} |
1274 |
|
1275 |
private void RadDropDownList_SelectedIndexChanged(object sender, Telerik.WinControls.UI.Data.PositionChangedEventArgs e) |
1276 |
{ |
1277 |
if (sender is RadDropDownList ddl) |
1278 |
{ |
1279 |
if (string.IsNullOrEmpty(ddl.SelectedValue.ToString())) |
1280 |
{ |
1281 |
ddl.BackColor = Color.White; |
1282 |
ddl.ForeColor = Color.Black; |
1283 |
ddl.Font = new Font("Segoe UI", 8.25F, FontStyle.Regular); |
1284 |
} |
1285 |
else |
1286 |
{ |
1287 |
ddl.BackColor = Color.DarkSlateBlue; |
1288 |
ddl.ForeColor = Color.Yellow; |
1289 |
ddl.Font = new Font("Segoe UI", 8.25F, FontStyle.Bold); |
1290 |
} |
1291 |
} |
1292 |
} |
1293 |
|
1294 |
private void RadCheckBox_CheckStateChanged(object sender, EventArgs e) |
1295 |
{ |
1296 |
if (sender is RadCheckBox) |
1297 |
{ |
1298 |
RadCheckBox checkBox = sender as RadCheckBox; |
1299 |
|
1300 |
if (checkBox.Tag != null) |
1301 |
{ |
1302 |
ColumnGroupsViewDefinition columnGroupsView = this.radGridViewDocuments.MasterTemplate.ViewDefinition as ColumnGroupsViewDefinition; |
1303 |
GridViewColumnGroup colGroup = columnGroupsView.GetAllGroups().Where(x => x.Name.Equals(checkBox.Tag.ToString())).FirstOrDefault(); |
1304 |
if (colGroup != null) |
1305 |
colGroup.IsVisible = checkBox.Checked; |
1306 |
} |
1307 |
} |
1308 |
|
1309 |
//ColumnGroupsViewDefinition columnGroupsView = this.radGridViewDocuments.MasterTemplate.ViewDefinition = columnGroupsView; |
1310 |
} |
1311 |
|
1312 |
private void RadTextBoxDocumentNo_KeyDown(object sender, KeyEventArgs e) |
1313 |
{ |
1314 |
if (e.KeyCode == Keys.Enter) |
1315 |
{ |
1316 |
this.radButtonSearch.Focus(); |
1317 |
this.radButtonSearch.PerformClick(); |
1318 |
} |
1319 |
} |
1320 |
|
1321 |
private void RadTextBoxDocumentNo_KeyUp(object sender, KeyEventArgs e) |
1322 |
{ |
1323 |
if (sender is RadTextBox txtBox) |
1324 |
{ |
1325 |
if (txtBox.Text.Length > 0) |
1326 |
{ |
1327 |
txtBox.BackColor = Color.DarkSlateBlue; |
1328 |
txtBox.ForeColor = Color.Yellow; |
1329 |
txtBox.Font = new Font("Segoe UI", 8.25F, FontStyle.Bold); |
1330 |
} |
1331 |
else |
1332 |
{ |
1333 |
txtBox.BackColor = Color.White; |
1334 |
txtBox.ForeColor = Color.Black; |
1335 |
txtBox.Font = new Font("Segoe UI", 8.25F, FontStyle.Regular); |
1336 |
} |
1337 |
} |
1338 |
} |
1339 |
|
1340 |
private void RadButtonSearch_Click(object sender, EventArgs e) |
1341 |
{ |
1342 |
try |
1343 |
{ |
1344 |
this.GetDocList(); |
1345 |
} |
1346 |
catch (Exception ex) |
1347 |
{ |
1348 |
Program.logger.Error($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex); |
1349 |
RadMessageBox.Show("DWG search failed.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error); |
1350 |
} |
1351 |
} |
1352 |
|
1353 |
private void BackstageButtonItemSelectDB_Click(object sender, EventArgs e) |
1354 |
{ |
1355 |
using (var frm = new SetID2ProjectDB()) |
1356 |
{ |
1357 |
if (frm.ShowDialog(this) == DialogResult.OK) |
1358 |
{ |
1359 |
if (informations.ActiveUser != null && !string.IsNullOrEmpty(informations.ActiveUser.RefProjectID)) |
1360 |
{ |
1361 |
this.radRibbonBarBackstageViewID2Manager.HidePopup(); |
1362 |
|
1363 |
informations.ActiveProject = new ProjectController().GetProjectInfo(informations.ActiveUser.RefProjectID); |
1364 |
informations.ProjectList = new ProjectController().GetAllProjectList().ToList(); |
1365 |
|
1366 |
this.LoadProject(); |
1367 |
} |
1368 |
else |
1369 |
{ |
1370 |
informations.ProjectList = new ProjectController().GetAllProjectList().ToList(); |
1371 |
bool isID2 = this.IsID2Connection(); |
1372 |
this.SetMenus(isID2); |
1373 |
|
1374 |
foreach (Control ctrl in this.backstageViewPageOpenProject.Controls) |
1375 |
{ |
1376 |
if (ctrl is OpenProjectView) |
1377 |
{ |
1378 |
var openProjectView = ctrl as OpenProjectView; |
1379 |
openProjectView.GetProjectGroups(); |
1380 |
break; |
1381 |
} |
1382 |
} |
1383 |
} |
1384 |
} |
1385 |
} |
1386 |
} |
1387 |
|
1388 |
private void BackstageButtonItemUserRegistration_Click(object sender, EventArgs e) |
1389 |
{ |
1390 |
using (var frm = new SetupUser()) |
1391 |
{ |
1392 |
if (frm.ShowDialog(this) == DialogResult.OK) |
1393 |
{ |
1394 |
|
1395 |
} |
1396 |
} |
1397 |
} |
1398 |
|
1399 |
private void BackstageButtonItemExit_Click(object sender, EventArgs e) |
1400 |
{ |
1401 |
Application.Exit(); |
1402 |
} |
1403 |
#endregion |
1404 |
|
1405 |
#region Grid event |
1406 |
private void RadGridViewDocuments_CommandCellClick(object sender, GridViewCellEventArgs e) |
1407 |
{ |
1408 |
if (e.Row is GridViewNewRowInfo) |
1409 |
{ |
1410 |
|
1411 |
} |
1412 |
else |
1413 |
{ |
1414 |
string extension = string.Empty; |
1415 |
|
1416 |
switch (e.Column.Name) |
1417 |
{ |
1418 |
case "MarkupLink": |
1419 |
{ |
1420 |
if (e.Row.DataBoundItem is Documents doc) |
1421 |
{ |
1422 |
if (!string.IsNullOrWhiteSpace(doc.RefProjectCode) && !string.IsNullOrWhiteSpace(doc.DocumentNo) && !string.IsNullOrWhiteSpace(informations.ActiveUser.ID)) |
1423 |
{ |
1424 |
bool result = MarkusHelper.Start(doc.RefProjectCode, doc.DocumentNo, informations.ActiveUser.ID); |
1425 |
} |
1426 |
} |
1427 |
} |
1428 |
break; |
1429 |
case "AVEVALink": |
1430 |
MessageBox.Show($"{e.Column.Name} 실행"); |
1431 |
break; |
1432 |
case "ID2Connection": |
1433 |
try |
1434 |
{ |
1435 |
if (e.Row.DataBoundItem is Documents doc) |
1436 |
{ |
1437 |
ID2Helper.OpenPID(doc.DocumentNo, string.Empty, Properties.Settings.Default.ID2Port); |
1438 |
|
1439 |
try |
1440 |
{ |
1441 |
var returnDoc = new DocumentController().SetID2Worker(new Documents() |
1442 |
{ |
1443 |
DocID = doc.DocID, |
1444 |
ID2StartDate = DateTime.Now, |
1445 |
Worker = informations.ActiveUser.ID |
1446 |
}, informations.ActiveUser.ID); |
1447 |
|
1448 |
if (returnDoc != null) |
1449 |
{ |
1450 |
doc.ID2StartDate = returnDoc.ID2StartDate; |
1451 |
doc.Worker = returnDoc.Worker; |
1452 |
} |
1453 |
} |
1454 |
catch { } |
1455 |
} |
1456 |
} |
1457 |
catch (Exception ex) |
1458 |
{ |
1459 |
RadMessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, RadMessageIcon.Error); |
1460 |
} |
1461 |
break; |
1462 |
case "Compare": |
1463 |
try |
1464 |
{ |
1465 |
if (e.Row.DataBoundItem is Documents selectedDoc) |
1466 |
{ |
1467 |
if (!string.IsNullOrEmpty(selectedDoc.DocID)) |
1468 |
{ |
1469 |
DockMainTabStrip.SelectedTab = DockValidation; |
1470 |
var verification = this.LayoutValidation.Controls[0] as Verification; |
1471 |
verification.DocumentSelection(selectedDoc); |
1472 |
} |
1473 |
} |
1474 |
} |
1475 |
catch (Exception ex) |
1476 |
{ |
1477 |
RadMessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, RadMessageIcon.Error); |
1478 |
} |
1479 |
break; |
1480 |
} |
1481 |
} |
1482 |
} |
1483 |
|
1484 |
private void RadGridViewDocuments_CellBeginEdit(object sender, GridViewCellCancelEventArgs e) |
1485 |
{ |
1486 |
if (e.ActiveEditor is RadDropDownListEditor) |
1487 |
{ |
1488 |
switch (e.Column.Name) |
1489 |
{ |
1490 |
//case "RefProjectCode": |
1491 |
// GridViewComboBoxColumn ColProjects = this.radGridViewDocuments.Columns[e.Column.Name] as GridViewComboBoxColumn; |
1492 |
// ColProjects.DataSource = informations.ProjectList.Where(x => x.GroupID.Equals(informations.ActiveProject.ProjectID)).ToList(); |
1493 |
// ColProjects.DisplayMember = "Name"; |
1494 |
// ColProjects.ValueMember = "Code"; |
1495 |
// break; |
1496 |
//case "PersonInCharge": |
1497 |
//case "Worker": |
1498 |
//case "AVEVAPersonInCharge": |
1499 |
//case "AVEVAWorker": |
1500 |
//case "ReplyRequester": |
1501 |
//case "ToCreator": |
1502 |
//case "ProdReviewer": |
1503 |
// var workUsers = informations.UserList.Where(x => (new string[] { "Manager", "User" }).Contains(x.Role) && string.IsNullOrEmpty(x.RefProjectID)); |
1504 |
// GridViewComboBoxColumn ColProdUsers = this.radGridViewDocuments.Columns[e.Column.Name] as GridViewComboBoxColumn; |
1505 |
// ColProdUsers.DataSource = workUsers; |
1506 |
// ColProdUsers.DisplayMember = "Name"; |
1507 |
// ColProdUsers.ValueMember = "ID"; |
1508 |
// break; |
1509 |
//case "FrCreator": |
1510 |
//case "ClientReviewer": |
1511 |
// var clientUsers = informations.UserList.Where(x => !string.IsNullOrEmpty(x.RefProjectID)); |
1512 |
// GridViewComboBoxColumn ColClientUsers = this.radGridViewDocuments.Columns[e.Column.Name] as GridViewComboBoxColumn; |
1513 |
// ColClientUsers.DataSource = clientUsers; |
1514 |
// ColClientUsers.DisplayMember = "Name"; |
1515 |
// ColClientUsers.ValueMember = "ID"; |
1516 |
// break; |
1517 |
case "JobLevel": |
1518 |
GridViewComboBoxColumn colJobLevel = this.radGridViewDocuments.Columns[e.Column.Name] as GridViewComboBoxColumn; |
1519 |
colJobLevel.DataSource = informations.JobLevel; |
1520 |
break; |
1521 |
case "ToIsDiscussion": |
1522 |
case "IsConvert": |
1523 |
case "DTIsImport": |
1524 |
case "DTIsGateWay": |
1525 |
case "DTIsRegSystem": |
1526 |
GridViewComboBoxColumn colYesNo = this.radGridViewDocuments.Columns[e.Column.Name] as GridViewComboBoxColumn; |
1527 |
colYesNo.DataSource = (new string[] { string.Empty }).Union<string>(informations.IsYesNo); |
1528 |
break; |
1529 |
case "ID2Status": |
1530 |
case "AVEVAStatus": |
1531 |
GridViewComboBoxColumn ColJobStatus = this.radGridViewDocuments.Columns[e.Column.Name] as GridViewComboBoxColumn; |
1532 |
ColJobStatus.DataSource = (new string[] { string.Empty }).Union<string>(informations.JobStatus); |
1533 |
break; |
1534 |
case "FrReviewStatus"://삼성의견status |
1535 |
GridViewComboBoxColumn ColClientStatus = this.radGridViewDocuments.Columns[e.Column.Name] as GridViewComboBoxColumn; |
1536 |
ColClientStatus.DataSource = (new string[] { string.Empty }).Union<string>(informations.ClientStatus); |
1537 |
break; |
1538 |
case "ProdIsResult": |
1539 |
case "ClientIsResult": |
1540 |
GridViewComboBoxColumn ColResult = this.radGridViewDocuments.Columns[e.Column.Name] as GridViewComboBoxColumn; |
1541 |
ColResult.DataSource = (new string[] { string.Empty }).Union<string>(informations.ValidationResult); |
1542 |
break; |
1543 |
} |
1544 |
} |
1545 |
} |
1546 |
|
1547 |
private void RadGridViewDocuments_ViewCellFormatting(object sender, CellFormattingEventArgs e) |
1548 |
{ |
1549 |
if (e.Row is GridViewDataRowInfo) |
1550 |
{ |
1551 |
if (e.CellElement is GridRowHeaderCellElement) |
1552 |
{ |
1553 |
// if (e.CellElement.RowIndex > -1) |
1554 |
// e.CellElement.Text = (e.CellElement.RowIndex + 1).ToString(); |
1555 |
} |
1556 |
else if (e.CellElement is GridGroupExpanderCellElement expanderCellElement) |
1557 |
{ |
1558 |
if((e.Row.DataBoundItem as Documents).Markups == null) |
1559 |
{ |
1560 |
expanderCellElement.Enabled = false; |
1561 |
} |
1562 |
} |
1563 |
else |
1564 |
{ |
1565 |
var result = e.Row.DataBoundItem as Documents; |
1566 |
if (result != null || e.Row is GridViewNewRowInfo) |
1567 |
{ |
1568 |
switch (e.CellElement.ColumnInfo.Name) |
1569 |
{ |
1570 |
case "AutoCADLink": |
1571 |
case "PDFLink": |
1572 |
case "MarkupLink": |
1573 |
case "AVEVALink": |
1574 |
case "ID2Connection": |
1575 |
case "Compare": |
1576 |
this.GetCommandColBtnElement(e.CellElement.Children[0], e.CellElement.ColumnInfo.Name); |
1577 |
break; |
1578 |
case "ToCapture": |
1579 |
if (result.ToCapture > 0) |
1580 |
{ |
1581 |
e.CellElement.Image = Properties.Resources.files18; |
1582 |
} |
1583 |
break; |
1584 |
case "FrCapture": |
1585 |
if (result.FrCapture > 0) |
1586 |
{ |
1587 |
e.CellElement.Image = Properties.Resources.files18; |
1588 |
} |
1589 |
break; |
1590 |
//case "ProdCapture": |
1591 |
// if (result.ProdCapture > 0) |
1592 |
// { |
1593 |
// e.CellElement.Image = Properties.Resources.files18; |
1594 |
// } |
1595 |
// break; |
1596 |
//case "ClientCapture": |
1597 |
// if (result.ClientCapture > 0) |
1598 |
// { |
1599 |
// e.CellElement.Image = Properties.Resources.files18; |
1600 |
// } |
1601 |
// break; |
1602 |
case "ID2Capture": |
1603 |
if (result.ID2Capture > 0) |
1604 |
{ |
1605 |
e.CellElement.Image = Properties.Resources.files18; |
1606 |
} |
1607 |
break; |
1608 |
} |
1609 |
} |
1610 |
else |
1611 |
{ |
1612 |
|
1613 |
} |
1614 |
} |
1615 |
} |
1616 |
else if(e.Row is GridViewDetailsRowInfo) |
1617 |
{ |
1618 |
if (e.CellElement is GridDetailViewCellElement detailViewCellElement) |
1619 |
{ |
1620 |
detailViewCellElement.Padding = new Padding(10,2,2,2); |
1621 |
detailViewCellElement.BackColor = Color.FromArgb(214, 214, 214); |
1622 |
detailViewCellElement.BackColor2 = Color.FromArgb(214, 214, 214); |
1623 |
} |
1624 |
} |
1625 |
//else if (e.Row is GridViewSummaryRowInfo) |
1626 |
//{ |
1627 |
// if (e.CellElement is GridRowHeaderCellElement) |
1628 |
// { |
1629 |
// e.CellElement.Text = "Count"; |
1630 |
// } |
1631 |
// else if (e.CellElement is GridSummaryCellElement) |
1632 |
// { |
1633 |
// e.CellElement.ForeColor = this._SummaryColor; |
1634 |
// e.CellElement.TextAlignment = ContentAlignment.BottomRight; |
1635 |
// e.CellElement.Font = new Font(e.CellElement.Font, FontStyle.Bold); |
1636 |
// } |
1637 |
// else |
1638 |
// { |
1639 |
|
1640 |
// } |
1641 |
//} |
1642 |
else |
1643 |
{ |
1644 |
|
1645 |
} |
1646 |
} |
1647 |
|
1648 |
private RadButtonElement GetCommandColBtnElement(RadElement elem, string colName) |
1649 |
{ |
1650 |
RadButtonElement btnElem = null; |
1651 |
Bitmap bitmap = null; ; |
1652 |
|
1653 |
switch (colName) |
1654 |
{ |
1655 |
case "AutoCADLink": |
1656 |
bitmap = new Bitmap(Properties.Resources.cad18); |
1657 |
break; |
1658 |
case "PDFLink": |
1659 |
bitmap = new Bitmap(Properties.Resources.pdf18); |
1660 |
break; |
1661 |
case "MarkupLink": |
1662 |
bitmap = new Bitmap(Properties.Resources.markus18); |
1663 |
break; |
1664 |
case "AVEVALink": |
1665 |
bitmap = new Bitmap(Properties.Resources.aveva_net18); |
1666 |
break; |
1667 |
case "ID2Connection": |
1668 |
bitmap = new Bitmap(Properties.Resources.id218); |
1669 |
break; |
1670 |
case "Compare": |
1671 |
bitmap = new Bitmap(Properties.Resources.compare18); |
1672 |
break; |
1673 |
} |
1674 |
|
1675 |
switch (colName) |
1676 |
{ |
1677 |
case "AutoCADLink": |
1678 |
case "PDFLink": |
1679 |
case "MarkupLink": |
1680 |
case "AVEVALink": |
1681 |
case "ID2Connection": |
1682 |
case "Compare": |
1683 |
btnElem = (RadButtonElement)elem; |
1684 |
btnElem.Margin = new Padding(0); |
1685 |
btnElem.Padding = new Padding(0); |
1686 |
btnElem.BorderElement.Opacity = 0; |
1687 |
btnElem.Alignment = ContentAlignment.MiddleCenter; |
1688 |
btnElem.DisplayStyle = DisplayStyle.Image; |
1689 |
btnElem.Image = bitmap; |
1690 |
btnElem.ImageAlignment = ContentAlignment.MiddleCenter; |
1691 |
btnElem.MaxSize = bitmap.Size; |
1692 |
break; |
1693 |
} |
1694 |
|
1695 |
return btnElem; |
1696 |
} |
1697 |
|
1698 |
private void RadGridViewDocuments_FilterChanged(object sender, GridViewCollectionChangedEventArgs e) |
1699 |
{ |
1700 |
this.lbSelectAndTotal.Text = $"{e.GridViewTemplate.DataView.Count} / {this.TotalCount} (Selected / Total)"; |
1701 |
} |
1702 |
#endregion |
1703 |
|
1704 |
#region Excel |
1705 |
private UserInfo GetUser(string user) |
1706 |
{ |
1707 |
UserInfo userInfo = informations.UserList.Where(x => x.ID.Equals(user)).FirstOrDefault(); |
1708 |
if (userInfo != null) return userInfo; |
1709 |
|
1710 |
userInfo = informations.UserList.Where(x => x.Name.Equals(user)).FirstOrDefault(); |
1711 |
if (userInfo != null) return userInfo; |
1712 |
|
1713 |
return userInfo ?? new UserInfo(); |
1714 |
} |
1715 |
|
1716 |
private ProjectInfo GetProject(string project) |
1717 |
{ |
1718 |
ProjectInfo prjInfo = informations.ProjectList.Where(x => x.ProjectID.Equals(project)).FirstOrDefault(); |
1719 |
if (prjInfo != null) return prjInfo; |
1720 |
|
1721 |
prjInfo = informations.ProjectList.FirstOrDefault(x => x.Name.Equals(project)); |
1722 |
if (prjInfo != null) return prjInfo; |
1723 |
|
1724 |
return prjInfo ?? new ProjectInfo(); |
1725 |
} |
1726 |
|
1727 |
private void RadButtonElementExcelImport_Click(object sender, EventArgs e) |
1728 |
{ |
1729 |
var form = new Forms.SelectExcelData(); |
1730 |
|
1731 |
var dialogResult = form.ShowDialog(); |
1732 |
|
1733 |
if (dialogResult == DialogResult.OK) |
1734 |
{ |
1735 |
using (ID2Excel excel = new ID2Excel(informations.UserList.ToList())) |
1736 |
{ |
1737 |
var result = excel.ExcelDataImport(form.SelectItems); |
1738 |
|
1739 |
if (result.Error != null) |
1740 |
{ |
1741 |
|
1742 |
RadMessageBox.Show(result.Error, "Information", MessageBoxButtons.OK, RadMessageIcon.Info); |
1743 |
} |
1744 |
else |
1745 |
{ |
1746 |
this.importImages = result.Images; |
1747 |
this.documents.AddRange(result.documents); |
1748 |
if (this.orgDocuments == null) this.orgDocuments = new List<Documents>(); |
1749 |
this.DocumentListBinding(); |
1750 |
//briefAndImagesReview.SetImages(this.importImages); |
1751 |
} |
1752 |
|
1753 |
} |
1754 |
} |
1755 |
} |
1756 |
|
1757 |
private void RadButtonElementExcelImport_Click_gembox(object sender, EventArgs e) |
1758 |
{ |
1759 |
using (OpenFileDialog ofd = new OpenFileDialog() |
1760 |
{ |
1761 |
Filter = "Excel files (*.xlsx)|*.xlsx", |
1762 |
Title = "Open an Excel File", |
1763 |
RestoreDirectory = true |
1764 |
}) |
1765 |
{ |
1766 |
if (ofd.ShowDialog() == DialogResult.OK) |
1767 |
{ |
1768 |
//Error Message |
1769 |
StringBuilder sbErrMsg = new StringBuilder(); |
1770 |
|
1771 |
using(ID2Excel excel = new ID2Excel(informations.UserList.ToList())) |
1772 |
{ |
1773 |
var result = excel.GemboxImport(ofd.FileName); |
1774 |
|
1775 |
if(result.Error != null) |
1776 |
{ |
1777 |
|
1778 |
RadMessageBox.Show(result.Error, "Information", MessageBoxButtons.OK, RadMessageIcon.Info); |
1779 |
} |
1780 |
else |
1781 |
{ |
1782 |
this.documents.AddRange(result.documents); |
1783 |
if (this.orgDocuments == null) this.orgDocuments = new List<Documents>(); |
1784 |
this.DocumentListBinding(); |
1785 |
} |
1786 |
|
1787 |
} |
1788 |
|
1789 |
|
1790 |
//foreach (Documents appDoc in appendDocuments) |
1791 |
//{ |
1792 |
// GridViewRowInfo rowInfo = this.radGridViewDocuments.Rows.AddNew(); |
1793 |
|
1794 |
// foreach (FieldInfo fieldInfo in appDoc.GetType().GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)) |
1795 |
// { |
1796 |
// if (fieldInfo.GetValue(appDoc) != null) |
1797 |
// { |
1798 |
// var cols = rowInfo.Cells.Where(x => fieldInfo.Name.Contains($"<{x.ColumnInfo.Name}>")); |
1799 |
|
1800 |
// if (cols.Any()) |
1801 |
// { |
1802 |
// cols.FirstOrDefault().Value = fieldInfo.GetValue(appDoc); |
1803 |
// } |
1804 |
// } |
1805 |
// } |
1806 |
//} |
1807 |
} |
1808 |
} |
1809 |
} |
1810 |
|
1811 |
private void RadButtonElementExcelExport_Click(object sender, EventArgs e) |
1812 |
{ |
1813 |
string sPrefixName = "Samsung Elec Task Management"; |
1814 |
string extension = ".xlsx"; |
1815 |
|
1816 |
using (SaveFileDialog sfd = new SaveFileDialog() |
1817 |
{ |
1818 |
FileName = $"{sPrefixName}_{DateTime.Now:yyyyMMddhhmmss}{extension}", |
1819 |
Filter = "Excel|*.xlsx", |
1820 |
Title = "Save an Excel File", |
1821 |
CheckFileExists = false, |
1822 |
CheckPathExists = true, |
1823 |
OverwritePrompt = true |
1824 |
}) |
1825 |
{ |
1826 |
if (sfd.ShowDialog() == DialogResult.OK) |
1827 |
{ |
1828 |
string fileName = $"{sPrefixName}{extension}"; |
1829 |
string templateFolder = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "Template"); |
1830 |
string templateFilePath = Path.Combine(templateFolder, fileName); |
1831 |
if (!File.Exists(templateFilePath)) |
1832 |
{ |
1833 |
RadMessageBox.Show(this, $"There is no {fileName} in {templateFolder}", "Error", MessageBoxButtons.OK, RadMessageIcon.Error); |
1834 |
return; |
1835 |
} |
1836 |
|
1837 |
var templateExcelFile = ExcelFile.Load(templateFilePath); |
1838 |
var templateWorksheets = templateExcelFile.Worksheets; |
1839 |
var templateWorksheet = templateWorksheets[0]; |
1840 |
|
1841 |
if (this.radGridViewDocuments.Rows.Count > 0) |
1842 |
{ |
1843 |
int rowIndex = 9; |
1844 |
//int colIndex = 1; |
1845 |
int rowNo = 1; |
1846 |
|
1847 |
foreach (var row in this.radGridViewDocuments.Rows) |
1848 |
{ |
1849 |
var doc = row.DataBoundItem as Documents; |
1850 |
|
1851 |
templateWorksheet.Cells[rowIndex, 0].Value = rowNo++; |
1852 |
|
1853 |
templateWorksheet.Cells[rowIndex, 7].Value = doc.RefProjectCode; |
1854 |
templateWorksheet.Cells[rowIndex, 8].Value = doc.System; |
1855 |
templateWorksheet.Cells[rowIndex, 9].Value = doc.SubSystemCode; |
1856 |
templateWorksheet.Cells[rowIndex, 10].Value = doc.DocumentNo; |
1857 |
templateWorksheet.Cells[rowIndex, 11].Value = this.GetUser(doc.PersonInCharge).Name; |
1858 |
templateWorksheet.Cells[rowIndex, 12].Value = this.GetUser(doc.Worker).Name; |
1859 |
templateWorksheet.Cells[rowIndex, 13].Value = this.GetUser(doc.AVEVAPersonInCharge).Name; |
1860 |
templateWorksheet.Cells[rowIndex, 14].Value = this.GetUser(doc.AVEVAWorker).Name; |
1861 |
templateWorksheet.Cells[rowIndex, 15].Value = doc.JobLevel; |
1862 |
templateWorksheet.Cells[rowIndex, 16].Value = doc.RevisonNo; |
1863 |
templateWorksheet.Cells[rowIndex, 17].Value = doc.ToIsDiscussion; |
1864 |
templateWorksheet.Cells[rowIndex, 18].Value = doc.ToRemarks; |
1865 |
templateWorksheet.Cells[rowIndex, 19].Value = this.GetUser(doc.ToCreator).Name; |
1866 |
//toreview-20 |
1867 |
templateWorksheet.Cells[rowIndex, 21].Value = doc.FrReviewStatus; |
1868 |
templateWorksheet.Cells[rowIndex, 22].Value = doc.FrRemarks; |
1869 |
templateWorksheet.Cells[rowIndex, 23].Value = this.GetUser(doc.FrCreator).Name; |
1870 |
//frreview-24 |
1871 |
templateWorksheet.Cells[rowIndex, 25].Value = $"{doc.ID2StartDate:yyyy/MM/dd hh:mm:ss}"; |
1872 |
templateWorksheet.Cells[rowIndex, 26].Value = $"{doc.ID2EndDate:yyyy/MM/dd hh:mm:ss}"; |
1873 |
templateWorksheet.Cells[rowIndex, 27].Value = doc.ID2Status; |
1874 |
templateWorksheet.Cells[rowIndex, 28].Value = doc.ID2Issues; |
1875 |
//id2work-29 |
1876 |
templateWorksheet.Cells[rowIndex, 30].Value = doc.ReplyModifications; |
1877 |
templateWorksheet.Cells[rowIndex, 31].Value = this.GetUser(doc.ReplyRequester).Name; |
1878 |
templateWorksheet.Cells[rowIndex, 32].Value = doc.IsConvert; |
1879 |
templateWorksheet.Cells[rowIndex, 33].Value = $"{doc.AVEVAConvertDate:yyyy/MM/dd}"; |
1880 |
templateWorksheet.Cells[rowIndex, 34].Value = $"{doc.AVEVAWorkDate:yyyy/MM/dd}"; |
1881 |
templateWorksheet.Cells[rowIndex, 35].Value = doc.AVEVAStatus; |
1882 |
templateWorksheet.Cells[rowIndex, 36].Value = doc.AVEVAIssues; |
1883 |
templateWorksheet.Cells[rowIndex, 37].Value = $"{doc.AVEVAReviewDate:yyyy/MM/dd}"; |
1884 |
templateWorksheet.Cells[rowIndex, 38].Value = this.GetUser(doc.ProdReviewer).Name; |
1885 |
templateWorksheet.Cells[rowIndex, 39].Value = doc.ProdIsResult; |
1886 |
templateWorksheet.Cells[rowIndex, 40].Value = doc.ProdRemarks; |
1887 |
templateWorksheet.Cells[rowIndex, 41].Value = this.GetUser(doc.ClientReviewer).Name; |
1888 |
templateWorksheet.Cells[rowIndex, 42].Value = doc.ClientIsResult; |
1889 |
templateWorksheet.Cells[rowIndex, 43].Value = doc.ClientRemarks; |
1890 |
templateWorksheet.Cells[rowIndex, 44].Value = doc.DTIsGateWay; |
1891 |
templateWorksheet.Cells[rowIndex, 45].Value = doc.DTIsImport; |
1892 |
templateWorksheet.Cells[rowIndex, 46].Value = doc.DTIsRegSystem; |
1893 |
templateWorksheet.Cells[rowIndex, 47].Value = doc.DTRemarks; |
1894 |
|
1895 |
/* |
1896 |
templateWorksheet.Cells[rowIndex, 0].Value = doc.Seq; |
1897 |
//templateWorksheet.Cells[rowIndex, 1].Value = doc.DocumentNo; |
1898 |
//templateWorksheet.Cells[rowIndex, 2].Value = doc.DocumentNo; |
1899 |
//templateWorksheet.Cells[rowIndex, 3].Value = doc.DocumentNo; |
1900 |
//templateWorksheet.Cells[rowIndex, 4].Value = doc.DocumentNo; |
1901 |
templateWorksheet.Cells[rowIndex, 5].Value = doc.RefProjectCode; |
1902 |
templateWorksheet.Cells[rowIndex, 6].Value = doc.DocumentNo; |
1903 |
templateWorksheet.Cells[rowIndex, 7].Value = this.GetUser(doc.PersonInCharge).Name; |
1904 |
templateWorksheet.Cells[rowIndex, 8].Value = doc.JobLevel; |
1905 |
//templateWorksheet.Cells[rowIndex, 9].Value = doc.IsTypical; |
1906 |
templateWorksheet.Cells[rowIndex, 10].Value = doc.RevisonNo; |
1907 |
templateWorksheet.Cells[rowIndex, 11].Value = doc.ToIsDiscussion; |
1908 |
templateWorksheet.Cells[rowIndex, 12].Value = doc.ToRemarks; |
1909 |
templateWorksheet.Cells[rowIndex, 13].Value = this.GetUser(doc.ToCreator).Name; |
1910 |
//templateWorksheet.Cells[rowIndex, 14].Value = doc.ToCapture; |
1911 |
//templateWorksheet.Cells[rowIndex, 15].Value = doc.ToIsMarkup; |
1912 |
templateWorksheet.Cells[rowIndex, 16].Value = doc.FrReviewStatus; |
1913 |
templateWorksheet.Cells[rowIndex, 17].Value = doc.FrRemarks; |
1914 |
templateWorksheet.Cells[rowIndex, 18].Value = this.GetUser(doc.FrCreator).Name; |
1915 |
//templateWorksheet.Cells[rowIndex, 19].Value = doc.FrCapture; |
1916 |
//templateWorksheet.Cells[rowIndex, 20].Value = doc.FrIsMarkup; |
1917 |
//templateWorksheet.Cells[rowIndex, 21].Value = doc.IsID2Work; |
1918 |
//templateWorksheet.Cells[rowIndex, 22].Value = doc.ID2Connection; |
1919 |
templateWorksheet.Cells[rowIndex, 23].Value = $"{doc.ID2StartDate:yyyy/MM/dd hh:mm:ss}"; |
1920 |
templateWorksheet.Cells[rowIndex, 24].Value = $"{doc.ID2EndDate:yyyy/MM/dd hh:mm:ss}"; |
1921 |
//templateWorksheet.Cells[rowIndex, 25].Value = doc.ID2JobTime; |
1922 |
templateWorksheet.Cells[rowIndex, 26].Value = doc.ID2Status; |
1923 |
templateWorksheet.Cells[rowIndex, 27].Value = doc.ID2Issues; |
1924 |
//templateWorksheet.Cells[rowIndex, 28].Value = doc.AVEVAConnection; |
1925 |
templateWorksheet.Cells[rowIndex, 29].Value = $"{doc.AVEVAConvertDate:yyyy/MM/dd}"; |
1926 |
templateWorksheet.Cells[rowIndex, 30].Value = $"{doc.AVEVAReviewDate:yyyy/MM/dd}"; |
1927 |
//추가필요templateWorksheet.Cells[rowIndex, 30].Value = $"{doc.AVEVAWorkDate:yyyy/MM/dd}"; |
1928 |
templateWorksheet.Cells[rowIndex, 31].Value = doc.AVEVAStatus; |
1929 |
templateWorksheet.Cells[rowIndex, 32].Value = doc.AVEVAIssues; |
1930 |
//templateWorksheet.Cells[rowIndex, 33].Value = doc.DocumentNo; |
1931 |
//templateWorksheet.Cells[rowIndex, 34].Value = doc.DocumentNo; |
1932 |
templateWorksheet.Cells[rowIndex, 35].Value = this.GetUser(doc.ProdReviewer).Name; |
1933 |
templateWorksheet.Cells[rowIndex, 36].Value = doc.ProdIsResult; |
1934 |
templateWorksheet.Cells[rowIndex, 37].Value = doc.ProdRemarks; |
1935 |
templateWorksheet.Cells[rowIndex, 38].Value = this.GetUser(doc.ClientReviewer).Name; |
1936 |
templateWorksheet.Cells[rowIndex, 39].Value = doc.ClientIsResult; |
1937 |
templateWorksheet.Cells[rowIndex, 40].Value = doc.ClientRemarks; |
1938 |
templateWorksheet.Cells[rowIndex, 41].Value = doc.DTIsGateWay; |
1939 |
templateWorksheet.Cells[rowIndex, 42].Value = doc.DTIsImport; |
1940 |
templateWorksheet.Cells[rowIndex, 43].Value = doc.DTIsRegSystem; |
1941 |
templateWorksheet.Cells[rowIndex, 44].Value = doc.DTRemarks; |
1942 |
*/ |
1943 |
rowIndex++; |
1944 |
} |
1945 |
} |
1946 |
templateExcelFile.Save(sfd.FileName); |
1947 |
RadMessageBox.Show("Exporting 'ID2 Document List' is complete", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info); |
1948 |
} |
1949 |
} |
1950 |
} |
1951 |
#endregion |
1952 |
|
1953 |
#region Save event |
1954 |
|
1955 |
private void SetSaved() |
1956 |
{ |
1957 |
try |
1958 |
{ |
1959 |
if (RadMessageBox.Show("Do you want to Save?", Globals.Name, MessageBoxButtons.YesNo, RadMessageIcon.Question) == DialogResult.Yes) |
1960 |
{ |
1961 |
#region document no 중복 유효성 체크 |
1962 |
int dupDwgNoCount = 0; |
1963 |
List<string> newDwgNos = this.documents.Where(x => string.IsNullOrEmpty(x.DocID)).Select(x => x.DocumentNo).ToList(); |
1964 |
if (newDwgNos.Count > 0) |
1965 |
{ |
1966 |
dupDwgNoCount = new DocumentController().ExistsDocument(informations.ActiveProject.ProjectID, newDwgNos); |
1967 |
} |
1968 |
|
1969 |
if (dupDwgNoCount > 0) |
1970 |
{ |
1971 |
RadMessageBox.Show($"Duplicate Dwg No exists.({dupDwgNoCount})", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info); |
1972 |
return; |
1973 |
} |
1974 |
#endregion |
1975 |
|
1976 |
var worker = new SetDocumentsWorker(this.documents, this.orgDocuments, this.radGridViewDocuments); |
1977 |
worker.OnWorkCompletedHandler += (e) => |
1978 |
{ |
1979 |
bool result = false; |
1980 |
bool markusResult = false; |
1981 |
bool markusMembersResult = false; |
1982 |
|
1983 |
result = (bool)e.Result; |
1984 |
if (result) |
1985 |
{ |
1986 |
markusResult = new MarkusInfoController().SetProperties(Program.informations.ProjectList.Where(x => x.Level == 2).Select(x=>x.Name)); |
1987 |
markusResult = new MarkusInfoController().SetMarkusInfo(this.documents); |
1988 |
markusMembersResult = new MarkusInfoController().SetMembers(informations.UserList); |
1989 |
//informations.ProjectList.Where(x => x.Level.Equals(2)); <- ID2 Manager에 저장 된 전체 프로젝트 리스트 |
1990 |
} |
1991 |
|
1992 |
if (result && markusResult && markusMembersResult) |
1993 |
{ |
1994 |
RadMessageBox.Show("Save is complete", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info); |
1995 |
|
1996 |
this.GetDocList(); |
1997 |
} |
1998 |
else if (!result) |
1999 |
{ |
2000 |
RadMessageBox.Show("Save is not complete", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error); |
2001 |
} |
2002 |
else if (!markusResult) |
2003 |
{ |
2004 |
RadMessageBox.Show("Markus Data Save is not complete", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error); |
2005 |
} |
2006 |
else if (!markusMembersResult) |
2007 |
{ |
2008 |
RadMessageBox.Show("Markus Members Save is not complete", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error); |
2009 |
} |
2010 |
}; |
2011 |
worker.StartWork(); |
2012 |
} |
2013 |
} |
2014 |
catch (Exception ex) |
2015 |
{ |
2016 |
throw ex; |
2017 |
} |
2018 |
} |
2019 |
|
2020 |
private void RadButtonElementSaveCommand_Click(object sender, EventArgs e) |
2021 |
{ |
2022 |
try |
2023 |
{ |
2024 |
this.SetSaved(); |
2025 |
} |
2026 |
catch (Exception ex) |
2027 |
{ |
2028 |
Program.logger.Error($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex); |
2029 |
RadMessageBox.Show("DWG save failed.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error); |
2030 |
} |
2031 |
} |
2032 |
|
2033 |
private void RadButtonElementSave_Click(object sender, EventArgs e) |
2034 |
{ |
2035 |
try |
2036 |
{ |
2037 |
this.SetSaved(); |
2038 |
} |
2039 |
catch (Exception ex) |
2040 |
{ |
2041 |
Program.logger.Error($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex); |
2042 |
RadMessageBox.Show("DWG save failed.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error); |
2043 |
} |
2044 |
} |
2045 |
|
2046 |
private void RadButtonElementSync_Click(object sender, EventArgs e) |
2047 |
{ |
2048 |
try |
2049 |
{ |
2050 |
if (RadMessageBox.Show("Do you want to ID2 Sync?", Globals.Name, MessageBoxButtons.YesNo, RadMessageIcon.Question) == DialogResult.Yes) |
2051 |
{ |
2052 |
var worker = new SyncDocumentsWorker(this.radGridViewDocuments); |
2053 |
worker.OnWorkCompletedHandler += (arg) => |
2054 |
{ |
2055 |
if ((bool)arg.Result) |
2056 |
{ |
2057 |
this.GetDocList(); |
2058 |
|
2059 |
RadMessageBox.Show("Sync with ID2 completed.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info); |
2060 |
} |
2061 |
}; |
2062 |
worker.StartWork(); |
2063 |
} |
2064 |
} |
2065 |
catch (Exception ex) |
2066 |
{ |
2067 |
Program.logger.Error($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex); |
2068 |
RadMessageBox.Show("Failed to sync with id2.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error); |
2069 |
} |
2070 |
} |
2071 |
|
2072 |
private void RadButtonElementNotice_Click(object sender, EventArgs e) |
2073 |
{ |
2074 |
try |
2075 |
{ |
2076 |
AttFileInfo notiFileInfo = new AttFileController().GetAttFileInfo(informations.ActiveProject.ProjectID, "notice"); |
2077 |
|
2078 |
if (notiFileInfo == null) |
2079 |
{ |
2080 |
RadMessageBox.Show("No notice.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info); |
2081 |
} |
2082 |
else |
2083 |
{ |
2084 |
string noticePath = Path.Combine(Globals.ProgramDataFolder, "NoticeFiles"); |
2085 |
string noticeFileFullName = Path.Combine(noticePath, $"{notiFileInfo.FileID}{notiFileInfo.FileExtension}"); |
2086 |
|
2087 |
FileInfo finfo = new FileInfo(noticeFileFullName); |
2088 |
|
2089 |
if (!finfo.Directory.Exists) |
2090 |
{ |
2091 |
Directory.CreateDirectory(noticePath); |
2092 |
} |
2093 |
|
2094 |
if (!finfo.Exists) |
2095 |
{ |
2096 |
var arrayBinary = notiFileInfo.FileData.ToArray(); |
2097 |
|
2098 |
using (MemoryStream ms = new MemoryStream(arrayBinary)) |
2099 |
{ |
2100 |
ms.Write(arrayBinary, 0, arrayBinary.Length); |
2101 |
ms.Seek(0, SeekOrigin.Begin); |
2102 |
|
2103 |
using (FileStream fs = finfo.Create()) |
2104 |
{ |
2105 |
ms.CopyTo(fs); |
2106 |
} |
2107 |
} |
2108 |
} |
2109 |
|
2110 |
try |
2111 |
{ |
2112 |
ProcessStartInfo startInfo = new ProcessStartInfo |
2113 |
{ |
2114 |
FileName = finfo.FullName, |
2115 |
UseShellExecute = true, |
2116 |
CreateNoWindow = false, |
2117 |
WindowStyle = ProcessWindowStyle.Normal |
2118 |
}; |
2119 |
|
2120 |
using (Process process = new Process()) |
2121 |
{ |
2122 |
process.StartInfo = startInfo; |
2123 |
process.Start(); |
2124 |
} |
2125 |
//Process.Start(finfo.FullName); |
2126 |
} |
2127 |
catch (Exception ex) |
2128 |
{ |
2129 |
throw ex; |
2130 |
} |
2131 |
|
2132 |
//using (MemoryStream ms = new MemoryStream(arrayBinary)) |
2133 |
//{ |
2134 |
// ProcessStartInfo startInfo = new ProcessStartInfo |
2135 |
// { |
2136 |
// FileName = Path.Combine(attFileInfo.FilePath, attFileInfo.FileName), |
2137 |
// RedirectStandardInput = true, |
2138 |
// UseShellExecute = false, |
2139 |
// CreateNoWindow = true, |
2140 |
// WindowStyle = ProcessWindowStyle.Hidden |
2141 |
// }; |
2142 |
|
2143 |
// using (Process process = new Process()) |
2144 |
// { |
2145 |
// process.StartInfo = startInfo; |
2146 |
// process.Start(); |
2147 |
|
2148 |
// // Write the memory stream contents to the process standard input |
2149 |
// byte[] buffer = ms.ToArray(); |
2150 |
// process.StandardInput.BaseStream.Write(buffer, 0, buffer.Length); |
2151 |
// process.StandardInput.Close(); |
2152 |
|
2153 |
// process.WaitForExit(); |
2154 |
// } |
2155 |
//} |
2156 |
} |
2157 |
} |
2158 |
catch (Exception ex) |
2159 |
{ |
2160 |
Program.logger.Error($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex); |
2161 |
RadMessageBox.Show("Notification lookup failed.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error); |
2162 |
} |
2163 |
} |
2164 |
|
2165 |
private void RadButtonElementNoticeUpload_Click(object sender, EventArgs e) |
2166 |
{ |
2167 |
string GetContentType(string filePath) |
2168 |
{ |
2169 |
string extension = Path.GetExtension(filePath).ToLower(); |
2170 |
|
2171 |
switch (extension) |
2172 |
{ |
2173 |
case ".txt": |
2174 |
return "text/plain"; |
2175 |
case ".pdf": |
2176 |
return "application/pdf"; |
2177 |
case ".jpg": |
2178 |
case ".jpeg": |
2179 |
return "image/jpeg"; |
2180 |
case ".png": |
2181 |
return "image/png"; |
2182 |
case ".bmp": |
2183 |
return "image/bmp"; |
2184 |
case ".gif": |
2185 |
return "image/gif"; |
2186 |
default: |
2187 |
return "application/octet-stream"; |
2188 |
} |
2189 |
} |
2190 |
|
2191 |
using (OpenFileDialog ofd = new OpenFileDialog() |
2192 |
{ |
2193 |
//Filter = "PDF files (*.pdf)|*.pdf|All files (*.*)|*.*", |
2194 |
Filter = "All Images Files (*.png;*.jpeg;*.gif;*.jpg;*.bmp)|*.png;*.jpeg;*.gif;*.jpg;*.bmp" |
2195 |
+ "|PNG Portable Network Graphics (*.png)|*.png" |
2196 |
+"|JPEG File Interchange Format (*.jpg *.jpeg *jfif)|*.jpg;*.jpeg;*.jfif" |
2197 |
+ "|BMP Windows Bitmap (*.bmp)|*.bmp" |
2198 |
+ "|GIF Graphics Interchange Format (*.gif)|*.gif", |
2199 |
//Title = "Open an Excel File", |
2200 |
RestoreDirectory = true |
2201 |
}) |
2202 |
{ |
2203 |
try |
2204 |
{ |
2205 |
if (ofd.ShowDialog() == DialogResult.OK) |
2206 |
{ |
2207 |
FileInfo fileInfo = new FileInfo(ofd.FileName); |
2208 |
if (fileInfo.Exists) |
2209 |
{ |
2210 |
AttFileInfo attFile = new AttFileInfo() |
2211 |
{ |
2212 |
RefID = informations.ActiveProject.ProjectID, |
2213 |
Category = "notice", |
2214 |
FileType = GetContentType(fileInfo.FullName), |
2215 |
FileName = fileInfo.Name, |
2216 |
FilePath = fileInfo.DirectoryName, |
2217 |
FileExtension = fileInfo.Extension |
2218 |
}; |
2219 |
|
2220 |
using (var stream = new FileStream(ofd.FileName, FileMode.Open, FileAccess.Read)) |
2221 |
{ |
2222 |
using (var reader = new BinaryReader(stream)) |
2223 |
{ |
2224 |
attFile.FileData = reader.ReadBytes((int)stream.Length); |
2225 |
} |
2226 |
} |
2227 |
|
2228 |
bool result = new AttFileController().SetAttFiles(new List<AttFileInfo>() { attFile }, informations.ActiveUser.ID); |
2229 |
|
2230 |
if (result) |
2231 |
{ |
2232 |
RadMessageBox.Show("An Notice has been posted.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info); |
2233 |
} |
2234 |
} |
2235 |
} |
2236 |
} |
2237 |
catch (Exception ex) |
2238 |
{ |
2239 |
Program.logger.Error($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex); |
2240 |
RadMessageBox.Show("Failed to register the Notice.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error); |
2241 |
} |
2242 |
} |
2243 |
} |
2244 |
|
2245 |
private void RadButtonElementRefreshCommand_Click(object sender, EventArgs e) |
2246 |
{ |
2247 |
bool isReload = false; |
2248 |
|
2249 |
try |
2250 |
{ |
2251 |
if (RadMessageBox.Show($"Do you want to reload the project?", Globals.Name, MessageBoxButtons.YesNo, RadMessageIcon.Question) == DialogResult.Yes) |
2252 |
{ |
2253 |
if (informations.ActiveUser != null && !string.IsNullOrEmpty(informations.ActiveUser.RefProjectID)) |
2254 |
{ |
2255 |
informations.ActiveProject = new ProjectController().GetProjectInfo(informations.ActiveUser.RefProjectID); |
2256 |
informations.ProjectList = new ProjectController().GetAllProjectList().ToList(); |
2257 |
|
2258 |
isReload = true; |
2259 |
} |
2260 |
else if (informations.ActiveProject != null) |
2261 |
{ |
2262 |
informations.ProjectList = new ProjectController().GetAllProjectList().ToList(); |
2263 |
|
2264 |
isReload = true; |
2265 |
} |
2266 |
else |
2267 |
{ |
2268 |
RadMessageBox.Show("Select a project.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info); |
2269 |
this.radRibbonBarBackstageViewID2Manager.ShowPopup(this.GetBackstageLocation(), this.ID2ManagerRadRibbonBar.RibbonBarElement); |
2270 |
} |
2271 |
} |
2272 |
|
2273 |
if (isReload) |
2274 |
{ |
2275 |
this.LoadProject(); |
2276 |
} |
2277 |
} |
2278 |
catch (Exception ex) |
2279 |
{ |
2280 |
Program.logger.Error($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex); |
2281 |
RadMessageBox.Show("Failed to reload the project.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error); |
2282 |
} |
2283 |
} |
2284 |
#endregion |
2285 |
|
2286 |
#region ColumnGroup |
2287 |
private void InitColumnGroupsViewDefinition(RadGridView gridView) |
2288 |
{ |
2289 |
ColumnGroupsViewDefinition columnGroupsView = new ColumnGroupsViewDefinition(); |
2290 |
|
2291 |
List<string> docLinkColNames = new List<string>() { "AutoCADLink", "ID2Connection", "PDFLink", "MarkupLink", "AVEVALink", "Compare" }; |
2292 |
List<string> docInfoColNames = new List<string>() { "RefProjectCode", "System", "SubSystemCode", "DocumentNo", "PersonInCharge", "Worker", "AVEVAPersonInCharge", "AVEVAWorker", "JobLevel", "RevisonNo" }; |
2293 |
List<string> rvToColNames = new List<string>() { "ToIsDiscussion", "ToRemarks", "ToCreator", "ToCapture" }; |
2294 |
List<string> rvFrColNames = new List<string>() { "FrReviewStatus", "FrRemarks", "FrCreator", "FrCapture" }; |
2295 |
List<string> wkID2ColNames = new List<string>() { "ID2StartDate", "ID2EndDate", "ID2Status", "ID2Issues", "ID2Capture", "ReplyModifications", "ReplyRequester" }; |
2296 |
List<string> wkAVEVAColNames = new List<string>() { "IsConvert", "AVEVAConvertDate", "AVEVAWorkDate", "AVEVAStatus", "AVEVAIssues" }; |
2297 |
List<string> valProdColNames = new List<string>() { "AVEVAReviewDate", "ProdReviewer", "ProdIsResult", "ProdRemarks" }; |
2298 |
List<string> valCntColNames = new List<string>() { "ClientReviewer", "ClientIsResult", "ClientRemarks" }; |
2299 |
List<string> dtColNames = new List<string>() { "DTIsGateWay", "DTIsImport", "DTIsRegSystem", "DTRemarks" }; |
2300 |
|
2301 |
//도면 |
2302 |
GridViewColumnGroup docColGrp = new GridViewColumnGroup("도면 "); |
2303 |
GridViewColumnGroup docLinkColGrp = new GridViewColumnGroup("프로그램 연동"); |
2304 |
GridViewColumnGroup docInfoColGrp = new GridViewColumnGroup("도면정보"); |
2305 |
|
2306 |
GridViewColumnGroupRow docLinkColGrpRow = new GridViewColumnGroupRow(); |
2307 |
docLinkColGrpRow.ColumnNames.AddRange(docLinkColNames); |
2308 |
|
2309 |
GridViewColumnGroupRow docInfoColGrpRow = new GridViewColumnGroupRow(); |
2310 |
docInfoColGrpRow.ColumnNames.AddRange(docInfoColNames); |
2311 |
|
2312 |
docLinkColGrp.Rows.Add(docLinkColGrpRow); |
2313 |
docColGrp.Groups.Add(docLinkColGrp); |
2314 |
docInfoColGrp.Rows.Add(docInfoColGrpRow); |
2315 |
docColGrp.Groups.Add(docInfoColGrp); |
2316 |
|
2317 |
//검토 |
2318 |
GridViewColumnGroup rvColGrp = new GridViewColumnGroup("검토", "review"); |
2319 |
GridViewColumnGroup rvToColGrp = new GridViewColumnGroup("도프텍"); |
2320 |
GridViewColumnGroup rvFrColGrp = new GridViewColumnGroup("삼성"); |
2321 |
|
2322 |
GridViewColumnGroupRow rvToColGrpRow = new GridViewColumnGroupRow(); |
2323 |
rvToColGrpRow.ColumnNames.AddRange(rvToColNames); |
2324 |
|
2325 |
GridViewColumnGroupRow rvFrColGrpRow = new GridViewColumnGroupRow(); |
2326 |
rvFrColGrpRow.ColumnNames.AddRange(rvFrColNames); |
2327 |
|
2328 |
rvToColGrp.Rows.Add(rvToColGrpRow); |
2329 |
rvFrColGrp.Rows.Add(rvFrColGrpRow); |
2330 |
|
2331 |
rvColGrp.Groups.Add(rvToColGrp); |
2332 |
rvColGrp.Groups.Add(rvFrColGrp); |
2333 |
|
2334 |
//작업 |
2335 |
GridViewColumnGroup wkColGrp = new GridViewColumnGroup("작업", "work"); |
2336 |
GridViewColumnGroup wkID2ColGrp = new GridViewColumnGroup("ID2"); |
2337 |
GridViewColumnGroup wkAVEVAColGrp = new GridViewColumnGroup("AVEVA"); |
2338 |
|
2339 |
GridViewColumnGroupRow wkID2ColGrpRow = new GridViewColumnGroupRow(); |
2340 |
wkID2ColGrpRow.ColumnNames.AddRange(wkID2ColNames); |
2341 |
|
2342 |
GridViewColumnGroupRow wkAVEVAColGrpRow = new GridViewColumnGroupRow(); |
2343 |
wkAVEVAColGrpRow.ColumnNames.AddRange(wkAVEVAColNames); |
2344 |
|
2345 |
wkID2ColGrp.Rows.Add(wkID2ColGrpRow); |
2346 |
wkAVEVAColGrp.Rows.Add(wkAVEVAColGrpRow); |
2347 |
|
2348 |
wkColGrp.Groups.Add(wkID2ColGrp); |
2349 |
wkColGrp.Groups.Add(wkAVEVAColGrp); |
2350 |
|
2351 |
//Validation |
2352 |
GridViewColumnGroup valColGrp = new GridViewColumnGroup("Validation", "validation"); |
2353 |
GridViewColumnGroup valProdColGrp = new GridViewColumnGroup("도프텍"); |
2354 |
GridViewColumnGroup valCntColGrp = new GridViewColumnGroup("삼성전자"); |
2355 |
|
2356 |
GridViewColumnGroupRow valProdColGrpRow = new GridViewColumnGroupRow(); |
2357 |
valProdColGrpRow.ColumnNames.AddRange(valProdColNames); |
2358 |
|
2359 |
GridViewColumnGroupRow valCntColGrpRow = new GridViewColumnGroupRow(); |
2360 |
valCntColGrpRow.ColumnNames.AddRange(valCntColNames); |
2361 |
|
2362 |
valProdColGrp.Rows.Add(valProdColGrpRow); |
2363 |
valCntColGrp.Rows.Add(valCntColGrpRow); |
2364 |
|
2365 |
valColGrp.Groups.Add(valProdColGrp); |
2366 |
valColGrp.Groups.Add(valCntColGrp); |
2367 |
|
2368 |
//AVEVA Net |
2369 |
GridViewColumnGroup dtColGrp = new GridViewColumnGroup("AVEVA Net\n(Digital Twin)", "avevanet"); |
2370 |
|
2371 |
GridViewColumnGroupRow dtColGrpRow = new GridViewColumnGroupRow(); |
2372 |
dtColGrpRow.ColumnNames.AddRange(dtColNames); |
2373 |
|
2374 |
dtColGrp.Rows.Add(dtColGrpRow); |
2375 |
|
2376 |
//Group 추가 |
2377 |
columnGroupsView.ColumnGroups.Add(docColGrp); |
2378 |
columnGroupsView.ColumnGroups.Add(rvColGrp); |
2379 |
columnGroupsView.ColumnGroups.Add(wkColGrp); |
2380 |
columnGroupsView.ColumnGroups.Add(valColGrp); |
2381 |
columnGroupsView.ColumnGroups.Add(dtColGrp); |
2382 |
|
2383 |
gridView.MasterTemplate.ViewDefinition = columnGroupsView; |
2384 |
} |
2385 |
#endregion |
2386 |
|
2387 |
private void txtFullSearch_TextChanged(object sender, EventArgs e) |
2388 |
{ |
2389 |
if(string.IsNullOrWhiteSpace(txtFullSearch.Text)) |
2390 |
radGridViewDocuments.MasterTemplate.Refresh(null); |
2391 |
|
2392 |
txtFullSearch.TextBoxElement.ShowClearButton = !string.IsNullOrWhiteSpace(txtFullSearch.Text); |
2393 |
radGridViewDocuments.MasterView.TableSearchRow.Search(txtFullSearch.Text); |
2394 |
} |
2395 |
|
2396 |
private void btnSearchPrevious_Click(object sender, EventArgs e) |
2397 |
{ |
2398 |
radGridViewDocuments.MasterView.TableSearchRow.SelectPreviousSearchResult(); |
2399 |
} |
2400 |
|
2401 |
private void btnSearchNext_Click(object sender, EventArgs e) |
2402 |
{ |
2403 |
radGridViewDocuments.MasterView.TableSearchRow.SelectNextSearchResult(); |
2404 |
} |
2405 |
|
2406 |
private void txtFullSearch_KeyDown(object sender, KeyEventArgs e) |
2407 |
{ |
2408 |
if(e.KeyCode == Keys.Enter) |
2409 |
{ |
2410 |
radGridViewDocuments.MasterView.TableSearchRow.SelectNextSearchResult(); |
2411 |
} |
2412 |
} |
2413 |
|
2414 |
private void commandBarSearch_ItemOverflowed(object sender, EventArgs e) |
2415 |
{ |
2416 |
commandBarSearch.OverflowButton.AddRemoveButtonsMenuItem.Visibility = ElementVisibility.Collapsed; |
2417 |
commandBarSearch.OverflowButton.CustomizeButtonMenuItem.Visibility = ElementVisibility.Collapsed; |
2418 |
} |
2419 |
|
2420 |
private void commandBarSearch_ItemOutOfOverflow(object sender, EventArgs e) |
2421 |
{ |
2422 |
commandBarSearch.OverflowButton.AddRemoveButtonsMenuItem.Visibility = ElementVisibility.Collapsed; |
2423 |
commandBarSearch.OverflowButton.CustomizeButtonMenuItem.Visibility = ElementVisibility.Collapsed; |
2424 |
} |
2425 |
} |
2426 |
} |
2427 |
|
2428 |
public class FilterColumn |
2429 |
{ |
2430 |
public string Name { get; set; } |
2431 |
public string FieldName { get; set; } |
2432 |
public bool IsSelect { get; set; } |
2433 |
} |