프로젝트

일반

사용자정보

개정판 04703422

ID04703422fdf79515f9645e8d2645d6734f2d76a9
상위 904fbe46
하위 4df0b3f5

유성호이(가) 일년 이상 전에 추가함

issue #0000
id2 데이터 연계 조회 리스트 삭제
main exception 처리 (log 및 exception)

Change-Id: Ifd93c1d102430bce9731587805b3d35641e28b6a

차이점 보기:

ID2.Manager/ID2.Manager/Classes/DocumentsWorker.cs
18 18
        public delegate void OnWorkCompleted(RunWorkerCompletedEventArgs e);
19 19
        public OnWorkCompleted OnWorkCompletedHandler;
20 20

  
21
        List<ID2ProjectInfo> ID2Prjs { get; set; }
22 21
        string ProjectCode { get; set; }
23 22
        string PersonIncharge { get; set; }
24 23
        string JobLevel { get; set; } 
......
46 45
            this.ClientIsResult = clientIsResult;
47 46
        }
48 47

  
49
        public LoadDocumentsWorker(List<ID2ProjectInfo> id2Infos, string projectCode, string personIncharge, string jobLevel, string documentNo, string isToIsDiscussion, string isFrReviewStatus, string isID2Work, string id2Status, string avevaStatus, string prodIsResult, string clientIsResult, Control parent = null) : base(parent)
50
        {
51
            this.ID2Prjs = id2Infos;
52
            this.ProjectCode = projectCode;
53
            this.PersonIncharge = personIncharge;
54
            this.JobLevel = jobLevel;
55
            this.DocumentNo = documentNo;
56
            this.IsToIsDiscussion = isToIsDiscussion;
57
            this.IsFrReviewStatus = isFrReviewStatus;
58
            this.IsID2Work = isID2Work;
59
            this.Id2Status = id2Status;
60
            this.AvevaStatus = avevaStatus;
61
            this.ProdIsResult = prodIsResult;
62
            this.ClientIsResult = clientIsResult;
63
        }
64

  
65 48
        protected override void DoWork(BackgroundWorker worker, DoWorkEventArgs e)
66 49
        {
67
            if (this.ID2Prjs == null)
50
            try
68 51
            {
69 52
                var (dwgs, totalCnt) = new DocumentController().GetDocuments(this.ProjectCode, this.PersonIncharge, this.JobLevel, this.DocumentNo, this.IsToIsDiscussion, this.IsFrReviewStatus, this.IsID2Work, this.Id2Status, this.AvevaStatus, this.ProdIsResult, this.ClientIsResult);
70 53
                e.Result = new DocumentsResult() { Dwgs = dwgs.ToList(), TotalCount = totalCnt };
71 54
            }
72
            else
55
            catch (Exception ex)
73 56
            {
74
                var (dwgs, totalCnt) = new DocumentController().GetDocuments(this.ID2Prjs, this.ProjectCode, this.PersonIncharge, this.JobLevel, this.DocumentNo, this.IsToIsDiscussion, this.IsFrReviewStatus, this.IsID2Work, this.Id2Status, this.AvevaStatus, this.ProdIsResult, this.ClientIsResult);
75
                e.Result = new DocumentsResult() { Dwgs = dwgs.ToList(), TotalCount = totalCnt };
57
                throw ex;
76 58
            }
77 59
        }
78 60

  
ID2.Manager/ID2.Manager/Main.cs
240 240

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

  
248
                this.LoadProject();
250
                    this.LoadProject();
251
                }
252
                else
253
                {
254
                    this.radRibbonBarBackstageViewID2Manager.ShowPopup(this.GetBackstageLocation(), this.ID2ManagerRadRibbonBar.RibbonBarElement);
255
                }
249 256
            }
250
            else
257
            catch (Exception ex)
251 258
            {
252
                this.radRibbonBarBackstageViewID2Manager.ShowPopup(this.GetBackstageLocation(), this.ID2ManagerRadRibbonBar.RibbonBarElement);
259
                Program.logger.Error($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex);
260
                RadMessageBox.Show("Failed to load project.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error);
253 261
            }
254 262

  
255 263
            base.OnLoad(e);
......
270 278
            InitializeGridViewDetail();
271 279

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

  
274 281
        }
275 282

  
276 283
        private void InitializeSearch()
......
386 393

  
387 394
        private void RadRibbonBarBackstageViewID2Manager_BackstageViewClosed(object sender, EventArgs e)
388 395
        {
389
            if (this.radRibbonBarBackstageViewID2Manager.Tag is ProjectEventArgs)
396
            try
390 397
            {
391
                var prjArgs = this.radRibbonBarBackstageViewID2Manager.Tag as ProjectEventArgs;
398
                if (this.radRibbonBarBackstageViewID2Manager.Tag is ProjectEventArgs)
399
                {
400
                    var prjArgs = this.radRibbonBarBackstageViewID2Manager.Tag as ProjectEventArgs;
392 401

  
393
                informations.ActiveProject = prjArgs.ProjectInfo;
402
                    informations.ActiveProject = prjArgs.ProjectInfo;
394 403

  
395
                this.radRibbonBarBackstageViewID2Manager.Tag = null;
404
                    this.radRibbonBarBackstageViewID2Manager.Tag = null;
396 405

  
397
                this.LoadProject();
406
                    this.LoadProject();
407
                }
408
            }
409
            catch (Exception ex)
410
            {
411
                Program.logger.Error($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex);
412
                RadMessageBox.Show("Failed to load project.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error);
398 413
            }
399 414
        }
400 415

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

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

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

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

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

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

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

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

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

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

  
517
            //삼성 결과
518
            if (this.radDropDownListClientIsResult.Items.Count > 0)
519
                this.radDropDownListClientIsResult.Items.Clear();
520
            informations.ValidationResult.ForEach(x =>
420
                #region 도면
421
                //Project List
422
                if (this.radDropDownListProject.Items.Count > 0)
423
                    this.radDropDownListProject.Items.Clear();
424
                informations.ProjectList.Where(x => x.GroupID.Equals(informations.ActiveProject.ProjectID)).ToList()
425
                                        .ForEach(x =>
426
                                        {
427
                                            this.radDropDownListProject.Items.Add(new RadListDataItem(x.Name, x.Code));
428
                                        });
429
                var allProject = new RadListDataItem("== 전체 ==", string.Empty);
430
                this.radDropDownListProject.Items.Insert(0, allProject);
431
                allProject.Selected = true;
432

  
433
                //담당자 List
434
                if (this.radDropDownListPersonInCharge.Items.Count > 0)
435
                    this.radDropDownListPersonInCharge.Items.Clear();
436
                informations.UserList.ForEach(x =>
437
                {
438
                    if ((new string[] { "Manager", "User" }).Contains(x.Role) && string.IsNullOrEmpty(x.RefProjectID))
439
                        this.radDropDownListPersonInCharge.Items.Add(new RadListDataItem(x.Name, x.ID));
440
                });
441
                var allUser = new RadListDataItem("== 전체 ==", string.Empty);
442
                this.radDropDownListPersonInCharge.Items.Insert(0, allUser);
443
                allUser.Selected = true;
444

  
445
                //난이도
446
                if (this.radDropDownListJobLevel.Items.Count > 0)
447
                    this.radDropDownListJobLevel.Items.Clear();
448
                informations.JobLevel.ForEach(x =>
449
                {
450
                    this.radDropDownListJobLevel.Items.Add(new RadListDataItem(x, x));
451
                });
452
                var allJobLevel = new RadListDataItem("== 전체 ==", string.Empty);
453
                this.radDropDownListJobLevel.Items.Insert(0, allJobLevel);
454
                allJobLevel.Selected = true;
455

  
456
                //도면번호 조회조건
457
                this.radTextBoxDocumentNo.Text = string.Empty;
458
                #endregion
459

  
460
                #region 검토
461
                //문의(DOF)
462
                if (this.radDropDownListToIsDiscussion.Items.Count > 0)
463
                    this.radDropDownListToIsDiscussion.Items.Clear();
464
                informations.IsYesNo.ForEach(x =>
465
               {
466
                   this.radDropDownListToIsDiscussion.Items.Add(new RadListDataItem(x, x));
467
               });
468
                var allToIsDiscussion = new RadListDataItem("== 전체 ==", string.Empty);
469
                this.radDropDownListToIsDiscussion.Items.Insert(0, allToIsDiscussion);
470
                allToIsDiscussion.Selected = true;
471

  
472
                //회신(DS)
473
                if (this.radDropDownListFrReviewStatus.Items.Count > 0)
474
                    this.radDropDownListFrReviewStatus.Items.Clear();
475
                informations.ClientStatus.ForEach(x =>
476
                {
477
                    this.radDropDownListFrReviewStatus.Items.Add(new RadListDataItem(x, x));
478
                });
479
                var allFrReviewStatus = new RadListDataItem("== 전체 ==", string.Empty);
480
                this.radDropDownListFrReviewStatus.Items.Insert(0, allFrReviewStatus);
481
                allFrReviewStatus.Selected = true;
482

  
483
                //ID2 작업가능
484
                if (this.radDropDownListIsID2Work.Items.Count > 0)
485
                    this.radDropDownListIsID2Work.Items.Clear();
486
                informations.IsYesNo.ForEach(x =>
487
                {
488
                    var item = new RadListDataItem(x, x);
489
                    if (x.Equals("Yes"))
490
                        item.Selected = true;
491
                    this.radDropDownListIsID2Work.Items.Add(item);
492

  
493
                });
494
                var allIsID2Work = new RadListDataItem("== 전체 ==", string.Empty);
495
                this.radDropDownListIsID2Work.Items.Insert(0, allIsID2Work);
496
                #endregion
497

  
498
                #region 작업
499
                //ID2 Status
500
                if (this.radDropDownListID2Status.Items.Count > 0)
501
                    this.radDropDownListID2Status.Items.Clear();
502
                informations.JobStatus.ForEach(x =>
503
                {
504
                    this.radDropDownListID2Status.Items.Add(new RadListDataItem(x, x));
505
                });
506
                var allID2Status = new RadListDataItem("== 전체 ==", string.Empty);
507
                this.radDropDownListID2Status.Items.Insert(0, allID2Status);
508
                allID2Status.Selected = true;
509

  
510
                //AVEVA Status
511
                if (this.radDropDownListAVEVAStatus.Items.Count > 0)
512
                    this.radDropDownListAVEVAStatus.Items.Clear();
513
                informations.JobStatus.ForEach(x =>
514
                {
515
                    this.radDropDownListAVEVAStatus.Items.Add(new RadListDataItem(x, x));
516
                });
517
                var allAVEVAStatus = new RadListDataItem("== 전체 ==", string.Empty);
518
                this.radDropDownListAVEVAStatus.Items.Insert(0, allAVEVAStatus);
519
                allAVEVAStatus.Selected = true;
520
                #endregion
521

  
522
                #region 확인
523
                //도프텍 결과
524
                if (this.radDropDownListProdIsResult.Items.Count > 0)
525
                    this.radDropDownListProdIsResult.Items.Clear();
526
                informations.ValidationResult.ForEach(x =>
527
                {
528
                    this.radDropDownListProdIsResult.Items.Add(new RadListDataItem(x, x));
529
                });
530
                var allProdIsResult = new RadListDataItem("== 전체 ==", string.Empty);
531
                this.radDropDownListProdIsResult.Items.Insert(0, allProdIsResult);
532
                allProdIsResult.Selected = true;
533

  
534
                //삼성 결과
535
                if (this.radDropDownListClientIsResult.Items.Count > 0)
536
                    this.radDropDownListClientIsResult.Items.Clear();
537
                informations.ValidationResult.ForEach(x =>
538
                {
539
                    this.radDropDownListClientIsResult.Items.Add(new RadListDataItem(x, x));
540
                });
541
                var allClientIsResult = new RadListDataItem("== 전체 ==", string.Empty);
542
                this.radDropDownListClientIsResult.Items.Insert(0, allClientIsResult);
543
                allClientIsResult.Selected = true;
544
                #endregion
545

  
546
                this.GetDocList();
547
            }
548
            catch (Exception ex)
521 549
            {
522
                this.radDropDownListClientIsResult.Items.Add(new RadListDataItem(x, x));
523
            });
524
            var allClientIsResult = new RadListDataItem("== 전체 ==", string.Empty);
525
            this.radDropDownListClientIsResult.Items.Insert(0, allClientIsResult);
526
            allClientIsResult.Selected = true;
527
            #endregion
528

  
529
            this.GetDocList();
550
                throw ex;
551
            }
530 552
        }
531 553

  
532 554
        #region Document List 조회
533 555
        public void GetDocList()
534 556
        {
535
            if (this.radDropDownListProject.SelectedValue != null)
557
            try
536 558
            {
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();
559
                if (this.radDropDownListProject.SelectedValue != null)
560
                {
561
                    string projectCode = this.radDropDownListProject.SelectedValue.ToString();
562
                    string personIncharge = this.radDropDownListPersonInCharge.SelectedValue.ToString();
563
                    string jobLevel = this.radDropDownListJobLevel.SelectedValue.ToString();
564
                    string documentNo = this.radTextBoxDocumentNo.Text.Trim();
541 565

  
542
                string isToIsDiscussion = this.radDropDownListToIsDiscussion.SelectedValue.ToString();
543
                string isFrReviewStatus = this.radDropDownListFrReviewStatus.SelectedValue.ToString();
544
                string isID2Work = this.radDropDownListIsID2Work.SelectedValue.ToString();
566
                    string isToIsDiscussion = this.radDropDownListToIsDiscussion.SelectedValue.ToString();
567
                    string isFrReviewStatus = this.radDropDownListFrReviewStatus.SelectedValue.ToString();
568
                    string isID2Work = this.radDropDownListIsID2Work.SelectedValue.ToString();
545 569

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

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

  
552
                var worker = new LoadDocumentsWorker(projectCode, personIncharge, jobLevel, documentNo, isToIsDiscussion, isFrReviewStatus, isID2Work, id2Status, avevaStatus, prodIsResult, clientIsResult, this.radGridViewDocuments);
553
                worker.OnWorkCompletedHandler += (e) =>
554
                {
555
                    var docData = e.Result as DocumentsResult;
576
                    var worker = new LoadDocumentsWorker(projectCode, personIncharge, jobLevel, documentNo, isToIsDiscussion, isFrReviewStatus, isID2Work, id2Status, avevaStatus, prodIsResult, clientIsResult, this.radGridViewDocuments);
577
                    worker.OnWorkCompletedHandler += (e) =>
578
                    {
579
                        var docData = e.Result as DocumentsResult;
556 580

  
557
                    this.documents = docData.Dwgs;
558
                    this.orgDocuments = JsonConvert.DeserializeObject<List<Documents>>(JsonConvert.SerializeObject(docData.Dwgs));
559
                    this.TotalCount = docData.TotalCount;
581
                        this.documents = docData.Dwgs;
582
                        this.orgDocuments = JsonConvert.DeserializeObject<List<Documents>>(JsonConvert.SerializeObject(docData.Dwgs));
583
                        this.TotalCount = docData.TotalCount;
560 584

  
561
                    List<string> projectCodes = new List<string>();
585
                        List<string> projectCodes = new List<string>();
562 586

  
563
                    if (!string.IsNullOrWhiteSpace(projectCode))
564
                    {
565
                        projectCodes.Add(projectCode);
566
                    }
567
                    else
568
                    {
569
                        projectCodes = informations.ProjectList.Select(x => x.Code).ToList();
570
                    }
587
                        if (!string.IsNullOrWhiteSpace(projectCode))
588
                        {
589
                            projectCodes.Add(projectCode);
590
                        }
591
                        else
592
                        {
593
                            projectCodes = informations.ProjectList.Select(x => x.Code).ToList();
594
                        }
571 595

  
572
                    this.Markups = new List<MarkupText>(new MarkusInfoController().GetMarkupData(projectCodes, this.documents.Select(x => x.DocumentNo)));
596
                        this.Markups = new List<MarkupText>(new MarkusInfoController().GetMarkupData(projectCodes, this.documents.Select(x => x.DocumentNo)));
573 597

  
574
                    this.DocumentListBinding();
575
                };
576
                worker.StartWork();
598
                        this.DocumentListBinding();
599
                    };
600
                    worker.StartWork();
601
                }
577 602
            }
578
        }
579

  
580
        public void GetDocListbyID2()
581
        {
582
            if (this.radDropDownListProject.SelectedValue != null)
603
            catch (Exception ex)
583 604
            {
584
                string projectCode = this.radDropDownListProject.SelectedValue.ToString();
585
                string personIncharge = this.radDropDownListPersonInCharge.SelectedValue.ToString();
586
                string jobLevel = this.radDropDownListJobLevel.SelectedValue.ToString();
587
                string documentNo = this.radTextBoxDocumentNo.Text.Trim();
588

  
589
                string isToIsDiscussion = this.radDropDownListToIsDiscussion.SelectedValue.ToString();
590
                string isFrReviewStatus = this.radDropDownListFrReviewStatus.SelectedValue.ToString();
591
                string isID2Work = this.radDropDownListIsID2Work.SelectedValue.ToString();
592

  
593
                string id2Status = this.radDropDownListID2Status.SelectedValue.ToString();
594
                string avevaStatus = this.radDropDownListAVEVAStatus.SelectedValue.ToString();
595

  
596
                string prodIsResult = this.radDropDownListProdIsResult.SelectedValue.ToString();
597
                string clientIsResult = this.radDropDownListClientIsResult.SelectedValue.ToString();
598

  
599
                var id2Prjs = informations.ProjectList.Where(x => x.GroupID.Equals(informations.ActiveProject.ProjectID)).Select(x => x.ID2Info).ToList();
600

  
601
                var worker = new LoadDocumentsWorker(id2Prjs, projectCode, personIncharge, jobLevel, documentNo, isToIsDiscussion, isFrReviewStatus, isID2Work, id2Status, avevaStatus, prodIsResult, clientIsResult, this.radGridViewDocuments);
602
                worker.OnWorkCompletedHandler += (e) =>
603
                {
604
                    var docData = e.Result as DocumentsResult;
605

  
606
                    this.documents = docData.Dwgs;
607
                    this.orgDocuments = JsonConvert.DeserializeObject<List<Documents>>(JsonConvert.SerializeObject(docData.Dwgs));
608
                    this.TotalCount = docData.TotalCount;
609

  
610
                    List<string> projectCodes = new List<string>();
611

  
612
                    if (!string.IsNullOrWhiteSpace(projectCode))
613
                    {
614
                        projectCodes.Add(projectCode);
615
                    }
616
                    else
617
                    {
618
                        projectCodes = informations.ProjectList.Select(x => x.Code).ToList();
619
                    }
620

  
621
                    this.Markups = new List<MarkupText>(new MarkusInfoController().GetMarkupData(projectCodes, this.documents.Select(x => x.DocumentNo)));
622

  
623
                    this.DocumentListBinding();
624
                };
625
                worker.StartWork();
626

  
627
                
628
                //var(dwgs, totalCnt) = new DocumentController().GetDocuments(id2Prjs, projectCode, personIncharge, jobLevel, documentNo, isToIsDiscussion, isFrReviewStatus, isID2Work, id2Status, avevaStatus, prodIsResult, clientIsResult);
629
                //this.documents = dwgs.ToList();
630
                //this.orgDocuments = JsonConvert.DeserializeObject<List<Documents>>(JsonConvert.SerializeObject(this.documents));
631
                //this.lbSelectAndTotal.Text = totalCnt.ToString();
605
                throw ex;
632 606
            }
633 607
        }
634 608

  
635 609
        public void DocumentListBinding()
636 610
        {
637
            GridViewComboBoxColumn ColProjects = this.radGridViewDocuments.Columns["RefProjectCode"] as GridViewComboBoxColumn;
638
            ColProjects.DataSource = informations.ProjectList.Where(x => x.GroupID.Equals(informations.ActiveProject.ProjectID)).ToList();
639
            ColProjects.DisplayMember = "Name";
640
            ColProjects.ValueMember = "Code";
641

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

  
645
            GridViewComboBoxColumn ColPersonInCharge = this.radGridViewDocuments.Columns["PersonInCharge"] as GridViewComboBoxColumn;
646
            ColPersonInCharge.DataSource = workUsers;
647
            ColPersonInCharge.DisplayMember = "Name";
648
            ColPersonInCharge.ValueMember = "ID";
649

  
650
            GridViewComboBoxColumn ColWorker = this.radGridViewDocuments.Columns["Worker"] as GridViewComboBoxColumn;
651
            ColWorker.DataSource = workUsers;
652
            ColWorker.DisplayMember = "Name";
653
            ColWorker.ValueMember = "ID";
654

  
655
            GridViewComboBoxColumn ColToCreator = this.radGridViewDocuments.Columns["ToCreator"] as GridViewComboBoxColumn;
656
            ColToCreator.DataSource = workUsers;
657
            ColToCreator.DisplayMember = "Name";
658
            ColToCreator.ValueMember = "ID";
659

  
660
            GridViewComboBoxColumn ColFrCreator = this.radGridViewDocuments.Columns["FrCreator"] as GridViewComboBoxColumn;
661
            ColFrCreator.DataSource = clientUsers;
662
            ColFrCreator.DisplayMember = "Name";
663
            ColFrCreator.ValueMember = "ID";
664

  
665
            GridViewComboBoxColumn ColProdReviewer = this.radGridViewDocuments.Columns["ProdReviewer"] as GridViewComboBoxColumn;
666
            ColProdReviewer.DataSource = workUsers;
667
            ColProdReviewer.DisplayMember = "Name";
668
            ColProdReviewer.ValueMember = "ID";
669

  
670
            GridViewComboBoxColumn ColClientReviewer = this.radGridViewDocuments.Columns["ClientReviewer"] as GridViewComboBoxColumn;
671
            ColClientReviewer.DataSource = clientUsers;
672
            ColClientReviewer.DisplayMember = "Name";
673
            ColClientReviewer.ValueMember = "ID";
674

  
675
            //Data
676
            if (this.radGridViewDocuments.DataSource != null)
677
                this.radGridViewDocuments.DataSource = null;
678

  
679
            /*
680
            var info = informations.ProjectList.Where(x => x.Name.Equals("APAO")).FirstOrDefault().ID2Info;
681
            var id2Datas = new DocumentController(info).GetID2DrawingsByProject(info);
682
            var test = from doc in this.documents
683
                       join id2 in id2Datas on doc.DocumentNo equals id2.DOCNAME into gj
684
                       from docs in gj.DefaultIfEmpty()
685
                       select new Documents()
686
                       {
687
                           DocumentNo = doc.DocumentNo,
688
                           ID2EndDate = docs?.DATETIME == null ? (DateTime?)null : Convert.ToDateTime(docs?.DATETIME)
689
                           //ProdRemarks = docs.DATETIME ?? null
690
                       };
691
            */
692

  
693
            this.radGridViewDocuments.FilterDescriptors.Clear();
694
            this.radGridViewDocuments.DataSource = new BindingList<Documents>(this.documents);
695
            this.lbSelectAndTotal.Text = $"{this.documents.Count} / {this.TotalCount} (Selected / Total)";
611
            try
612
            {
613
                GridViewComboBoxColumn ColProjects = this.radGridViewDocuments.Columns["RefProjectCode"] as GridViewComboBoxColumn;
614
                ColProjects.DataSource = informations.ProjectList.Where(x => x.GroupID.Equals(informations.ActiveProject.ProjectID)).ToList();
615
                ColProjects.DisplayMember = "Name";
616
                ColProjects.ValueMember = "Code";
617

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

  
621
                GridViewComboBoxColumn ColPersonInCharge = this.radGridViewDocuments.Columns["PersonInCharge"] as GridViewComboBoxColumn;
622
                ColPersonInCharge.DataSource = workUsers;
623
                ColPersonInCharge.DisplayMember = "Name";
624
                ColPersonInCharge.ValueMember = "ID";
625

  
626
                GridViewComboBoxColumn ColWorker = this.radGridViewDocuments.Columns["Worker"] as GridViewComboBoxColumn;
627
                ColWorker.DataSource = workUsers;
628
                ColWorker.DisplayMember = "Name";
629
                ColWorker.ValueMember = "ID";
630

  
631
                GridViewComboBoxColumn ColToCreator = this.radGridViewDocuments.Columns["ToCreator"] as GridViewComboBoxColumn;
632
                ColToCreator.DataSource = workUsers;
633
                ColToCreator.DisplayMember = "Name";
634
                ColToCreator.ValueMember = "ID";
635

  
636
                GridViewComboBoxColumn ColFrCreator = this.radGridViewDocuments.Columns["FrCreator"] as GridViewComboBoxColumn;
637
                ColFrCreator.DataSource = clientUsers;
638
                ColFrCreator.DisplayMember = "Name";
639
                ColFrCreator.ValueMember = "ID";
640

  
641
                GridViewComboBoxColumn ColProdReviewer = this.radGridViewDocuments.Columns["ProdReviewer"] as GridViewComboBoxColumn;
642
                ColProdReviewer.DataSource = workUsers;
643
                ColProdReviewer.DisplayMember = "Name";
644
                ColProdReviewer.ValueMember = "ID";
645

  
646
                GridViewComboBoxColumn ColClientReviewer = this.radGridViewDocuments.Columns["ClientReviewer"] as GridViewComboBoxColumn;
647
                ColClientReviewer.DataSource = clientUsers;
648
                ColClientReviewer.DisplayMember = "Name";
649
                ColClientReviewer.ValueMember = "ID";
650

  
651
                //Data
652
                if (this.radGridViewDocuments.DataSource != null)
653
                    this.radGridViewDocuments.DataSource = null;
654

  
655
                /*
656
                var info = informations.ProjectList.Where(x => x.Name.Equals("APAO")).FirstOrDefault().ID2Info;
657
                var id2Datas = new DocumentController(info).GetID2DrawingsByProject(info);
658
                var test = from doc in this.documents
659
                           join id2 in id2Datas on doc.DocumentNo equals id2.DOCNAME into gj
660
                           from docs in gj.DefaultIfEmpty()
661
                           select new Documents()
662
                           {
663
                               DocumentNo = doc.DocumentNo,
664
                               ID2EndDate = docs?.DATETIME == null ? (DateTime?)null : Convert.ToDateTime(docs?.DATETIME)
665
                               //ProdRemarks = docs.DATETIME ?? null
666
                           };
667
                */
668

  
669
                this.radGridViewDocuments.FilterDescriptors.Clear();
670
                this.radGridViewDocuments.DataSource = new BindingList<Documents>(this.documents);
671
                this.lbSelectAndTotal.Text = $"{this.documents.Count} / {this.TotalCount} (Selected / Total)";
672
            }
673
            catch (Exception ex)
674
            {
675
                throw ex;
676
            }
696 677
        }
697 678
        #endregion
698 679

  
......
726 707

  
727 708
        private void RadButtonSearch_Click(object sender, EventArgs e)
728 709
        {
729
            this.GetDocList();
710
            try
711
            {
712
                this.GetDocList();
713
            }
714
            catch (Exception ex)
715
            {
716
                Program.logger.Error($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex);
717
                RadMessageBox.Show("DWG search failed.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error);
718
            }
730 719
        }
731 720

  
732 721
        private void BackstageButtonItemUserRegistration_Click(object sender, EventArgs e)
......
1363 1352

  
1364 1353
        private void SetSaved()
1365 1354
        {
1366
            if (RadMessageBox.Show("Do you want to Save?", Globals.Name, MessageBoxButtons.YesNo, RadMessageIcon.Question) == DialogResult.Yes)
1355
            try
1367 1356
            {
1368
                List<Documents> setDocuments = new List<Documents>();
1369
                List<Documents> delDocuments = new List<Documents>();
1370

  
1371
                var worker = new SetDocumentsWorker(this.documents, this.orgDocuments, setDocuments, delDocuments, this.radGridViewDocuments);
1372
                worker.OnWorkCompletedHandler += (e) =>
1357
                if (RadMessageBox.Show("Do you want to Save?", Globals.Name, MessageBoxButtons.YesNo, RadMessageIcon.Question) == DialogResult.Yes)
1373 1358
                {
1374
                    bool result = new DocumentController().SetDocumentData(setDocuments, delDocuments, informations.ActiveUser.ID);
1359
                    List<Documents> setDocuments = new List<Documents>();
1360
                    List<Documents> delDocuments = new List<Documents>();
1375 1361

  
1376
                    bool markusResult = new MarkusInfoController().SetMarkusInfo(this.documents);
1362
                    var worker = new SetDocumentsWorker(this.documents, this.orgDocuments, setDocuments, delDocuments, this.radGridViewDocuments);
1363
                    worker.OnWorkCompletedHandler += (e) =>
1364
                    {
1365
                        bool result = new DocumentController().SetDocumentData(setDocuments, delDocuments, informations.ActiveUser.ID);
1377 1366

  
1378
                    bool markusMembersResult = new MarkusInfoController().SetMembers(informations.UserList);
1367
                        bool markusResult = new MarkusInfoController().SetMarkusInfo(this.documents);
1379 1368

  
1380
                    if (result && markusResult && markusMembersResult)
1381
                    {
1382
                        RadMessageBox.Show("Save is complete", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info);
1369
                        bool markusMembersResult = new MarkusInfoController().SetMembers(informations.UserList);
1383 1370

  
1384
                        this.GetDocList();
1385
                    }
1386
                    else if (!result)
1387
                    {
1388
                        RadMessageBox.Show("Save is not complete", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error);
1389
                    }
1390
                    else if (!markusResult)
1391
                    {
1392
                        RadMessageBox.Show("Markus Data Save is not complete", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error);
1393
                    }
1394
                    else if (!markusMembersResult)
1395
                    {
1396
                        RadMessageBox.Show("Markus Members Save is not complete", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error);
1397
                    }
1398
                };
1399
                worker.StartWork();
1371
                        if (result && markusResult && markusMembersResult)
1372
                        {
1373
                            RadMessageBox.Show("Save is complete", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info);
1374

  
1375
                            this.GetDocList();
1376
                        }
1377
                        else if (!result)
1378
                        {
1379
                            RadMessageBox.Show("Save is not complete", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error);
1380
                        }
1381
                        else if (!markusResult)
1382
                        {
1383
                            RadMessageBox.Show("Markus Data Save is not complete", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error);
1384
                        }
1385
                        else if (!markusMembersResult)
1386
                        {
1387
                            RadMessageBox.Show("Markus Members Save is not complete", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error);
1388
                        }
1389
                    };
1390
                    worker.StartWork();
1391
                }
1392
            }
1393
            catch (Exception ex)
1394
            {
1395
                throw ex;
1400 1396
            }
1401 1397
        }
1402 1398

  
......
1408 1404
            }
1409 1405
            catch (Exception ex)
1410 1406
            {
1411
                Program.logger.Error(ex);
1407
                Program.logger.Error($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex);
1408
                RadMessageBox.Show("DWG save failed.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error);
1412 1409
            }
1413 1410
        }
1414 1411

  
......
1420 1417
            }
1421 1418
            catch (Exception ex)
1422 1419
            {
1423
                Program.logger.Error(ex);
1420
                Program.logger.Error($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex);
1421
                RadMessageBox.Show("DWG save failed.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error);
1424 1422
            }
1425 1423
        }
1426 1424

  
1427 1425
        private void RadButtonElementSync_Click(object sender, EventArgs e)
1428 1426
        {
1429
            if (RadMessageBox.Show("Do you want to ID2 Sync?", Globals.Name, MessageBoxButtons.YesNo, RadMessageIcon.Question) == DialogResult.Yes)
1427
            try
1430 1428
            {
1431
                var id2Prjs = informations.ProjectList.Where(x => x.GroupID.Equals(informations.ActiveProject.ProjectID)).Select(x => x.ID2Info).ToList();
1429
                if (RadMessageBox.Show("Do you want to ID2 Sync?", Globals.Name, MessageBoxButtons.YesNo, RadMessageIcon.Question) == DialogResult.Yes)
1430
                {
1431
                    var id2Prjs = informations.ProjectList.Where(x => x.GroupID.Equals(informations.ActiveProject.ProjectID)).Select(x => x.ID2Info).ToList();
1432 1432

  
1433
                bool result = new DocumentController().SetID2Sync(id2Prjs, informations.ActiveUser.ID);
1433
                    bool result = new DocumentController().SetID2Sync(id2Prjs, informations.ActiveUser.ID);
1434 1434

  
1435
                if (result)
1436
                {
1437
                    this.GetDocListbyID2();
1435
                    if (result)
1436
                    {
1437
                        this.GetDocList();
1438
                    }
1438 1439
                }
1439 1440
            }
1441
            catch (Exception ex)
1442
            {
1443
                Program.logger.Error($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex);
1444
                RadMessageBox.Show("Failed to sync with id2.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error);
1445
            }
1440 1446
        }
1441 1447

  
1442 1448
        private void RadButtonElementNotice_Click(object sender, EventArgs e)

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)