프로젝트

일반

사용자정보

통계
| 브랜치(Branch): | 개정판:

hytos / ID2.Manager / ID2.Manager / Main.cs @ 993feace

이력 | 보기 | 이력해설 | 다운로드 (117 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
            this.radButtonElementDelete.Click += RadButtonElementDelete_Click;
93

    
94
            this.radButtonDateClear.Click += RadButtonDateClear_Click;
95

    
96
            this.radDropDownListProject.SelectedIndexChanged += RadDropDownList_SelectedIndexChanged;
97
            this.radDropDownListPersonInCharge.SelectedIndexChanged += RadDropDownList_SelectedIndexChanged;
98
            this.radDropDownListJobLevel.SelectedIndexChanged += RadDropDownList_SelectedIndexChanged;
99
            this.radDropDownListToIsDiscussion.SelectedIndexChanged += RadDropDownList_SelectedIndexChanged;
100
            this.radDropDownListFrReviewStatus.SelectedIndexChanged += RadDropDownList_SelectedIndexChanged;
101
            this.radDropDownListID2Status.SelectedIndexChanged += RadDropDownList_SelectedIndexChanged;
102
            this.radDropDownListID2Issues.SelectedIndexChanged += RadDropDownList_SelectedIndexChanged;
103
            this.radDropDownListAVEVAStatus.SelectedIndexChanged += RadDropDownList_SelectedIndexChanged;
104
            this.radDropDownListAVEVAIssues.SelectedIndexChanged += RadDropDownList_SelectedIndexChanged;
105
            this.radDropDownListProdIsResult.SelectedIndexChanged += RadDropDownList_SelectedIndexChanged;
106
            this.radDropDownListClientIsResult.SelectedIndexChanged += RadDropDownList_SelectedIndexChanged;
107
            this.radDropDownListGateway.SelectedIndexChanged += RadDropDownList_SelectedIndexChanged;
108
            this.radDropDownListRegistration.SelectedIndexChanged += RadDropDownList_SelectedIndexChanged;
109

    
110
            this.radCheckBox1.CheckStateChanged += RadCheckBox_CheckStateChanged;
111
            this.radCheckBox2.CheckStateChanged += RadCheckBox_CheckStateChanged;
112
            this.radCheckBox3.CheckStateChanged += RadCheckBox_CheckStateChanged;
113
            this.radCheckBox4.CheckStateChanged += RadCheckBox_CheckStateChanged;
114
            this.radTextBoxDocumentNo.KeyDown += RadTextBoxDocumentNo_KeyDown;
115
            this.radTextBoxDocumentNo.KeyUp += RadTextBoxDocumentNo_KeyUp;
116
            this.radButtonSearch.Click += RadButtonSearch_Click;
117

    
118
            //this.radGridViewDocuments.DefaultValuesNeeded += RadGridViewDocuments_DefaultValuesNeeded;
119
            //this.radGridViewDocuments.UserAddedRow += RadGridViewDocuments_UserAddedRow;
120
            this.radGridViewDocuments.SelectionChanged += RadGridViewDocuments_SelectionChanged;
121
            this.radGridViewDocuments.ViewCellFormatting += RadGridViewDocuments_ViewCellFormatting;
122
            this.radGridViewDocuments.CreateRowInfo += RadGridViewDocuments_CreateRowInfo;
123
            this.radGridViewDocuments.CellBeginEdit += RadGridViewDocuments_CellBeginEdit;
124
            this.radGridViewDocuments.CommandCellClick += RadGridViewDocuments_CommandCellClick;
125
            this.radGridViewDocuments.MasterView.TableSearchRow.SearchProgressChanged += TableSearchRow_SearchProgressChanged;
126
            //this.radGridViewDocuments.FilterChanging += RadGridViewDocuments_FilterChanging;
127
            this.radGridViewDocuments.FilterChanged += RadGridViewDocuments_FilterChanged;
128
            this.radGridViewDocuments.ValueChanged += RadGridViewDocuments_ValueChanged;
129

    
130
            this.radGridViewDocuments.MasterView.TableHeaderRow.MinHeight = 36;
131
            this.radGridViewDocuments.TableElement.RowHeaderColumnWidth = 36;
132
            //this.radGridViewDocuments.MasterView.TableSearchRow.InitialSearchResultsTreshold = ;
133
            this.radGridViewDocuments.MasterView.TableSearchRow.IsVisible = false;
134

    
135
            var openProjectView = new OpenProjectView()
136
            {
137
                Dock = DockStyle.Fill
138
            };
139

    
140
            this.backstageViewPageOpenProject.Controls.Add(openProjectView);
141
            openProjectView.OpenProjectClick += OpenProjectView_OpenProjectClick;
142
            openProjectView.CloseProjectClick += OpenProjectView_OpenProjectClick;
143
            this.backstageButtonItemSelectDB.Click += BackstageButtonItemSelectDB_Click;
144
            this.backstageButtonItemUserRegistration.Click += BackstageButtonItemUserRegistration_Click;
145
            this.backstageButtonItemExit.Click += BackstageButtonItemExit_Click;
146
            this.radRibbonBarBackstageViewID2Manager.BackstageViewOpened += RadRibbonBarBackstageViewID2Manager_BackstageViewOpened;
147
            this.radRibbonBarBackstageViewID2Manager.BackstageViewClosed += RadRibbonBarBackstageViewID2Manager_BackstageViewClosed;
148

    
149
            this.InitColumnGroupsViewDefinition(this.radGridViewDocuments);
150

    
151
            this.radPageViewPageReview.Controls.Add(briefAndImagesReview);
152
            this.radPageViewPageWork.Controls.Add(issueImagesAndAnswerWork);
153

    
154
            briefAndImagesReview.RemoveImage += BriefAndImages_RemoveImage;
155
            issueImagesAndAnswerWork.RemoveImage += IssueImagesAndAnswer_RemoveImage;
156
            this.Initialize();
157
        }
158

    
159
        private void BtnDockLayoutReset_Click(object sender, EventArgs e)
160
        {
161
            this.LoadDockingLayout(true);
162
        }
163

    
164
        private void BriefAndImages_RemoveImage(object sender, AttImageInfo e)
165
        {
166
            try
167
            {
168
                if (e is AttImageInfo)
169
                {
170
                    if (this.radGridViewDocuments.SelectedRows.Count() > 0 && this.radGridViewDocuments.SelectedRows.First().DataBoundItem is Documents doc)
171
                    {
172
                        var reslut = doc.AttFiles.RemoveAll(x => x.FileID == e.ID);
173

    
174
                        if (reslut > 0)
175
                        {
176

    
177
                        }
178
                        else
179
                        {
180
                            MessageBox.Show("삭제오류");
181
                        }
182
                    }
183
                }
184
            }
185
            catch (Exception ex)
186
            {
187
                Program.logger.Error("BriefAndImages_RemoveImage", ex);
188
            }
189
        }
190

    
191
        private void IssueImagesAndAnswer_RemoveImage(object sender, AttImageInfo e)
192
        {
193
            try
194
            {
195
                if (e is AttImageInfo)
196
                {
197
                    if (this.radGridViewDocuments.SelectedRows.Count() > 0 && this.radGridViewDocuments.SelectedRows.First().DataBoundItem is Documents doc)
198
                    {
199
                        var reslut = doc.AttFiles.RemoveAll(x => x.FileID == e.ID);
200

    
201
                        if (reslut > 0)
202
                        {
203

    
204
                        }
205
                        else
206
                        {
207
                            MessageBox.Show("삭제오류");
208
                        }
209
                    }
210
                }
211
            }
212
            catch (Exception ex)
213
            {
214
                Program.logger.Error("IssueImagesAndAnswer_RemoveImage", ex);
215
            }
216
        }
217

    
218
        private void SaveDockingLayout()
219
        {
220
            try
221
            {
222
                this.DockMain.SaveToXml(dockLayoutPath);
223
            }
224
            catch (Exception ex)
225
            {
226
                System.Diagnostics.Debug.WriteLine("SaveDockingLayout Error.", ex);
227
            }
228
        }
229

    
230
        private void LoadDockingLayout(bool IsDefaultLayoutLoad = false)
231
        {
232
            try
233
            {
234
                bool IsUseLayoutLoad = false;
235

    
236
                try
237
                {
238
                    var dockLayoutFile = new FileInfo(dockLayoutPath);
239

    
240

    
241
                    if (!IsDefaultLayoutLoad && dockLayoutFile.Exists)
242
                    {
243
                        this.DockMain.LoadFromXml(dockLayoutPath);
244
                        IsUseLayoutLoad = true;
245
                    }
246

    
247
                }
248
                catch (Exception ex)
249
                {
250
                    Program.logger.Error($"dock Layout File load Error. File Path : {dockLayoutPath}", ex);
251
                }
252

    
253
                if (!IsUseLayoutLoad)
254
                {
255
                    var layout = Properties.Resources.DefalutDockLayout;
256

    
257
                    using (MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(layout)))
258
                    {
259
                        this.DockMain.LoadFromXml(stream);
260
                    }
261
                }
262

    
263
                this.DockMain.DocumentTabsVisible = true;
264

    
265
                this.DockMain.DockWindows.ForAll(x =>
266
                {
267
                    x.DockManager.ShowDocumentPinButton = false;
268
                    x.DockManager.ShowDocumentCloseButton = false;
269
                });
270

    
271
                this.DockMain.AutoHideWindowDisplaying += DockMain_AutoHideWindowDisplaying;
272

    
273
                this.DockMain.DockStateChanged += (snd, evt) =>
274
                {
275
                    if (evt.DockWindow.Name == DockWindowMain.Name || evt.DockWindow.Name == DockValidation.Name)
276
                    {
277

    
278
                    }
279

    
280
                };
281

    
282
                this.DockMain.DockWindowClosed += (snd, evt) =>
283
                {
284
                    evt.DockWindow.DockState = Telerik.WinControls.UI.Docking.DockState.AutoHide;
285

    
286
                    //Telerik.WinControls.UI.Docking.AutoHidePosition tabPosition = Telerik.WinControls.UI.Docking.AutoHidePosition.Right;
287

    
288

    
289
                    //List<DockWindow> dockWindows = new List<DockWindow>();
290

    
291
                    //var autoHideWindows = this.DockMain.DockWindows.Where(x => x.DockState == Telerik.WinControls.UI.Docking.DockState.AutoHide).ToList();
292

    
293

    
294
                    //if (evt.DockWindow.AccessibleName == DockWindowMain.AccessibleName || evt.DockWindow.Name == DockValidation.AccessibleName)
295
                    //{
296
                    //    dockWindows.AddRange(autoHideWindows.Where(x => x.AccessibleName == DockWindowMain.AccessibleName && evt.DockWindow.Name == DockValidation.AccessibleName));
297

    
298
                    //    tabPosition = Telerik.WinControls.UI.Docking.AutoHidePosition.Bottom;
299

    
300
                    //    dockWindows.Add(evt.DockWindow);
301
                    //}
302
                    //else
303
                    //{
304
                    //    dockWindows.AddRange(autoHideWindows.Where(x => x.AccessibleName != DockWindowMain.AccessibleName || evt.DockWindow.Name != DockValidation.AccessibleName));
305

    
306
                    //    dockWindows.Add(evt.DockWindow);
307
                    //}
308

    
309

    
310
                    //this.DockMain.AutoHideWindows(dockWindows, tabPosition);
311
                };
312
            }
313
            catch (Exception ex)
314
            {
315
                Program.logger.Error($"dock Layout load Error. File Path : {dockLayoutPath}", ex);
316
            }
317
        }
318

    
319
        private void DockMain_AutoHideWindowDisplaying(object sender, Telerik.WinControls.UI.Docking.AutoHideWindowDisplayingEventArgs e)
320
        {
321

    
322
        }
323

    
324
        private void Main_FormClosing(object sender, FormClosingEventArgs e)
325
        {
326
            SaveDockingLayout();
327
        }
328

    
329
        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
330
        {
331
            if (keyData == (Keys.F10 | Keys.Control))
332
            {
333
#if DEBUG
334
                radControlSpyForm.Show();
335
#endif
336
            }
337

    
338
            if (keyData == (Keys.V | Keys.Control))
339
            {
340
                System.Diagnostics.Debug.WriteLine("KeyDown CTRL + V");
341

    
342
                if (Clipboard.ContainsImage())
343
                {
344
                    var IsDoftech = true;
345
                    var selectReview = true;
346
                    string category = "";
347
                    byte[] imageBytes = null;
348

    
349
                    Image clipboardImage = Clipboard.GetImage();
350

    
351
                    using (MemoryStream stream = new MemoryStream())
352
                    {
353
                        clipboardImage.Save(stream, System.Drawing.Imaging.ImageFormat.Png);
354
                        imageBytes = stream.ToArray();
355
                    }
356

    
357
                    if (this.radGridViewDocuments.SelectedRows.Count() > 0 && this.radGridViewDocuments.SelectedRows.First().DataBoundItem is Documents doc)
358
                    {
359

    
360
                        /// 도프텍 or 삼성
361
                        if (!string.IsNullOrEmpty(informations.ActiveUser.RefProjectID))
362
                        {
363
                            IsDoftech = false;
364
                        }
365

    
366
                        /// 검토 or 검증
367
                        if (radPageViewComment.SelectedPage != radPageViewPageReview)
368
                        {
369
                            selectReview = false;
370
                        }
371

    
372
                        if (IsDoftech && selectReview)
373
                        {
374
                            category = "toreview";
375
                        }
376
                        else if (!IsDoftech && selectReview)
377
                        {
378
                            category = "frreview";
379
                        }
380
                        //else if (IsDoftech && !selectReview)
381
                        //{
382
                        //    category = "prodvalidation";
383
                        //}
384
                        //else 
385
                        //{
386
                        //    category = "clientvalidation";
387
                        //}
388
                        else
389
                        {
390
                            category = "id2work";
391
                        }
392

    
393

    
394
                        AttFileInfo newFile = new AttFileInfo
395
                        {
396
                            FileID = Guid.NewGuid().ToString(),
397
                            Category = category,
398
                            FileType = "image/png",
399
                            FileName = "ClipBoard",
400
                            FilePath = "ClipBoard",
401
                            FileExtension = ".png",
402
                            CreatedDate = DateTime.Now,
403
                            Creator = informations.ActiveUser.ID,
404
                            FileData = imageBytes
405

    
406
                        };
407

    
408
                        if (doc.AttFiles == null)
409
                        {
410
                            doc.AttFiles = new List<AttFileInfo>();
411
                        }
412

    
413
                        doc.AttFiles.Add(newFile);
414

    
415
                        var imageInfo = new AttImageInfo { ID = newFile.FileID, Data = newFile.FileData };
416

    
417
                        switch (category)
418
                        {
419
                            case "toreview":
420
                                briefAndImagesReview.AddToImage(imageInfo, true);
421
                                break;
422
                            case "frreview":
423
                                briefAndImagesReview.AddFrImage(imageInfo, true);
424
                                break;
425
                            //case "prodvalidation":
426
                            //    briefAndImagesValidation.AddToImage(imageInfo, true);
427
                            //    break;
428
                            //case "clientvalidation":
429
                            //    briefAndImagesValidation.AddFrImage(imageInfo, true);
430
                            //    break;
431
                            case "id2work":
432
                                issueImagesAndAnswerWork.AddImage(imageInfo, true);
433
                                break;
434
                        }
435
                    }
436
                }
437
            }
438

    
439
            return base.ProcessCmdKey(ref msg, keyData);
440
        }
441

    
442
        private void RadGridViewDocuments_CreateRowInfo(object sender, GridViewCreateRowInfoEventArgs e)
443
        {
444
            if (e.RowInfo is GridViewSearchRowInfo)
445
            {
446
                var row = new SearchRow(e.ViewInfo);
447
                e.RowInfo = row;
448
            }
449

    
450
            //System.Diagnostics.Debug.WriteLine(e.RowInfo.GetType().Name);
451
        }
452

    
453
        private void TableSearchRow_SearchProgressChanged(object sender, SearchProgressChangedEventArgs e)
454
        {
455
            if (e.SearchFinished)
456
            {
457

    
458
            }
459
        }
460

    
461
        /// <summary>
462
        /// 선택한 Document와 상세 편집 창을 연동시킨다.
463
        /// </summary>
464
        /// <param name="doc"></param>
465
        public void BindingDocumentToDetailEditor(Documents doc)
466
        {
467
            briefAndImagesReview.Clear();
468
            issueImagesAndAnswerWork.Clear();
469

    
470
            //FrRemarks 추가
471

    
472
            briefAndImagesReview.DataBindings.Add(new Binding("BriefDoftech", doc, "ToRemarks", false, DataSourceUpdateMode.OnPropertyChanged, null));
473
            briefAndImagesReview.DataBindings.Add(new Binding("BriefSec", doc, "FrRemarks", false, DataSourceUpdateMode.OnPropertyChanged, null));
474

    
475
            issueImagesAndAnswerWork.DataBindings.Add(new Binding("IssueText", doc, "ID2Issues", false, DataSourceUpdateMode.OnPropertyChanged, null));
476
            issueImagesAndAnswerWork.DataBindings.Add(new Binding("ReplyModificationText", doc, "ReplyModifications", false, DataSourceUpdateMode.OnPropertyChanged, null));
477

    
478
            if (doc.AttFiles != null)
479
            {
480
                if (doc.AttFiles.Any(x => x.Category == "toreview"))
481
                {
482
                    var images = doc.AttFiles.Where(x => x.Category == "toreview").Select(x => new AttImageInfo { ID = x.FileID, Category = x.Category, Data = x.FileData });
483
                    briefAndImagesReview.SetToImages(images.ToList());
484
                }
485

    
486
                if (doc.AttFiles.Any(x => x.Category == "frreview"))
487
                {
488
                    var images = doc.AttFiles.Where(x => x.Category == "frreview").Select(x => new AttImageInfo { ID = x.FileID, Category = x.Category, Data = x.FileData });
489
                    briefAndImagesReview.SetFrImages(images.ToList());
490
                }
491

    
492
                //if (doc.AttFiles.Any(x => x.Category == "prodvalidation"))
493
                //{
494
                //    var images = doc.AttFiles.Where(x => x.Category == "prodvalidation").Select(x => new AttImageInfo { ID = x.FileID, Category = x.Category, Data = x.FileData });
495
                //    briefAndImagesValidation.SetToImages(images.ToList());
496
                //}
497

    
498
                //if (doc.AttFiles.Any(x => x.Category == "clientvalidation"))
499
                //{
500
                //    var images = doc.AttFiles.Where(x => x.Category == "clientvalidation").Select(x => new AttImageInfo { ID = x.FileID, Category = x.Category, Data = x.FileData });
501
                //    briefAndImagesValidation.SetFrImages(images.ToList());
502
                //}
503

    
504
                //수정필요
505
                if (doc.AttFiles.Any(x => x.Category == "id2work"))
506
                {
507
                    var images = doc.AttFiles.Where(x => x.Category == "id2work").Select(x => new AttImageInfo { ID = x.FileID, Category = x.Category, Data = x.FileData });
508
                    issueImagesAndAnswerWork.SetImages(images.ToList());
509
                }
510
            }
511
        }
512

    
513
        private void RadGridViewDocuments_DefaultValuesNeeded(object sender, GridViewRowEventArgs e)
514
        {
515
            BindingDocumentToDetailEditor(new Documents());
516
        }
517

    
518
        private void RadGridViewDocuments_UserAddedRow(object sender, GridViewRowEventArgs e)
519
        {
520
            if (e.Row.DataBoundItem is Documents doc)
521
            {
522
                this.documents.Add(doc);
523
            }
524
        }
525

    
526
        /// <summary>
527
        /// 선택된 행의 AutoCAD와 PDF 파일을 보여준다.
528
        /// </summary>
529
        /// <param name="sender"></param>
530
        /// <param name="e"></param>
531
        private void RadGridViewDocuments_SelectionChanged(object sender, EventArgs e)
532
        {
533
            if (this.radGridViewDocuments.SelectedRows.Any() && this.radGridViewDocuments.SelectedRows.First().DataBoundItem is Documents doc)
534
            {
535
                //if (informations.ActiveUser.ID != doc.PersonInCharge)
536
                //{
537
                //    var row = this.radGridViewDocuments.SelectedRows.First();
538
                //    foreach(var cell in row.Cells)
539
                //    {
540
                //        cell.ReadOnly = true;
541
                //    }
542
                //}
543
                BindingDocumentToDetailEditor(doc);
544
            }
545
        }
546

    
547
        #region Init, Load
548
        private void Initialize()
549
        {
550
            this.Text = Globals.Name;
551

    
552
            this.ID2ManagerRadRibbonBar.Expanded = false;
553

    
554
            this.radLabelElementUser.Text = $"{informations.ActiveUser.ID} {informations.ActiveUser.Name}";
555
        }
556

    
557
        protected override void OnLoad(EventArgs e)
558
        {
559
            try
560
            {
561
                LoadDockingLayout();
562
                InitializeGrid();
563

    
564
                bool isID2DB = this.IsID2Connection();
565
                this.SetMenus(isID2DB);
566

    
567
                if (isID2DB)
568
                {
569
                    if (informations.ActiveUser != null && !string.IsNullOrEmpty(informations.ActiveUser.RefProjectID))
570
                    {
571
                        informations.ActiveProject = new ProjectController().GetProjectInfo(informations.ActiveUser.RefProjectID);
572
                        informations.ProjectList = new ProjectController().GetAllProjectList().ToList();
573

    
574
                        this.LoadProject();
575
                    }
576
                    else
577
                    {
578
                        informations.ProjectList = new ProjectController().GetAllProjectList().ToList();
579

    
580
                        foreach (Control ctrl in this.backstageViewPageOpenProject.Controls)
581
                        {
582
                            if (ctrl is OpenProjectView)
583
                            {
584
                                var openProjectView = ctrl as OpenProjectView;
585
                                openProjectView.GetProjectGroups();
586
                                break;
587
                            }
588
                        }
589

    
590
                        this.radRibbonBarBackstageViewID2Manager.ShowPopup(this.GetBackstageLocation(), this.ID2ManagerRadRibbonBar.RibbonBarElement);
591
                    }
592
                }
593
                else
594
                {
595
                    this.radRibbonBarBackstageViewID2Manager.ShowPopup(this.GetBackstageLocation(), this.ID2ManagerRadRibbonBar.RibbonBarElement);
596
                    RadMessageBox.Show(this, $"Please select db file.", "Error", MessageBoxButtons.OK, RadMessageIcon.Info);
597
                }
598
            }
599
            catch (Exception ex)
600
            {
601
                Program.logger.Error($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex);
602
                RadMessageBox.Show("Failed to load project.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error);
603
            }
604

    
605
            base.OnLoad(e);
606
        }
607

    
608
        private bool IsID2Connection()
609
        {
610
            bool isSuccess = false;
611

    
612
            try
613
            {
614
                isSuccess = Globals.IsProjectDBConnstr();
615

    
616
                if (isSuccess)
617
                {
618
                    var id2Project = new ID2Controller().GetID2ProjectList();
619
                }
620
            }
621
            catch (Exception ex)
622
            {
623
                Program.logger.Error($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex);
624
                isSuccess = false;
625
            }
626

    
627
            return isSuccess;
628
        }
629

    
630
        private void SetMenus(bool isid2)
631
        {
632
            if (isid2)
633
            {
634
                this.IsID2Manager = (new string[] { "Admin", "Manager" }).Contains(informations.ActiveUser.Role) && string.IsNullOrEmpty(informations.ActiveUser.RefProjectID);
635

    
636
                if (this.IsID2Manager)
637
                {
638
                    this.radButtonElementNoticeUpload.Enabled = true;
639

    
640
                    this.backstageViewPageOpenProject.Controls[0].Visible = true;
641
                    this.backstageTabItemOpenProject.Visibility = ElementVisibility.Visible;
642
                    this.backstageButtonItemUserRegistration.Visibility = ElementVisibility.Visible;
643

    
644
                    this.ribbonTabProjMgt.Visibility = ElementVisibility.Visible;
645
                }
646
                else
647
                {
648
                    this.radButtonElementNoticeUpload.Enabled = false;
649

    
650
                    if (string.IsNullOrEmpty(informations.ActiveUser.RefProjectID))
651
                    {
652
                        this.backstageViewPageOpenProject.Controls[0].Visible = true;
653
                    }
654
                    else
655
                    {
656
                        foreach (Control ctrl in this.backstageViewPageOpenProject.Controls)
657
                        {
658
                            ctrl.Visible = false;
659
                        }
660
                    }
661
                    this.backstageTabItemOpenProject.Visibility = ElementVisibility.Collapsed;
662
                    this.backstageButtonItemUserRegistration.Visibility = ElementVisibility.Collapsed;
663

    
664
                    this.ribbonTabProjMgt.Visibility = ElementVisibility.Collapsed;
665
                }
666
            }
667
            else
668
            {
669
                this.radButtonElementNoticeUpload.Enabled = false;
670

    
671
                this.backstageButtonItemSelectDB.Visibility = ElementVisibility.Visible;
672
                foreach (Control ctrl in this.backstageViewPageOpenProject.Controls)
673
                {
674
                    ctrl.Visible = false;
675
                }
676
                this.backstageTabItemOpenProject.Visibility = ElementVisibility.Collapsed;
677
                this.backstageButtonItemUserRegistration.Visibility = ElementVisibility.Collapsed;
678

    
679
                this.ribbonTabProjMgt.Visibility = ElementVisibility.Collapsed;
680
            }
681
        }
682

    
683
        public Point GetBackstageLocation()
684
        {
685
            Point location = this.ID2ManagerRadRibbonBar.RibbonBarElement.ApplicationButtonElement.ControlBoundingRectangle.Location;
686
            location.Offset(new Point(0, this.ID2ManagerRadRibbonBar.RibbonBarElement.ApplicationButtonElement.ControlBoundingRectangle.Height));
687
            location.Offset(this.ID2ManagerRadRibbonBar.Location);
688

    
689
            return location;
690
        }
691

    
692
        private void InitializeGrid()
693
        {
694
            InitializeColumns();
695
            InitializeSearch();
696
            InitializeGridViewDetail();
697

    
698
            //this.radGridViewDocuments.DataSource = new BindingList<Documents>(this.documents);
699
        }
700

    
701
        private void InitializeColumns()
702
        {
703
            bool isClient = !string.IsNullOrEmpty(informations.ActiveUser.RefProjectID);
704
            GridViewColumnCollection cols = this.radGridViewDocuments.Columns;
705

    
706
            cols.ForAll(x =>
707
            {
708
                if (!x.ReadOnly)
709
                {
710
                    switch (x.Name)
711
                    {
712
                        case "FrReviewStatus":
713
                        case "FrRemarks":
714
                        case "FrCreator":
715
                        case "ClientReviewer":
716
                        case "ClientIsResult":
717
                        case "ClientRemarks":
718
                            x.ReadOnly = !isClient;
719
                            break;
720
                        default:
721
                            x.ReadOnly = isClient;
722
                            break;
723
                    }
724
                }
725
            });
726
        }
727

    
728
        private void InitializeSearch()
729
        {
730

    
731
            var font1 = ThemeResolutionService.GetCustomFont("TelerikWebUI");
732

    
733
            lbSearch.Text = "\ue13E";
734
            btnSearchNext.Text = "\ue006";
735
            btnSearchPrevious.Text = "\ue004";
736

    
737
            var chkbox = new RadCheckBoxElement();
738
            chkbox.Text = "Match Case";
739
            chkbox.CheckStateChanged += (snd, evt) => { radGridViewDocuments.MasterView.TableSearchRow.CaseSensitive = chkbox.Checked; };
740

    
741
            btnMatchCase.HostedItem = chkbox;
742

    
743
            var chkbox1 = new RadCheckBoxElement();
744
            chkbox1.Text = "Show All Detail";
745
            chkbox1.CheckStateChanged += (snd, evt) =>
746
            {
747
                radGridViewDocuments.MasterView.ChildRows.ForAll(x => x.IsExpanded = chkbox1.Checked);
748
            };
749

    
750
            btnShowAllDetail.HostedItem = chkbox1;
751

    
752
            var chkbox2 = new RadCheckBoxElement();
753
            chkbox2.Text = "Search from current position";
754
            chkbox2.CheckStateChanged += (snd, evt) => { radGridViewDocuments.MasterView.TableSearchRow.SearchFromCurrentPosition = chkbox.Checked; };
755

    
756
            btnSearchFormCurrent.HostedItem = chkbox2;
757

    
758
            var columns = radGridViewDocuments.Columns.Where(x => x.AllowSearching).Select(x =>
759
                                 new FilterColumn
760
                                 {
761
                                     Name = x.HeaderText,
762
                                     FieldName = x.FieldName,
763
                                     IsSelect = x.AllowSearching
764
                                 }).ToList();
765

    
766
            var panel = new StackLayoutElement();
767
            panel.Orientation = Orientation.Vertical;
768

    
769
            var btnComboColumns = new RadCheckedDropDownListElement();
770
            btnComboColumns.ShowCheckAllItems = true;
771
            btnComboColumns.CheckAllItem.Checked = true;
772
            btnComboColumns.AutoCompleteEditableAreaElement.NullText = "Search in Columns";
773
            btnComboColumns.AutoCompleteEditableAreaElement.AutoCompleteTextBox.IsReadOnly = true;
774
            btnComboColumns.DropDownMinSize = new Size(200, 200);
775
            btnComboColumns.DropDownSizingMode = SizingMode.UpDownAndRightBottom;
776
            btnComboColumns.DisplayMember = "Name";
777
            btnComboColumns.CheckedMember = "IsSelect";
778
            btnComboColumns.ValueMember = "FieldName";
779
            btnComboColumns.TextBox.CustomFont = font1.Name;
780
            btnComboColumns.TextBox.Text = "\ue13A";
781

    
782
            columns.Add(new FilterColumn { FieldName = "CREATE_USER", Name = "Markus User", IsSelect = true });
783
            columns.Add(new FilterColumn { FieldName = "TEXT", Name = "Markus Text", IsSelect = true });
784

    
785
            btnComboColumns.DataSource = columns;
786

    
787
            txtFullSearch.TextBoxElement.ClearButton.Click += (snd, evt) =>
788
            {
789
                radGridViewDocuments.MasterTemplate.Refresh(null);
790
            };
791

    
792
            btnComboColumns.PopupOpening += (snd, evt) =>
793
            {
794
                (snd as RadCheckedDropDownListElement).CheckAllItem.Checked = (snd as RadCheckedDropDownListElement).Items.All(x => (x.DataBoundItem as FilterColumn).IsSelect);
795
            };
796

    
797
            btnComboColumns.PopupClosed += (snd, evt) =>
798
            {
799
                foreach (RadCheckedListDataItem item in btnComboColumns.Items)
800
                {
801
                    if (radGridViewDocuments.Columns[item.Value.ToString()] != null)
802
                    {
803
                        radGridViewDocuments.Columns[item.Value.ToString()].AllowSearching = item.Checked;
804
                    }
805

    
806
                    foreach (var template in radGridViewDocuments.Templates)
807
                    {
808
                        if (template.Columns[item.Value.ToString()] != null)
809
                        {
810
                            template.Columns[item.Value.ToString()].AllowSearching = item.Checked;
811
                        }
812
                    }
813
                }
814
            };
815

    
816
            btnFilters.HostedItem = btnComboColumns;
817
        }
818

    
819
        private void InitializeGridViewDetail()
820
        {
821
            DetailGridViewTemplate markupList = new DetailGridViewTemplate();
822

    
823
            GridViewTextBoxColumn userColumn = new GridViewTextBoxColumn("CREATE_USER");
824
            GridViewTextBoxColumn textColumn = new GridViewTextBoxColumn("TEXT");
825

    
826
            userColumn.MinWidth = 110;
827
            userColumn.AutoSizeMode = BestFitColumnMode.AllCells;
828
            userColumn.AllowSearching = true;
829
            textColumn.AutoSizeMode = BestFitColumnMode.AllCells;
830
            textColumn.AllowSearching = true;
831

    
832
            markupList.Columns.AddRange(userColumn, textColumn);
833
            markupList.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
834

    
835
            this.radGridViewDocuments.MasterTemplate.Templates.Add(markupList);
836
            markupList.HierarchyDataProvider = new GridViewEventDataProvider(markupList);
837

    
838
            this.radGridViewDocuments.ChildViewExpanded += RadGridViewDocuments_ChildViewExpanded;
839
            this.radGridViewDocuments.RowSourceNeeded += RadGridViewDocuments_RowSourceNeeded;
840
        }
841

    
842
        private void RadGridViewDocuments_RowSourceNeeded(object sender, GridViewRowSourceNeededEventArgs e)
843
        {
844
            if (e.Template.HierarchyLevel == 1)
845
            {
846
                if (e.ParentRow.DataBoundItem is Documents documents)
847
                {
848
                    if (documents.Markups != null)
849
                    {
850
                        foreach (var makrup in documents.Markups)
851
                        {
852
                            GridViewRowInfo row = e.Template.Rows.NewRow();
853

    
854
                            row.Cells["CREATE_USER"].Value = makrup.CREATE_USER;
855
                            row.Cells["TEXT"].Value = makrup.TEXT;
856
                            e.SourceCollection.Add(row);
857
                        }
858

    
859
                        e.Template.BestFitColumns(BestFitColumnMode.AllCells);
860
                    }
861
                }
862
            }
863
        }
864

    
865
        private void RadGridViewDocuments_ChildViewExpanded(object sender, ChildViewExpandedEventArgs e)
866
        {
867
            if (e.IsExpanded)
868
            {
869
            }
870
        }
871

    
872
        #endregion
873

    
874
        private void OpenProjectView_OpenProjectClick(object sender, EventArgs e)
875
        {
876
            this.radRibbonBarBackstageViewID2Manager.Tag = e;
877
            this.radRibbonBarBackstageViewID2Manager.HidePopup();
878
        }
879

    
880
        private void RadRibbonBarBackstageViewID2Manager_BackstageViewOpened(object sender, EventArgs e)
881
        {
882
            this.radRibbonBarBackstageViewID2Manager.SelectedItem = this.backstageTabItemOpenProject;
883

    
884
            foreach (Control ctrl in this.backstageViewPageOpenProject.Controls)
885
            {
886
                if (ctrl is OpenProjectView)
887
                {
888
                    var openProjectView = ctrl as OpenProjectView;
889
                    openProjectView.GetProjectGroups();
890
                    break;
891
                }
892
            }
893
        }
894

    
895
        private void RadRibbonBarBackstageViewID2Manager_BackstageViewClosed(object sender, EventArgs e)
896
        {
897
            try
898
            {
899
                if (this.radRibbonBarBackstageViewID2Manager.Tag is ProjectEventArgs)
900
                {
901
                    var prjArgs = this.radRibbonBarBackstageViewID2Manager.Tag as ProjectEventArgs;
902

    
903
                    informations.ActiveProject = prjArgs.ProjectInfo;
904

    
905
                    this.radRibbonBarBackstageViewID2Manager.Tag = null;
906

    
907
                    this.LoadProject();
908
                }
909
            }
910
            catch (Exception ex)
911
            {
912
                Program.logger.Error($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex);
913
                RadMessageBox.Show("Failed to load project.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error);
914
            }
915
        }
916

    
917
        private void LoadProject()
918
        {
919
            this.radLabelElementUser.Text = $"{informations.ActiveUser.ID} {informations.ActiveUser.Name}";
920

    
921
            try
922
            {
923
                #region Date
924
                //Date Type
925
                if (this.radCheckedDropDownListDateType.DataSource != null)
926
                    this.radCheckedDropDownListDateType.DataSource = null;
927

    
928
                this.radCheckedDropDownListDateType.DataSource = informations.DateType;
929
                this.radCheckedDropDownListDateType.DisplayMember = "Value";
930
                this.radCheckedDropDownListDateType.ValueMember = "Key";
931

    
932
                //FromDate
933
                this.radDateTimePickerFr.NullableValue = null;
934
                this.radDateTimePickerFr.SetToNullValue();
935

    
936
                //ToDate
937
                this.radDateTimePickerTo.NullableValue = null;
938
                this.radDateTimePickerTo.SetToNullValue();
939
                #endregion
940

    
941
                #region 도면
942
                //Project List
943
                if (this.radDropDownListProject.Items.Count > 0)
944
                    this.radDropDownListProject.Items.Clear();
945
                informations.ProjectList.Where(x => x.GroupID.Equals(informations.ActiveProject.ProjectID)).ToList()
946
                                        .ForEach(x =>
947
                                        {
948
                                            this.radDropDownListProject.Items.Add(new RadListDataItem(x.Name, x.Code));
949
                                        });
950
                var allProject = new RadListDataItem("== 전체 ==", string.Empty);
951
                this.radDropDownListProject.Items.Insert(0, allProject);
952
                allProject.Selected = true;
953

    
954
                //담당자 List
955
                if (this.radDropDownListPersonInCharge.Items.Count > 0)
956
                    this.radDropDownListPersonInCharge.Items.Clear();
957
                informations.UserList.ForEach(x =>
958
                {
959
                    if ((new string[] { "Manager", "User" }).Contains(x.Role) && string.IsNullOrEmpty(x.RefProjectID))
960
                        this.radDropDownListPersonInCharge.Items.Add(new RadListDataItem(x.Name, x.ID));
961
                });
962
                var allUser = new RadListDataItem("== 전체 ==", string.Empty);
963
                this.radDropDownListPersonInCharge.Items.Insert(0, allUser);
964
                allUser.Selected = true;
965

    
966
                //난이도
967
                if (this.radDropDownListJobLevel.Items.Count > 0)
968
                    this.radDropDownListJobLevel.Items.Clear();
969
                informations.JobLevel.ForEach(x =>
970
                {
971
                    this.radDropDownListJobLevel.Items.Add(new RadListDataItem(x, x));
972
                });
973
                var allJobLevel = new RadListDataItem("== 전체 ==", string.Empty);
974
                this.radDropDownListJobLevel.Items.Insert(0, allJobLevel);
975
                allJobLevel.Selected = true;
976

    
977
                //도면번호 조회조건
978
                this.radTextBoxDocumentNo.Text = string.Empty;
979
                #endregion
980

    
981
                #region 검토
982
                //문의(DOF)
983
                if (this.radDropDownListToIsDiscussion.Items.Count > 0)
984
                    this.radDropDownListToIsDiscussion.Items.Clear();
985
                informations.IsYesNo.ForEach(x =>
986
                {
987
                    this.radDropDownListToIsDiscussion.Items.Add(new RadListDataItem(x, x));
988
                });
989
                var allToIsDiscussion = new RadListDataItem("== 전체 ==", string.Empty);
990
                this.radDropDownListToIsDiscussion.Items.Insert(0, allToIsDiscussion);
991
                allToIsDiscussion.Selected = true;
992

    
993
                //회신(DS)
994
                if (this.radDropDownListFrReviewStatus.Items.Count > 0)
995
                    this.radDropDownListFrReviewStatus.Items.Clear();
996
                informations.ClientStatus.ForEach(x =>
997
                {
998
                    this.radDropDownListFrReviewStatus.Items.Add(new RadListDataItem(x, x));
999
                });
1000
                var allFrReviewStatus = new RadListDataItem("== 전체 ==", string.Empty);
1001
                this.radDropDownListFrReviewStatus.Items.Insert(0, allFrReviewStatus);
1002
                allFrReviewStatus.Selected = true;
1003
                #endregion
1004

    
1005
                #region 작업
1006
                //ID2 Status
1007
                {
1008
                    if (this.radDropDownListID2Status.Items.Count > 0)
1009
                        this.radDropDownListID2Status.Items.Clear();
1010
                    informations.JobStatus.ForEach(x =>
1011
                    {
1012
                        this.radDropDownListID2Status.Items.Add(new RadListDataItem(x, x));
1013
                    });
1014
                    var allID2Status = new RadListDataItem("== 전체 ==", string.Empty);
1015
                    this.radDropDownListID2Status.Items.Insert(0, allID2Status);
1016
                    allID2Status.Selected = true;
1017
                }
1018

    
1019
                //ID2 Issues
1020
                {
1021
                    if (this.radDropDownListID2Issues.Items.Count > 0)
1022
                        this.radDropDownListID2Issues.Items.Clear();
1023
                    informations.IsYesNo.ForEach(x =>
1024
                    {
1025
                        this.radDropDownListID2Issues.Items.Add(new RadListDataItem(x, x));
1026
                    });
1027
                    var allID2Issues = new RadListDataItem("== 전체 ==", string.Empty);
1028
                    this.radDropDownListID2Issues.Items.Insert(0, allID2Issues);
1029
                    allID2Issues.Selected = true;
1030
                }
1031

    
1032
                //AVEVA Status
1033
                {
1034
                    if (this.radDropDownListAVEVAStatus.Items.Count > 0)
1035
                        this.radDropDownListAVEVAStatus.Items.Clear();
1036
                    informations.JobStatus.ForEach(x =>
1037
                    {
1038
                        this.radDropDownListAVEVAStatus.Items.Add(new RadListDataItem(x, x));
1039
                    });
1040
                    var allAVEVAStatus = new RadListDataItem("== 전체 ==", string.Empty);
1041
                    this.radDropDownListAVEVAStatus.Items.Insert(0, allAVEVAStatus);
1042
                    allAVEVAStatus.Selected = true;
1043
                }
1044

    
1045
                //AVEVA Issues
1046
                {
1047
                    if (this.radDropDownListAVEVAIssues.Items.Count > 0)
1048
                        this.radDropDownListAVEVAIssues.Items.Clear();
1049
                    informations.IsYesNo.ForEach(x =>
1050
                    {
1051
                        this.radDropDownListAVEVAIssues.Items.Add(new RadListDataItem(x, x));
1052
                    });
1053
                    var allAVEVAIssues = new RadListDataItem("== 전체 ==", string.Empty);
1054
                    this.radDropDownListAVEVAIssues.Items.Insert(0, allAVEVAIssues);
1055
                    allAVEVAIssues.Selected = true;
1056
                }
1057

    
1058
                #endregion
1059

    
1060
                #region 검수
1061
                //도프텍 결과
1062
                if (this.radDropDownListProdIsResult.Items.Count > 0)
1063
                    this.radDropDownListProdIsResult.Items.Clear();
1064
                informations.ValidationResult.ForEach(x =>
1065
                {
1066
                    this.radDropDownListProdIsResult.Items.Add(new RadListDataItem(x, x));
1067
                });
1068
                var allProdIsResult = new RadListDataItem("== 전체 ==", string.Empty);
1069
                this.radDropDownListProdIsResult.Items.Insert(0, allProdIsResult);
1070
                allProdIsResult.Selected = true;
1071

    
1072
                //삼성 결과
1073
                if (this.radDropDownListClientIsResult.Items.Count > 0)
1074
                    this.radDropDownListClientIsResult.Items.Clear();
1075
                informations.ValidationResult.ForEach(x =>
1076
                {
1077
                    this.radDropDownListClientIsResult.Items.Add(new RadListDataItem(x, x));
1078
                });
1079
                var allClientIsResult = new RadListDataItem("== 전체 ==", string.Empty);
1080
                this.radDropDownListClientIsResult.Items.Insert(0, allClientIsResult);
1081
                allClientIsResult.Selected = true;
1082
                #endregion
1083

    
1084
                #region AVEVA
1085
                //Gateway
1086
                if (this.radDropDownListGateway.Items.Count > 0)
1087
                    this.radDropDownListGateway.Items.Clear();
1088
                informations.IsYesNo.ForEach(x =>
1089
                {
1090
                    this.radDropDownListGateway.Items.Add(new RadListDataItem(x, x));
1091
                });
1092
                var allDTIsGateWay = new RadListDataItem("== 전체 ==", string.Empty);
1093
                this.radDropDownListGateway.Items.Insert(0, allDTIsGateWay);
1094
                allDTIsGateWay.Selected = true;
1095

    
1096
                //Registration
1097
                if (this.radDropDownListRegistration.Items.Count > 0)
1098
                    this.radDropDownListRegistration.Items.Clear();
1099
                informations.IsYesNo.ForEach(x =>
1100
                {
1101
                    this.radDropDownListRegistration.Items.Add(new RadListDataItem(x, x));
1102
                });
1103
                var allDTIsRegSystem = new RadListDataItem("== 전체 ==", string.Empty);
1104
                this.radDropDownListRegistration.Items.Insert(0, allDTIsRegSystem);
1105
                allDTIsRegSystem.Selected = true;
1106
                #endregion
1107

    
1108
                this.GetDocList();
1109
            }
1110
            catch (Exception ex)
1111
            {
1112
                throw ex;
1113
            }
1114
            finally
1115
            {
1116

    
1117
                this.Cursor = Cursors.Default;
1118

    
1119
            }
1120

    
1121
        }
1122

    
1123
        #region Document List 조회
1124
        public void GetDocList()
1125
        {
1126
            try
1127
            {
1128
                if (this.radDropDownListProject.SelectedValue != null)
1129
                {
1130
                    List<string> dateTypes = this.radCheckedDropDownListDateType.CheckedItems.Select(x => x.Value.ToString()).ToList();
1131
                    DateTime? frDate = this.radDateTimePickerFr.Value.Equals(this.radDateTimePickerFr.NullDate) ? (DateTime?)null : this.radDateTimePickerFr.Value;
1132
                    DateTime? toDate = this.radDateTimePickerTo.Value.Equals(this.radDateTimePickerTo.NullDate) ? (DateTime?)null : this.radDateTimePickerTo.Value;
1133

    
1134
                    string projectCode = this.radDropDownListProject.SelectedValue.ToString();
1135
                    string personIncharge = this.radDropDownListPersonInCharge.SelectedValue.ToString();
1136
                    string jobLevel = this.radDropDownListJobLevel.SelectedValue.ToString();
1137
                    string documentNo = this.radTextBoxDocumentNo.Text.Trim();
1138

    
1139
                    string isToIsDiscussion = this.radDropDownListToIsDiscussion.SelectedValue.ToString();
1140
                    string isFrReviewStatus = this.radDropDownListFrReviewStatus.SelectedValue.ToString();
1141

    
1142
                    string id2Status = this.radDropDownListID2Status.SelectedValue.ToString();
1143
                    string id2Issues = this.radDropDownListID2Issues.SelectedValue.ToString();
1144
                    string avevaStatus = this.radDropDownListAVEVAStatus.SelectedValue.ToString();
1145
                    string avevaIssues = this.radDropDownListAVEVAIssues.SelectedValue.ToString();
1146

    
1147
                    string prodIsResult = this.radDropDownListProdIsResult.SelectedValue.ToString();
1148
                    string clientIsResult = this.radDropDownListClientIsResult.SelectedValue.ToString();
1149

    
1150
                    string isGateWay = this.radDropDownListGateway.SelectedValue.ToString();
1151
                    string isRegSystem = this.radDropDownListRegistration.SelectedValue.ToString();
1152

    
1153
                    var worker = new LoadDocumentsWorker(dateTypes, frDate, toDate, projectCode, personIncharge, jobLevel, documentNo, isToIsDiscussion, isFrReviewStatus, id2Status, id2Issues, avevaStatus, avevaIssues, prodIsResult, clientIsResult, isGateWay, isRegSystem, this.radGridViewDocuments);
1154
                    worker.OnWorkCompletedHandler += (e) =>
1155
                    {
1156
                        var docData = e.Result as DocumentsResult;
1157

    
1158
                        this.documents = docData.Dwgs;
1159
                        this.orgDocuments = JsonConvert.DeserializeObject<List<Documents>>(JsonConvert.SerializeObject(docData.Dwgs));
1160
                        this.TotalCount = docData.TotalCount;
1161

    
1162
                        List<string> projectCodes = new List<string>();
1163

    
1164
                        if (!string.IsNullOrWhiteSpace(projectCode))
1165
                        {
1166
                            projectCodes.Add(projectCode);
1167
                        }
1168
                        else
1169
                        {
1170
                            projectCodes = informations.ProjectList.Select(x => x.Code).ToList();
1171
                        }
1172

    
1173
                        this.DocumentListBinding();
1174
                    };
1175

    
1176
                    (btnShowAllDetail.HostedItem as RadCheckBoxElement).Checked = false;
1177
                    worker.StartWork();
1178
                }
1179
            }
1180
            catch (Exception ex)
1181
            {
1182
                throw ex;
1183
            }
1184
        }
1185

    
1186
        public void DocumentListBinding()
1187
        {
1188
            try
1189
            {
1190
                GridViewComboBoxColumn ColProjects = this.radGridViewDocuments.Columns["RefProjectCode"] as GridViewComboBoxColumn;
1191
                ColProjects.DataSource = informations.ProjectList.Where(x => x.GroupID.Equals(informations.ActiveProject.ProjectID)).ToList();
1192
                ColProjects.DisplayMember = "Name";
1193
                ColProjects.ValueMember = "Code";
1194

    
1195
                var workUsers = informations.UserList.Where(x => (new string[] { "Manager", "User" }).Contains(x.Role) && string.IsNullOrEmpty(x.RefProjectID));
1196
                var clientUsers = informations.UserList.Where(x => !string.IsNullOrEmpty(x.RefProjectID));
1197

    
1198
                GridViewComboBoxColumn ColPersonInCharge = this.radGridViewDocuments.Columns["PersonInCharge"] as GridViewComboBoxColumn;
1199
                ColPersonInCharge.DataSource = workUsers;
1200
                ColPersonInCharge.DisplayMember = "Name";
1201
                ColPersonInCharge.ValueMember = "ID";
1202

    
1203
                GridViewComboBoxColumn ColWorker = this.radGridViewDocuments.Columns["Worker"] as GridViewComboBoxColumn;
1204
                ColWorker.DataSource = workUsers;
1205
                ColWorker.DisplayMember = "Name";
1206
                ColWorker.ValueMember = "ID";
1207

    
1208
                GridViewComboBoxColumn ColAVEVAPersonInCharge = this.radGridViewDocuments.Columns["AVEVAPersonInCharge"] as GridViewComboBoxColumn;
1209
                ColAVEVAPersonInCharge.DataSource = workUsers;
1210
                ColAVEVAPersonInCharge.DisplayMember = "Name";
1211
                ColAVEVAPersonInCharge.ValueMember = "ID";
1212

    
1213
                GridViewComboBoxColumn ColAVEVAWorker = this.radGridViewDocuments.Columns["AVEVAWorker"] as GridViewComboBoxColumn;
1214
                ColAVEVAWorker.DataSource = workUsers;
1215
                ColAVEVAWorker.DisplayMember = "Name";
1216
                ColAVEVAWorker.ValueMember = "ID";
1217

    
1218
                GridViewComboBoxColumn ColReplyRequester = this.radGridViewDocuments.Columns["ReplyRequester"] as GridViewComboBoxColumn;
1219
                ColReplyRequester.DataSource = workUsers;
1220
                ColReplyRequester.DisplayMember = "Name";
1221
                ColReplyRequester.ValueMember = "ID";
1222

    
1223
                GridViewComboBoxColumn ColToCreator = this.radGridViewDocuments.Columns["ToCreator"] as GridViewComboBoxColumn;
1224
                ColToCreator.DataSource = workUsers;
1225
                ColToCreator.DisplayMember = "Name";
1226
                ColToCreator.ValueMember = "ID";
1227

    
1228
                GridViewComboBoxColumn ColFrCreator = this.radGridViewDocuments.Columns["FrCreator"] as GridViewComboBoxColumn;
1229
                ColFrCreator.DataSource = clientUsers;
1230
                ColFrCreator.DisplayMember = "Name";
1231
                ColFrCreator.ValueMember = "ID";
1232

    
1233
                GridViewComboBoxColumn ColProdReviewer = this.radGridViewDocuments.Columns["ProdReviewer"] as GridViewComboBoxColumn;
1234
                ColProdReviewer.DataSource = workUsers;
1235
                ColProdReviewer.DisplayMember = "Name";
1236
                ColProdReviewer.ValueMember = "ID";
1237

    
1238
                GridViewComboBoxColumn ColClientReviewer = this.radGridViewDocuments.Columns["ClientReviewer"] as GridViewComboBoxColumn;
1239
                ColClientReviewer.DataSource = clientUsers;
1240
                ColClientReviewer.DisplayMember = "Name";
1241
                ColClientReviewer.ValueMember = "ID";
1242

    
1243
                //Data
1244
                if (this.radGridViewDocuments.DataSource != null)
1245
                    this.radGridViewDocuments.DataSource = null;
1246

    
1247
                /*
1248
                var info = informations.ProjectList.Where(x => x.Name.Equals("APAO")).FirstOrDefault().ID2Info;
1249
                var id2Datas = new DocumentController(info).GetID2DrawingsByProject(info);
1250
                var test = from doc in this.documents
1251
                           join id2 in id2Datas on doc.DocumentNo equals id2.DOCNAME into gj
1252
                           from docs in gj.DefaultIfEmpty()
1253
                           select new Documents()
1254
                           {
1255
                               DocumentNo = doc.DocumentNo,
1256
                               ID2EndDate = docs?.DATETIME == null ? (DateTime?)null : Convert.ToDateTime(docs?.DATETIME)
1257
                               //ProdRemarks = docs.DATETIME ?? null
1258
                           };
1259
                */
1260

    
1261
                this.radGridViewDocuments.FilterDescriptors.Clear();
1262
                this.radGridViewDocuments.DataSource = new BindingList<Documents>(this.documents);
1263
                this.lbSelectAndTotal.Text = $"{this.radGridViewDocuments.MasterTemplate.DataView.Count} / {this.TotalCount} (Selected / Total)";
1264

    
1265
                var verification = this.LayoutValidation.Controls[0] as Verification;
1266
                verification.DocumentListBinding(this.documents);
1267
            }
1268
            catch (Exception ex)
1269
            {
1270
                throw ex;
1271
            }
1272
        }
1273
        #endregion
1274

    
1275
        #region Button, Checkbox event
1276
        private void RadButtonDateClear_Click(object sender, EventArgs e)
1277
        {
1278
            //DateType
1279
            this.radCheckedDropDownListDateType.CheckedItems.Clear();
1280
            //FromDate
1281
            this.radDateTimePickerFr.SetToNullValue();
1282
            //ToDate
1283
            this.radDateTimePickerTo.SetToNullValue();
1284
        }
1285

    
1286
        private void RadDropDownList_SelectedIndexChanged(object sender, Telerik.WinControls.UI.Data.PositionChangedEventArgs e)
1287
        {
1288
            if (sender is RadDropDownList ddl)
1289
            {
1290
                if (ddl.SelectedValue != null)
1291
                {
1292
                    if (string.IsNullOrEmpty(ddl.SelectedValue.ToString()))
1293
                    {
1294
                        ddl.BackColor = Color.White;
1295
                        ddl.ForeColor = Color.Black;
1296
                        ddl.Font = new Font("Segoe UI", 8.25F, FontStyle.Regular);
1297
                    }
1298
                    else
1299
                    {
1300
                        ddl.BackColor = Color.DarkSlateBlue;
1301
                        ddl.ForeColor = Color.Yellow;
1302
                        ddl.Font = new Font("Segoe UI", 8.25F, FontStyle.Bold);
1303
                    }
1304
                }
1305
            }
1306
        }
1307

    
1308
        private void RadCheckBox_CheckStateChanged(object sender, EventArgs e)
1309
        {
1310
            if (sender is RadCheckBox checkBox)
1311
            {
1312
                if (checkBox.Tag != null)
1313
                {
1314
                    ColumnGroupsViewDefinition columnGroupsView = this.radGridViewDocuments.MasterTemplate.ViewDefinition as ColumnGroupsViewDefinition;
1315
                    GridViewColumnGroup colGroup = columnGroupsView.GetAllGroups().Where(x => x.Name.Equals(checkBox.Tag.ToString())).FirstOrDefault();
1316
                    if (colGroup != null)
1317
                        colGroup.IsVisible = checkBox.Checked;
1318
                }
1319
            }
1320

    
1321
            //ColumnGroupsViewDefinition columnGroupsView = this.radGridViewDocuments.MasterTemplate.ViewDefinition = columnGroupsView;
1322
        }
1323

    
1324
        private void RadTextBoxDocumentNo_KeyDown(object sender, KeyEventArgs e)
1325
        {
1326
            if (e.KeyCode == Keys.Enter)
1327
            {
1328
                this.radButtonSearch.Focus();
1329
                this.radButtonSearch.PerformClick();
1330
            }
1331
        }
1332

    
1333
        private void RadTextBoxDocumentNo_KeyUp(object sender, KeyEventArgs e)
1334
        {
1335
            if (sender is RadTextBox txtBox)
1336
            {
1337
                if (txtBox.Text.Length > 0)
1338
                {
1339
                    txtBox.BackColor = Color.DarkSlateBlue;
1340
                    txtBox.ForeColor = Color.Yellow;
1341
                    txtBox.Font = new Font("Segoe UI", 8.25F, FontStyle.Bold);
1342
                }
1343
                else
1344
                {
1345
                    txtBox.BackColor = Color.White;
1346
                    txtBox.ForeColor = Color.Black;
1347
                    txtBox.Font = new Font("Segoe UI", 8.25F, FontStyle.Regular);
1348
                }
1349
            }
1350
        }
1351

    
1352
        private void RadButtonSearch_Click(object sender, EventArgs e)
1353
        {
1354
            try
1355
            {
1356
                this.GetDocList();
1357
            }
1358
            catch (Exception ex)
1359
            {
1360
                Program.logger.Error($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex);
1361
                RadMessageBox.Show("DWG search failed.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error);
1362
            }
1363
        }
1364

    
1365
        private void BackstageButtonItemSelectDB_Click(object sender, EventArgs e)
1366
        {
1367
            using (var frm = new SetID2ProjectDB())
1368
            {
1369
                if (frm.ShowDialog(this) == DialogResult.OK)
1370
                {
1371
                    if (informations.ActiveUser != null && !string.IsNullOrEmpty(informations.ActiveUser.RefProjectID))
1372
                    {
1373
                        this.radRibbonBarBackstageViewID2Manager.HidePopup();
1374

    
1375
                        informations.ActiveProject = new ProjectController().GetProjectInfo(informations.ActiveUser.RefProjectID);
1376
                        informations.ProjectList = new ProjectController().GetAllProjectList().ToList();
1377

    
1378
                        this.LoadProject();
1379
                    }
1380
                    else
1381
                    {
1382
                        informations.ProjectList = new ProjectController().GetAllProjectList().ToList();
1383
                        bool isID2 = this.IsID2Connection();
1384
                        this.SetMenus(isID2);
1385

    
1386
                        foreach (Control ctrl in this.backstageViewPageOpenProject.Controls)
1387
                        {
1388
                            if (ctrl is OpenProjectView)
1389
                            {
1390
                                var openProjectView = ctrl as OpenProjectView;
1391
                                openProjectView.GetProjectGroups();
1392
                                break;
1393
                            }
1394
                        }
1395
                    }
1396
                }
1397
            }
1398
        }
1399

    
1400
        private void BackstageButtonItemUserRegistration_Click(object sender, EventArgs e)
1401
        {
1402
            using (var frm = new SetupUser())
1403
            {
1404
                if (frm.ShowDialog(this) == DialogResult.OK)
1405
                {
1406

    
1407
                }
1408
            }
1409
        }
1410

    
1411
        private void BackstageButtonItemExit_Click(object sender, EventArgs e)
1412
        {
1413
            Application.Exit();
1414
        }
1415
        #endregion
1416

    
1417
        #region Grid event
1418
        private void RadGridViewDocuments_CommandCellClick(object sender, GridViewCellEventArgs e)
1419
        {
1420
            if (e.Row is GridViewNewRowInfo)
1421
            {
1422

    
1423
            }
1424
            else
1425
            {
1426
                string extension = string.Empty;
1427

    
1428
                switch (e.Column.Name)
1429
                {
1430
                    case "MarkupLink":
1431
                        {
1432
                            if (e.Row.DataBoundItem is Documents doc)
1433
                            {
1434
                                if (!string.IsNullOrWhiteSpace(doc.RefProjectCode) && !string.IsNullOrWhiteSpace(doc.DocumentNo) && !string.IsNullOrWhiteSpace(informations.ActiveUser.ID))
1435
                                {
1436
                                    bool result = MarkusHelper.Start(doc.RefProjectCode, doc.DocumentNo, informations.ActiveUser.ID);
1437
                                }
1438
                            }
1439
                        }
1440
                        break;
1441
                    case "AVEVALink":
1442
                        MessageBox.Show($"{e.Column.Name} 실행");
1443
                        break;
1444
                    case "ID2Connection":
1445
                        try
1446
                        {
1447
                            if (e.Row.DataBoundItem is Documents doc)
1448
                            {
1449
                                ID2Helper.OpenPID(doc.DocumentNo, string.Empty, Properties.Settings.Default.ID2Port);
1450

    
1451
                                try
1452
                                {
1453
                                    var returnDoc = new DocumentController().SetID2Worker(new Documents()
1454
                                    {
1455
                                        DocID = doc.DocID,
1456
                                        ID2StartDate = DateTime.Now,
1457
                                        Worker = informations.ActiveUser.ID
1458
                                    }, informations.ActiveUser.ID);
1459

    
1460
                                    if (returnDoc != null)
1461
                                    {
1462
                                        doc.ID2StartDate = returnDoc.ID2StartDate;
1463
                                        doc.Worker = returnDoc.Worker;
1464
                                    }
1465
                                }
1466
                                catch { }
1467
                            }
1468
                        }
1469
                        catch (Exception ex)
1470
                        {
1471
                            RadMessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, RadMessageIcon.Error);
1472
                        }
1473
                        break;
1474
                    case "Compare":
1475
                        try
1476
                        {
1477
                            if (e.Row.DataBoundItem is Documents selectedDoc)
1478
                            {
1479
                                if (!string.IsNullOrEmpty(selectedDoc.DocID))
1480
                                {
1481
                                    DockMainTabStrip.SelectedTab = DockValidation;
1482
                                    var verification = this.LayoutValidation.Controls[0] as Verification;
1483
                                    verification.DocumentSelection(selectedDoc);
1484
                                }
1485
                            }
1486
                        }
1487
                        catch (Exception ex)
1488
                        {
1489
                            RadMessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, RadMessageIcon.Error);
1490
                        }
1491
                        break;
1492
                }
1493
            }
1494
        }
1495

    
1496
        private void RadGridViewDocuments_CellBeginEdit(object sender, GridViewCellCancelEventArgs e)
1497
        {
1498
            if (e.ActiveEditor is RadDropDownListEditor)
1499
            {
1500
                switch (e.Column.Name)
1501
                {
1502
                    //case "RefProjectCode":
1503
                    //    GridViewComboBoxColumn ColProjects = this.radGridViewDocuments.Columns[e.Column.Name] as GridViewComboBoxColumn;
1504
                    //    ColProjects.DataSource = informations.ProjectList.Where(x => x.GroupID.Equals(informations.ActiveProject.ProjectID)).ToList();
1505
                    //    ColProjects.DisplayMember = "Name";
1506
                    //    ColProjects.ValueMember = "Code";
1507
                    //    break;
1508
                    //case "PersonInCharge":
1509
                    //case "Worker":
1510
                    //case "AVEVAPersonInCharge":
1511
                    //case "AVEVAWorker":
1512
                    //case "ReplyRequester":
1513
                    //case "ToCreator":
1514
                    //case "ProdReviewer":
1515
                    //    var workUsers = informations.UserList.Where(x => (new string[] { "Manager", "User" }).Contains(x.Role) && string.IsNullOrEmpty(x.RefProjectID));
1516
                    //    GridViewComboBoxColumn ColProdUsers = this.radGridViewDocuments.Columns[e.Column.Name] as GridViewComboBoxColumn;
1517
                    //    ColProdUsers.DataSource = workUsers;
1518
                    //    ColProdUsers.DisplayMember = "Name";
1519
                    //    ColProdUsers.ValueMember = "ID";
1520
                    //    break;
1521
                    //case "FrCreator":
1522
                    //case "ClientReviewer":
1523
                    //    var clientUsers = informations.UserList.Where(x => !string.IsNullOrEmpty(x.RefProjectID));
1524
                    //    GridViewComboBoxColumn ColClientUsers = this.radGridViewDocuments.Columns[e.Column.Name] as GridViewComboBoxColumn;
1525
                    //    ColClientUsers.DataSource = clientUsers;
1526
                    //    ColClientUsers.DisplayMember = "Name";
1527
                    //    ColClientUsers.ValueMember = "ID";
1528
                    //    break;
1529
                    case "JobLevel":
1530
                        GridViewComboBoxColumn colJobLevel = this.radGridViewDocuments.Columns[e.Column.Name] as GridViewComboBoxColumn;
1531
                        colJobLevel.DataSource = informations.JobLevel;
1532
                        break;
1533
                    case "ToIsDiscussion":
1534
                    case "IsConvert":
1535
                    case "DTIsImport":
1536
                    case "DTIsGateWay":
1537
                    case "DTIsRegSystem":
1538
                        GridViewComboBoxColumn colYesNo = this.radGridViewDocuments.Columns[e.Column.Name] as GridViewComboBoxColumn;
1539
                        colYesNo.DataSource = (new string[] { string.Empty }).Union<string>(informations.IsYesNo);
1540
                        break;
1541
                    case "ID2Status":
1542
                    case "AVEVAStatus":
1543
                        GridViewComboBoxColumn ColJobStatus = this.radGridViewDocuments.Columns[e.Column.Name] as GridViewComboBoxColumn;
1544
                        ColJobStatus.DataSource = (new string[] { string.Empty }).Union<string>(informations.JobStatus);
1545
                        break;
1546
                    case "FrReviewStatus"://삼성의견status
1547
                        GridViewComboBoxColumn ColClientStatus = this.radGridViewDocuments.Columns[e.Column.Name] as GridViewComboBoxColumn;
1548
                        ColClientStatus.DataSource = (new string[] { string.Empty }).Union<string>(informations.ClientStatus);
1549
                        break;
1550
                    case "ProdIsResult":
1551
                    case "ClientIsResult":
1552
                        GridViewComboBoxColumn ColResult = this.radGridViewDocuments.Columns[e.Column.Name] as GridViewComboBoxColumn;
1553
                        ColResult.DataSource = (new string[] { string.Empty }).Union<string>(informations.ValidationResult);
1554
                        break;
1555
                }
1556
            }
1557
        }
1558

    
1559
        private void RadGridViewDocuments_ViewCellFormatting(object sender, CellFormattingEventArgs e)
1560
        {
1561
            if (e.Row is GridViewDataRowInfo)
1562
            {
1563
                if (e.CellElement is GridRowHeaderCellElement)
1564
                {
1565
                    // if (e.CellElement.RowIndex > -1)
1566
                    //      e.CellElement.Text = (e.CellElement.RowIndex + 1).ToString();
1567
                }
1568
                else if (e.CellElement is GridGroupExpanderCellElement expanderCellElement)
1569
                {
1570
                    if ((e.Row.DataBoundItem as Documents).Markups == null)
1571
                    {
1572
                        expanderCellElement.Enabled = false;
1573
                    }
1574
                }
1575
                else
1576
                {
1577
                    var result = e.Row.DataBoundItem as Documents;
1578
                    if (result != null || e.Row is GridViewNewRowInfo)
1579
                    {
1580
                        switch (e.CellElement.ColumnInfo.Name)
1581
                        {
1582
                            case "AutoCADLink":
1583
                            case "PDFLink":
1584
                            case "MarkupLink":
1585
                            case "AVEVALink":
1586
                            case "ID2Connection":
1587
                            case "Compare":
1588
                                this.GetCommandColBtnElement(e.CellElement.Children[0], e.CellElement.ColumnInfo.Name);
1589
                                break;
1590
                            case "ToCapture":
1591
                                if (result.ToCapture > 0)
1592
                                {
1593
                                    e.CellElement.Image = Properties.Resources.files18;
1594
                                }
1595
                                break;
1596
                            case "FrCapture":
1597
                                if (result.FrCapture > 0)
1598
                                {
1599
                                    e.CellElement.Image = Properties.Resources.files18;
1600
                                }
1601
                                break;
1602
                            //case "ProdCapture":
1603
                            //    if (result.ProdCapture > 0)
1604
                            //    {
1605
                            //        e.CellElement.Image = Properties.Resources.files18;
1606
                            //    }
1607
                            //    break;
1608
                            //case "ClientCapture":
1609
                            //    if (result.ClientCapture > 0)
1610
                            //    {
1611
                            //        e.CellElement.Image = Properties.Resources.files18;
1612
                            //    }
1613
                            //    break;
1614
                            case "ID2Capture":
1615
                                if (result.ID2Capture > 0)
1616
                                {
1617
                                    e.CellElement.Image = Properties.Resources.files18;
1618
                                }
1619
                                break;
1620
                        }
1621
                    }
1622
                    else
1623
                    {
1624

    
1625
                    }
1626
                }
1627
            }
1628
            else if (e.Row is GridViewDetailsRowInfo)
1629
            {
1630
                if (e.CellElement is GridDetailViewCellElement detailViewCellElement)
1631
                {
1632
                    detailViewCellElement.Padding = new Padding(10, 2, 2, 2);
1633
                    detailViewCellElement.BackColor = Color.FromArgb(214, 214, 214);
1634
                    detailViewCellElement.BackColor2 = Color.FromArgb(214, 214, 214);
1635
                }
1636
            }
1637
            //else if (e.Row is GridViewSummaryRowInfo)
1638
            //{
1639
            //    if (e.CellElement is GridRowHeaderCellElement)
1640
            //    {
1641
            //        e.CellElement.Text = "Count";
1642
            //    }
1643
            //    else if (e.CellElement is GridSummaryCellElement)
1644
            //    {
1645
            //        e.CellElement.ForeColor = this._SummaryColor;
1646
            //        e.CellElement.TextAlignment = ContentAlignment.BottomRight;
1647
            //        e.CellElement.Font = new Font(e.CellElement.Font, FontStyle.Bold);
1648
            //    }
1649
            //    else
1650
            //    {
1651

    
1652
            //    }
1653
            //}
1654
            else
1655
            {
1656

    
1657
            }
1658
        }
1659

    
1660
        private RadButtonElement GetCommandColBtnElement(RadElement elem, string colName)
1661
        {
1662
            RadButtonElement btnElem = null;
1663
            Bitmap bitmap = null; ;
1664

    
1665
            switch (colName)
1666
            {
1667
                case "AutoCADLink":
1668
                    bitmap = new Bitmap(Properties.Resources.cad18);
1669
                    break;
1670
                case "PDFLink":
1671
                    bitmap = new Bitmap(Properties.Resources.pdf18);
1672
                    break;
1673
                case "MarkupLink":
1674
                    bitmap = new Bitmap(Properties.Resources.markus18);
1675
                    break;
1676
                case "AVEVALink":
1677
                    bitmap = new Bitmap(Properties.Resources.aveva_net18);
1678
                    break;
1679
                case "ID2Connection":
1680
                    bitmap = new Bitmap(Properties.Resources.id218);
1681
                    break;
1682
                case "Compare":
1683
                    bitmap = new Bitmap(Properties.Resources.compare18);
1684
                    break;
1685
            }
1686

    
1687
            switch (colName)
1688
            {
1689
                case "AutoCADLink":
1690
                case "PDFLink":
1691
                case "MarkupLink":
1692
                case "AVEVALink":
1693
                case "ID2Connection":
1694
                case "Compare":
1695
                    btnElem = (RadButtonElement)elem;
1696
                    btnElem.Margin = new Padding(0);
1697
                    btnElem.Padding = new Padding(0);
1698
                    btnElem.BorderElement.Opacity = 0;
1699
                    btnElem.Alignment = ContentAlignment.MiddleCenter;
1700
                    btnElem.DisplayStyle = DisplayStyle.Image;
1701
                    btnElem.Image = bitmap;
1702
                    btnElem.ImageAlignment = ContentAlignment.MiddleCenter;
1703
                    btnElem.MaxSize = bitmap.Size;
1704
                    break;
1705
            }
1706

    
1707
            return btnElem;
1708
        }
1709

    
1710
        private void RadGridViewDocuments_FilterChanging(object sender, GridViewCollectionChangingEventArgs e)
1711
        {
1712

    
1713
        }
1714

    
1715
        private void RadGridViewDocuments_FilterChanged(object sender, GridViewCollectionChangedEventArgs e)
1716
        {
1717
            //if (sender is RadGridView grid)
1718
            //{
1719
            //    var viewRows = e.GridViewTemplate.DataView;
1720

    
1721
            //    grid.Rows.ForAll(x => x.Cells["Checked"].Value = false);
1722

    
1723
            //    viewRows.ForAll(x =>
1724
            //    {
1725
            //        bool isChecked = Convert.ToBoolean(x.Cells["Checked"].Value);
1726
            //        x.Cells["Checked"].Value = isChecked;
1727
            //        if (x.Cells["Checked"].Value != null && Convert.ToBoolean(x.Cells["Checked"].Value))
1728
            //        {
1729
            //            x.Cells["Checked"].Value = false;
1730
            //        }
1731
            //    });
1732
            //}            
1733

    
1734
            //this.radGridViewDocuments.Rows.ToList().Except(e.GridViewTemplate.DataView).Count()
1735

    
1736
            //var datas = this.radGridViewDocuments.MasterTemplate.DataView.Except(e.GridViewTemplate.DataView);
1737
            //datas.ForAll(x => x.Cells["Checked"].Value = false);
1738

    
1739
            //if (e.Action == NotifyCollectionChangedAction.Remove)
1740
            //{
1741
            //    if (sender is RadGridView grid)
1742
            //    {
1743
            //        var allRows = grid.Rows.ToList();
1744
            //        var viewRows = e.GridViewTemplate.DataView;
1745
            //        var hiddenRows = allRows.Except(viewRows);
1746

    
1747
            //        //grid.BeginUpdate();
1748
            //        hiddenRows.ForAll(x =>
1749
            //        {
1750
            //            if (x.Cells["Checked"].Value != null)
1751
            //            {
1752
            //                if (Convert.ToBoolean(x.Cells["Checked"].Value))
1753
            //                {
1754
            //                    x.Cells["Checked"].Value = false;
1755
            //                }
1756
            //            }
1757
            //        });
1758
            //        //grid.EndUpdate();
1759
            //    }
1760
            //}
1761

    
1762
            this.lbSelectAndTotal.Text = $"{e.GridViewTemplate.DataView.Count} / {this.TotalCount} (Selected / Total)";
1763
        }
1764

    
1765
        private void RadGridViewDocuments_ValueChanged(object sender, EventArgs e)
1766
        {
1767
            this.radGridViewDocuments.EndEdit();
1768
        }
1769
        #endregion
1770

    
1771
        #region Excel
1772
        private UserInfo GetUser(string user)
1773
        {
1774
            UserInfo userInfo = informations.UserList.Where(x => x.ID.Equals(user)).FirstOrDefault();
1775
            if (userInfo != null) return userInfo;
1776

    
1777
            userInfo = informations.UserList.Where(x => x.Name.Equals(user)).FirstOrDefault();
1778
            if (userInfo != null) return userInfo;
1779

    
1780
            return userInfo ?? new UserInfo();
1781
        }
1782

    
1783
        private ProjectInfo GetProject(string project)
1784
        {
1785
            ProjectInfo prjInfo = informations.ProjectList.Where(x => x.Code.Equals(project)).FirstOrDefault();
1786
            if (prjInfo != null) return prjInfo;
1787

    
1788
            prjInfo = informations.ProjectList.FirstOrDefault(x => x.Name.Equals(project));
1789
            if (prjInfo != null) return prjInfo;
1790

    
1791
            return prjInfo ?? new ProjectInfo();
1792
        }
1793

    
1794
        private void RadButtonElementExcelImport_Click(object sender, EventArgs e)
1795
        {
1796
            var form = new Forms.SelectExcelData();
1797

    
1798
            var dialogResult = form.ShowDialog();
1799

    
1800
            if (dialogResult == DialogResult.OK)
1801
            {
1802
                using (ID2Excel excel = new ID2Excel())
1803
                {
1804
                    var result = excel.ExcelDataImport(form.SelectItems);
1805

    
1806
                    if (result.Error != null)
1807
                    {
1808

    
1809
                        RadMessageBox.Show(result.Error, "Information", MessageBoxButtons.OK, RadMessageIcon.Info);
1810
                    }
1811
                    else
1812
                    {
1813
                        this.importImages = result.Images;
1814
                        this.documents.AddRange(result.documents);
1815
                        if (this.orgDocuments == null) this.orgDocuments = new List<Documents>();
1816
                        this.DocumentListBinding();
1817
                        //briefAndImagesReview.SetImages(this.importImages);
1818
                    }
1819

    
1820
                }
1821
            }
1822
        }
1823

    
1824
        private void RadButtonElementExcelImport_Click_gembox(object sender, EventArgs e)
1825
        {
1826
            using (OpenFileDialog ofd = new OpenFileDialog()
1827
            {
1828
                Filter = "Excel files (*.xlsx)|*.xlsx",
1829
                Title = "Open an Excel File",
1830
                RestoreDirectory = true
1831
            })
1832
            {
1833
                if (ofd.ShowDialog() == DialogResult.OK)
1834
                {
1835
                    //Error Message
1836
                    StringBuilder sbErrMsg = new StringBuilder();
1837

    
1838
                    using (ID2Excel excel = new ID2Excel())
1839
                    {
1840
                        var result = excel.GemboxImport(ofd.FileName);
1841

    
1842
                        if (result.Error != null)
1843
                        {
1844

    
1845
                            RadMessageBox.Show(result.Error, "Information", MessageBoxButtons.OK, RadMessageIcon.Info);
1846
                        }
1847
                        else
1848
                        {
1849
                            this.documents.AddRange(result.documents);
1850
                            if (this.orgDocuments == null) this.orgDocuments = new List<Documents>();
1851
                            this.DocumentListBinding();
1852
                        }
1853

    
1854
                    }
1855

    
1856

    
1857
                    //foreach (Documents appDoc in appendDocuments)
1858
                    //{
1859
                    //    GridViewRowInfo rowInfo = this.radGridViewDocuments.Rows.AddNew();
1860

    
1861
                    //    foreach (FieldInfo fieldInfo in appDoc.GetType().GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly))
1862
                    //    {
1863
                    //        if (fieldInfo.GetValue(appDoc) != null)
1864
                    //        {
1865
                    //            var cols = rowInfo.Cells.Where(x => fieldInfo.Name.Contains($"<{x.ColumnInfo.Name}>"));
1866

    
1867
                    //            if (cols.Any())
1868
                    //            {
1869
                    //                cols.FirstOrDefault().Value = fieldInfo.GetValue(appDoc);
1870
                    //            }
1871
                    //        }
1872
                    //    }
1873
                    //}
1874
                }
1875
            }
1876
        }
1877

    
1878
        private void RadButtonElementExcelExport_Click(object sender, EventArgs e)
1879
        {
1880
            string sPrefixName = "Samsung Elec Task Management";
1881
            string extension = ".xlsx";
1882

    
1883
            using (SaveFileDialog sfd = new SaveFileDialog()
1884
            {
1885
                FileName = $"{sPrefixName}_{DateTime.Now:yyyyMMddhhmmss}{extension}",
1886
                Filter = "Excel|*.xlsx",
1887
                Title = "Save an Excel File",
1888
                CheckFileExists = false,
1889
                CheckPathExists = true,
1890
                OverwritePrompt = true
1891
            })
1892
            {
1893
                if (sfd.ShowDialog() == DialogResult.OK)
1894
                {
1895
                    string fileName = $"{sPrefixName}{extension}";
1896
                    string templateFolder = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "Template");
1897
                    string templateFilePath = Path.Combine(templateFolder, fileName);
1898
                    if (!File.Exists(templateFilePath))
1899
                    {
1900
                        RadMessageBox.Show(this, $"There is no {fileName} in {templateFolder}", "Error", MessageBoxButtons.OK, RadMessageIcon.Error);
1901
                        return;
1902
                    }
1903

    
1904
                    var templateExcelFile = ExcelFile.Load(templateFilePath);
1905
                    var templateWorksheets = templateExcelFile.Worksheets;
1906
                    var templateWorksheet = templateWorksheets[0];
1907

    
1908
                    if (this.radGridViewDocuments.Rows.Count > 0)
1909
                    {
1910
                        int rowIndex = 9;
1911
                        //int colIndex = 1;
1912
                        int rowNo = 1;
1913

    
1914
                        foreach (var row in this.radGridViewDocuments.Rows)
1915
                        {
1916
                            var doc = row.DataBoundItem as Documents;
1917

    
1918
                            templateWorksheet.Cells[rowIndex, 0].Value = rowNo++;
1919

    
1920
                            templateWorksheet.Cells[rowIndex, 7].Value = doc.RefProjectCode;
1921
                            templateWorksheet.Cells[rowIndex, 8].Value = doc.System;
1922
                            templateWorksheet.Cells[rowIndex, 9].Value = doc.SubSystemCode;
1923
                            templateWorksheet.Cells[rowIndex, 10].Value = doc.DocumentNo;
1924
                            templateWorksheet.Cells[rowIndex, 11].Value = this.GetUser(doc.PersonInCharge).Name;
1925
                            templateWorksheet.Cells[rowIndex, 12].Value = this.GetUser(doc.Worker).Name;
1926
                            templateWorksheet.Cells[rowIndex, 13].Value = this.GetUser(doc.AVEVAPersonInCharge).Name;
1927
                            templateWorksheet.Cells[rowIndex, 14].Value = this.GetUser(doc.AVEVAWorker).Name;
1928
                            templateWorksheet.Cells[rowIndex, 15].Value = doc.JobLevel;
1929
                            templateWorksheet.Cells[rowIndex, 16].Value = doc.RevisonNo;
1930
                            templateWorksheet.Cells[rowIndex, 17].Value = doc.ToIsDiscussion;
1931
                            templateWorksheet.Cells[rowIndex, 18].Value = doc.ToRemarks;
1932
                            templateWorksheet.Cells[rowIndex, 19].Value = this.GetUser(doc.ToCreator).Name;
1933
                            //toreview-20
1934
                            templateWorksheet.Cells[rowIndex, 21].Value = doc.FrReviewStatus;
1935
                            templateWorksheet.Cells[rowIndex, 22].Value = doc.FrRemarks;
1936
                            templateWorksheet.Cells[rowIndex, 23].Value = this.GetUser(doc.FrCreator).Name;
1937
                            //frreview-24
1938
                            templateWorksheet.Cells[rowIndex, 25].Value = $"{doc.ID2StartDate:yyyy/MM/dd hh:mm:ss}";
1939
                            templateWorksheet.Cells[rowIndex, 26].Value = $"{doc.ID2EndDate:yyyy/MM/dd hh:mm:ss}";
1940
                            templateWorksheet.Cells[rowIndex, 27].Value = doc.ID2Status;
1941
                            templateWorksheet.Cells[rowIndex, 28].Value = doc.ID2Issues;
1942
                            //id2work-29
1943
                            templateWorksheet.Cells[rowIndex, 30].Value = doc.ReplyModifications;
1944
                            templateWorksheet.Cells[rowIndex, 31].Value = this.GetUser(doc.ReplyRequester).Name;
1945
                            templateWorksheet.Cells[rowIndex, 32].Value = doc.IsConvert;
1946
                            templateWorksheet.Cells[rowIndex, 33].Value = $"{doc.AVEVAConvertDate:yyyy/MM/dd}";
1947
                            templateWorksheet.Cells[rowIndex, 34].Value = $"{doc.AVEVAWorkDate:yyyy/MM/dd}";
1948
                            templateWorksheet.Cells[rowIndex, 35].Value = doc.AVEVAStatus;
1949
                            templateWorksheet.Cells[rowIndex, 36].Value = doc.AVEVAIssues;
1950
                            templateWorksheet.Cells[rowIndex, 37].Value = $"{doc.AVEVAReviewDate:yyyy/MM/dd}";
1951
                            templateWorksheet.Cells[rowIndex, 38].Value = this.GetUser(doc.ProdReviewer).Name;
1952
                            templateWorksheet.Cells[rowIndex, 39].Value = doc.ProdIsResult;
1953
                            templateWorksheet.Cells[rowIndex, 40].Value = doc.ProdRemarks;
1954
                            templateWorksheet.Cells[rowIndex, 41].Value = this.GetUser(doc.ClientReviewer).Name;
1955
                            templateWorksheet.Cells[rowIndex, 42].Value = doc.ClientIsResult;
1956
                            templateWorksheet.Cells[rowIndex, 43].Value = doc.ClientRemarks;
1957
                            templateWorksheet.Cells[rowIndex, 44].Value = doc.DTIsGateWay;
1958
                            templateWorksheet.Cells[rowIndex, 45].Value = doc.DTIsImport;
1959
                            templateWorksheet.Cells[rowIndex, 46].Value = doc.DTIsRegSystem;
1960
                            templateWorksheet.Cells[rowIndex, 47].Value = doc.DTRemarks;
1961

    
1962
                            /*
1963
                            templateWorksheet.Cells[rowIndex, 0].Value = doc.Seq;
1964
                            //templateWorksheet.Cells[rowIndex, 1].Value = doc.DocumentNo;
1965
                            //templateWorksheet.Cells[rowIndex, 2].Value = doc.DocumentNo;
1966
                            //templateWorksheet.Cells[rowIndex, 3].Value = doc.DocumentNo;
1967
                            //templateWorksheet.Cells[rowIndex, 4].Value = doc.DocumentNo;
1968
                            templateWorksheet.Cells[rowIndex, 5].Value = doc.RefProjectCode;
1969
                            templateWorksheet.Cells[rowIndex, 6].Value = doc.DocumentNo;
1970
                            templateWorksheet.Cells[rowIndex, 7].Value = this.GetUser(doc.PersonInCharge).Name;
1971
                            templateWorksheet.Cells[rowIndex, 8].Value = doc.JobLevel;
1972
                            //templateWorksheet.Cells[rowIndex, 9].Value = doc.IsTypical;
1973
                            templateWorksheet.Cells[rowIndex, 10].Value = doc.RevisonNo;
1974
                            templateWorksheet.Cells[rowIndex, 11].Value = doc.ToIsDiscussion;
1975
                            templateWorksheet.Cells[rowIndex, 12].Value = doc.ToRemarks;
1976
                            templateWorksheet.Cells[rowIndex, 13].Value = this.GetUser(doc.ToCreator).Name;
1977
                            //templateWorksheet.Cells[rowIndex, 14].Value = doc.ToCapture;
1978
                            //templateWorksheet.Cells[rowIndex, 15].Value = doc.ToIsMarkup;
1979
                            templateWorksheet.Cells[rowIndex, 16].Value = doc.FrReviewStatus;
1980
                            templateWorksheet.Cells[rowIndex, 17].Value = doc.FrRemarks;
1981
                            templateWorksheet.Cells[rowIndex, 18].Value = this.GetUser(doc.FrCreator).Name;
1982
                            //templateWorksheet.Cells[rowIndex, 19].Value = doc.FrCapture;
1983
                            //templateWorksheet.Cells[rowIndex, 20].Value = doc.FrIsMarkup;
1984
                            //templateWorksheet.Cells[rowIndex, 21].Value = doc.IsID2Work;
1985
                            //templateWorksheet.Cells[rowIndex, 22].Value = doc.ID2Connection;
1986
                            templateWorksheet.Cells[rowIndex, 23].Value = $"{doc.ID2StartDate:yyyy/MM/dd hh:mm:ss}";
1987
                            templateWorksheet.Cells[rowIndex, 24].Value = $"{doc.ID2EndDate:yyyy/MM/dd hh:mm:ss}";
1988
                            //templateWorksheet.Cells[rowIndex, 25].Value = doc.ID2JobTime;
1989
                            templateWorksheet.Cells[rowIndex, 26].Value = doc.ID2Status;
1990
                            templateWorksheet.Cells[rowIndex, 27].Value = doc.ID2Issues;
1991
                            //templateWorksheet.Cells[rowIndex, 28].Value = doc.AVEVAConnection;
1992
                            templateWorksheet.Cells[rowIndex, 29].Value = $"{doc.AVEVAConvertDate:yyyy/MM/dd}";
1993
                            templateWorksheet.Cells[rowIndex, 30].Value = $"{doc.AVEVAReviewDate:yyyy/MM/dd}";
1994
                            //추가필요templateWorksheet.Cells[rowIndex, 30].Value = $"{doc.AVEVAWorkDate:yyyy/MM/dd}";
1995
                            templateWorksheet.Cells[rowIndex, 31].Value = doc.AVEVAStatus;
1996
                            templateWorksheet.Cells[rowIndex, 32].Value = doc.AVEVAIssues;
1997
                            //templateWorksheet.Cells[rowIndex, 33].Value = doc.DocumentNo;
1998
                            //templateWorksheet.Cells[rowIndex, 34].Value = doc.DocumentNo;
1999
                            templateWorksheet.Cells[rowIndex, 35].Value = this.GetUser(doc.ProdReviewer).Name;
2000
                            templateWorksheet.Cells[rowIndex, 36].Value = doc.ProdIsResult;
2001
                            templateWorksheet.Cells[rowIndex, 37].Value = doc.ProdRemarks;
2002
                            templateWorksheet.Cells[rowIndex, 38].Value = this.GetUser(doc.ClientReviewer).Name;
2003
                            templateWorksheet.Cells[rowIndex, 39].Value = doc.ClientIsResult;
2004
                            templateWorksheet.Cells[rowIndex, 40].Value = doc.ClientRemarks;
2005
                            templateWorksheet.Cells[rowIndex, 41].Value = doc.DTIsGateWay;
2006
                            templateWorksheet.Cells[rowIndex, 42].Value = doc.DTIsImport;
2007
                            templateWorksheet.Cells[rowIndex, 43].Value = doc.DTIsRegSystem;
2008
                            templateWorksheet.Cells[rowIndex, 44].Value = doc.DTRemarks;
2009
                            */
2010
                            rowIndex++;
2011
                        }
2012
                    }
2013
                    templateExcelFile.Save(sfd.FileName);
2014
                    RadMessageBox.Show("Exporting 'ID2 Document List' is complete", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info);
2015
                }
2016
            }
2017
        }
2018
        #endregion
2019

    
2020
        /*
2021
        private void GetCheckedList()
2022
        {
2023
            RadGridView grid = this.radGridViewDocuments;
2024

    
2025
            //var checkers = grid.Rows.Where(x =>
2026
            //{
2027
            //    return x.Cells["Checked"].Value != null && Convert.ToBoolean(x.Cells["Checked"].Value);
2028
            //}).Select(x => x.DataBoundItem as Documents).ToList();
2029

    
2030
            //var viewRows = new Queue<GridViewRowInfo>(this.radGridViewDocuments.MasterTemplate.DataView.Where(x => x.Cells["spq");
2031
            var viewRows = grid.MasterTemplate.DataView;
2032

    
2033
            var checkers = viewRows.Where(x =>
2034
            {
2035
                return x.Cells["Checked"].Value != null && Convert.ToBoolean(x.Cells["Checked"].Value);
2036
            }).ToList();
2037

    
2038
            var rows = new GridViewDataRowInfo[checkers.Count];
2039
            checkers.CopyTo(rows, 0);
2040

    
2041
            if (rows.Length > 0)
2042
            {
2043
                grid.BeginUpdate();
2044

    
2045
                int nLoop = 0;
2046
                rows.ForAll(x =>
2047
                {
2048
                    grid.Rows.Remove(rows[nLoop]);
2049
                    nLoop++;
2050
                });
2051

    
2052
                grid.EndUpdate();
2053
            }
2054

    
2055

    
2056
            //grid.Rows.re grid.Rows.ToList().Intersect(checkers)
2057

    
2058

    
2059
            //RadMessageBox.Show($"{checkers.Count()}", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info);
2060
            //RadMessageBox.Show($"{this.documents.Count}", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info);
2061
            this.lbSelectAndTotal.Text = $"{grid.MasterTemplate.DataView.Count} / {this.TotalCount} (Selected / Total)";
2062
        }
2063
        */
2064
        private IEnumerable<GridViewRowInfo> GetCheckedList()
2065
        {
2066
            try
2067
            {
2068
                RadGridView grid = this.radGridViewDocuments;
2069
                var viewRows = grid.MasterTemplate.DataView;
2070
                return viewRows.Where(x =>
2071
                {
2072
                    return x.Cells["Checked"].Value != null && Convert.ToBoolean(x.Cells["Checked"].Value);
2073
                });
2074
            }
2075
            catch (Exception ex)
2076
            {
2077
                throw ex;
2078
            }
2079
        }
2080

    
2081
        private void RadButtonElementDelete_Click(object sender, EventArgs e)
2082
        {
2083
            //RadMessageBox.Show("삭제 진행", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info);
2084

    
2085
            RadGridView grid = this.radGridViewDocuments;
2086
            List<GridViewRowInfo> checkList = null;
2087

    
2088
            try
2089
            {
2090
                checkList = new List<GridViewRowInfo>(this.GetCheckedList());
2091

    
2092
                if (checkList.Count > 0)
2093
                {
2094
                    if (RadMessageBox.Show("Do you want to Delete?", Globals.Name, MessageBoxButtons.YesNo, RadMessageIcon.Question) == DialogResult.Yes)
2095
                    {
2096
                        var delData = new GridViewDataRowInfo[checkList.Count];
2097
                        checkList.CopyTo(delData, 0);
2098

    
2099
                        if (delData.Length > 0)
2100
                        {
2101
                            grid.BeginUpdate();
2102
                            int nLoop = 0;
2103
                            delData.ForAll(x => { grid.Rows.Remove(delData[nLoop]); nLoop++; });
2104
                            grid.EndUpdate();
2105

    
2106
                            RadMessageBox.Show("Delete is complete", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info);
2107

    
2108
                            this.DocumentListBinding();
2109
                        }
2110
                    }
2111
                }
2112
                else
2113
                {
2114
                    RadMessageBox.Show("Please check the DWG.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info);
2115
                }
2116
            }
2117
            catch (Exception ex)
2118
            {
2119
                Program.logger.Error($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex);
2120
                RadMessageBox.Show("DWG delete failed.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error);
2121
            }
2122
        }
2123

    
2124
        #region Save event
2125

    
2126
        private void SetSaved()
2127
        {
2128
            try
2129
            {
2130
                if (RadMessageBox.Show("Do you want to Save?", Globals.Name, MessageBoxButtons.YesNo, RadMessageIcon.Question) == DialogResult.Yes)
2131
                {
2132
                    #region 유효성검사
2133

    
2134
                    #region 필수값 체크(Team, DWG_ID)
2135

    
2136
                    if (this.documents.Any(x => string.IsNullOrEmpty(x.RefProjectCode)))
2137
                    {
2138
                        RadMessageBox.Show($"Please, check the required value (Team).", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info);
2139
                        return;
2140
                    }
2141

    
2142
                    if (this.documents.Any(x => string.IsNullOrEmpty(x.DocumentNo)))
2143
                    {
2144
                        RadMessageBox.Show($"Please, check the required value (DWG_ID).", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info);
2145
                        return;
2146
                    }
2147

    
2148
                    #endregion
2149

    
2150
                    #endregion
2151

    
2152
                    #region document no 중복 유효성 체크
2153
                    //this.documents.GroupBy(g => new { g.RefProjectCode, g.DocumentNo })
2154
                    //              .Where(x => x.Count() > 1).Select(x => x.Key).ToList();
2155

    
2156
                    //int dupDwgNoCount = 0;
2157
                    //List<string> newDwgNos =  this.documents.Where(x => string.IsNullOrEmpty(x.DocID)).Select(x => x.DocumentNo).ToList();
2158
                    //if (newDwgNos.Count > 0)
2159
                    //{
2160
                    //    dupDwgNoCount = new DocumentController().ExistsDocument(informations.ActiveProject.ProjectID, newDwgNos);
2161
                    //}
2162

    
2163
                    //if (dupDwgNoCount > 0)
2164
                    //{
2165
                    //    RadMessageBox.Show($"Duplicate Dwg No exists.({dupDwgNoCount})", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info);
2166
                    //    return;
2167
                    //}
2168
                    #endregion
2169

    
2170
                    var worker = new SetDocumentsWorker(this.documents, this.orgDocuments, this.radGridViewDocuments);
2171
                    worker.OnWorkCompletedHandler += (e) =>
2172
                    {
2173
                        bool result = false;
2174
                        bool markusResult = false;
2175
                        bool markusMembersResult = false;
2176

    
2177
                        result = (bool)e.Result;
2178
                        if (result)
2179
                        {
2180
                            markusResult = new MarkusInfoController().SetProperties(Program.informations.ProjectList.Where(x => x.Level == 2).Select(x => x.Name));
2181
                            markusResult = new MarkusInfoController().SetMarkusInfo(this.documents);
2182
                            markusMembersResult = new MarkusInfoController().SetMembers(informations.UserList);
2183
                            //informations.ProjectList.Where(x => x.Level.Equals(2)); <- ID2 Manager에 저장 된 전체 프로젝트 리스트
2184
                        }
2185

    
2186
                        if (result && markusResult && markusMembersResult)
2187
                        {
2188
                            RadMessageBox.Show("Save is complete", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info);
2189

    
2190
                            this.GetDocList();
2191
                        }
2192
                        else if (!result)
2193
                        {
2194
                            RadMessageBox.Show("Save is not complete", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error);
2195
                        }
2196
                        else if (!markusResult)
2197
                        {
2198
                            RadMessageBox.Show("Markus Data Save is not complete", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error);
2199
                        }
2200
                        else if (!markusMembersResult)
2201
                        {
2202
                            RadMessageBox.Show("Markus Members Save is not complete", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error);
2203
                        }
2204
                    };
2205
                    worker.StartWork();
2206
                }
2207
            }
2208
            catch (Exception ex)
2209
            {
2210
                throw ex;
2211
            }
2212
        }
2213

    
2214
        private void RadButtonElementSaveCommand_Click(object sender, EventArgs e)
2215
        {
2216
            try
2217
            {
2218
                this.SetSaved();
2219
            }
2220
            catch (Exception ex)
2221
            {
2222
                Program.logger.Error($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex);
2223
                RadMessageBox.Show("DWG save failed.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error);
2224
            }
2225
        }
2226

    
2227
        private void RadButtonElementSave_Click(object sender, EventArgs e)
2228
        {
2229
            try
2230
            {
2231
                this.SetSaved();
2232
            }
2233
            catch (Exception ex)
2234
            {
2235
                Program.logger.Error($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex);
2236
                RadMessageBox.Show("DWG save failed.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error);
2237
            }
2238
        }
2239

    
2240
        private void RadButtonElementSync_Click(object sender, EventArgs e)
2241
        {
2242
            try
2243
            {
2244
                if (RadMessageBox.Show("Do you want to ID2 Sync?", Globals.Name, MessageBoxButtons.YesNo, RadMessageIcon.Question) == DialogResult.Yes)
2245
                {
2246
                    var worker = new SyncDocumentsWorker(this.radGridViewDocuments);
2247
                    worker.OnWorkCompletedHandler += (arg) =>
2248
                    {
2249
                        if ((bool)arg.Result)
2250
                        {
2251
                            this.GetDocList();
2252

    
2253
                            RadMessageBox.Show("Sync with ID2 completed.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info);
2254
                        }
2255
                    };
2256
                    worker.StartWork();
2257
                }
2258
            }
2259
            catch (Exception ex)
2260
            {
2261
                Program.logger.Error($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex);
2262
                RadMessageBox.Show("Failed to sync with id2.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error);
2263
            }
2264
        }
2265

    
2266
        private void RadButtonElementNotice_Click(object sender, EventArgs e)
2267
        {
2268
            try
2269
            {
2270
                AttFileInfo notiFileInfo = new AttFileController().GetAttFileInfo(informations.ActiveProject.ProjectID, "notice");
2271

    
2272
                if (notiFileInfo == null)
2273
                {
2274
                    RadMessageBox.Show("No notice.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info);
2275
                }
2276
                else
2277
                {
2278
                    string noticePath = Path.Combine(Globals.ProgramDataFolder, "NoticeFiles");
2279
                    string noticeFileFullName = Path.Combine(noticePath, $"{notiFileInfo.FileID}{notiFileInfo.FileExtension}");
2280

    
2281
                    FileInfo finfo = new FileInfo(noticeFileFullName);
2282

    
2283
                    if (!finfo.Directory.Exists)
2284
                    {
2285
                        Directory.CreateDirectory(noticePath);
2286
                    }
2287

    
2288
                    if (!finfo.Exists)
2289
                    {
2290
                        var arrayBinary = notiFileInfo.FileData.ToArray();
2291

    
2292
                        using (MemoryStream ms = new MemoryStream(arrayBinary))
2293
                        {
2294
                            ms.Write(arrayBinary, 0, arrayBinary.Length);
2295
                            ms.Seek(0, SeekOrigin.Begin);
2296

    
2297
                            using (FileStream fs = finfo.Create())
2298
                            {
2299
                                ms.CopyTo(fs);
2300
                            }
2301
                        }
2302
                    }
2303

    
2304
                    try
2305
                    {
2306
                        ProcessStartInfo startInfo = new ProcessStartInfo
2307
                        {
2308
                            FileName = finfo.FullName,
2309
                            UseShellExecute = true,
2310
                            CreateNoWindow = false,
2311
                            WindowStyle = ProcessWindowStyle.Normal
2312
                        };
2313

    
2314
                        using (Process process = new Process())
2315
                        {
2316
                            process.StartInfo = startInfo;
2317
                            process.Start();
2318
                        }
2319
                        //Process.Start(finfo.FullName);
2320
                    }
2321
                    catch (Exception ex)
2322
                    {
2323
                        throw ex;
2324
                    }
2325

    
2326
                    //using (MemoryStream ms = new MemoryStream(arrayBinary))
2327
                    //{
2328
                    //    ProcessStartInfo startInfo = new ProcessStartInfo
2329
                    //    {
2330
                    //        FileName = Path.Combine(attFileInfo.FilePath, attFileInfo.FileName),
2331
                    //        RedirectStandardInput = true,
2332
                    //        UseShellExecute = false,
2333
                    //        CreateNoWindow = true,
2334
                    //        WindowStyle = ProcessWindowStyle.Hidden
2335
                    //    };
2336

    
2337
                    //    using (Process process = new Process())
2338
                    //    {
2339
                    //        process.StartInfo = startInfo;
2340
                    //        process.Start();
2341

    
2342
                    //        // Write the memory stream contents to the process standard input
2343
                    //        byte[] buffer = ms.ToArray();
2344
                    //        process.StandardInput.BaseStream.Write(buffer, 0, buffer.Length);
2345
                    //        process.StandardInput.Close();
2346

    
2347
                    //        process.WaitForExit();
2348
                    //    }
2349
                    //}
2350
                }
2351
            }
2352
            catch (Exception ex)
2353
            {
2354
                Program.logger.Error($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex);
2355
                RadMessageBox.Show("Notification lookup failed.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error);
2356
            }
2357
        }
2358

    
2359
        private void RadButtonElementNoticeUpload_Click(object sender, EventArgs e)
2360
        {
2361
            string GetContentType(string filePath)
2362
            {
2363
                string extension = Path.GetExtension(filePath).ToLower();
2364

    
2365
                switch (extension)
2366
                {
2367
                    case ".txt":
2368
                        return "text/plain";
2369
                    case ".pdf":
2370
                        return "application/pdf";
2371
                    case ".jpg":
2372
                    case ".jpeg":
2373
                        return "image/jpeg";
2374
                    case ".png":
2375
                        return "image/png";
2376
                    case ".bmp":
2377
                        return "image/bmp";
2378
                    case ".gif":
2379
                        return "image/gif";
2380
                    default:
2381
                        return "application/octet-stream";
2382
                }
2383
            }
2384

    
2385
            using (OpenFileDialog ofd = new OpenFileDialog()
2386
            {
2387
                //Filter = "PDF files (*.pdf)|*.pdf|All files (*.*)|*.*",
2388
                Filter = "All Images Files (*.png;*.jpeg;*.gif;*.jpg;*.bmp)|*.png;*.jpeg;*.gif;*.jpg;*.bmp"
2389
                       + "|PNG Portable Network Graphics (*.png)|*.png"
2390
                       + "|JPEG File Interchange Format (*.jpg *.jpeg *jfif)|*.jpg;*.jpeg;*.jfif"
2391
                       + "|BMP Windows Bitmap (*.bmp)|*.bmp"
2392
                       + "|GIF Graphics Interchange Format (*.gif)|*.gif",
2393
                //Title = "Open an Excel File",
2394
                RestoreDirectory = true
2395
            })
2396
            {
2397
                try
2398
                {
2399
                    if (ofd.ShowDialog() == DialogResult.OK)
2400
                    {
2401
                        FileInfo fileInfo = new FileInfo(ofd.FileName);
2402
                        if (fileInfo.Exists)
2403
                        {
2404
                            AttFileInfo attFile = new AttFileInfo()
2405
                            {
2406
                                RefID = informations.ActiveProject.ProjectID,
2407
                                Category = "notice",
2408
                                FileType = GetContentType(fileInfo.FullName),
2409
                                FileName = fileInfo.Name,
2410
                                FilePath = fileInfo.DirectoryName,
2411
                                FileExtension = fileInfo.Extension
2412
                            };
2413

    
2414
                            using (var stream = new FileStream(ofd.FileName, FileMode.Open, FileAccess.Read))
2415
                            {
2416
                                using (var reader = new BinaryReader(stream))
2417
                                {
2418
                                    attFile.FileData = reader.ReadBytes((int)stream.Length);
2419
                                }
2420
                            }
2421

    
2422
                            bool result = new AttFileController().SetAttFiles(new List<AttFileInfo>() { attFile }, informations.ActiveUser.ID);
2423

    
2424
                            if (result)
2425
                            {
2426
                                RadMessageBox.Show("An Notice has been posted.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info);
2427
                            }
2428
                        }
2429
                    }
2430
                }
2431
                catch (Exception ex)
2432
                {
2433
                    Program.logger.Error($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex);
2434
                    RadMessageBox.Show("Failed to register the Notice.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error);
2435
                }
2436
            }
2437
        }
2438

    
2439
        private void RadButtonElementRefreshCommand_Click(object sender, EventArgs e)
2440
        {
2441
            bool isReload = false;
2442

    
2443
            try
2444
            {
2445
                if (RadMessageBox.Show($"Do you want to reload the project?", Globals.Name, MessageBoxButtons.YesNo, RadMessageIcon.Question) == DialogResult.Yes)
2446
                {
2447
                    if (informations.ActiveUser != null && !string.IsNullOrEmpty(informations.ActiveUser.RefProjectID))
2448
                    {
2449
                        informations.ActiveProject = new ProjectController().GetProjectInfo(informations.ActiveUser.RefProjectID);
2450
                        informations.ProjectList = new ProjectController().GetAllProjectList().ToList();
2451

    
2452
                        isReload = true;
2453
                    }
2454
                    else if (informations.ActiveProject != null)
2455
                    {
2456
                        informations.ProjectList = new ProjectController().GetAllProjectList().ToList();
2457

    
2458
                        isReload = true;
2459
                    }
2460
                    else
2461
                    {
2462
                        RadMessageBox.Show("Select a project.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info);
2463
                        this.radRibbonBarBackstageViewID2Manager.ShowPopup(this.GetBackstageLocation(), this.ID2ManagerRadRibbonBar.RibbonBarElement);
2464
                    }
2465
                }
2466

    
2467
                if (isReload)
2468
                {
2469
                    this.LoadProject();
2470
                }
2471
            }
2472
            catch (Exception ex)
2473
            {
2474
                Program.logger.Error($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex);
2475
                RadMessageBox.Show("Failed to reload the project.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error);
2476
            }
2477
        }
2478
        #endregion
2479

    
2480
        #region ColumnGroup
2481
        private void InitColumnGroupsViewDefinition(RadGridView gridView)
2482
        {
2483
            ColumnGroupsViewDefinition columnGroupsView = new ColumnGroupsViewDefinition();
2484

    
2485
            List<string> chkColNames = new List<string>() { "Checked" };
2486

    
2487
            List<string> docLinkColNames = new List<string>() { "AutoCADLink", "ID2Connection", "PDFLink", "MarkupLink", "AVEVALink", "Compare" };
2488
            List<string> docInfoColNames = new List<string>() { "RefProjectCode", "System", "SubSystemCode", "DocumentNo", "PersonInCharge", "Worker", "AVEVAPersonInCharge", "AVEVAWorker", "JobLevel", "RevisonNo" };
2489
            List<string> rvToColNames = new List<string>() { "ToIsDiscussion", "ToRemarks", "ToCreator", "ToCapture" };
2490
            List<string> rvFrColNames = new List<string>() { "FrReviewStatus", "FrRemarks", "FrCreator", "FrCapture" };
2491
            List<string> wkID2ColNames = new List<string>() { "ID2StartDate", "ID2EndDate", "ID2Status", "ID2Issues", "ID2Capture", "ReplyModifications", "ReplyRequester" };
2492
            List<string> wkAVEVAColNames = new List<string>() { "IsConvert", "AVEVAConvertDate", "AVEVAWorkDate", "AVEVAStatus", "AVEVAIssues" };
2493
            List<string> valProdColNames = new List<string>() { "AVEVAReviewDate", "ProdReviewer", "ProdIsResult", "ProdRemarks" };
2494
            List<string> valCntColNames = new List<string>() { "ClientReviewer", "ClientIsResult", "ClientRemarks" };
2495
            List<string> dtColNames = new List<string>() { "DTIsGateWay", "DTIsImport", "DTIsRegSystem", "DTRemarks" };
2496

    
2497
            //체크
2498
            GridViewColumnGroup chkColGrp = new GridViewColumnGroup("√") { IsPinned = true };
2499
            GridViewColumnGroupRow chkColGrpRow = new GridViewColumnGroupRow();
2500
            chkColGrpRow.ColumnNames.AddRange(chkColNames);
2501
            chkColGrp.Rows.Add(chkColGrpRow);
2502

    
2503
            //도면
2504
            GridViewColumnGroup docColGrp = new GridViewColumnGroup("도면 ");
2505
            GridViewColumnGroup docLinkColGrp = new GridViewColumnGroup("프로그램 연동");
2506
            GridViewColumnGroup docInfoColGrp = new GridViewColumnGroup("도면정보");
2507

    
2508
            GridViewColumnGroupRow docLinkColGrpRow = new GridViewColumnGroupRow();
2509
            docLinkColGrpRow.ColumnNames.AddRange(docLinkColNames);
2510

    
2511
            GridViewColumnGroupRow docInfoColGrpRow = new GridViewColumnGroupRow();
2512
            docInfoColGrpRow.ColumnNames.AddRange(docInfoColNames);
2513

    
2514
            docLinkColGrp.Rows.Add(docLinkColGrpRow);
2515
            docColGrp.Groups.Add(docLinkColGrp);
2516
            docInfoColGrp.Rows.Add(docInfoColGrpRow);
2517
            docColGrp.Groups.Add(docInfoColGrp);
2518

    
2519
            //검토
2520
            GridViewColumnGroup rvColGrp = new GridViewColumnGroup("검토", "review");
2521
            GridViewColumnGroup rvToColGrp = new GridViewColumnGroup("도프텍");
2522
            GridViewColumnGroup rvFrColGrp = new GridViewColumnGroup("삼성");
2523

    
2524
            GridViewColumnGroupRow rvToColGrpRow = new GridViewColumnGroupRow();
2525
            rvToColGrpRow.ColumnNames.AddRange(rvToColNames);
2526

    
2527
            GridViewColumnGroupRow rvFrColGrpRow = new GridViewColumnGroupRow();
2528
            rvFrColGrpRow.ColumnNames.AddRange(rvFrColNames);
2529

    
2530
            rvToColGrp.Rows.Add(rvToColGrpRow);
2531
            rvFrColGrp.Rows.Add(rvFrColGrpRow);
2532

    
2533
            rvColGrp.Groups.Add(rvToColGrp);
2534
            rvColGrp.Groups.Add(rvFrColGrp);
2535

    
2536
            //작업
2537
            GridViewColumnGroup wkColGrp = new GridViewColumnGroup("작업", "work");
2538
            GridViewColumnGroup wkID2ColGrp = new GridViewColumnGroup("ID2");
2539
            GridViewColumnGroup wkAVEVAColGrp = new GridViewColumnGroup("AVEVA");
2540

    
2541
            GridViewColumnGroupRow wkID2ColGrpRow = new GridViewColumnGroupRow();
2542
            wkID2ColGrpRow.ColumnNames.AddRange(wkID2ColNames);
2543

    
2544
            GridViewColumnGroupRow wkAVEVAColGrpRow = new GridViewColumnGroupRow();
2545
            wkAVEVAColGrpRow.ColumnNames.AddRange(wkAVEVAColNames);
2546

    
2547
            wkID2ColGrp.Rows.Add(wkID2ColGrpRow);
2548
            wkAVEVAColGrp.Rows.Add(wkAVEVAColGrpRow);
2549

    
2550
            wkColGrp.Groups.Add(wkID2ColGrp);
2551
            wkColGrp.Groups.Add(wkAVEVAColGrp);
2552

    
2553
            //Validation
2554
            GridViewColumnGroup valColGrp = new GridViewColumnGroup("Validation", "validation");
2555
            GridViewColumnGroup valProdColGrp = new GridViewColumnGroup("도프텍");
2556
            GridViewColumnGroup valCntColGrp = new GridViewColumnGroup("삼성전자");
2557

    
2558
            GridViewColumnGroupRow valProdColGrpRow = new GridViewColumnGroupRow();
2559
            valProdColGrpRow.ColumnNames.AddRange(valProdColNames);
2560

    
2561
            GridViewColumnGroupRow valCntColGrpRow = new GridViewColumnGroupRow();
2562
            valCntColGrpRow.ColumnNames.AddRange(valCntColNames);
2563

    
2564
            valProdColGrp.Rows.Add(valProdColGrpRow);
2565
            valCntColGrp.Rows.Add(valCntColGrpRow);
2566

    
2567
            valColGrp.Groups.Add(valProdColGrp);
2568
            valColGrp.Groups.Add(valCntColGrp);
2569

    
2570
            //AVEVA Net
2571
            GridViewColumnGroup dtColGrp = new GridViewColumnGroup("AVEVA Net\n(Digital Twin)", "avevanet");
2572

    
2573
            GridViewColumnGroupRow dtColGrpRow = new GridViewColumnGroupRow();
2574
            dtColGrpRow.ColumnNames.AddRange(dtColNames);
2575

    
2576
            dtColGrp.Rows.Add(dtColGrpRow);
2577

    
2578
            //Group 추가
2579
            columnGroupsView.ColumnGroups.Add(chkColGrp);
2580
            columnGroupsView.ColumnGroups.Add(docColGrp);
2581
            columnGroupsView.ColumnGroups.Add(wkColGrp);
2582
            columnGroupsView.ColumnGroups.Add(rvColGrp);
2583
            columnGroupsView.ColumnGroups.Add(valColGrp);
2584
            columnGroupsView.ColumnGroups.Add(dtColGrp);
2585

    
2586
            gridView.MasterTemplate.ViewDefinition = columnGroupsView;
2587
        }
2588
        #endregion
2589

    
2590
        private void txtFullSearch_TextChanged(object sender, EventArgs e)
2591
        {
2592
            if (string.IsNullOrWhiteSpace(txtFullSearch.Text))
2593
                radGridViewDocuments.MasterTemplate.Refresh(null);
2594

    
2595
            txtFullSearch.TextBoxElement.ShowClearButton = !string.IsNullOrWhiteSpace(txtFullSearch.Text);
2596
            radGridViewDocuments.MasterView.TableSearchRow.Search(txtFullSearch.Text);
2597
        }
2598

    
2599
        private void btnSearchPrevious_Click(object sender, EventArgs e)
2600
        {
2601
            radGridViewDocuments.MasterView.TableSearchRow.SelectPreviousSearchResult();
2602
        }
2603

    
2604
        private void btnSearchNext_Click(object sender, EventArgs e)
2605
        {
2606
            radGridViewDocuments.MasterView.TableSearchRow.SelectNextSearchResult();
2607
        }
2608

    
2609
        private void txtFullSearch_KeyDown(object sender, KeyEventArgs e)
2610
        {
2611
            if (e.KeyCode == Keys.Enter)
2612
            {
2613
                radGridViewDocuments.MasterView.TableSearchRow.SelectNextSearchResult();
2614
            }
2615
        }
2616

    
2617
        private void commandBarSearch_ItemOverflowed(object sender, EventArgs e)
2618
        {
2619
            commandBarSearch.OverflowButton.AddRemoveButtonsMenuItem.Visibility = ElementVisibility.Collapsed;
2620
            commandBarSearch.OverflowButton.CustomizeButtonMenuItem.Visibility = ElementVisibility.Collapsed;
2621
        }
2622

    
2623
        private void commandBarSearch_ItemOutOfOverflow(object sender, EventArgs e)
2624
        {
2625
            commandBarSearch.OverflowButton.AddRemoveButtonsMenuItem.Visibility = ElementVisibility.Collapsed;
2626
            commandBarSearch.OverflowButton.CustomizeButtonMenuItem.Visibility = ElementVisibility.Collapsed;
2627
        }
2628
    }
2629
}
2630

    
2631
public class FilterColumn
2632
{
2633
    public string Name { get; set; }
2634
    public string FieldName { get; set; }
2635
    public bool IsSelect { get; set; }
2636
}
클립보드 이미지 추가 (최대 크기: 500 MB)