프로젝트

일반

사용자정보

통계
| 개정판:

hytos / ID2.Manager / ID2.Manager / Main.cs @ 1ae525e9

이력 | 보기 | 이력해설 | 다운로드 (76.6 KB)

1
using System;
2
using System.Collections.Generic;
3
using System.ComponentModel;
4
using System.Data;
5
using System.Drawing;
6
using System.Linq;
7
using System.Text;
8
using System.Threading.Tasks;
9
using System.Windows.Forms;
10

    
11
using System.IO;
12
using System.Reflection;
13

    
14
using ID2.Manager.Controls;
15
using ID2.Manager.Common;
16
using ID2.Manager.Classes;
17
using ID2.Manager.Data.Models;
18
using ID2.Manager.Forms;
19
using ID2.Manager.Controller.Controllers;
20

    
21
using Telerik.WinControls;
22
using Telerik.WinControls.UI;
23
using Telerik.WinControls.Data;
24

    
25
using GemBox.Spreadsheet;
26

    
27
using Newtonsoft.Json;
28
using System.Diagnostics;
29
using ID2.Manager.Common.Helpers;
30

    
31
namespace ID2.Manager
32
{
33
    public partial class Main : RadRibbonForm
34
    {
35
        readonly Informations informations = Informations.Instance;
36
        bool IsID2Manager = false;
37
        List<MarkupText> Markups = new List<MarkupText>();
38
        List<Documents> documents = new List<Documents>();
39
        List<Documents> orgDocuments = null;
40

    
41
        private readonly Color _SummaryColor = Color.FromArgb(255, 108, 55);
42

    
43
        public Main()
44
        {
45
            InitializeComponent();
46

    
47
            Telerik.WinControls.RadControlSpy.RadControlSpyForm radControlSpyForm = new Telerik.WinControls.RadControlSpy.RadControlSpyForm();
48
            radControlSpyForm.Show();
49

    
50
            this.Load += Main_Load;
51

    
52
            this.radButtonElementRefreshCommand.Click += RadButtonElementRefreshCommand_Click;
53
            this.radButtonElementSaveCommand.Click += RadButtonElementSaveCommand_Click;
54

    
55
            this.radButtonElementSave.Click += RadButtonElementSave_Click;
56
            this.radButtonElementSync.Click += RadButtonElementSync_Click;
57
            this.radButtonElementNotice.Click += RadButtonElementNotice_Click;
58
            this.radButtonElementExcelImport.Click += RadButtonElementExcelImport_Click;
59
            this.radButtonElementExcelExport.Click += RadButtonElementExcelExport_Click;
60

    
61
            this.radCheckBox1.CheckStateChanged += RadCheckBox_CheckStateChanged;
62
            this.radCheckBox2.CheckStateChanged += RadCheckBox_CheckStateChanged;
63
            this.radCheckBox3.CheckStateChanged += RadCheckBox_CheckStateChanged;
64
            this.radCheckBox4.CheckStateChanged += RadCheckBox_CheckStateChanged;
65
            this.radTextBoxDocumentNo.KeyDown += RadTextBoxDocumentNo_KeyDown;
66
            this.radButtonSearch.Click += RadButtonSearch_Click;
67

    
68
            this.radGridViewDocuments.SelectionChanged += RadGridViewDocuments_SelectionChanged;
69
            this.radGridViewDocuments.ViewCellFormatting += RadGridViewDocuments_ViewCellFormatting;
70
            this.radGridViewDocuments.CreateRow += RadGridViewDocuments_CreateRow;
71
            this.radGridViewDocuments.CreateRowInfo += RadGridViewDocuments_CreateRowInfo;
72
            this.radGridViewDocuments.CreateCell += RadGridViewDocuments_CreateCell1;
73
            this.radGridViewDocuments.CellBeginEdit += RadGridViewDocuments_CellBeginEdit;
74
            this.radGridViewDocuments.CommandCellClick += RadGridViewDocuments_CommandCellClick;
75
            this.radGridViewDocuments.MasterView.TableSearchRow.SearchProgressChanged += TableSearchRow_SearchProgressChanged;
76

    
77
            this.radGridViewDocuments.MasterView.TableHeaderRow.MinHeight = 36;
78
            this.radGridViewDocuments.TableElement.RowHeaderColumnWidth = 36;
79
            //this.radGridViewDocuments.MasterView.TableSearchRow.InitialSearchResultsTreshold = ;
80
            this.radGridViewDocuments.MasterView.TableSearchRow.IsVisible = false;
81

    
82
            var detailGridview = new DetailGridViewTemplate();
83
            detailGridview.DataSource = Markups;
84
            this.radGridViewDocuments.MasterTemplate.Templates.Add(detailGridview);
85

    
86
            GridViewRelation relation = new GridViewRelation(this.radGridViewDocuments.MasterTemplate);
87
            relation.ChildTemplate = detailGridview;
88
            relation.RelationName = "MarkupTextRelation";
89
            relation.ParentColumnNames.Add("DocumentNo");
90
            relation.ChildColumnNames.Add("DOCUMENT_ID");
91
            this.radGridViewDocuments.Relations.Add(relation);
92

    
93
            var openProjectView = new OpenProjectView()
94
            {
95
                Dock = DockStyle.Fill
96
            };
97
            this.backstageViewPageOpenProject.Controls.Add(openProjectView);
98
            openProjectView.OpenProjectClick += OpenProjectView_OpenProjectClick;
99
            openProjectView.CloseProjectClick += OpenProjectView_OpenProjectClick;
100
            this.backstageButtonItemUserRegistration.Click += BackstageButtonItemUserRegistration_Click;
101
            this.backstageButtonItemExit.Click += BackstageButtonItemExit_Click;
102
            this.radRibbonBarBackstageViewID2Manager.BackstageViewOpened += RadRibbonBarBackstageViewID2Manager_BackstageViewOpened;
103
            this.radRibbonBarBackstageViewID2Manager.BackstageViewClosed += RadRibbonBarBackstageViewID2Manager_BackstageViewClosed;
104

    
105
            this.InitColumnGroupsViewDefinition(this.radGridViewDocuments);
106

    
107
            this.Initialize();
108
        }
109

    
110
        private void RadGridViewDocuments_CreateRowInfo(object sender, GridViewCreateRowInfoEventArgs e)
111
        {
112
            if (e.RowInfo is GridViewSearchRowInfo)
113
            {
114
                e.RowInfo = new SearchRow(e.ViewInfo);
115
            }
116

    
117
        }
118

    
119
        private void TableSearchRow_SearchProgressChanged(object sender, SearchProgressChangedEventArgs e)
120
        {
121
            if (e.SearchFinished)
122
            {
123
                
124
            }
125
        }
126

    
127
        /// <summary>
128
        /// 선택된 행의 AutoCAD와 PDF 파일을 보여준다.
129
        /// </summary>
130
        /// <param name="sender"></param>
131
        /// <param name="e"></param>
132
        private void RadGridViewDocuments_SelectionChanged(object sender, EventArgs e)
133
        {
134
            void ShowAutoCADFile(string FilePath)
135
            {
136
                Controls.AutoCADViewer viewer = null;
137
                foreach (var control in this.radPageViewPageAutoCAD.Controls)
138
                {
139
                    if (control is Controls.AutoCADViewer _viewer)
140
                    {
141
                        viewer = _viewer;
142
                        break;
143
                    }
144
                }
145

    
146
                if (viewer == null)
147
                {
148
                    viewer = new Controls.AutoCADViewer() { Dock = DockStyle.Fill };
149
                    this.radPageViewPageAutoCAD.Controls.Add(viewer);
150
                }
151
                else
152
                {
153
                    viewer.Visible = true;
154
                }
155

    
156
                if (File.Exists(FilePath) && viewer != null) viewer.ReadDWG(FilePath);
157
            }
158

    
159
            void ShowPDFFile(string FilePath)
160
            {
161
                Controls.PDFViewer viewer = null;
162
                foreach (var control in this.radPageViewPagePDF.Controls)
163
                {
164
                    if (control is Controls.PDFViewer _viewer)
165
                    {
166
                        viewer = _viewer;
167
                        break;
168
                    }
169
                }
170

    
171
                if (viewer == null)
172
                {
173
                    viewer = new Controls.PDFViewer() { Dock = DockStyle.Fill };
174
                    this.radPageViewPagePDF.Controls.Add(viewer);
175
                }
176
                else
177
                {
178
                    viewer.Visible = true;
179
                }
180

    
181
                if (File.Exists(FilePath) && viewer != null) viewer.ReadPDF(FilePath);
182
            }
183

    
184
            if (this.radGridViewDocuments.SelectedRows.Count() > 0 && this.radGridViewDocuments.SelectedRows.First().DataBoundItem is Documents doc)
185
            {
186
                string dwgExtension = ".dwg";
187
                string dwgFilePath = Path.Combine(informations.FindID2LocalPath(doc.RefProjectCode), "drawings", "Native", $"{doc.DocumentNo}{dwgExtension}");
188
                ShowAutoCADFile(dwgFilePath);
189
      
190
                string pdfExtension = ".pdf";
191
                string pdfFilePath = Path.Combine(informations.FindID2LocalPath(doc.RefProjectCode), "drawings", $"{doc.DocumentNo}{pdfExtension}");
192
                ShowPDFFile(pdfFilePath);
193

    
194
                //if (informations.ActiveUser.ID != doc.PersonInCharge)
195
                //{
196
                //    var row = this.radGridViewDocuments.SelectedRows.First();
197
                //    foreach(var cell in row.Cells)
198
                //    {
199
                //        cell.ReadOnly = true;
200
                //    }
201
                //}
202
            }
203
        }
204

    
205
        #region Init, Load
206
        private void Initialize()
207
        {
208
            this.Text = Globals.Name;
209

    
210
            this.ID2ManagerRadRibbonBar.Expanded = false;
211

    
212
            this.radLabelElementUser.Text = $"{informations.ActiveUser.ID} {informations.ActiveUser.Name}";
213

    
214
            this.IsID2Manager = (new string[] { "Admin", "Manager" }).Contains(informations.ActiveUser.Role) && string.IsNullOrEmpty(informations.ActiveUser.RefProjectID);
215

    
216
            if (this.IsID2Manager)
217
            {
218
                this.backstageViewPageOpenProject.Controls[0].Visible = true;
219
                this.backstageTabItemOpenProject.Visibility = ElementVisibility.Visible;
220
                this.backstageButtonItemUserRegistration.Visibility = ElementVisibility.Visible;
221
            }
222
            else
223
            {
224
                if (string.IsNullOrEmpty(informations.ActiveUser.RefProjectID))
225
                {
226
                    this.backstageViewPageOpenProject.Controls[0].Visible = true;
227
                }
228
                else
229
                {
230
                    foreach (Control ctrl in this.backstageViewPageOpenProject.Controls)
231
                    {
232
                        ctrl.Visible = false;
233
                    }
234
                }
235
                this.backstageTabItemOpenProject.Visibility = ElementVisibility.Collapsed;
236
                this.backstageButtonItemUserRegistration.Visibility = ElementVisibility.Collapsed;
237
            }
238
        }
239

    
240
        protected override void OnLoad(EventArgs e)
241
        {
242
            if (informations.ActiveUser != null && !string.IsNullOrEmpty(informations.ActiveUser.RefProjectID))
243
            {
244
                informations.ActiveProject = new ProjectController().GetProjectInfo(informations.ActiveUser.RefProjectID);
245
                informations.ProjectList = new ProjectController().GetAllProjectList().ToList();
246

    
247
                this.LoadProject();
248
            }
249
            else
250
            {
251
                this.radRibbonBarBackstageViewID2Manager.ShowPopup(this.GetBackstageLocation(), this.ID2ManagerRadRibbonBar.RibbonBarElement);
252
            }
253

    
254
            base.OnLoad(e);
255
        }
256

    
257
        public Point GetBackstageLocation()
258
        {
259
            Point location = this.ID2ManagerRadRibbonBar.RibbonBarElement.ApplicationButtonElement.ControlBoundingRectangle.Location;
260
            location.Offset(new Point(0, this.ID2ManagerRadRibbonBar.RibbonBarElement.ApplicationButtonElement.ControlBoundingRectangle.Height));
261
            location.Offset(this.ID2ManagerRadRibbonBar.Location);
262

    
263
            return location;
264
        }
265

    
266
        private void Main_Load(object sender, EventArgs e)
267
        {
268
            InitializeSearch();
269
            InitializeGridViewDetail();
270

    
271
            this.radGridViewDocuments.DataSource = new BindingList<Documents>(this.documents);
272

    
273
        }
274

    
275
        private void InitializeSearch()
276
        {
277
            var font1 = ThemeResolutionService.GetCustomFont("TelerikWebUI");
278

    
279
            lbSearch.Text = "\ue13E";
280
            btnSearchNext.Text = "\ue006";
281
            btnSearchPrevious.Text = "\ue004";
282

    
283
            var chkbox = new RadCheckBoxElement();
284
            chkbox.Text = "Match Case";
285
            chkbox.CheckStateChanged += (snd, evt) => { radGridViewDocuments.MasterView.TableSearchRow.CaseSensitive = chkbox.Checked; };
286

    
287
            btnMatchCase.HostedItem = chkbox;
288

    
289
            var chkbox1 = new RadCheckBoxElement();
290
            chkbox1.Text = "Show All Detail";
291
            chkbox1.CheckStateChanged += (snd, evt) => 
292
            { 
293
                radGridViewDocuments.MasterView.ChildRows.ForAll(x=>x.IsExpanded = chkbox1.Checked); 
294
            };
295

    
296
            btnShowAllDetail.HostedItem = chkbox1;
297

    
298
            var chkbox2 = new RadCheckBoxElement();
299
            chkbox2.Text = "Search from current position";
300
            chkbox2.CheckStateChanged += (snd, evt) => { radGridViewDocuments.MasterView.TableSearchRow.SearchFromCurrentPosition = chkbox.Checked; };
301

    
302
            btnSearchFormCurrent.HostedItem = chkbox2;
303

    
304
            var columns = radGridViewDocuments.Columns.Where(x => x.AllowSearching).Select(x =>
305
                                 new FilterColumn
306
                                 {
307
                                     Name = x.HeaderText,
308
                                     FieldName = x.FieldName,
309
                                     IsSelect = x.AllowSearching
310
                                 });
311

    
312
            var panel = new StackLayoutElement();
313
            panel.Orientation = Orientation.Vertical;
314
            
315
            var btnComboColumns = new RadCheckedDropDownListElement();
316
            btnComboColumns.ShowCheckAllItems = true;
317
            btnComboColumns.CheckAllItem.Checked = true;
318
            btnComboColumns.AutoCompleteEditableAreaElement.NullText = "Search in Columns";
319
            btnComboColumns.AutoCompleteEditableAreaElement.AutoCompleteTextBox.IsReadOnly = true;
320
            btnComboColumns.DropDownMinSize = new Size(200, 200);
321
            btnComboColumns.DropDownSizingMode = SizingMode.UpDownAndRightBottom;
322
            btnComboColumns.DisplayMember = "Name";
323
            btnComboColumns.CheckedMember = "IsSelect";
324
            btnComboColumns.ValueMember = "FieldName";
325
            btnComboColumns.TextBox.CustomFont = font1.Name;
326
            btnComboColumns.TextBox.Text = "\ue13A";
327

    
328
            btnComboColumns.DataSource = columns;
329

    
330
            txtFullSearch.TextBoxElement.ClearButton.Click += (snd, evt) =>
331
            {
332
                radGridViewDocuments.MasterTemplate.Refresh(null);
333
            };
334

    
335
            btnComboColumns.PopupOpening += (snd, evt) =>
336
            {
337
                (snd as RadCheckedDropDownListElement).CheckAllItem.Checked = (snd as RadCheckedDropDownListElement).Items.All(x => (x.DataBoundItem as FilterColumn).IsSelect);
338
            };
339

    
340
            btnComboColumns.PopupClosed += (snd, evt) =>
341
            {
342
                foreach (RadCheckedListDataItem item in btnComboColumns.Items)
343
                {
344
                    radGridViewDocuments.Columns[item.Value.ToString()].AllowSearching = item.Checked;
345
                }
346
            };
347

    
348
            btnFilters.HostedItem = btnComboColumns;
349
        }
350

    
351
        private void InitializeGridViewDetail()
352
        {
353
            this.radGridViewDocuments.ChildViewExpanded += RadGridViewDocuments_ChildViewExpanded;
354
        }
355

    
356
        private void RadGridViewDocuments_ChildViewExpanded(object sender, ChildViewExpandedEventArgs e)
357
        {
358
            //e.ChildRow.ChildViewInfos[0].ChildRows[0].Height = 152;
359
            //e.ChildRow.ChildViewInfos[2].ChildRows[0].Height = 152;
360
            e.ChildRow.Height = 224;
361
        }
362

    
363
        #endregion
364

    
365
        private void OpenProjectView_OpenProjectClick(object sender, EventArgs e)
366
        {
367
            this.radRibbonBarBackstageViewID2Manager.Tag = e;
368
            this.radRibbonBarBackstageViewID2Manager.HidePopup();
369
        }
370

    
371
        private void RadRibbonBarBackstageViewID2Manager_BackstageViewOpened(object sender, EventArgs e)
372
        {
373
            this.radRibbonBarBackstageViewID2Manager.SelectedItem = this.backstageTabItemOpenProject;
374

    
375
            foreach ( Control ctrl in this.backstageViewPageOpenProject.Controls)
376
            {
377
                if (ctrl is OpenProjectView)
378
                {
379
                    var openProjectView = ctrl as OpenProjectView;
380
                    openProjectView.GetProjectGroups();
381
                    break;
382
                }
383
            }
384
        }
385

    
386
        private void RadRibbonBarBackstageViewID2Manager_BackstageViewClosed(object sender, EventArgs e)
387
        {
388
            if (this.radRibbonBarBackstageViewID2Manager.Tag is ProjectEventArgs)
389
            {
390
                var prjArgs = this.radRibbonBarBackstageViewID2Manager.Tag as ProjectEventArgs;
391

    
392
                informations.ActiveProject = prjArgs.ProjectInfo;
393

    
394
                this.radRibbonBarBackstageViewID2Manager.Tag = null;
395

    
396
                this.LoadProject();
397
            }
398
        }
399

    
400
        private void LoadProject()
401
        {
402
            #region 도면
403
            //Project List
404
            if (this.radDropDownListProject.Items.Count > 0)
405
                this.radDropDownListProject.Items.Clear();
406
            informations.ProjectList.Where(x => x.GroupID.Equals(informations.ActiveProject.ProjectID)).ToList()
407
                                    .ForEach(x =>
408
                                    {
409
                                        this.radDropDownListProject.Items.Add(new RadListDataItem(x.Name, x.Code));
410
                                    });
411
            var allProject = new RadListDataItem("== 전체 ==", string.Empty);
412
            this.radDropDownListProject.Items.Insert(0, allProject);
413
            allProject.Selected = true;
414

    
415
            //담당자 List
416
            if (this.radDropDownListPersonInCharge.Items.Count > 0)
417
                this.radDropDownListPersonInCharge.Items.Clear();
418
            informations.UserList.ForEach(x =>
419
            {
420
                if ((new string[] { "Manager", "User" }).Contains(x.Role) && string.IsNullOrEmpty(x.RefProjectID))
421
                    this.radDropDownListPersonInCharge.Items.Add(new RadListDataItem(x.Name, x.ID));
422
            });
423
            var allUser = new RadListDataItem("== 전체 ==", string.Empty);
424
            this.radDropDownListPersonInCharge.Items.Insert(0, allUser);
425
            allUser.Selected = true;
426

    
427
            //난이도
428
            if (this.radDropDownListJobLevel.Items.Count > 0)
429
                this.radDropDownListJobLevel.Items.Clear();
430
            informations.JobLevel.ForEach(x =>
431
            {
432
                this.radDropDownListJobLevel.Items.Add(new RadListDataItem(x, x));
433
            });
434
            var allJobLevel = new RadListDataItem("== 전체 ==", string.Empty);
435
            this.radDropDownListJobLevel.Items.Insert(0, allJobLevel);
436
            allJobLevel.Selected = true;
437

    
438
            //도면번호 조회조건
439
            this.radTextBoxDocumentNo.Text = string.Empty;
440
            #endregion
441

    
442
            #region 검토
443
            //문의(DOF)
444
            if (this.radDropDownListToIsDiscussion.Items.Count > 0)
445
                this.radDropDownListToIsDiscussion.Items.Clear();
446
            informations. IsYesNo.ForEach(x =>
447
            {
448
                this.radDropDownListToIsDiscussion.Items.Add(new RadListDataItem(x, x));
449
            });
450
            var allToIsDiscussion = new RadListDataItem("== 전체 ==", string.Empty);
451
            this.radDropDownListToIsDiscussion.Items.Insert(0, allToIsDiscussion);
452
            allToIsDiscussion.Selected = true;
453

    
454
            //회신(DS)
455
            if (this.radDropDownListFrReviewStatus.Items.Count > 0)
456
                this.radDropDownListFrReviewStatus.Items.Clear();
457
            informations.ClientStatus.ForEach(x =>
458
            {
459
                this.radDropDownListFrReviewStatus.Items.Add(new RadListDataItem(x, x));
460
            });
461
            var allFrReviewStatus = new RadListDataItem("== 전체 ==", string.Empty);
462
            this.radDropDownListFrReviewStatus.Items.Insert(0, allFrReviewStatus);
463
            allFrReviewStatus.Selected = true;
464

    
465
            //ID2 작업가능
466
            if (this.radDropDownListIsID2Work.Items.Count > 0)
467
                this.radDropDownListIsID2Work.Items.Clear();
468
            informations.IsYesNo.ForEach(x =>
469
            {
470
                var item = new RadListDataItem(x, x);
471
                if (x.Equals("Yes"))
472
                    item.Selected = true;
473
                this.radDropDownListIsID2Work.Items.Add(item);
474
                
475
            });
476
            var allIsID2Work = new RadListDataItem("== 전체 ==", string.Empty);
477
            this.radDropDownListIsID2Work.Items.Insert(0, allIsID2Work);
478
            #endregion
479

    
480
            #region 작업
481
            //ID2 Status
482
            if (this.radDropDownListID2Status.Items.Count > 0)
483
                this.radDropDownListID2Status.Items.Clear();
484
            informations.JobStatus.ForEach(x =>
485
            {
486
                this.radDropDownListID2Status.Items.Add(new RadListDataItem(x, x));
487
            });
488
            var allID2Status = new RadListDataItem("== 전체 ==", string.Empty);
489
            this.radDropDownListID2Status.Items.Insert(0, allID2Status);
490
            allID2Status.Selected = true;
491

    
492
            //AVEVA Status
493
            if (this.radDropDownListAVEVAStatus.Items.Count > 0)
494
                this.radDropDownListAVEVAStatus.Items.Clear();
495
            informations.JobStatus.ForEach(x =>
496
            {
497
                this.radDropDownListAVEVAStatus.Items.Add(new RadListDataItem(x, x));
498
            });
499
            var allAVEVAStatus = new RadListDataItem("== 전체 ==", string.Empty);
500
            this.radDropDownListAVEVAStatus.Items.Insert(0, allAVEVAStatus);
501
            allAVEVAStatus.Selected = true;
502
            #endregion
503

    
504
            #region 확인
505
            //도프텍 결과
506
            if (this.radDropDownListProdIsResult.Items.Count > 0)
507
                this.radDropDownListProdIsResult.Items.Clear();
508
            informations.ValidationResult.ForEach(x =>
509
            {
510
                this.radDropDownListProdIsResult.Items.Add(new RadListDataItem(x, x));
511
            });
512
            var allProdIsResult = new RadListDataItem("== 전체 ==", string.Empty);
513
            this.radDropDownListProdIsResult.Items.Insert(0, allProdIsResult);
514
            allProdIsResult.Selected = true;
515

    
516
            //삼성 결과
517
            if (this.radDropDownListClientIsResult.Items.Count > 0)
518
                this.radDropDownListClientIsResult.Items.Clear();
519
            informations.ValidationResult.ForEach(x =>
520
            {
521
                this.radDropDownListClientIsResult.Items.Add(new RadListDataItem(x, x));
522
            });
523
            var allClientIsResult = new RadListDataItem("== 전체 ==", string.Empty);
524
            this.radDropDownListClientIsResult.Items.Insert(0, allClientIsResult);
525
            allClientIsResult.Selected = true;
526
            #endregion
527

    
528
            this.GetDocList();
529
            this.DocumentListBinding();
530
        }
531

    
532
        #region Document List 조회
533
        public void GetDocList()
534
        {
535
            if (this.radDropDownListProject.SelectedValue != null)
536
            {
537
                string projectCode = this.radDropDownListProject.SelectedValue.ToString();
538
                string personIncharge = this.radDropDownListPersonInCharge.SelectedValue.ToString();
539
                string jobLevel = this.radDropDownListJobLevel.SelectedValue.ToString();//
540
                string documentNo = this.radTextBoxDocumentNo.Text.Trim();
541

    
542
                string isToIsDiscussion = this.radDropDownListToIsDiscussion.SelectedValue.ToString();
543
                string isFrReviewStatus = this.radDropDownListFrReviewStatus.SelectedValue.ToString();
544
                string isID2Work = this.radDropDownListIsID2Work.SelectedValue.ToString();//
545

    
546
                string id2Status = this.radDropDownListID2Status.SelectedValue.ToString();//
547
                string avevaStatus = this.radDropDownListAVEVAStatus.SelectedValue.ToString();//
548

    
549
                string prodIsResult = this.radDropDownListProdIsResult.SelectedValue.ToString();//
550
                string clientIsResult = this.radDropDownListClientIsResult.SelectedValue.ToString();//
551

    
552
                var (dwgs, totalCnt) = new DocumentController().GetDocuments(projectCode, personIncharge, jobLevel, documentNo, isToIsDiscussion, isFrReviewStatus, isID2Work, id2Status, avevaStatus, prodIsResult, clientIsResult);
553

    
554
                this.documents = dwgs.ToList();
555
                this.orgDocuments = JsonConvert.DeserializeObject<List<Documents>>(JsonConvert.SerializeObject(this.documents));
556
                this.lbSelectAndTotal.Text = totalCnt.ToString();
557

    
558
                List<string> projectCodes = new List<string>();
559

    
560
                if(!string.IsNullOrWhiteSpace(projectCode))
561
                {
562
                    projectCodes.Add(projectCode);
563
                }
564
                else
565
                {
566
                    projectCodes = informations.ProjectList.Select(x => x.Code).ToList();
567
                }
568

    
569
                this.Markups = new List<MarkupText>(new MarkusInfoController().GetMarkupData(projectCodes, this.documents.Select(x => x.DocumentNo)));
570
            }
571
        }
572

    
573
        public void GetDocListbyID2()
574
        {
575
            if (this.radDropDownListProject.SelectedValue != null)
576
            {
577
                string projectCode = this.radDropDownListProject.SelectedValue.ToString();
578
                string personIncharge = this.radDropDownListPersonInCharge.SelectedValue.ToString();
579
                string jobLevel = this.radDropDownListJobLevel.SelectedValue.ToString();
580
                string documentNo = this.radTextBoxDocumentNo.Text.Trim();
581

    
582
                string isToIsDiscussion = this.radDropDownListToIsDiscussion.SelectedValue.ToString();
583
                string isFrReviewStatus = this.radDropDownListFrReviewStatus.SelectedValue.ToString();
584
                string isID2Work = this.radDropDownListIsID2Work.SelectedValue.ToString();
585

    
586
                string id2Status = this.radDropDownListID2Status.SelectedValue.ToString();
587
                string avevaStatus = this.radDropDownListAVEVAStatus.SelectedValue.ToString();
588

    
589
                string prodIsResult = this.radDropDownListProdIsResult.SelectedValue.ToString();
590
                string clientIsResult = this.radDropDownListClientIsResult.SelectedValue.ToString();
591

    
592
                var id2Prjs = informations.ProjectList.Where(x => x.GroupID.Equals(informations.ActiveProject.ProjectID)).Select(x => x.ID2Info).ToList();
593
                var(dwgs, totalCnt) = new DocumentController().GetDocuments(id2Prjs, projectCode, personIncharge, jobLevel, documentNo, isToIsDiscussion, isFrReviewStatus, isID2Work, id2Status, avevaStatus, prodIsResult, clientIsResult);
594
                this.documents = dwgs.ToList();
595
                this.orgDocuments = JsonConvert.DeserializeObject<List<Documents>>(JsonConvert.SerializeObject(this.documents));
596
                this.lbSelectAndTotal.Text = totalCnt.ToString();
597
            }
598
        }
599

    
600
        public void DocumentListBinding()
601
        {
602
            GridViewComboBoxColumn ColProjects = this.radGridViewDocuments.Columns["RefProjectCode"] as GridViewComboBoxColumn;
603
            ColProjects.DataSource = informations.ProjectList.Where(x => x.GroupID.Equals(informations.ActiveProject.ProjectID)).ToList();
604
            ColProjects.DisplayMember = "Name";
605
            ColProjects.ValueMember = "Code";
606

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

    
610
            GridViewComboBoxColumn ColPersonInCharge = this.radGridViewDocuments.Columns["PersonInCharge"] as GridViewComboBoxColumn;
611
            ColPersonInCharge.DataSource = workUsers;
612
            ColPersonInCharge.DisplayMember = "Name";
613
            ColPersonInCharge.ValueMember = "ID";
614

    
615
            GridViewComboBoxColumn ColWorker = this.radGridViewDocuments.Columns["Worker"] as GridViewComboBoxColumn;
616
            ColWorker.DataSource = workUsers;
617
            ColWorker.DisplayMember = "Name";
618
            ColWorker.ValueMember = "ID";
619

    
620
            GridViewComboBoxColumn ColToCreator = this.radGridViewDocuments.Columns["ToCreator"] as GridViewComboBoxColumn;
621
            ColToCreator.DataSource = workUsers;
622
            ColToCreator.DisplayMember = "Name";
623
            ColToCreator.ValueMember = "ID";
624

    
625
            GridViewComboBoxColumn ColFrCreator = this.radGridViewDocuments.Columns["FrCreator"] as GridViewComboBoxColumn;
626
            ColFrCreator.DataSource = clientUsers;
627
            ColFrCreator.DisplayMember = "Name";
628
            ColFrCreator.ValueMember = "ID";
629

    
630
            GridViewComboBoxColumn ColProdReviewer = this.radGridViewDocuments.Columns["ProdReviewer"] as GridViewComboBoxColumn;
631
            ColProdReviewer.DataSource = workUsers;
632
            ColProdReviewer.DisplayMember = "Name";
633
            ColProdReviewer.ValueMember = "ID";
634

    
635
            GridViewComboBoxColumn ColClientReviewer = this.radGridViewDocuments.Columns["ClientReviewer"] as GridViewComboBoxColumn;
636
            ColClientReviewer.DataSource = clientUsers;
637
            ColClientReviewer.DisplayMember = "Name";
638
            ColClientReviewer.ValueMember = "ID";
639

    
640
            //Data
641
            if (this.radGridViewDocuments.DataSource != null)
642
                this.radGridViewDocuments.DataSource = null;
643

    
644
            /*
645
            var info = informations.ProjectList.Where(x => x.Name.Equals("APAO")).FirstOrDefault().ID2Info;
646
            var id2Datas = new DocumentController(info).GetID2DrawingsByProject(info);
647
            var test = from doc in this.documents
648
                       join id2 in id2Datas on doc.DocumentNo equals id2.DOCNAME into gj
649
                       from docs in gj.DefaultIfEmpty()
650
                       select new Documents()
651
                       {
652
                           DocumentNo = doc.DocumentNo,
653
                           ID2EndDate = docs?.DATETIME == null ? (DateTime?)null : Convert.ToDateTime(docs?.DATETIME)
654
                           //ProdRemarks = docs.DATETIME ?? null
655
                       };
656
            */
657

    
658
            this.radGridViewDocuments.DataSource = new BindingList<Documents>(this.documents);
659

    
660
            if (this.radGridViewDocuments.SummaryRowsBottom != null)
661
                this.radGridViewDocuments.SummaryRowsBottom.Clear();
662

    
663
            string totalCount = String.Format("{0:#,###}", this.documents.Count());
664

    
665
            //Summary
666
            GridViewSummaryRowItem summaryRowItem = new GridViewSummaryRowItem()
667
            {
668
                new GridViewSummaryItem("DocumentNo", "{0:#,###} / " + totalCount, GridAggregateFunction.Count)
669
            };
670
            this.radGridViewDocuments.SummaryRowsBottom.Add(summaryRowItem);
671
            this.radGridViewDocuments.MasterView.SummaryRows[0].PinPosition = PinnedRowPosition.Bottom;
672
            this.radGridViewDocuments.MasterTemplate.BottomPinnedRowsMode = GridViewBottomPinnedRowsMode.Fixed;
673
        }
674
        #endregion
675

    
676
        #region Button, Checkbox event
677
        private void RadCheckBox_CheckStateChanged(object sender, EventArgs e)
678
        {
679
            if (sender is RadCheckBox)
680
            {
681
                RadCheckBox checkBox = sender as RadCheckBox;
682

    
683
                if (checkBox.Tag != null)
684
                {
685
                    ColumnGroupsViewDefinition columnGroupsView =  this.radGridViewDocuments.MasterTemplate.ViewDefinition as ColumnGroupsViewDefinition;
686
                    GridViewColumnGroup colGroup = columnGroupsView.GetAllGroups().Where(x => x.Name.Equals(checkBox.Tag.ToString())).FirstOrDefault();
687
                    if (colGroup != null)
688
                        colGroup.IsVisible = checkBox.Checked;
689
                }
690
            }
691

    
692
            //ColumnGroupsViewDefinition columnGroupsView = this.radGridViewDocuments.MasterTemplate.ViewDefinition = columnGroupsView;
693
        }
694

    
695
        private void RadTextBoxDocumentNo_KeyDown(object sender, KeyEventArgs e)
696
        {
697
            if (e.KeyCode == Keys.Enter)
698
            {
699
                this.radButtonSearch.Focus();
700
                this.radButtonSearch.PerformClick();
701
            }
702
        }
703

    
704
        private void RadButtonSearch_Click(object sender, EventArgs e)
705
        {
706
            this.GetDocList();
707
            this.DocumentListBinding();
708
        }
709

    
710
        private void BackstageButtonItemUserRegistration_Click(object sender, EventArgs e)
711
        {
712
            using (var frm = new SetupUser())
713
            {
714
                if (frm.ShowDialog(this) == DialogResult.OK)
715
                {
716
                    
717
                }
718
            }
719
        }
720

    
721
        private void BackstageButtonItemExit_Click(object sender, EventArgs e)
722
        {
723
            Application.Exit();
724
        }
725
        #endregion
726

    
727
        #region Grid event
728
        private void RadGridViewDocuments_CommandCellClick(object sender, GridViewCellEventArgs e)
729
        {
730
            if (e.Row is GridViewNewRowInfo)
731
            {
732
                
733
            }
734
            else
735
            {
736
                string extension = string.Empty;
737

    
738
                switch (e.Column.Name)
739
                {
740
                    case "MarkupLink":
741
                        {
742
                            if (e.Row.DataBoundItem is Documents doc)
743
                            {
744
                                if (!string.IsNullOrWhiteSpace(doc.RefProjectCode) && !string.IsNullOrWhiteSpace(doc.DocumentNo) && !string.IsNullOrWhiteSpace(informations.ActiveUser.ID))
745
                                {
746
                                    bool result = MarkusHelper.Start(doc.RefProjectCode, doc.DocumentNo, informations.ActiveUser.ID);
747
                                }
748
                            }
749
                        }
750
                        break;
751
                    case "AVEVALink":
752
                    case "AVEVAConnection":
753
                        MessageBox.Show($"{e.Column.Name} 실행");
754
                        break;
755
                    case "ReviewFileName"://일단주석
756
                        MessageBox.Show($"{e.Column.Name} 실행");
757
                        break;
758
                    case "SystemLink":
759
                        MessageBox.Show($"{e.Column.Name} 실행");
760
                        break;
761
                    case "ToCapture":
762
                    case "FrCapture":
763

    
764
                        if (e.Row.DataBoundItem is Documents dd)
765
                        {
766
                            using (var frm = new ImageView(dd.DocID))
767
                            {
768
                                frm.ShowDialog(this);
769
                            }
770
                        }
771
                        break;
772
                    case "ID2Connection":
773
                        try
774
                        {
775
                            if (e.Row.DataBoundItem is Documents doc)
776
                            {
777
                                ID2Helper.OpenPID(doc.DocumentNo, string.Empty, Properties.Settings.Default.ID2Port);
778

    
779
                                try
780
                                {
781
                                    var returnDoc = new DocumentController().SetID2Worker(new Documents()
782
                                    {
783
                                        DocID = doc.DocID,
784
                                        ID2StartDate = DateTime.Now,
785
                                        Worker = informations.ActiveUser.ID
786
                                    }, informations.ActiveUser.ID);
787

    
788
                                    if (returnDoc != null)
789
                                    {
790
                                        doc.ID2StartDate = returnDoc.ID2StartDate;
791
                                        doc.Worker = returnDoc.Worker;
792
                                        doc.ID2JobTime = returnDoc.ID2JobTime;
793
                                    }
794
                                }
795
                                catch { }
796
                            }
797
                        }
798
                        catch (Exception ex)
799
                        {
800
                            RadMessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, RadMessageIcon.Error);
801
                        }
802
                        break;
803
                }
804
            }
805
        }
806

    
807
        private void RadGridViewDocuments_CellBeginEdit(object sender, GridViewCellCancelEventArgs e)
808
        {
809
            if (e.ActiveEditor is RadDropDownListEditor)
810
            {
811
                switch (e.Column.Name)
812
                {
813
                    case "JobLevel":
814
                        GridViewComboBoxColumn colJobLevel = this.radGridViewDocuments.Columns[e.Column.Name] as GridViewComboBoxColumn;
815
                        colJobLevel.DataSource = informations.JobLevel;
816
                        break;
817
                    case "IsTypical":
818
                    case "ToIsDiscussion":
819
                    case "ToIsMarkup":
820
                    case "FrIsMarkup":
821
                    case "IsID2Work":
822
                    case "DTIsImport":
823
                        GridViewComboBoxColumn colYesNo = this.radGridViewDocuments.Columns[e.Column.Name] as GridViewComboBoxColumn;
824
                        colYesNo.DataSource = (new string[] { string.Empty }).Union<string>(informations.IsYesNo);
825
                        break;
826
                    case "DTIsGateWay":
827
                    case "DTIsRegSystem":
828
                        GridViewComboBoxColumn colSuccess = this.radGridViewDocuments.Columns[e.Column.Name] as GridViewComboBoxColumn;
829
                        colSuccess.DataSource = (new string[] { string.Empty }).Union<string>(informations.IsSuccess);
830
                        break;
831
                    case "ID2Status":
832
                    case "AVEVAStatus":
833
                        GridViewComboBoxColumn ColJobStatus = this.radGridViewDocuments.Columns[e.Column.Name] as GridViewComboBoxColumn;
834
                        ColJobStatus.DataSource = (new string[] { string.Empty }).Union<string>(informations.JobStatus);
835
                        break;
836
                    case "FrReviewStatus"://삼성의견status
837
                        GridViewComboBoxColumn ColClientStatus = this.radGridViewDocuments.Columns[e.Column.Name] as GridViewComboBoxColumn;
838
                        ColClientStatus.DataSource = (new string[] { string.Empty }).Union<string>(informations.ClientStatus);
839
                        break;
840
                    case "ProdIsResult":
841
                    case "ClientIsResult":
842
                        GridViewComboBoxColumn ColResult = this.radGridViewDocuments.Columns[e.Column.Name] as GridViewComboBoxColumn;
843
                        ColResult.DataSource = (new string[] { string.Empty }).Union<string>(informations.ValidationResult);
844
                        break;
845
                }
846
            }
847
        }
848

    
849
        private void RadGridViewDocuments_CreateRow(object sender, GridViewCreateRowEventArgs e)
850
        {
851
            if (e.RowType == typeof(GridDetailViewRowElement))
852
            {
853
                //if (e.RowInfo.ChildRows.Count() > 0)
854
                //{
855
                    e.RowElement = new RowDetailViewRowElement();
856
                
857
                //}
858
                //else
859
                //{
860
                //    e.RowElement = null;
861
                //}
862
            }
863
        }
864

    
865

    
866
        private void RadGridViewDocuments_CreateCell1(object sender, GridViewCreateCellEventArgs e)
867
        {
868
            if (e.CellType == typeof(GridDetailViewCellElement))
869
            {
870
                //if (e.Row.RowInfo.ChildRows.Count() > 0)
871
                //{
872
                e.CellElement = new MarkupDetailCellElement(e.Column, e.Row);
873
                //}
874
            }
875
        }
876

    
877

    
878
        private void RadGridViewDocuments_ViewCellFormatting(object sender, CellFormattingEventArgs e)
879
        {
880
            if (e.Row is GridViewDataRowInfo)
881
            {
882
                if (e.CellElement is GridRowHeaderCellElement)
883
                {
884
                   // if (e.CellElement.RowIndex > -1)
885
                  //      e.CellElement.Text = (e.CellElement.RowIndex + 1).ToString();
886
                }
887
                else
888
                {
889
                    var result = e.Row.DataBoundItem as Documents;
890
                    if (result != null || e.Row is GridViewNewRowInfo)
891
                    {
892
                        switch (e.CellElement.ColumnInfo.Name)
893
                        {
894
                            case "AutoCADLink":
895
                            case "PDFLink":
896
                            case "MarkupLink":
897
                            case "AVEVALink":
898
                            case "AVEVAConnection":
899
                            case "ReviewFileName"://일단주석
900
                            case "SystemLink":
901
                            case "ToCapture":
902
                            case "FrCapture":
903
                            case "ID2Connection":
904
                                this.GetCommandColBtnElement(e.CellElement.Children[0], e.CellElement.ColumnInfo.Name);
905
                                break;
906
                        }
907
                    }
908
                    else
909
                    {
910

    
911
                    }
912
                }
913
            }
914
            else if (e.Row is GridViewSummaryRowInfo)
915
            {
916
                if (e.CellElement is GridRowHeaderCellElement)
917
                {
918
                    e.CellElement.Text = "Count";
919
                }
920
                else if (e.CellElement is GridSummaryCellElement)
921
                {
922
                    e.CellElement.ForeColor = this._SummaryColor;
923
                    e.CellElement.TextAlignment = ContentAlignment.BottomRight;
924
                    e.CellElement.Font = new Font(e.CellElement.Font, FontStyle.Bold);
925
                }
926
                else
927
                {
928

    
929
                }
930
            }
931
            else if(e.Row is GridViewDetailsRowInfo)
932
            {
933
                if(e.CellElement is MarkupDetailCellElement element)
934
                {
935
                    //element.UpdateInfo();
936
                }
937
            }
938
            else
939
            {
940

    
941
            }
942
        }
943

    
944
        private RadButtonElement GetCommandColBtnElement(RadElement elem, string colName)
945
        {
946
            RadButtonElement btnElem = null;
947
            Bitmap bitmap = null; ;
948

    
949
            switch (colName)
950
            {
951
                case "AutoCADLink":
952
                    bitmap = new Bitmap(Properties.Resources.cad18);
953
                    break;
954
                case "PDFLink":
955
                    bitmap = new Bitmap(Properties.Resources.pdf18);
956
                    break;
957
                case "MarkupLink":
958
                    bitmap = new Bitmap(Properties.Resources.markus18);
959
                    break;
960
                case "AVEVALink":
961
                case "AVEVAConnection":
962
                    bitmap = new Bitmap(Properties.Resources.aveva_net18);
963
                    break;
964
                case "ReviewFileName"://일단주석
965
                    bitmap = new Bitmap(Properties.Resources.pdf18);
966
                    break;
967
                case "SystemLink":
968
                    bitmap = new Bitmap(Properties.Resources.link18_yellow);
969
                    break;
970
                case "ToCapture":
971
                case "FrCapture":
972
                    bitmap = new Bitmap(Properties.Resources.files18);
973
                    break;
974
                case "ID2Connection":
975
                    bitmap = new Bitmap(Properties.Resources.id218);
976
                    break;
977
            }
978

    
979
            switch (colName)
980
            {
981
                case "AutoCADLink":
982
                case "PDFLink":
983
                case "MarkupLink":
984
                case "AVEVALink":
985
                case "AVEVAConnection":
986
                case "ReviewFileName"://일단주석
987
                case "SystemLink":
988
                case "ToCapture":
989
                case "FrCapture":
990
                case "ID2Connection":
991
                    btnElem = (RadButtonElement)elem;
992
                    btnElem.Margin = new Padding(0);
993
                    btnElem.Padding = new Padding(0);
994
                    btnElem.BorderElement.Opacity = 0;
995
                    btnElem.Alignment = ContentAlignment.MiddleCenter;
996
                    btnElem.DisplayStyle = DisplayStyle.Image;
997
                    btnElem.Image = bitmap;
998
                    btnElem.ImageAlignment = ContentAlignment.MiddleCenter;
999
                    btnElem.MaxSize = bitmap.Size;
1000
                    break;
1001
            }
1002

    
1003
            return btnElem;
1004
        }
1005
        #endregion
1006

    
1007
        #region Excel
1008
        private UserInfo GetUser(string user)
1009
        {
1010
            UserInfo userInfo = informations.UserList.Where(x => x.ID.Equals(user)).FirstOrDefault();
1011
            if (userInfo != null) return userInfo;
1012

    
1013
            userInfo = informations.UserList.Where(x => x.Name.Equals(user)).FirstOrDefault();
1014
            if (userInfo != null) return userInfo;
1015

    
1016
            return userInfo ?? new UserInfo();
1017
        }
1018

    
1019
        private ProjectInfo GetProject(string project)
1020
        {
1021
            ProjectInfo prjInfo = informations.ProjectList.Where(x => x.ProjectID.Equals(project)).FirstOrDefault();
1022
            if (prjInfo != null) return prjInfo;
1023

    
1024
            prjInfo = informations.ProjectList.FirstOrDefault(x => x.Name.Equals(project));
1025
            if (prjInfo != null) return prjInfo;
1026

    
1027
            return prjInfo ?? new ProjectInfo();
1028
        }
1029
        private void RadButtonElementExcelImport_Click(object sender, EventArgs e)
1030
        {
1031
            using (OpenFileDialog ofd = new OpenFileDialog()
1032
            {
1033
                Filter = "Excel files (*.xlsx)|*.xlsx",
1034
                Title = "Open an Excel File",
1035
                RestoreDirectory = true
1036
            })
1037
            {
1038
                if (ofd.ShowDialog() == DialogResult.OK)
1039
                {
1040
                    //Error Message
1041
                    StringBuilder sbErrMsg = new StringBuilder();
1042

    
1043
                    using(ID2Excel excel = new ID2Excel())
1044
                    {
1045
                       var result = excel.GemboxImport(ofd.FileName);
1046

    
1047
                        if(result.Error != null)
1048
                        {
1049

    
1050
                            RadMessageBox.Show(result.Error, "Information", MessageBoxButtons.OK, RadMessageIcon.Info);
1051
                        }
1052
                        else
1053
                        {
1054
                            this.documents.AddRange(result.documents);
1055
                            if (this.orgDocuments == null) this.orgDocuments = new List<Documents>();
1056
                            this.DocumentListBinding();
1057
                        }
1058

    
1059
                    }
1060

    
1061

    
1062
                    //foreach (Documents appDoc in appendDocuments)
1063
                    //{
1064
                    //    GridViewRowInfo rowInfo = this.radGridViewDocuments.Rows.AddNew();
1065

    
1066
                    //    foreach (FieldInfo fieldInfo in appDoc.GetType().GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly))
1067
                    //    {
1068
                    //        if (fieldInfo.GetValue(appDoc) != null)
1069
                    //        {
1070
                    //            var cols = rowInfo.Cells.Where(x => fieldInfo.Name.Contains($"<{x.ColumnInfo.Name}>"));
1071

    
1072
                    //            if (cols.Any())
1073
                    //            {
1074
                    //                cols.FirstOrDefault().Value = fieldInfo.GetValue(appDoc);
1075
                    //            }
1076
                    //        }
1077
                    //    }
1078
                    //}
1079
                }
1080
            }
1081
        }
1082

    
1083
        private void RadButtonElementExcelImport_Click_old(object sender, EventArgs e)
1084
        {
1085
            using (OpenFileDialog ofd = new OpenFileDialog()
1086
            {
1087
                Filter = "Excel files (*.xlsx)|*.xlsx",
1088
                Title = "Open an Excel File",
1089
                RestoreDirectory = true
1090
            })
1091
            {
1092
                if (ofd.ShowDialog() == DialogResult.OK)
1093
                {
1094
                    //Error Message
1095
                    StringBuilder sbErrMsg = new StringBuilder();
1096

    
1097
                    var exFile = ExcelFile.Load(ofd.FileName);
1098
                    var ws = exFile.Worksheets[0];
1099

    
1100
                    int rowCount = ws.Rows.Count;
1101
                    int columnCount = ws.CalculateMaxUsedColumns();
1102
                    int exRow = 8;
1103

    
1104
                    #region Excel 유효성검사
1105

    
1106
                    //Excel 포멧체크
1107
                    if (rowCount < 10 || columnCount != 45)
1108
                    {
1109
                        RadMessageBox.Show("Please, check the excel.\n", "Information", MessageBoxButtons.OK, RadMessageIcon.Info);
1110
                        return;
1111
                    }
1112

    
1113
                    #region 엑셀 필수값 체크(도면 : 이름,담당자, 난이도, Typical)
1114
                    ws.Rows.SelectMany(row => row.AllocatedCells)
1115
                           .Where(col => col.Column.Index > 5 && col.Column.Index < 10 && col.Row.Index > exRow && col.Value == null)
1116
                           .ToList()
1117
                           .ForEach(p => sbErrMsg.Append(", " + p.Column.Name + p.Row.Name));
1118

    
1119
                    if (sbErrMsg.Length > 0)
1120
                    {
1121
                        string errMsg = sbErrMsg.ToString().Substring(2);
1122
                        if (errMsg.Length > 100)
1123
                        {
1124
                            errMsg = $"{errMsg.Substring(0, 100)}...";
1125
                        }
1126

    
1127
                        RadMessageBox.Show($"Please, check null value in excel.\n{errMsg}", "Information", MessageBoxButtons.OK, RadMessageIcon.Info);
1128
                        return;
1129
                    }
1130
                    #endregion
1131

    
1132
                    #region 엑셀 도명명 중복 값 체크
1133
                    ws.Rows.SelectMany(row => row.AllocatedCells)
1134
                                                 .Where(col => col.Column.Index == 6 && col.Row.Index > exRow)
1135
                                                 .GroupBy(g => g.Row.Index)
1136
                                                 .Select(p => new {
1137
                                                     rowIndex = p.Key,
1138
                                                     docNo = p.Select(x => x.Value.ToString()).FirstOrDefault()
1139
                                                 })
1140
                                                 .GroupBy(g => g.docNo)
1141
                                                 .Where(p => p.Count() > 1)
1142
                                                 .Select(p => p.Select(x => (x.rowIndex + 1).ToString())
1143
                                                                                            .Aggregate((x, y) => x.ToString() + "," + y.ToString())
1144
                                                                                            .ToString())
1145
                                                 .ToList().ForEach(p => sbErrMsg.Append("\n" + p.ToString()));
1146
                    if (sbErrMsg.Length > 0)
1147
                    {
1148
                        sbErrMsg.Insert(0, "\n중복 된 도면명 Excel row : ");
1149
                        string errMsg = sbErrMsg.ToString();
1150
                        if (errMsg.Length > 100)
1151
                        {
1152
                            errMsg = $"{errMsg.Substring(0, 100)}...";
1153
                        }
1154

    
1155
                        RadMessageBox.Show($"Please, check the duplicate value in excel.\n{errMsg}", "Information", MessageBoxButtons.OK, RadMessageIcon.Info);
1156
                        return;
1157
                    }
1158
                    #endregion
1159

    
1160
                    #endregion
1161

    
1162
                    List<Documents> appendDocuments = new List<Documents>();
1163

    
1164
                    ws.Rows.Where(row => row.Index > exRow)
1165
                           .ToList()
1166
                           .ForEach(p => appendDocuments.Add(new Documents()
1167
                           {
1168
                               //UID = string.Empty,
1169
                               //Type = this.radTextBoxInsulationType.Text,
1170
                               //TempFrom = ws.Rows[exRow].Cells[p.Column.Index].Value == null ? 0 : Convert.ToSingle(ws.Rows[exRow].Cells[p.Column.Index].Value),
1171
                               //TempTo = ws.Rows[exRow + 2].Cells[p.Column.Index].Value == null ? 0 : Convert.ToSingle(ws.Rows[exRow + 2].Cells[p.Column.Index].Value),
1172
                               //NPS = ws.Rows[p.Row.Index].Cells[0].Value == null ? 0 : Convert.ToSingle(ws.Rows[p.Row.Index].Cells[0].Value),
1173
                               //Thickness = p.Value == null ? 0 : Convert.ToSingle(p.Value)
1174

    
1175
                               RefProjectCode = ws.Rows[p.Index].Cells[5].Value == null ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(),
1176
                               DocumentNo = ws.Rows[p.Index].Cells[6].Value == null ? string.Empty : ws.Rows[p.Index].Cells[6].Value.ToString(),
1177
                               PersonInCharge = ws.Rows[p.Index].Cells[7].Value == null ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[7].Value.ToString()).ID,
1178
                               JobLevel = ws.Rows[p.Index].Cells[8].Value == null ? string.Empty : ws.Rows[p.Index].Cells[8].Value.ToString(),
1179
                               IsTypical = ws.Rows[p.Index].Cells[9].Value == null ? string.Empty : ws.Rows[p.Index].Cells[9].Value.ToString(),
1180
                               RevisonNo = ws.Rows[p.Index].Cells[10].Value == null ? string.Empty : ws.Rows[p.Index].Cells[10].Value.ToString(),
1181
                               ToIsDiscussion = ws.Rows[p.Index].Cells[11].Value == null ? string.Empty : ws.Rows[p.Index].Cells[11].Value.ToString(),
1182
                               ToRemarks = ws.Rows[p.Index].Cells[12].Value == null ? string.Empty : ws.Rows[p.Index].Cells[12].Value.ToString(),
1183
                               ToCreator = ws.Rows[p.Index].Cells[13].Value == null ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[13].Value.ToString()).ID,
1184
                               //ToCapture = ws.Rows[p.Index].Cells[5].Value == null ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(),
1185
                               //ToIsMarkup = ws.Rows[p.Index].Cells[5].Value == null ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(),
1186
                               FrReviewStatus = ws.Rows[p.Index].Cells[16].Value == null ? string.Empty : ws.Rows[p.Index].Cells[16].Value.ToString(),
1187
                               FrRemarks = ws.Rows[p.Index].Cells[17].Value == null ? string.Empty : ws.Rows[p.Index].Cells[17].Value.ToString(),
1188
                               FrCreator = ws.Rows[p.Index].Cells[18].Value == null ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[18].Value.ToString()).ID,
1189
                               //FrCapture = ws.Rows[p.Index].Cells[5].Value == null ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(),
1190
                               //FrIsMarkup = ws.Rows[p.Index].Cells[5].Value == null ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(),
1191
                               IsID2Work = ws.Rows[p.Index].Cells[21].Value == null ? string.Empty : ws.Rows[p.Index].Cells[21].Value.ToString(),
1192
                               //ID2Connection = ws.Rows[p.Index].Cells[5].Value == null ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(),
1193
                               ID2StartDate = ws.Rows[p.Index].Cells[23].Value == null ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[23].Value?.ToString()),
1194
                               ID2EndDate = ws.Rows[p.Index].Cells[24].Value == null ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[24].Value?.ToString()),
1195
                               //ID2JobTime = ws.Rows[p.Index].Cells[5].Value == null ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(),
1196
                               ID2Status = ws.Rows[p.Index].Cells[26].Value == null ? string.Empty : ws.Rows[p.Index].Cells[26].Value.ToString(),
1197
                               ID2Issues = ws.Rows[p.Index].Cells[27].Value == null ? string.Empty : ws.Rows[p.Index].Cells[27].Value.ToString(),
1198
                               //AVEVAConnection = ws.Rows[p.Index].Cells[5].Value == null ? string.Empty : ws.Rows[p.Index].Cells[5].Value.ToString(),
1199
                               AVEVAConvertDate = ws.Rows[p.Index].Cells[29].Value == null ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[29].Value.ToString()),
1200
                               AVEVAReviewDate = ws.Rows[p.Index].Cells[30].Value == null ? (DateTime?)null : Convert.ToDateTime(ws.Rows[p.Index].Cells[30].Value.ToString()),
1201
                               AVEVAStatus = ws.Rows[p.Index].Cells[31].Value == null ? string.Empty : ws.Rows[p.Index].Cells[31].Value.ToString(),
1202
                               AVEVAIssues = ws.Rows[p.Index].Cells[32].Value == null ? string.Empty : ws.Rows[p.Index].Cells[32].Value.ToString(),
1203
                               ProdReviewer = ws.Rows[p.Index].Cells[35].Value == null ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[35].Value.ToString()).ID,
1204
                               ProdIsResult = ws.Rows[p.Index].Cells[36].Value == null ? string.Empty : ws.Rows[p.Index].Cells[36].Value.ToString(),
1205
                               ProdRemarks = ws.Rows[p.Index].Cells[37].Value == null ? string.Empty : ws.Rows[p.Index].Cells[37].Value.ToString(),
1206
                               ClientReviewer = ws.Rows[p.Index].Cells[38].Value == null ? string.Empty : this.GetUser(ws.Rows[p.Index].Cells[38].Value.ToString()).ID,
1207
                               ClientIsResult = ws.Rows[p.Index].Cells[39].Value == null ? string.Empty : ws.Rows[p.Index].Cells[39].Value.ToString(),
1208
                               ClientRemarks = ws.Rows[p.Index].Cells[40].Value == null ? string.Empty : ws.Rows[p.Index].Cells[40].Value.ToString(),
1209
                               DTIsGateWay = ws.Rows[p.Index].Cells[41].Value == null ? string.Empty : ws.Rows[p.Index].Cells[41].Value.ToString(),
1210
                               DTIsImport = ws.Rows[p.Index].Cells[42].Value == null ? string.Empty : ws.Rows[p.Index].Cells[42].Value.ToString(),
1211
                               DTIsRegSystem = ws.Rows[p.Index].Cells[43].Value == null ? string.Empty : ws.Rows[p.Index].Cells[43].Value.ToString(),
1212
                               DTRemarks = ws.Rows[p.Index].Cells[44].Value == null ? string.Empty : ws.Rows[p.Index].Cells[44].Value.ToString()
1213
                           }));
1214

    
1215
                    this.documents.AddRange(appendDocuments);
1216
                    if (this.orgDocuments == null) this.orgDocuments = new List<Documents>();
1217
                    this.DocumentListBinding();
1218

    
1219
                    //foreach (Documents appDoc in appendDocuments)
1220
                    //{
1221
                    //    GridViewRowInfo rowInfo = this.radGridViewDocuments.Rows.AddNew();
1222

    
1223
                    //    foreach (FieldInfo fieldInfo in appDoc.GetType().GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly))
1224
                    //    {
1225
                    //        if (fieldInfo.GetValue(appDoc) != null)
1226
                    //        {
1227
                    //            var cols = rowInfo.Cells.Where(x => fieldInfo.Name.Contains($"<{x.ColumnInfo.Name}>"));
1228

    
1229
                    //            if (cols.Any())
1230
                    //            {
1231
                    //                cols.FirstOrDefault().Value = fieldInfo.GetValue(appDoc);
1232
                    //            }
1233
                    //        }
1234
                    //    }
1235
                    //}
1236
                }
1237
            }
1238
        }
1239

    
1240
        private void RadButtonElementExcelExport_Click(object sender, EventArgs e)
1241
        {
1242
            string sPrefixName = "Samsung Elec Task Management";
1243
            string extension = ".xlsx";
1244

    
1245
            using (SaveFileDialog sfd = new SaveFileDialog()
1246
            {
1247
                FileName = $"{sPrefixName}_{DateTime.Now:yyyyMMddhhmmss}{extension}",
1248
                Filter = "Excel|*.xlsx",
1249
                Title = "Save an Excel File",
1250
                CheckFileExists = false,
1251
                CheckPathExists = true,
1252
                OverwritePrompt = true
1253
            })
1254
            {
1255
                if (sfd.ShowDialog() == DialogResult.OK)
1256
                {
1257
                    string fileName = $"{sPrefixName}{extension}";
1258
                    string templateFolder = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "Template");
1259
                    string templateFilePath = Path.Combine(templateFolder, fileName);
1260
                    if (!File.Exists(templateFilePath))
1261
                    {
1262
                        RadMessageBox.Show(this, $"There is no {fileName} in {templateFolder}", "Error", MessageBoxButtons.OK, RadMessageIcon.Error);
1263
                        return;
1264
                    }
1265

    
1266
                    if (this.radGridViewDocuments.Rows.Count > 0)
1267
                    {
1268
                        var templateExcelFile = ExcelFile.Load(templateFilePath);
1269
                        var templateWorksheets = templateExcelFile.Worksheets;
1270
                        var templateWorksheet = templateWorksheets[0];
1271

    
1272
                        int rowIndex = 9;
1273
                        //int colIndex = 1;
1274

    
1275
                        foreach (var row in this.radGridViewDocuments.Rows)
1276
                        {
1277
                            var doc = row.DataBoundItem as Documents;
1278

    
1279
                            templateWorksheet.Cells[rowIndex, 0].Value = doc.Seq;
1280
                            //templateWorksheet.Cells[rowIndex, 1].Value = doc.DocumentNo;
1281
                            //templateWorksheet.Cells[rowIndex, 2].Value = doc.DocumentNo;
1282
                            //templateWorksheet.Cells[rowIndex, 3].Value = doc.DocumentNo;
1283
                            //templateWorksheet.Cells[rowIndex, 4].Value = doc.DocumentNo;
1284
                            templateWorksheet.Cells[rowIndex, 5].Value = doc.RefProjectCode;
1285
                            templateWorksheet.Cells[rowIndex, 6].Value = doc.DocumentNo;
1286
                            templateWorksheet.Cells[rowIndex, 7].Value = this.GetUser(doc.PersonInCharge).Name;
1287
                            templateWorksheet.Cells[rowIndex, 8].Value = doc.JobLevel;
1288
                            templateWorksheet.Cells[rowIndex, 9].Value = doc.IsTypical;
1289
                            templateWorksheet.Cells[rowIndex, 10].Value = doc.RevisonNo;
1290
                            templateWorksheet.Cells[rowIndex, 11].Value = doc.ToIsDiscussion;
1291
                            templateWorksheet.Cells[rowIndex, 12].Value = doc.ToRemarks;
1292
                            templateWorksheet.Cells[rowIndex, 13].Value = this.GetUser(doc.ToCreator).Name;
1293
                            templateWorksheet.Cells[rowIndex, 14].Value = doc.ToCapture;
1294
                            templateWorksheet.Cells[rowIndex, 15].Value = doc.ToIsMarkup;
1295
                            templateWorksheet.Cells[rowIndex, 16].Value = doc.FrReviewStatus;
1296
                            templateWorksheet.Cells[rowIndex, 17].Value = doc.FrRemarks;
1297
                            templateWorksheet.Cells[rowIndex, 18].Value = this.GetUser(doc.FrCreator).Name;
1298
                            templateWorksheet.Cells[rowIndex, 19].Value = doc.FrCapture;
1299
                            templateWorksheet.Cells[rowIndex, 20].Value = doc.FrIsMarkup;
1300
                            templateWorksheet.Cells[rowIndex, 21].Value = doc.IsID2Work;
1301
                            templateWorksheet.Cells[rowIndex, 22].Value = doc.ID2Connection;
1302
                            templateWorksheet.Cells[rowIndex, 23].Value = $"{doc.ID2StartDate:yyyy/MM/dd hh:mm:ss}";
1303
                            templateWorksheet.Cells[rowIndex, 24].Value = $"{doc.ID2EndDate:yyyy/MM/dd hh:mm:ss}";
1304
                            templateWorksheet.Cells[rowIndex, 25].Value = doc.ID2JobTime;
1305
                            templateWorksheet.Cells[rowIndex, 26].Value = doc.ID2Status;
1306
                            templateWorksheet.Cells[rowIndex, 27].Value = doc.ID2Issues;
1307
                            templateWorksheet.Cells[rowIndex, 28].Value = doc.AVEVAConnection;
1308
                            templateWorksheet.Cells[rowIndex, 29].Value = $"{doc.AVEVAConvertDate:yyyy/MM/dd}";
1309
                            templateWorksheet.Cells[rowIndex, 30].Value = $"{doc.AVEVAReviewDate:yyyy/MM/dd}";
1310
                            templateWorksheet.Cells[rowIndex, 31].Value = doc.AVEVAStatus;
1311
                            templateWorksheet.Cells[rowIndex, 32].Value = doc.AVEVAIssues;
1312
                            //templateWorksheet.Cells[rowIndex, 33].Value = doc.DocumentNo;
1313
                            //templateWorksheet.Cells[rowIndex, 34].Value = doc.DocumentNo;
1314
                            templateWorksheet.Cells[rowIndex, 35].Value = this.GetUser(doc.ProdReviewer).Name;
1315
                            templateWorksheet.Cells[rowIndex, 36].Value = doc.ProdIsResult;
1316
                            templateWorksheet.Cells[rowIndex, 37].Value = doc.ProdRemarks;
1317
                            templateWorksheet.Cells[rowIndex, 38].Value = this.GetUser(doc.ClientReviewer).Name;
1318
                            templateWorksheet.Cells[rowIndex, 39].Value = doc.ClientIsResult;
1319
                            templateWorksheet.Cells[rowIndex, 40].Value = doc.ClientRemarks;
1320
                            templateWorksheet.Cells[rowIndex, 41].Value = doc.DTIsGateWay;
1321
                            templateWorksheet.Cells[rowIndex, 42].Value = doc.DTIsImport;
1322
                            templateWorksheet.Cells[rowIndex, 43].Value = doc.DTIsRegSystem;
1323
                            templateWorksheet.Cells[rowIndex, 44].Value = doc.DTRemarks;
1324
                            rowIndex++;
1325
                        }
1326

    
1327
                        templateExcelFile.Save(sfd.FileName);
1328
                        RadMessageBox.Show("Exporting 'ID2 Document List' is complete", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info);
1329
                    }
1330
                }
1331
            }
1332
        }
1333
        #endregion
1334

    
1335
        #region Save event
1336

    
1337
        private void SetSaved()
1338
        {
1339
            if (RadMessageBox.Show("Do you want to Save?", Globals.Name, MessageBoxButtons.YesNo, RadMessageIcon.Question) == DialogResult.Yes)
1340
            {
1341
                List<Documents> setDocuments = new List<Documents>();
1342
                List<Documents> delDocuments = new List<Documents>();
1343

    
1344
                var worker = new SetDocumentsWorker(this.documents, this.orgDocuments, setDocuments, delDocuments, this.radGridViewDocuments);
1345
                worker.OnWorkCompletedHandler += () =>
1346
                {
1347
                    bool result = new DocumentController().SetDocumentData(setDocuments, delDocuments, informations.ActiveUser.ID);
1348

    
1349
                    bool markusResult = new MarkusInfoController().SetMarkusInfo(this.documents);
1350

    
1351
                    var users = new UserController().GetAllUserInfo();
1352

    
1353
                    bool markusMembersResult = new MarkusInfoController().SetMembers(users);
1354

    
1355
                    if (result && markusResult && markusMembersResult)
1356
                    {
1357
                        RadMessageBox.Show("Save is complete", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info);
1358

    
1359
                        this.GetDocList();
1360
                    }
1361
                    else if (!result)
1362
                    {
1363
                        RadMessageBox.Show("Save is not complete", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error);
1364
                    }
1365
                    else if (!markusResult)
1366
                    {
1367
                        RadMessageBox.Show("Markus Data Save is not complete", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error);
1368
                    }
1369
                    else if (!markusMembersResult)
1370
                    {
1371
                        RadMessageBox.Show("Markus Members Save is not complete", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error);
1372
                    }
1373
                };
1374
                worker.StartWork();
1375
            }
1376
        }
1377

    
1378
        private void RadButtonElementSaveCommand_Click(object sender, EventArgs e)
1379
        {
1380
            try
1381
            {
1382
                this.SetSaved();
1383
            }
1384
            catch (Exception ex)
1385
            {
1386
                Program.logger.Error(ex);
1387
            }
1388
        }
1389

    
1390
        private void RadButtonElementSave_Click(object sender, EventArgs e)
1391
        {
1392
            try
1393
            {
1394
                this.SetSaved();
1395
            }
1396
            catch (Exception ex)
1397
            {
1398
                Program.logger.Error(ex);
1399
            }
1400
        }
1401

    
1402
        private void RadButtonElementSync_Click(object sender, EventArgs e)
1403
        {
1404
            if (RadMessageBox.Show("Do you want to ID2 Sync?", Globals.Name, MessageBoxButtons.YesNo, RadMessageIcon.Question) == DialogResult.Yes)
1405
            {
1406
                var id2Prjs = informations.ProjectList.Where(x => x.GroupID.Equals(informations.ActiveProject.ProjectID)).Select(x => x.ID2Info).ToList();
1407

    
1408
                bool result = new DocumentController().SetID2Sync(id2Prjs, informations.ActiveUser.ID);
1409

    
1410
                if (result)
1411
                {
1412
                    this.GetDocListbyID2();
1413
                    this.DocumentListBinding();
1414
                }
1415
            }
1416
        }
1417

    
1418
        private void RadButtonElementNotice_Click(object sender, EventArgs e)
1419
        {
1420
            RadMessageBox.Show("공지사항 click!!", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info);
1421
        }
1422

    
1423
        private void RadButtonElementRefreshCommand_Click(object sender, EventArgs e)
1424
        {
1425
            bool isReload = false;
1426

    
1427
            try
1428
            {
1429
                if (RadMessageBox.Show($"Do you want to reload the project?", Globals.Name, MessageBoxButtons.YesNo, RadMessageIcon.Question) == DialogResult.Yes)
1430
                {
1431
                    if (informations.ActiveUser != null && !string.IsNullOrEmpty(informations.ActiveUser.RefProjectID))
1432
                    {
1433
                        informations.ActiveProject = new ProjectController().GetProjectInfo(informations.ActiveUser.RefProjectID);
1434
                        informations.ProjectList = new ProjectController().GetAllProjectList().ToList();
1435

    
1436
                        isReload = true;
1437
                    }
1438
                    else if (informations.ActiveProject != null)
1439
                    {
1440
                        informations.ProjectList = new ProjectController().GetAllProjectList().ToList();
1441

    
1442
                        isReload = true;
1443
                    }
1444
                    else
1445
                    {
1446
                        RadMessageBox.Show("Select a project.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info);
1447
                        this.radRibbonBarBackstageViewID2Manager.ShowPopup(this.GetBackstageLocation(), this.ID2ManagerRadRibbonBar.RibbonBarElement);
1448
                    }
1449
                }
1450

    
1451
                if (isReload)
1452
                {
1453
                    this.LoadProject();
1454
                }
1455
            }
1456
            catch (Exception ex)
1457
            {
1458
                Program.logger.Error($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex);
1459
                RadMessageBox.Show("Failed to reload the project.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error);
1460
            }
1461
        }
1462
        #endregion
1463

    
1464
        #region ColumnGroup
1465
        private void InitColumnGroupsViewDefinition(RadGridView gridView)
1466
        {
1467
            ColumnGroupsViewDefinition columnGroupsView = new ColumnGroupsViewDefinition();
1468

    
1469
            List<string> docLinkColNames = new List<string>() { "AutoCADLink", "PDFLink", "MarkupLink", "AVEVALink" };
1470
            List<string> docInfoColNames = new List<string>() { "RefProjectCode", "DocumentNo", "PersonInCharge", "Worker", "JobLevel", "IsTypical", "RevisonNo" };
1471
            List<string> rvToColNames = new List<string>() { "ToIsDiscussion", "ToRemarks", "ToCreator", "ToCapture", "ToIsMarkup" };
1472
            List<string> rvFrColNames = new List<string>() { "FrReviewStatus", "FrRemarks", "FrCreator", "FrCapture", "FrIsMarkup" };
1473
            List<string> rvEtcColNames = new List<string>() { "IsID2Work" };
1474
            List<string> wkID2ColNames = new List<string>() { "ID2Connection", "ID2StartDate", "ID2EndDate", "ID2JobTime", "ID2Status", "ID2Issues" };
1475
            List<string> wkAVEVAColNames = new List<string>() { "AVEVAConnection", "AVEVAConvertDate", "AVEVAReviewDate", "AVEVAStatus", "AVEVAIssues" };
1476
            List<string> valLinkColNames = new List<string>() { "ReviewFileName", "SystemLink" };
1477
            List<string> valProdColNames = new List<string>() { "ProdReviewer", "ProdIsResult", "ProdRemarks" };
1478
            List<string> valCntColNames = new List<string>() { "ClientReviewer", "ClientIsResult", "ClientRemarks" };
1479
            List<string> dtColNames = new List<string>() { "DTIsGateWay", "DTIsImport", "DTIsRegSystem", "DTRemarks" };
1480

    
1481
            //도면
1482
            GridViewColumnGroup docColGrp = new GridViewColumnGroup("도면 ");
1483
            GridViewColumnGroup docLinkColGrp = new GridViewColumnGroup("파일링크");
1484
            GridViewColumnGroup docInfoColGrp = new GridViewColumnGroup("도면정보");
1485

    
1486
            GridViewColumnGroupRow docLinkColGrpRow = new GridViewColumnGroupRow();
1487
            docLinkColGrpRow.ColumnNames.AddRange(docLinkColNames);
1488

    
1489
            GridViewColumnGroupRow docInfoColGrpRow = new GridViewColumnGroupRow();
1490
            docInfoColGrpRow.ColumnNames.AddRange(docInfoColNames);
1491

    
1492
            docLinkColGrp.Rows.Add(docLinkColGrpRow);
1493
            docColGrp.Groups.Add(docLinkColGrp);
1494
            docInfoColGrp.Rows.Add(docInfoColGrpRow);
1495
            docColGrp.Groups.Add(docInfoColGrp);
1496

    
1497
            //검토
1498
            GridViewColumnGroup rvColGrp = new GridViewColumnGroup("검토", "review");
1499
            GridViewColumnGroup rvToColGrp = new GridViewColumnGroup("도프텍");
1500
            GridViewColumnGroup rvFrColGrp = new GridViewColumnGroup("삼성");
1501
            GridViewColumnGroup rvEtcColGrp = new GridViewColumnGroup("기타");
1502

    
1503
            GridViewColumnGroupRow rvToColGrpRow = new GridViewColumnGroupRow();
1504
            rvToColGrpRow.ColumnNames.AddRange(rvToColNames);
1505

    
1506
            GridViewColumnGroupRow rvFrColGrpRow = new GridViewColumnGroupRow();
1507
            rvFrColGrpRow.ColumnNames.AddRange(rvFrColNames);
1508

    
1509
            GridViewColumnGroupRow rvEtcColGrpRow = new GridViewColumnGroupRow();
1510
            rvEtcColGrpRow.ColumnNames.AddRange(rvEtcColNames);
1511

    
1512
            rvToColGrp.Rows.Add(rvToColGrpRow);
1513
            rvFrColGrp.Rows.Add(rvFrColGrpRow);
1514
            rvEtcColGrp.Rows.Add(rvEtcColGrpRow);
1515

    
1516

    
1517
            rvColGrp.Groups.Add(rvToColGrp);
1518
            rvColGrp.Groups.Add(rvFrColGrp);
1519
            rvColGrp.Groups.Add(rvEtcColGrp);
1520

    
1521

    
1522
            //작업
1523
            GridViewColumnGroup wkColGrp = new GridViewColumnGroup("작업", "work");
1524
            GridViewColumnGroup wkID2ColGrp = new GridViewColumnGroup("ID2");
1525
            GridViewColumnGroup wkAVEVAColGrp = new GridViewColumnGroup("AVEVA");
1526

    
1527
            GridViewColumnGroupRow wkID2ColGrpRow = new GridViewColumnGroupRow();
1528
            wkID2ColGrpRow.ColumnNames.AddRange(wkID2ColNames);
1529

    
1530
            GridViewColumnGroupRow wkAVEVAColGrpRow = new GridViewColumnGroupRow();
1531
            wkAVEVAColGrpRow.ColumnNames.AddRange(wkAVEVAColNames);
1532

    
1533
            wkID2ColGrp.Rows.Add(wkID2ColGrpRow);
1534
            wkAVEVAColGrp.Rows.Add(wkAVEVAColGrpRow);
1535

    
1536
            wkColGrp.Groups.Add(wkID2ColGrp);
1537
            wkColGrp.Groups.Add(wkAVEVAColGrp);
1538

    
1539

    
1540
            //Validation
1541
            GridViewColumnGroup valColGrp = new GridViewColumnGroup("Validation", "validation");
1542
            GridViewColumnGroup valLinkColGrp = new GridViewColumnGroup("파일링크");
1543
            GridViewColumnGroup valProdColGrp = new GridViewColumnGroup("도프텍");
1544
            GridViewColumnGroup valCntColGrp = new GridViewColumnGroup("삼성전자");
1545

    
1546
            GridViewColumnGroupRow valLinkColGrpRow = new GridViewColumnGroupRow();
1547
            valLinkColGrpRow.ColumnNames.AddRange(valLinkColNames);
1548

    
1549
            GridViewColumnGroupRow valProdColGrpRow = new GridViewColumnGroupRow();
1550
            valProdColGrpRow.ColumnNames.AddRange(valProdColNames);
1551

    
1552
            GridViewColumnGroupRow valCntColGrpRow = new GridViewColumnGroupRow();
1553
            valCntColGrpRow.ColumnNames.AddRange(valCntColNames);
1554

    
1555
            valLinkColGrp.Rows.Add(valLinkColGrpRow);
1556
            valProdColGrp.Rows.Add(valProdColGrpRow);
1557
            valCntColGrp.Rows.Add(valCntColGrpRow);
1558

    
1559
            valColGrp.Groups.Add(valLinkColGrp);
1560
            valColGrp.Groups.Add(valProdColGrp);
1561
            valColGrp.Groups.Add(valCntColGrp);
1562

    
1563
            //AVEVA Net
1564
            GridViewColumnGroup dtColGrp = new GridViewColumnGroup("AVEVA Net\n(Digital Twin)", "avevanet");
1565

    
1566
            GridViewColumnGroupRow dtColGrpRow = new GridViewColumnGroupRow();
1567
            dtColGrpRow.ColumnNames.AddRange(dtColNames);
1568

    
1569
            dtColGrp.Rows.Add(dtColGrpRow);
1570

    
1571
            //Group 추가
1572
            columnGroupsView.ColumnGroups.Add(docColGrp);
1573
            columnGroupsView.ColumnGroups.Add(rvColGrp);
1574
            columnGroupsView.ColumnGroups.Add(wkColGrp);
1575
            columnGroupsView.ColumnGroups.Add(valColGrp);
1576
            columnGroupsView.ColumnGroups.Add(dtColGrp);
1577

    
1578
            gridView.MasterTemplate.ViewDefinition = columnGroupsView;
1579
        }
1580
        #endregion
1581

    
1582
        private void txtFullSearch_TextChanged(object sender, EventArgs e)
1583
        {
1584
            if(string.IsNullOrWhiteSpace(txtFullSearch.Text))
1585
                radGridViewDocuments.MasterTemplate.Refresh(null);
1586

    
1587
            txtFullSearch.TextBoxElement.ShowClearButton = !string.IsNullOrWhiteSpace(txtFullSearch.Text);
1588
            radGridViewDocuments.MasterView.TableSearchRow.Search(txtFullSearch.Text);
1589
        }
1590

    
1591
        private void btnSearchPrevious_Click(object sender, EventArgs e)
1592
        {
1593
            radGridViewDocuments.MasterView.TableSearchRow.SelectPreviousSearchResult();
1594
        }
1595

    
1596
        private void btnSearchNext_Click(object sender, EventArgs e)
1597
        {
1598
            radGridViewDocuments.MasterView.TableSearchRow.SelectNextSearchResult();
1599
        }
1600

    
1601
        private void txtFullSearch_KeyDown(object sender, KeyEventArgs e)
1602
        {
1603
            if(e.KeyCode == Keys.Enter)
1604
            {
1605
                radGridViewDocuments.MasterView.TableSearchRow.SelectNextSearchResult();
1606
            }
1607
        }
1608
    }
1609
}
1610

    
1611
public class FilterColumn
1612
{
1613
    public string Name { get; set; }
1614
    public string FieldName { get; set; }
1615
    public bool IsSelect { get; set; }
1616
}
클립보드 이미지 추가 (최대 크기: 500 MB)