프로젝트

일반

사용자정보

개정판 f074a104

IDf074a104b9acf2af5c39f50243581b31acce7c39
상위 63af7f3c
하위 e9700266

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

issue #0000
Main Grid
- 이미지 삭제 시 이미지 count 업데이트 되도록 수정
- 이미지 추가 시 이미지 count 업데이트 되도록 수정
- checkbox 클릭 후 combo 데이터 변경 시 해당 checkbox에 해당하는 값이 변경되면 체크박스 전체 데이터 변경 되도록 수정
Excel Import
- Excel Import 시 기존에 바인딩 되어있는 Team, Document No 가 존재하면 해당 데이터 업데이트
- Excel Import 시 기존에 바인딩 되어있는 Team, Document No 가 존재하지 않으면 append 되도록 수정
Save
- Save 로직 수정
Documents Model
- 불필요한 컬럼 삭제
- Team, Document No 비교 class 추가
- Document 값을 복사 및 파일 append를 위한 함수추가

Change-Id: Iedc21f63e38e0140e3ccfec0c12fc492544ee342

차이점 보기:

ID2.Manager/ID2.Manager.Controller/Controllers/DocumentController.cs
76 76
                                     DocumentNo = doc.DocumentNo,
77 77
                                     RevisonNo = doc.RevisonNo,
78 78
                                     RefProjectCode = doc.RefProjectCode,
79
                                     IsLatest = doc.IsLatest,
80 79
                                     JobLevel = doc.JobLevel,
81 80
                                     PersonInCharge = doc.PersonInCharge,
82
                                     IsDeleted = doc.IsDeleted,
83
                                     RegisteredDate = doc.RegisteredDate,
84
                                     ModifiedDate = doc.ModifiedDate,
85
                                     DeletedDate = doc.DeletedDate,
86 81
                                     ToIsDiscussion = doc.ToIsDiscussion,
87 82
                                     ToRemarks = doc.ToRemarks,
88 83
                                     ToCreator = doc.ToCreator,
......
142 137
            }
143 138
        }
144 139

  
145
        public bool SetDocumentData(string projectGroupID, List<Documents> docList, List<Documents> delDocList, string userId)
140
        public bool SetDocumentData(string projectGroupID, List<Documents> docList, List<string> delDocList, string userId)
146 141
        {
147 142
            try
148 143
            {
ID2.Manager/ID2.Manager.Dapper/Repository/DocumentRepository.cs
334 334
            return existCount;
335 335
        }
336 336

  
337
        public bool SetDocumentData(string projectGroupID, List<Documents> docList, List<Documents> delDocList, string userId)
337
        public bool SetDocumentData(string projectGroupID, List<Documents> docList, List<string> delDocList, string userId)
338 338
        {
339 339
            bool isSuccess = false;
340 340

  
341 341
            try
342 342
            {
343

  
344
                #region merge 주석처리
345
                /*
346
                {
347
                    docList.ForEach(x =>
348
                    {
349
                        x.RegisteredUser = userId;
350
                        x.ModifiedUser = userId;
351
                    });
352
                    string query = $@"
353
merge into dbo.Documents as tg 
354
using
355
(
356
values
357
(
358
    @DocumentNo
359
   ,@RevisonNo
360
   ,@System
361
   ,@SubSystemCode
362
   ,@RefProjectCode
363
   ,@JobLevel
364
   ,@PersonInCharge
365
   ,@RegisteredUser
366
   ,@ModifiedUser
367
   ,@ToIsDiscussion
368
   ,@ToRemarks
369
   ,@ToCreator
370
   ,@FrReviewStatus
371
   ,@FrRemarks
372
   ,@FrCreator
373
   ,@ID2StartDate
374
   ,@ID2EndDate
375
   ,@ID2Status
376
   ,@ID2Issues
377
   ,@ReplyModifications
378
   ,@ReplyRequester
379
   ,@IsConvert
380
   ,@AVEVAPersonInCharge
381
   ,@AVEVAWorker
382
   ,@AVEVAConvertDate
383
   ,@AVEVAReviewDate
384
   ,@AVEVAWorkDate
385
   ,@AVEVAStatus
386
   ,@AVEVAIssues
387
   ,@ProdReviewer
388
   ,@ProdIsResult
389
   ,@ProdRemarks
390
   ,@ClientReviewer
391
   ,@ClientIsResult
392
   ,@ClientRemarks
393
   ,@DTIsGateWay
394
   ,@DTIsImport
395
   ,@DTIsRegSystem
396
   ,@DTRemarks
397
)
398
) as sc
399
(
400
    DocumentNo
401
   ,RevisonNo
402
   ,[System]
403
   ,SubSystemCode
404
   ,RefProjectCode
405
   ,JobLevel
406
   ,PersonInCharge
407
   ,RegisteredUser
408
   ,ModifiedUser
409
   ,ToIsDiscussion
410
   ,ToRemarks
411
   ,ToCreator
412
   ,FrReviewStatus
413
   ,FrRemarks
414
   ,FrCreator
415
   ,ID2StartDate
416
   ,ID2EndDate
417
   ,ID2Status
418
   ,ID2Issues
419
   ,ReplyModifications
420
   ,ReplyRequester
421
   ,IsConvert
422
   ,AVEVAPersonInCharge
423
   ,AVEVAWorker
424
   ,AVEVAConvertDate
425
   ,AVEVAReviewDate
426
   ,AVEVAWorkDate
427
   ,AVEVAStatus
428
   ,AVEVAIssues
429
   ,ProdReviewer
430
   ,ProdIsResult
431
   ,ProdRemarks
432
   ,ClientReviewer
433
   ,ClientIsResult
434
   ,ClientRemarks
435
   ,DTIsGateWay
436
   ,DTIsImport
437
   ,DTIsRegSystem
438
   ,DTRemarks
439
)
440
ON sc.DocumentNo=tg.DocumentNo 
441
when matched and tg.IsDeleted=0 then
442

  
443
update 
444
set    tg.DocumentNo=sc.DocumentNo
445
      ,tg.RevisonNo=sc.RevisonNo
446
      ,tg.[System]=sc.[System]
447
      ,tg.SubSystemCode=sc.SubSystemCode
448
      ,tg.RefProjectCode=sc.RefProjectCode
449
      ,tg.JobLevel=sc.JobLevel
450
      ,tg.PersonInCharge=sc.PersonInCharge
451
      ,tg.ModifiedDate=getdate()
452
      ,tg.ModifiedUser=sc.ModifiedUser
453
      ,tg.ToIsDiscussion=sc.ToIsDiscussion
454
      ,tg.ToRemarks=sc.ToRemarks
455
      ,tg.ToCreator=sc.ToCreator
456
      ,tg.FrReviewStatus=sc.FrReviewStatus
457
      ,tg.FrRemarks=sc.FrRemarks
458
      ,tg.FrCreator=sc.FrCreator
459
      ,tg.ID2StartDate=sc.ID2StartDate
460
      ,tg.ID2EndDate=sc.ID2EndDate
461
      ,tg.ID2Status=sc.ID2Status
462
      ,tg.ID2Issues=sc.ID2Issues
463
      ,tg.ReplyModifications=sc.ReplyModifications
464
      ,tg.ReplyRequester=sc.ReplyRequester
465
      ,tg.IsConvert=sc.IsConvert
466
      ,tg.AVEVAPersonInCharge=sc.AVEVAPersonInCharge
467
      ,tg.AVEVAWorker=sc.AVEVAWorker
468
      ,tg.AVEVAConvertDate=sc.AVEVAConvertDate
469
      ,tg.AVEVAReviewDate=sc.AVEVAReviewDate
470
      ,tg.AVEVAWorkDate=sc.AVEVAWorkDate
471
      ,tg.AVEVAStatus=sc.AVEVAStatus
472
      ,tg.AVEVAIssues=sc.AVEVAIssues
473
      ,tg.ProdReviewer=sc.ProdReviewer
474
      ,tg.ProdIsResult=sc.ProdIsResult
475
      ,tg.ProdRemarks=sc.ProdRemarks
476
      ,tg.ClientReviewer=sc.ClientReviewer
477
      ,tg.ClientIsResult=sc.ClientIsResult
478
      ,tg.ClientRemarks=sc.ClientRemarks
479
      ,tg.DTIsGateWay=sc.DTIsGateWay
480
      ,tg.DTIsImport=sc.DTIsImport
481
      ,tg.DTIsRegSystem=sc.DTIsRegSystem
482
      ,tg.DTRemarks=sc.DTRemarks
483
when not matched then
484

  
485

  
486
insert
487
(
488
 DocID
489
,DocumentNo
490
,RevisonNo
491
,[System]
492
,SubSystemCode
493
,RefProjectCode
494
,JobLevel
495
,PersonInCharge
496
,RegisteredDate
497
,RegisteredUser
498
,ToIsDiscussion
499
,ToRemarks
500
,ToCreator
501
,FrReviewStatus
502
,FrRemarks
503
,FrCreator
504
,ID2StartDate
505
,ID2EndDate
506
,ID2Status
507
,ID2Issues
508
,ReplyModifications
509
,ReplyRequester
510
,IsConvert
511
,AVEVAPersonInCharge
512
,AVEVAWorker
513
,AVEVAConvertDate
514
,AVEVAReviewDate
515
,AVEVAWorkDate
516
,AVEVAStatus
517
,AVEVAIssues
518
,ProdReviewer
519
,ProdIsResult
520
,ProdRemarks
521
,ClientReviewer
522
,ClientIsResult
523
,ClientRemarks
524
,DTIsGateWay
525
,DTIsImport
526
,DTIsRegSystem
527
,DTRemarks
528
)
529
values 
530
(
531
 lower(newid())
532
,sc.DocumentNo
533
,case when isnull(sc.RevisonNo,'')='' then '0' else sc.RevisonNo end
534
,sc.System
535
,sc.SubSystemCode
536
,sc.RefProjectCode
537
,sc.JobLevel
538
,sc.PersonInCharge
539
,getdate()
540
,sc.RegisteredUser
541
,sc.ToIsDiscussion
542
,sc.ToRemarks
543
,sc.ToCreator
544
,sc.FrReviewStatus
545
,sc.FrRemarks
546
,sc.FrCreator
547
,sc.ID2StartDate
548
,sc.ID2EndDate
549
,sc.ID2Status
550
,sc.ID2Issues
551
,sc.ReplyModifications
552
,sc.ReplyRequester
553
,sc.IsConvert
554
,sc.AVEVAPersonInCharge
555
,sc.AVEVAWorker
556
,sc.AVEVAConvertDate
557
,sc.AVEVAReviewDate
558
,sc.AVEVAWorkDate
559
,sc.AVEVAStatus
560
,sc.AVEVAIssues
561
,sc.ProdReviewer
562
,sc.ProdIsResult
563
,sc.ProdRemarks
564
,sc.ClientReviewer
565
,sc.ClientIsResult
566
,sc.ClientRemarks
567
,sc.DTIsGateWay
568
,sc.DTIsImport
569
,sc.DTIsRegSystem
570
,sc.DTRemarks
571
)
572
output $action;";
573
                    //base.Query QueryFirstOrDefault<string>(query, docList, transaction);
574
                    //var test = base.Query<string>(query, docList);
575
                    var test = base.QueryFirstOrDefault<string>(query, docList);
576
                }
577
                */
578
                #endregion
579

  
580 343
                using (var transaction = base.BeginTransaction())
581 344
                {
582 345
                    string query = string.Empty;
......
594 357

  
595 358
                            parameters.Add("DeletedUser", userId);
596 359

  
597
                            var limitDwgNos = delDocList.Skip(paramMaxCount * i).Take(paramMaxCount).Select(x => x.DocID).ToList();
360
                            var limitDwgNos = delDocList.Skip(paramMaxCount * i).Take(paramMaxCount).ToList();
598 361
                            sbWhere.Append($@" and DocID in @limitDwgNos ");
599 362
                            parameters.Add("limitDwgNos", limitDwgNos);
600 363

  
......
774 537
        select ''
775 538
    end
776 539
end";
777
                            #region 기존 입력 쿼리 주석
778
                            /*
779
                            query = $@"
780
declare @tbdoc table(docid varchar(36))
781
insert into dbo.Documents
782
(
783
     DocID
784
    ,DocumentNo
785
    ,RevisonNo
786
    ,System
787
    ,SubSystemCode
788
    ,RefProjectCode
789
    ,JobLevel
790
    ,PersonInCharge
791
    ,RegisteredDate
792
    ,RegisteredUser
793
    ,ToIsDiscussion
794
    ,ToRemarks
795
    ,ToCreator
796
    ,FrReviewStatus
797
    ,FrRemarks
798
    ,FrCreator
799
    ,ID2StartDate
800
    ,ID2EndDate
801
    ,ID2Status
802
    ,ID2Issues
803
    ,ReplyModifications
804
    ,ReplyRequester
805
    ,IsConvert
806
    ,AVEVAPersonInCharge
807
    ,AVEVAWorker
808
    ,AVEVAConvertDate
809
    ,AVEVAReviewDate
810
    ,AVEVAWorkDate
811
    ,AVEVAStatus
812
    ,AVEVAIssues
813
    ,ProdReviewer
814
    ,ProdIsResult
815
    ,ProdRemarks
816
    ,ClientReviewer
817
    ,ClientIsResult
818
    ,ClientRemarks
819
    ,DTIsGateWay
820
    ,DTIsImport
821
    ,DTIsRegSystem
822
    ,DTRemarks
823
)
824
output inserted.DocID into @tbdoc
825
values 
826
(
827
     lower(newid())
828
    ,@DocumentNo
829
    ,case when isnull(@RevisonNo,'')='' then '0' else @RevisonNo end
830
    ,@System
831
    ,@SubSystemCode
832
    ,@RefProjectCode
833
    ,@JobLevel
834
    ,@PersonInCharge
835
    ,getdate()
836
    ,@RegisteredUser
837
    ,@ToIsDiscussion
838
    ,@ToRemarks
839
    ,@ToCreator
840
    ,@FrReviewStatus
841
    ,@FrRemarks
842
    ,@FrCreator
843
    ,@ID2StartDate
844
    ,@ID2EndDate
845
    ,@ID2Status
846
    ,@ID2Issues
847
    ,@ReplyModifications
848
    ,@ReplyRequester
849
    ,@IsConvert
850
    ,@AVEVAPersonInCharge
851
    ,@AVEVAWorker
852
    ,@AVEVAConvertDate
853
    ,@AVEVAReviewDate
854
    ,@AVEVAWorkDate
855
    ,@AVEVAStatus
856
    ,@AVEVAIssues
857
    ,@ProdReviewer
858
    ,@ProdIsResult
859
    ,@ProdRemarks
860
    ,@ClientReviewer
861
    ,@ClientIsResult
862
    ,@ClientRemarks
863
    ,@DTIsGateWay
864
    ,@DTIsImport
865
    ,@DTIsRegSystem
866
    ,@DTRemarks
867
)
868

  
869
if @@rowcount > 0
870
begin
871
    select docid from @tbdoc
872
end
873
else
874
begin
875
    select ''
876
end;";
877
                            */
878
                            #endregion
879 540
                        }
880 541
                        else
881 542
                        {
ID2.Manager/ID2.Manager.Data/Models/Documents.cs
39 39
        [DataMember]
40 40
        public string RefProjectCode { get; set; }
41 41
        [DataMember]
42
        public bool IsLatest { get; set; }
43
        [DataMember]
44 42
        public string JobLevel { get; set; }
45 43
        [DataMember]
46 44
        public string PersonInCharge { get; set; }
......
62 60
            }
63 61
        }
64 62
        [DataMember]
65
        public bool IsDeleted { get; set; }
66
        [DataMember]
67
        public DateTime RegisteredDate { get; set; }
68
        [DataMember]
69
        public DateTime? ModifiedDate { get; set; }
70
        [DataMember]
71
        public DateTime? DeletedDate { get; set; }
72
        [DataMember]
73 63
        public string RegisteredUser { get; set; }
74 64
        [DataMember]
75 65
        public string ModifiedUser { get; set; }
......
169 159
            }
170 160

  
171 161
            bool result = other != null && this.DocumentNo == other.DocumentNo && this.RevisonNo == other.RevisonNo && this.System == other.System && this.SubSystemCode == other.SubSystemCode
172
                && this.RefProjectCode == other.RefProjectCode && this.IsLatest == other.IsLatest && this.JobLevel == other.JobLevel
173
                && this.PersonInCharge == other.PersonInCharge && this.IsDeleted == other.IsDeleted && this.ToIsDiscussion == other.ToIsDiscussion && this.ToRemarks == other.ToRemarks
162
                && this.RefProjectCode == other.RefProjectCode && this.JobLevel == other.JobLevel
163
                && this.PersonInCharge == other.PersonInCharge && this.ToIsDiscussion == other.ToIsDiscussion && this.ToRemarks == other.ToRemarks
174 164
                && this.ToCreator == other.ToCreator
175 165
                && this.FrReviewStatus == other.FrReviewStatus && this.FrRemarks == other.FrRemarks && this.FrCreator == other.FrCreator
176 166
                && this.ID2StartDate == other.ID2StartDate && this.ID2EndDate == other.ID2EndDate && this.ID2Status == other.ID2Status
......
193 183
        public override int GetHashCode()
194 184
        {
195 185
            return this.DocumentNo.GetNullableHash() + this.RevisonNo.GetNullableHash() + this.System.GetNullableHash() + this.SubSystemCode.GetNullableHash()
196
                + this.RefProjectCode.GetNullableHash() + this.IsLatest.GetNullableHash() + this.JobLevel.GetNullableHash()
197
                + this.PersonInCharge.GetNullableHash() + this.IsDeleted.GetNullableHash() + this.ToIsDiscussion.GetNullableHash() + this.ToRemarks.GetNullableHash()
186
                + this.RefProjectCode.GetNullableHash() + this.JobLevel.GetNullableHash()
187
                + this.PersonInCharge.GetNullableHash() + this.ToIsDiscussion.GetNullableHash() + this.ToRemarks.GetNullableHash()
198 188
                + this.ToCreator.GetNullableHash()
199 189
                + this.FrReviewStatus.GetNullableHash() + this.FrRemarks.GetNullableHash() + this.FrCreator.GetNullableHash()
200 190
                + this.ID2StartDate.GetNullableHash() + this.ID2EndDate.GetNullableHash() + this.ID2Status.GetNullableHash()
......
206 196
                + this.DTIsRegSystem.GetNullableHash() + this.DTRemarks.GetNullableHash() + this.ConvertStatus.GetNullableHash();
207 197
        }
208 198

  
209
        public class DocumentsKeyComparer : IEqualityComparer<Documents>
199
        public class DocumentsKeyCompare : IEqualityComparer<Documents>
210 200
        {
211 201
            public bool Equals(Documents x, Documents y)
212 202
            {
......
225 215
                return (obj.DocID != null ? obj.DocID.GetHashCode() : 0);
226 216
            }
227 217
        }
218

  
219
        public class DocumentsUniqueCompare : IEqualityComparer<Documents>
220
        {
221
            public bool Equals(Documents x, Documents y)
222
            {
223
                if (x == null && y == null)
224
                    return true;
225
                else if (x == null || y == null)
226
                    return false;
227
                else
228
                {
229
                    return x.RefProjectCode == y.RefProjectCode && x.DocumentNo == y.DocumentNo;
230
                }
231
            }
232

  
233
            public int GetHashCode(Documents obj)
234
            {
235
                return (obj.RefProjectCode != null ? obj.RefProjectCode.GetHashCode() : 0) + (obj.DocumentNo != null ? obj.DocumentNo.GetHashCode() : 0);
236
            }
237
        }
238

  
239
        public void ValueCopy(Documents other)
240
        {
241
            this.DocumentNo = other.DocumentNo;
242
            this.RevisonNo = other.RevisonNo;
243
            this.System = other.System;
244
            this.SubSystemCode = other.SubSystemCode;
245
            this.RefProjectCode = other.RefProjectCode;
246
            this.JobLevel = other.JobLevel;
247
            this.PersonInCharge = other.PersonInCharge;
248
            this.ToIsDiscussion = other.ToIsDiscussion;
249
            this.ToRemarks = other.ToRemarks;
250
            this.ToCreator = other.ToCreator;
251
            this.ToCapture += other.ToCapture;
252
            this.FrReviewStatus = other.FrReviewStatus;
253
            this.FrRemarks = other.FrRemarks;
254
            this.FrCapture += other.FrCapture;
255
            this.FrCreator = other.FrCreator;
256
            this.ID2StartDate = other.ID2StartDate;
257
            this.ID2EndDate = other.ID2EndDate;
258
            this.ID2Status = other.ID2Status;
259
            this.ID2Issues = other.ID2Issues;
260
            this.ID2Capture += other.ID2Capture;
261
            this.ReplyModifications = other.ReplyModifications;
262
            this.ReplyRequester = other.ReplyRequester;
263
            this.IsConvert = other.IsConvert;
264
            this.AVEVAPersonInCharge = other.AVEVAPersonInCharge;
265
            this.AVEVAWorker = other.AVEVAWorker;
266
            this.AVEVAConvertDate = other.AVEVAConvertDate;
267
            this.AVEVAReviewDate = other.AVEVAReviewDate;
268
            this.AVEVAWorkDate = other.AVEVAWorkDate;
269
            this.AVEVAStatus = other.AVEVAStatus;
270
            this.AVEVAIssues = other.AVEVAIssues;
271
            this.ProdReviewer = other.ProdReviewer;
272
            this.ProdIsResult = other.ProdIsResult;
273
            this.ProdRemarks = other.ProdRemarks;
274
            this.ClientReviewer = other.ClientReviewer;
275
            this.ClientIsResult = other.ClientIsResult;
276
            this.ClientRemarks = other.ClientRemarks;
277
            this.DTIsGateWay = other.DTIsGateWay;
278
            this.DTIsImport = other.DTIsImport;
279
            this.DTIsRegSystem = other.DTIsRegSystem;
280
            this.DTRemarks = other.DTRemarks;
281
            if (this.AttFiles == null)
282
                this.AttFiles = other.AttFiles;
283
            else
284
                this.AttFiles.AddRange(other.AttFiles ?? new List<AttFileInfo>());
285
        }
228 286
    }
229 287

  
230 288
    [DataContract]
ID2.Manager/ID2.Manager/Classes/DocumentsWorker.cs
87 87

  
88 88
        List<Documents> DocList { get; set; }
89 89
        List<Documents> OrgList { get; set; }
90
        List<Documents> SetList { get; set; } = new List<Documents>();
91
        List<Documents> DelList { get; set; } = new List<Documents>();
92 90

  
93 91
        public SetDocumentsWorker(List<Documents> docList, List<Documents> orgDocList, Control parent = null) : base(parent)
94 92
        {
......
97 95
        }
98 96
        protected override void DoWork(BackgroundWorker worker, DoWorkEventArgs e)
99 97
        {
100
            /*
101
            //수정리스트
102
            var sets = this.DocList.Where(x => !this.OrgList.Any(y => y.Equals(x))).ToList();
103
            var setorgs = this.OrgList.Intersect(sets, new DocumentsKeyComparer()).ToList();
104
            var newsets = sets.Except(this.OrgList, new DocumentsKeyComparer()).ToList();
105
            foreach (var newset in newsets)
106
            {
107
                newset.DocID = null;
108
            }
109
            if (sets != null && sets.Count > 0)
98
            try
110 99
            {
111
                this.SetList.AddRange(sets);
112
            }
113
            //newsets.Select(x => { x.DocID = null; return x; });
114
            //sets.Except(this.OrgList, new DocumentsKeyComparer()).Select(x => { x.DocID = null; return x; })
115
            //this.OrgList.Except(this.DocList, new DocumentsKeyComparer())
100
                //Get Transaction Key
101
                bool isTran = false;
102
                int trKey = new DocumentController().GetTranKey(informations.ActiveUser.ID, informations.ActiveProject.ProjectID);
116 103

  
117
            foreach (var set in sets)
118
            {
119
                List<AttFileInfo> setAtts = set.AttFiles ?? new List<AttFileInfo>();
120
                List<AttFileInfo> orgAtts = new List<AttFileInfo>();
121
                List<AttFileInfo> finalAtts = new List<AttFileInfo>();
104
                //수정리스트
105
                var sets = this.DocList.Where(x => !this.OrgList.Any(y => y.Equals(x))).ToList();
122 106

  
123
                var org = setorgs.Where(x => x.DocID == (set.DocID ?? string.Empty)).FirstOrDefault();
124
                if (org != null)
107
                if (sets.Any())
125 108
                {
126
                    if (org.AttFiles != null)
109
                    sets.ForAll(set =>
127 110
                    {
128
                        orgAtts = org.AttFiles;
129
                    }
130
                }
131

  
132
                finalAtts.AddRange(orgAtts.Where(x => !setAtts.Any(y => y.FileID.Equals(x.FileID))));
133
                finalAtts.AddRange(setAtts.Where(x => !orgAtts.Any(y => y.FileID.Equals(x.FileID))).Select(x => { x.FileID = null; return x; }));
134

  
135
                if (finalAtts.Count > 0)
136
                {
137
                    set.AttFiles = finalAtts;
138
                }
139

  
140
                this.SetList.Add(set);
141
            }
142

  
143

  
144
            //this.DocList.Where(x => !this.OrgList.Any(y => y.Equals(x)))
145
            //            .ToList().ForEach(x => this.SetList.Add(x));
146

  
147
            //this.SetList.Intersect(this.OrgList, new DocumentsKeyComparer());
148

  
149
            //this.SetList.Select(x =>
150
            //{
151
            //    x.inter (this.OrgList, new DocumentsAttFileComparer())
152
            //    return x;
153
            //});
154
            //var test = this.OrgList.Except(this.DocList, new DocumentsAttFileComparer());
155
            */
156

  
157
            //Get Transaction Key
158
            bool isTran = false;
159
            int trKey = new DocumentController().GetTranKey(informations.ActiveUser.ID, informations.ActiveProject.ProjectID);
160

  
161
            //수정리스트
162
            this.DocList.Where(x => !this.OrgList.Any(y => y.Equals(x))).ForAll(x => this.SetList.Add(x));
163

  
164
            foreach (var set in this.SetList)
165
            {
166
                List<AttFileInfo> setAtts = set.AttFiles ?? new List<AttFileInfo>();
167
                List<AttFileInfo> orgAtts = new List<AttFileInfo>();
168
                List<AttFileInfo> finalAtts = new List<AttFileInfo>();
169

  
170
                var org = this.OrgList.Where(x => x.DocID == (set.DocID ?? string.Empty)).FirstOrDefault();
171
                if (org != null)
172
                {
173
                    if (org.AttFiles != null)
174
                    {
175
                        orgAtts = org.AttFiles;
176
                    }
177
                }
111
                        List<AttFileInfo> setAtts = set.AttFiles ?? new List<AttFileInfo>();
112
                        List<AttFileInfo> orgAtts = new List<AttFileInfo>();
113
                        var org = this.OrgList.FirstOrDefault(x => x.DocID.Equals(set.DocID ?? string.Empty));
114
                        if (org != null)
115
                        {
116
                            if (org.AttFiles != null)
117
                            {
118
                                orgAtts = org.AttFiles;
119
                            }
120
                        }
121
                        List<AttFileInfo> finalAtts = new List<AttFileInfo>();
178 122

  
179
                finalAtts.AddRange(orgAtts.Where(x => !setAtts.Any(y => y.FileID.Equals(x.FileID))));
180
                finalAtts.AddRange(setAtts.Where(x => !orgAtts.Any(y => y.FileID.Equals(x.FileID))).Select(x => { x.FileID = null; return x; }));
123
                        finalAtts.AddRange(orgAtts.Where(x => !setAtts.Any(y => y.FileID.Equals(x.FileID))));//삭제된이미지
124
                        finalAtts.AddRange(setAtts.Where(x => !orgAtts.Any(y => y.FileID.Equals(x.FileID))).Select(x => { x.FileID = null; return x; }));//추가된이미지
181 125

  
182
                if (finalAtts.Count > 0)
183
                {
184
                    set.AttFiles = finalAtts;
126
                        set.AttFiles = finalAtts;
127
                    });
185 128
                }
186
            }
187

  
188
            //삭제리스트
189
            this.DelList.AddRange(this.OrgList.Except(this.DocList, new DocumentsKeyComparer()));
190 129

  
191
            //e.Result = new DocumentController().SetDocumentData(informations.ActiveProject.ProjectID, SetList, DelList, informations.ActiveUser.ID);
130
                //삭제리스트
131
                var dels = this.OrgList.Except(this.DocList, new DocumentsKeyCompare()).Select(x => x.DocID).ToList();
192 132

  
193
            bool result = false;
194
            bool markusPrjResult = false;
195
            bool markusDataResult = false;
196
            bool markusUserResult = false;
133
                bool result = false;
134
                bool markusPrjResult = false;
135
                bool markusDataResult = false;
136
                bool markusUserResult = false;
197 137

  
198
            if (trKey > 0)
199
            {
200
                isTran = new DocumentController().SetTran(trKey, true, true, SetList.Count + DelList.Count, 0);
201

  
202
                if (isTran)
138
                if (trKey > 0)
203 139
                {
204
                    result = new DocumentController().SetDocumentData(informations.ActiveProject.ProjectID, SetList, DelList, informations.ActiveUser.ID);
205
                }
206
            }
207

  
208
            if (result)
209
            {
210
                isTran = new DocumentController().SetTran(trKey, true, false, 0, 0);
211

  
212
                List<Documents> docs = new DocumentController().GetTrDocuments(trKey).ToList();
140
                    isTran = new DocumentController().SetTran(trKey, true, true, (sets.Count + dels.Count), 0);
213 141

  
214
                isTran = new DocumentController().SetTran(trKey, false, true, 0, docs.Count);
215

  
216
                if (docs.Any())
217
                {
218 142
                    if (isTran)
219 143
                    {
220
                        markusPrjResult = new MarkusInfoController().SetProperties(informations.ProjectList.Where(x => x.Level == 2).Select(x => x.Name));
221
                        markusDataResult = new MarkusInfoController().SetMarkusInfo(docs);
222
                        markusUserResult = new MarkusInfoController().SetMembers(informations.UserList);
144
                        result = new DocumentController().SetDocumentData(informations.ActiveProject.ProjectID, sets, dels, informations.ActiveUser.ID);
223 145

  
224
                        if (markusDataResult)
146
                        if (result)
225 147
                        {
226
                            isTran = new DocumentController().SetTran(trKey, false, false, 0, 0);
148
                            isTran = new DocumentController().SetTran(trKey, true, false, 0, 0);
149

  
150
                            List<Documents> docs = new DocumentController().GetTrDocuments(trKey).ToList();
151

  
152
                            isTran = new DocumentController().SetTran(trKey, false, true, 0, docs.Count);
153

  
154
                            if (docs.Any())
155
                            {
156
                                if (isTran)
157
                                {
158
                                    markusPrjResult = new MarkusInfoController().SetProperties(informations.ProjectList.Where(x => x.Level == 2).Select(x => x.Name));
159
                                    markusDataResult = new MarkusInfoController().SetMarkusInfo(docs);
160
                                    markusUserResult = new MarkusInfoController().SetMembers(informations.UserList);
161

  
162
                                    if (markusDataResult)
163
                                    {
164
                                        isTran = new DocumentController().SetTran(trKey, false, false, 0, 0);
165
                                    }
166
                                }
167
                            }
168
                            else
169
                            {
170
                                markusPrjResult = true;
171
                                markusDataResult = true;
172
                                markusUserResult = true;
173

  
174
                                isTran = new DocumentController().SetTran(trKey, false, false, 0, 0);
175
                            }
227 176
                        }
228 177
                    }
229 178
                }
230
                else
231
                {
232
                    markusPrjResult = true;
233
                    markusDataResult = true;
234
                    markusUserResult = true;
235 179

  
236
                    isTran = new DocumentController().SetTran(trKey, false, false, 0, 0);
237
                }
180
                e.Result = (result, markusPrjResult, markusDataResult, markusUserResult);
181
            }
182
            catch (Exception ex)
183
            {
184
                throw ex;
238 185
            }
239

  
240
            e.Result = this.GetDwgResult(result, markusPrjResult, markusDataResult, markusUserResult);
241
        }
242

  
243
        private (bool isDwg, bool isMarkusPrj, bool isMarkusDwg, bool isMarkusUser) GetDwgResult(bool result, bool markusPrjResult, bool markusDataResult, bool markusUserResult)
244
        {
245
            return (result, markusPrjResult, markusDataResult, markusUserResult);
246 186
        }
247 187

  
248 188
        protected override void WorkCompleted(RunWorkerCompletedEventArgs e)
ID2.Manager/ID2.Manager/Main.Designer.cs
1200 1200
            gridViewComboBoxColumn1.FieldName = "RefProjectCode";
1201 1201
            gridViewComboBoxColumn1.HeaderText = "Team";
1202 1202
            gridViewComboBoxColumn1.Name = "RefProjectCode";
1203
            //gridViewComboBoxColumn1.ReadOnly = true;
1203 1204
            gridViewComboBoxColumn1.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
1204 1205
            gridViewComboBoxColumn1.Width = 150;
1205 1206
            gridViewTextBoxColumn1.FieldName = "System";
......
1214 1215
            gridViewTextBoxColumn3.FieldName = "DocumentNo";
1215 1216
            gridViewTextBoxColumn3.HeaderText = "DWG_ID";
1216 1217
            gridViewTextBoxColumn3.Name = "DocumentNo";
1218
            //gridViewTextBoxColumn3.ReadOnly = true;
1217 1219
            gridViewTextBoxColumn3.Width = 150;
1218 1220
            gridViewComboBoxColumn2.EnableExpressionEditor = false;
1219 1221
            gridViewComboBoxColumn2.FieldName = "PersonInCharge";
ID2.Manager/ID2.Manager/Main.cs
10 10

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

  
14 15
using ID2.Manager.Controls;
15 16
using ID2.Manager.Common;
......
17 18
using ID2.Manager.Data.Models;
18 19
using ID2.Manager.Forms;
19 20
using ID2.Manager.Controller.Controllers;
21
using ID2.Manager.Common.Helpers;
22
using static ID2.Manager.Data.Models.Documents;
20 23

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

  
25 27
using GemBox.Spreadsheet;
26 28

  
27 29
using Newtonsoft.Json;
28
using System.Diagnostics;
29
using ID2.Manager.Common.Helpers;
30
using Telerik.WinControls.UI.Docking;
31 30

  
32 31
namespace ID2.Manager
33 32
{
......
141 140
            this.radGridViewDocuments.MasterView.TableSearchRow.SearchProgressChanged += TableSearchRow_SearchProgressChanged;
142 141
            //this.radGridViewDocuments.FilterChanging += RadGridViewDocuments_FilterChanging;
143 142
            this.radGridViewDocuments.FilterChanged += RadGridViewDocuments_FilterChanged;
143
            this.radGridViewDocuments.CellValidated += RadGridViewDocuments_CellValidated;
144 144
            this.radGridViewDocuments.ValueChanged += RadGridViewDocuments_ValueChanged;
145 145

  
146 146
            this.radGridViewDocuments.MasterView.TableHeaderRow.MinHeight = 36;
......
209 209

  
210 210
                        if (reslut > 0)
211 211
                        {
212

  
212
                            switch (e.Category)
213
                            {
214
                                case "toreview":
215
                                    doc.ToCapture -= reslut;
216
                                    break;
217
                                case "frreview":
218
                                    doc.FrCapture -= reslut;
219
                                    break;
220
                                case "id2work":
221
                                    doc.ID2Capture -= reslut;
222
                                    break;
223
                            }
213 224
                        }
214 225
                        else
215 226
                        {
......
413 424
                        {
414 425
                            category = "frreview";
415 426
                        }
416
                        //else if (IsDoftech && !selectReview)
417
                        //{
418
                        //    category = "prodvalidation";
419
                        //}
420
                        //else 
421
                        //{
422
                        //    category = "clientvalidation";
423
                        //}
424 427
                        else
425 428
                        {
426 429
                            category = "id2work";
427 430
                        }
428 431

  
429

  
430 432
                        AttFileInfo newFile = new AttFileInfo
431 433
                        {
432 434
                            FileID = Guid.NewGuid().ToString(),
......
454 456
                        {
455 457
                            case "toreview":
456 458
                                briefAndImagesReview.AddToImage(imageInfo, true);
459
                                ++doc.ToCapture;
457 460
                                break;
458 461
                            case "frreview":
459 462
                                briefAndImagesReview.AddFrImage(imageInfo, true);
463
                                ++doc.FrCapture;
460 464
                                break;
461
                            //case "prodvalidation":
462
                            //    briefAndImagesValidation.AddToImage(imageInfo, true);
463
                            //    break;
464
                            //case "clientvalidation":
465
                            //    briefAndImagesValidation.AddFrImage(imageInfo, true);
466
                            //    break;
467 465
                            case "id2work":
468 466
                                issueImagesAndAnswerWork.AddImage(imageInfo, true);
467
                                ++doc.ID2Capture;
469 468
                                break;
470 469
                        }
471 470
                    }
......
548 547

  
549 548
        private void RadGridViewDocuments_DefaultValuesNeeded(object sender, GridViewRowEventArgs e)
550 549
        {
550
            if (e.Row is GridViewNewRowInfo)
551
            {
552
                e.Row.Cells["Team"].ReadOnly = false;
553
            }
554

  
551 555
            BindingDocumentToDetailEditor(new Documents());
552 556
        }
553 557

  
......
1677 1681
                    detailViewCellElement.BackColor2 = Color.FromArgb(214, 214, 214);
1678 1682
                }
1679 1683
            }
1684
            //else if (e.Row is GridViewNewRowInfo)
1685
            //{
1686
            //    switch (e.CellElement.ColumnInfo.Name)
1687
            //    {
1688
            //        case "RefProjectCode":
1689
            //        case "DocumentNo":
1690
            //            e.CellElement.ColumnInfo.ReadOnly = false;
1691
            //            break;
1692
            //    }
1693
            //}
1680 1694
            //else if (e.Row is GridViewSummaryRowInfo)
1681 1695
            //{
1682 1696
            //    if (e.CellElement is GridRowHeaderCellElement)
......
1805 1819
            this.lbSelectAndTotal.Text = $"{e.GridViewTemplate.DataView.Count} / {this.TotalCount} (Selected / Total)";
1806 1820
        }
1807 1821

  
1822
        private void RadGridViewDocuments_CellValidated(object sender, CellValidatedEventArgs e)
1823
        {
1824
            if (e.Column is GridViewComboBoxColumn)
1825
            {
1826
                bool isChecked = e.Row.Cells["Checked"].Value != null && Convert.ToBoolean(e.Row.Cells["Checked"].Value);
1827

  
1828
                if (isChecked)
1829
                {
1830
                    var chkRows = this.GetCheckedList();
1831
                    if (chkRows.Any())
1832
                    {
1833
                        switch (e.Column.Name)
1834
                        {
1835
                            case "RefProjectCode":
1836
                            case "PersonInCharge":
1837
                            case "Worker":
1838
                            case "JobLevel":
1839
                            case "ToIsDiscussion":
1840
                            case "ToCreator":
1841
                            case "FrReviewStatus":
1842
                            case "FrCreator":
1843
                            case "ID2Status":
1844
                            case "ReplyRequester":
1845
                            case "IsConvert":
1846
                            case "AVEVAPersonInCharge":
1847
                            case "AVEVAWorker":
1848
                            case "AVEVAStatus":
1849
                            case "ProdReviewer":
1850
                            case "ProdIsResult":
1851
                            case "ClientReviewer":
1852
                            case "ClientIsResult":
1853
                            case "DTIsGateWay":
1854
                            case "DTIsImport":
1855
                            case "DTIsRegSystem":
1856
                                chkRows.ForAll(x => x.Cells[e.Column.Name].Value = e.Row.Cells[e.Column.Name].Value);
1857
                                break;
1858
                        }
1859
                    }
1860
                }
1861
            }
1862
        }
1863

  
1808 1864
        private void RadGridViewDocuments_ValueChanged(object sender, EventArgs e)
1809 1865
        {
1810 1866
            this.radGridViewDocuments.EndEdit();
......
1848 1904

  
1849 1905
                    if (result.Error != null)
1850 1906
                    {
1851

  
1852 1907
                        RadMessageBox.Show(result.Error, "Information", MessageBoxButtons.OK, RadMessageIcon.Info);
1853 1908
                    }
1854 1909
                    else
1855 1910
                    {
1856
                        this.importImages = result.Images;
1857
                        this.documents.AddRange(result.documents);
1911
                        this.importImages = result.Images;//???
1912

  
1913
                        var intersections = this.documents.Intersect(result.documents, new DocumentsUniqueCompare());
1914
                        var subtractions = result.documents.Except(this.documents, new DocumentsUniqueCompare());
1915

  
1916
                        if (intersections.Any())
1917
                        {
1918
                            var intersectionImports = result.documents.Intersect(this.documents, new DocumentsUniqueCompare());
1919

  
1920
                            intersections.ForAll(x =>
1921
                            {
1922
                                var intersectionImport = intersectionImports.FirstOrDefault(o => o.RefProjectCode.Equals(x.RefProjectCode) && o.DocumentNo.Equals(x.DocumentNo));
1923
                                if (intersectionImport != null)
1924
                                {
1925
                                    x.ValueCopy(intersectionImport);
1926
                                }
1927
                            });
1928
                        }
1929

  
1930
                        this.documents.AddRange(subtractions);
1858 1931
                        if (this.orgDocuments == null) this.orgDocuments = new List<Documents>();
1859 1932
                        this.DocumentListBinding();
1860 1933
                        //briefAndImagesReview.SetImages(this.importImages);
......
2212 2285
                        RadMessageBox.Show($"Duplicate Dwg No exists.({dupDwgNoCount})", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info);
2213 2286
                        return;
2214 2287
                    }
2215

  
2216
                    //List<string> newDwgNos =  this.documents.Where(x => string.IsNullOrEmpty(x.DocID)).Select(x => x.DocumentNo).ToList();
2217
                    //if (newDwgNos.Count > 0)
2218
                    //{
2219
                    //    dupDwgNoCount = new DocumentController().ExistsDocument(informations.ActiveProject.ProjectID, newDwgNos);
2220
                    //}
2221

  
2222
                    //if (dupDwgNoCount > 0)
2223
                    //{
2224
                    //    RadMessageBox.Show($"Duplicate Dwg No exists.({dupDwgNoCount})", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info);
2225
                    //    return;
2226
                    //}
2227 2288
                    #endregion
2228 2289

  
2229 2290
                    var worker = new SetDocumentsWorker(this.documents, this.orgDocuments, this.radGridViewDocuments);
......
2234 2295
                        bool isMarkusDwg = false;
2235 2296
                        bool isMarkusUser = false;
2236 2297

  
2237
                        (isDwg, isMarkusPrj, isMarkusDwg, isMarkusUser) = ((bool, bool, bool, bool ))e.Result;
2298
                        (isDwg, isMarkusPrj, isMarkusDwg, isMarkusUser) = ((bool, bool, bool, bool))e.Result;
2238 2299

  
2239 2300
                        if (!isDwg)
2240 2301
                        {
......
2257 2318
                            RadMessageBox.Show("Save is complete", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info);
2258 2319
                            this.GetDocList();
2259 2320
                        }
2260

  
2261
                        //isDwg = result.isDwg;
2262
                        //isMarkusPrj = result.isDwg;
2263
                        //isMarkusDwg = result.isDwg;
2264
                        //isMarkusUser = result.isDwg;
2265

  
2266
                        //string test = "";
2267

  
2268
                        //(isDwg, isMarkusPrj, isMarkusDwg, isMarkusUser) = (isDwg, isMarkusPrj, isMarkusDwg, isMarkusUser)e.Result;
2269

  
2270

  
2271
                        /*
2272
                        bool result = false;
2273
                        bool markusResult = false;
2274
                        bool markusMembersResult = false;
2275

  
2276
                        result = (bool)e.Result;
2277
                        if (result)
2278
                        {
2279
                            markusResult = new MarkusInfoController().SetProperties(Program.informations.ProjectList.Where(x => x.Level == 2).Select(x => x.Name));
2280
                            markusResult = new MarkusInfoController().SetMarkusInfo(this.documents);
2281
                            markusMembersResult = new MarkusInfoController().SetMembers(informations.UserList);
2282
                            //informations.ProjectList.Where(x => x.Level.Equals(2)); <- ID2 Manager에 저장 된 전체 프로젝트 리스트
2283
                        }
2284

  
2285
                        if (result && markusResult && markusMembersResult)
2286
                        {
2287
                            RadMessageBox.Show("Save is complete", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info);
2288

  
2289
                            this.GetDocList();
2290
                        }
2291
                        else if (!result)
2292
                        {
2293
                            RadMessageBox.Show("Save is not complete", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error);
2294
                        }
2295
                        else if (!markusResult)
2296
                        {
2297
                            RadMessageBox.Show("Markus Data Save is not complete", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error);
2298
                        }
2299
                        else if (!markusMembersResult)
2300
                        {
2301
                            RadMessageBox.Show("Markus Members Save is not complete", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error);
2302
                        }
2303
                        */
2304 2321
                    };
2305 2322
                    worker.StartWork();
2306 2323
                }

내보내기 Unified diff

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