프로젝트

일반

사용자정보

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

markus / ConvertService / ServiceBase / Markus.Service.StationController / ViewModel / FinalPDFViewModel.cs @ cb806a91

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

1
using Markus.Service.Extensions;
2
using Markus.Service.StationController.Data;
3
using Markus.Service.StationController.Behaviors;
4
using Markus.Service.StationController.Extensions;
5
using Markus.Service.StationController.Controls;
6
using Microsoft.Win32;
7
using System;
8
using System.Collections.Generic;
9
using System.ComponentModel;
10
using System.Linq;
11
using System.Threading.Tasks;
12
using System.Web;
13
using System.Windows;
14
using Telerik.Windows.Controls;
15
using Telerik.Windows.Data;
16
using System.Net;
17
using System.Windows.Threading;
18
using System.Diagnostics;
19
using System.Windows.Input;
20
using Markus.Mvvm.ToolKit;
21
using System.Windows.Data;
22
using System.Windows.Controls;
23
using System.IO;
24
using Newtonsoft.Json;
25
using static Markus.Service.StationController.Data.FinalPDF;
26
using System.Collections.ObjectModel;
27

    
28
namespace Markus.Service.StationController.ViewModel
29
{
30
    class FinalPDFViewModel : Mvvm.ToolKit.ViewModelBase
31
    {
32
        #region Constructor
33

    
34
        /// <summary>
35
        /// 실행하면 처음 들어가는 부분
36
        /// </summary>
37
        public FinalPDFViewModel()
38
        {
39
            DataFilterCommand = new DelegateCommand(DataFilter);
40
            DataSaveFileGemBoxCommand = new DelegateCommand(DataExportData);
41
            ConvertCommand = new DelegateCommand(DataConvert);
42
            DeleteCommand = new DelegateCommand(DataDelete);
43
            ValidateCommand = new DelegateCommand(DataValidate);
44
            MarkusLinkCommand = new DelegateCommand(MarkusLink);
45
            RemoveCreateTimeFilterCommand = new DelegateCommand(RemoveCreateTimeFilter);
46
            ResetCommand = new DelegateCommand(Reset);
47
            ConverAddCommand = new DelegateCommand(ConverAdd);
48
            ConvertPathFileSearchCommand = new DelegateCommand(ConvertPathFileSearch);
49
        }
50

    
51
        #endregion
52

    
53
        #region Properties
54

    
55
        DataService.DataServiceClient WcfClient = new DataService.DataServiceClient();
56

    
57

    
58
        private static System.Collections.ObjectModel.ObservableCollection<FinalPDF> _ConvertSource;
59
        public static System.Collections.ObjectModel.ObservableCollection<FinalPDF> ConvertSource
60
        {
61
            get
62
            {
63
                if (_ConvertSource == null)
64
                {
65
                    _ConvertSource = new System.Collections.ObjectModel.ObservableCollection<FinalPDF>();
66
                }
67
                return _ConvertSource;
68
            }
69
            set
70
            {
71
                _ConvertSource = value;
72
            }
73
        }
74

    
75
        public ObservableCollection<ProjectName> _ProjectNames;
76
        public ObservableCollection<ProjectName> ProjectNames
77
        {
78
            get
79
            {
80
                if (_ProjectNames == null)
81
                {
82
                    _ProjectNames = new System.Collections.ObjectModel.ObservableCollection<ProjectName>();
83
                }
84

    
85
                return _ProjectNames;
86
            }
87
            set
88
            {
89
                _ProjectNames = value;
90
                OnPropertyChanged(() => ProjectNames);
91
            }
92
        }
93

    
94
        private System.Collections.ObjectModel.ObservableCollection<FinalPDF> _FilterSearch;
95
        public System.Collections.ObjectModel.ObservableCollection<FinalPDF> FilterSearch
96
        {
97
            get
98
            {
99
                if (_FilterSearch == null)
100
                {
101
                    _FilterSearch = new System.Collections.ObjectModel.ObservableCollection<FinalPDF>
102
                            {
103
                                new FinalPDF{ProjectNumber = "Filter Search"}
104
                            };
105
                }
106

    
107
                return _FilterSearch;
108
            }
109
        }
110

    
111
        private System.Collections.ObjectModel.ObservableCollection<FinalPDF> _AliveItems;
112
        public System.Collections.ObjectModel.ObservableCollection<FinalPDF> AliveItems
113
        {
114
            get => _AliveItems;
115
            set
116
            {
117
                _AliveItems = value;
118
                OnPropertyChanged(() => AliveItems);
119
            }
120
        }
121

    
122
        public ICollectionView FilterConvertSourceView
123
        {
124
            get
125
            {
126
                var view = CollectionViewSource.GetDefaultView(FilterConvertSource);
127
                return view;
128
            }
129
        }
130

    
131
        private System.Collections.ObjectModel.ObservableCollection<FinalPDF> _FilterConvertSource;
132
        public System.Collections.ObjectModel.ObservableCollection<FinalPDF> FilterConvertSource
133
        {
134
            get
135
            {
136
                if (_FilterConvertSource == null)
137
                {
138
                    _FilterConvertSource = new System.Collections.ObjectModel.ObservableCollection<FinalPDF>();
139
                }
140
                return _FilterConvertSource;
141
            }
142
            set
143
            {
144
                _FilterConvertSource = value;
145
                OnPropertyChanged(() => FilterConvertSource);
146
            }
147
        }
148

    
149

    
150
        private System.Collections.ObjectModel.ObservableCollection<FinalPDF> _RealConvertSource;
151
        public System.Collections.ObjectModel.ObservableCollection<FinalPDF> RealConvertSource
152
        {
153
            get => _RealConvertSource;
154
            set
155
            {
156
                _RealConvertSource = value;
157
                OnPropertyChanged(() => RealConvertSource);
158
            }
159
        }
160

    
161

    
162
        private System.Windows.Documents.FlowDocument connectionLog;
163
        public System.Windows.Documents.FlowDocument ConnectionLog
164
        {
165
            get => connectionLog;
166
            set
167
            {
168
                if (connectionLog != value)
169
                {
170
                    connectionLog = value;
171
                    OnPropertyChanged(() => ConnectionLog);
172
                }
173
            }
174
        }
175

    
176

    
177
        private int _SelectedInt = 4;
178
        public int SelectedInt
179
        {
180
            get => _SelectedInt;
181
            set
182
            {
183
                _SelectedInt = value;
184
                OnPropertyChanged(() => SelectedInt);
185
            }
186
        }
187

    
188

    
189
        private Telerik.Windows.Data.EnumMemberViewModel _SelectedStatus;
190
        public Telerik.Windows.Data.EnumMemberViewModel SelectedStatus
191
        {
192
            get => _SelectedStatus;
193
            set
194
            {
195
                _SelectedStatus = value;
196
                OnPropertyChanged(() => SelectedStatus);
197
            }
198
        }
199

    
200

    
201
        private SelectedCountItem _SelectedCount;
202
        public SelectedCountItem SelectedCount
203
        {
204
            get => _SelectedCount;
205
            set
206
            {
207
                _SelectedCount = value;
208
                OnPropertyChanged(() => SelectedCount);
209
            }
210
        }
211

    
212
        List<SelectedCountItem> _SelectedCountList;
213
        public List<SelectedCountItem> SelectedCountList
214
        {
215
            get
216
            {
217
                if (_SelectedCountList == null)
218
                {
219
                    _SelectedCountList = new List<SelectedCountItem>
220
                            {
221
                                new SelectedCountItem{DisplayMember = "50",ValueMember = 50},
222
                                new SelectedCountItem{DisplayMember = "100",ValueMember = 100},
223
                                new SelectedCountItem{DisplayMember = "150",ValueMember = 150},
224
                                new SelectedCountItem{DisplayMember = "200",ValueMember = 200}
225
                            };
226
                }
227

    
228
                return _SelectedCountList;
229
            }
230
        }
231

    
232
        private FinalPDF _SelectFilterConvert;
233
        public FinalPDF SelectFilterConvert
234
        {
235
            get => _SelectFilterConvert;
236
            set
237
            {
238
                _SelectFilterConvert = value;
239
                OnPropertyChanged(() => SelectFilterConvert);
240
            }
241
        }
242

    
243

    
244

    
245
        private ObservableCollection<FinalPDF> _SelectFilterConvertList;
246
        public ObservableCollection<FinalPDF> SelectFilterConvertList
247
        {
248
            get
249
            {
250
                if (_SelectFilterConvertList == null)
251
                {
252
                    _SelectFilterConvertList = new ObservableCollection<FinalPDF>();
253
                }
254
                return _SelectFilterConvertList;
255
            }
256
            set
257
            {
258
                _SelectFilterConvertList = value;
259
                OnPropertyChanged(() => SelectFilterConvertList);
260
            }
261
        }
262

    
263
        private FinalPDF _SelectRealConvert;
264
        public FinalPDF SelectRealConvert
265
        {
266
            get => _SelectRealConvert;
267
            set
268
            {
269
                _SelectRealConvert = value;
270
                OnPropertyChanged(() => SelectRealConvert);
271
            }
272
        }
273

    
274

    
275
        private FinalPDF _SelectAliveConvert;
276
        public FinalPDF SelectAliveConvert
277
        {
278
            get => _SelectAliveConvert;
279
            set
280
            {
281
                _SelectAliveConvert = value;
282
                OnPropertyChanged(() => SelectAliveConvert);
283
            }
284
        }
285

    
286

    
287
        private StatusTypeList _StatusType;
288
        public StatusTypeList StatusType
289
        {
290
            get => _StatusType;
291
            set
292
            {
293
                _StatusType = value;
294
                OnPropertyChanged(() => StatusType);
295
            }
296
        }
297

    
298
        private bool _IsLoading;
299
        public bool IsLoading
300
        {
301
            get => _IsLoading;
302
            set
303
            {
304
                if (_IsLoading != value)
305
                {
306
                    _IsLoading = value;
307
                    OnPropertyChanged(() => IsLoading);
308
                }
309
            }
310
        }
311

    
312
        IEnumerable<Telerik.Windows.Data.EnumMemberViewModel> _StatusCodeList;
313
        public IEnumerable<Telerik.Windows.Data.EnumMemberViewModel> StatusCodeList
314
        {
315
            get
316
            {
317
                if (_StatusCodeList == null)
318
                {
319
                    _StatusCodeList = Telerik.Windows.Data.EnumDataSource.FromType<StatusCodeType>();
320
                }
321

    
322
                return _StatusCodeList;
323
            }
324
        }
325

    
326
        public ProjectName _ProjectNumberFilter;
327
        public ProjectName ProjectNumberFilter
328
        {
329
            get
330
            {
331
                if (_ProjectNumberFilter == null)
332
                {
333
                    _ProjectNumberFilter = new ProjectName();
334
                }
335
                return _ProjectNumberFilter;
336
            }
337
            set
338
            {
339
                _ProjectNumberFilter = value;
340
                OnPropertyChanged(() => ProjectNumberFilter);
341
            }
342
        }
343

    
344
        public string _DocumentIDFilter;
345
        public string DocumentIDFilter
346
        {
347
            get
348
            {
349
                return _DocumentIDFilter;
350
            }
351
            set
352
            {
353
                if (_DocumentIDFilter == "")
354
                {
355
                    _DocumentIDFilter = null;
356
                }
357
                else if (_DocumentIDFilter != value)
358
                {
359
                    _DocumentIDFilter = value;
360
                    OnPropertyChanged(() => DocumentIDFilter);
361
                }
362
            }
363
        }
364

    
365
        public string _DOCINFO_IDFilter;
366
        public string DOCINFO_IDFilter
367
        {
368
            get
369
            {
370
                return _DOCINFO_IDFilter;
371
            }
372
            set
373
            {
374
                if (_DOCINFO_IDFilter == "")
375
                {
376
                    _DOCINFO_IDFilter = null;
377
                }
378
                else if (_DOCINFO_IDFilter != value)
379
                {
380
                    _DOCINFO_IDFilter = value;
381
                    OnPropertyChanged(() => DOCINFO_IDFilter);
382
                }
383
            }
384
        }
385

    
386
        public string _Document_URLFilter;
387
        public string Document_URLFilter
388
        {
389
            get
390
            {
391
                return _Document_URLFilter;
392
            }
393
            set
394
            {
395
                if (_Document_URLFilter != value)
396
                {
397
                    _Document_URLFilter = value;
398
                    OnPropertyChanged(() => Document_URLFilter);
399
                }
400
            }
401
        }
402

    
403
        public string _MarkupInfo_IDFilter;
404
        public string MarkupInfo_IDFilter
405
        {
406
            get
407
            {
408
                return _MarkupInfo_IDFilter;
409
            }
410
            set
411
            {
412
                if (_MarkupInfo_IDFilter != value)
413
                {
414
                    _MarkupInfo_IDFilter = value;
415
                    OnPropertyChanged(() => MarkupInfo_IDFilter);
416
                }
417
            }
418
        }
419

    
420
        public string _CreateUser_IDFilter;
421
        public string CreateUser_IDFilter
422
        {
423
            get
424
            {
425
                return _CreateUser_IDFilter;
426
            }
427
            set
428
            {
429
                if (_CreateUser_IDFilter == "")
430
                {
431
                    _CreateUser_IDFilter = null;
432
                }
433
                else if (_CreateUser_IDFilter != value)
434
                {
435
                    _CreateUser_IDFilter = value;
436
                    OnPropertyChanged(() => CreateUser_IDFilter);
437
                }
438
            }
439
        }
440

    
441
        public string _GROUP_NOFilter;
442
        public string GROUP_NOFilter
443
        {
444
            get
445
            {
446
                return _GROUP_NOFilter;
447
            }
448
            set
449
            {
450
                if (_GROUP_NOFilter == "")
451
                {
452
                    _GROUP_NOFilter = null;
453
                }
454
                else if (_GROUP_NOFilter != value)
455
                {
456
                    _GROUP_NOFilter = value;
457
                    OnPropertyChanged(() => GROUP_NOFilter);
458
                }
459
            }
460
        }
461

    
462
        public string _REVISIONFilter;
463
        public string REVISIONFilter
464
        {
465
            get
466
            {
467
                return _REVISIONFilter;
468
            }
469
            set
470
            {
471
                if (_REVISIONFilter == "")
472
                {
473
                    _REVISIONFilter = null;
474
                }
475
                else if (_REVISIONFilter != value)
476
                {
477
                    _REVISIONFilter = value;
478
                    OnPropertyChanged(() => REVISIONFilter);
479
                }
480
            }
481
        }
482

    
483
        public StatusCodeType _ConvertStateFilter;
484
        public StatusCodeType ConvertStateFilter
485
        {
486
            get { return _ConvertStateFilter; }
487
            set
488
            {
489
                if (_ConvertStateFilter != value)
490
                {
491
                    _ConvertStateFilter = value;
492
                    OnPropertyChanged(() => ConvertStateFilter);
493
                }
494
            }
495
        }
496

    
497
        public string _Document_NOFilter;
498
        public string Document_NOFilter
499
        {
500
            get { return _Document_NOFilter; }
501
            set
502
            {
503
                if (_Document_NOFilter == "")
504
                {
505
                    _Document_NOFilter = null;
506
                }
507
                else if (_Document_NOFilter != value)
508
                {
509
                    _Document_NOFilter = value;
510
                    OnPropertyChanged(() => Document_NOFilter);
511
                }
512
            }
513
        }
514

    
515
        public string _Exception;
516
        public string Exception
517
        {
518
            get { return _Exception; }
519
            set
520
            {
521
                if (_Exception == "")
522
                {
523
                    _Exception = null;
524
                }
525
                else if (_Exception != value)
526
                {
527
                    _Exception = value;
528
                    OnPropertyChanged(() => Exception);
529
                }
530
            }
531
        }
532

    
533
        public string _Document_NameFilter;
534
        public string Document_NameFilter
535
        {
536
            get { return _Document_NameFilter; }
537
            set
538
            {
539
                if (_Document_NameFilter == "")
540
                {
541
                    _Document_NameFilter = null;
542
                }
543
                else if (_Document_NameFilter != value)
544
                {
545
                    _Document_NameFilter = value;
546
                    OnPropertyChanged(() => Document_NameFilter);
547
                }
548
            }
549
        }
550

    
551

    
552
        static DateTime DefaultCreateTime = DateTime.Now;
553
        private DateTime _SelectedCreateTimeBegin = DefaultCreateTime;
554
        public DateTime SelectedCreateTimeBegin
555
        {
556

    
557
            get { return _SelectedCreateTimeBegin; }
558
            set
559
            {
560
                if (_SelectedCreateTimeBegin == value)
561
                    return;
562
                _SelectedCreateTimeBegin = value;
563
                OnPropertyChanged(() => SelectedCreateTimeBegin);
564

    
565
            }
566
        }
567

    
568
        private DateTime _SelectedCreateTimeEnd = DefaultCreateTime;
569
        public DateTime SelectedCreateTimeEnd
570
        {
571

    
572
            get { return _SelectedCreateTimeEnd; }
573
            set
574
            {
575
                if (_SelectedCreateTimeEnd == value)
576
                    return;
577
                _SelectedCreateTimeEnd = value;
578
                OnPropertyChanged(() => SelectedCreateTimeEnd);
579
            }
580
        }
581

    
582
        public int _DataBase_ItemsHeight = 800;
583
        public int DataBase_ItemsHeight
584
        {
585
            get { return _DataBase_ItemsHeight; }
586
            set
587
            {
588
                _DataBase_ItemsHeight = value;
589
                OnPropertyChanged(() => DataBase_ItemsHeight);
590
            }
591
        }
592

    
593

    
594
        public int _RealConvert_Height = 80;
595
        public int RealConvert_Height
596
        {
597
            get { return _RealConvert_Height; }
598
            set
599
            {
600
                _RealConvert_Height = value;
601
                OnPropertyChanged(() => RealConvert_Height);
602
            }
603
        }
604

    
605
        public int _Alive_Height = 80;
606
        public int Alive_Height
607
        {
608
            get { return _Alive_Height; }
609
            set
610
            {
611
                _Alive_Height = value;
612
                OnPropertyChanged(() => Alive_Height);
613
            }
614
        }
615

    
616
        public bool _ConvertShow;
617
        public bool ConvertShow
618
        {
619
            get => _ConvertShow;
620
            set
621
            {
622
                if (_ConvertShow = !value)
623
                {
624
                    _ConvertShow = false;
625
                }
626
                _ConvertShow = value;
627
                OnPropertyChanged(() => ConvertShow);
628
            }
629
        }
630

    
631
        public bool _AliveShow;
632
        public bool AliveShow
633
        {
634
            get => _AliveShow;
635
            set
636
            {
637
                if (_AliveShow = !value)
638
                {
639
                    _AliveShow = false;
640
                }
641
                _AliveShow = value;
642
                OnPropertyChanged(() => AliveShow);
643
            }
644
        }
645

    
646

    
647
        private bool _ExcptionCheck = false;
648
        public bool ExcptionCheck
649
        {
650
            get
651
            {
652
                return _ExcptionCheck;
653
            }
654
            set
655
            {
656
                _ExcptionCheck = value;
657
                OnPropertyChanged(() => ExcptionCheck);
658
            }
659
        }
660

    
661
        #endregion
662

    
663
        #region Command
664

    
665
        public DelegateCommand ConvertCommand { get; private set; }
666
        public DelegateCommand DeleteCommand { get; private set; }
667
        public DelegateCommand ValidateCommand { get; private set; }
668
        public DelegateCommand DataSaveFileGemBoxCommand { get; private set; }
669
        public DelegateCommand MarkusLinkCommand { get; private set; }
670
        public DelegateCommand RemoveCreateTimeFilterCommand { get; private set; }
671

    
672
        public DelegateCommand DataFilterCommand { get; private set; }
673
        public DelegateCommand ResetCommand { get; private set; }
674
        public DelegateCommand ConverAddCommand { get; private set; }
675
        public DelegateCommand ConvertPathFileSearchCommand { get; private set; }
676

    
677
        #endregion
678

    
679
        #region Main Logic
680

    
681
        /// <summary>
682
        /// 각각의 Grid row 객체들 업데이트
683
        /// </summary>
684

    
685
        private DispatcherTimer dispatcherTimer;
686
        public override void Loaded()
687
        {
688
            base.Loaded();
689

    
690
            if (!App.IsDesignMode)
691
            {
692
                dispatcherTimer = new DispatcherTimer();
693
                dispatcherTimer.Tick += new EventHandler(Timer_Tick);
694
                dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
695
                dispatcherTimer.Start();
696
            }
697
        }
698

    
699
        private async void Timer_Tick(object sender, EventArgs e)
700
        {
701
            dispatcherTimer.Stop();
702

    
703
            if (IsAcitve)
704
            {
705
                await App.Current.Dispatcher.InvokeAsync(() =>
706
                {
707
                    DataSelect();
708

    
709
                    AliveDataSelect();
710
                });
711
            }
712

    
713
            await Task.Delay(5000);
714

    
715
            System.Threading.Thread.Sleep(new TimeSpan(0, 0, 0, 0, 100));
716

    
717
            dispatcherTimer.Start();
718
        }
719

    
720
        private async void SearchTimer_Tick(object sender, EventArgs e)
721
        {
722
            dispatcherTimer.Stop();
723

    
724
            if (IsAcitve)
725
            {
726
                await App.Current.Dispatcher.InvokeAsync(() =>
727
                {
728
                    DataSearch(new[] { (StatusCodeType)(SelectedStatus.Value) }, FilterConvertSource);
729

    
730
                    RealDataSelect(new[] { StatusCodeType.None, StatusCodeType.Wait, StatusCodeType.PageLoading, StatusCodeType.Saving }, RealConvertSource);
731

    
732
                    AliveDataSelect();
733
                });
734
            }
735

    
736
            await Task.Delay(5000);
737

    
738
            dispatcherTimer.Start();
739
        }
740

    
741

    
742
        public override void Closed()
743
        {
744
            if (dispatcherTimer != null)
745
            {
746
                dispatcherTimer.Stop();
747
            }
748

    
749
            base.Closed();
750
        }
751

    
752

    
753
        #endregion
754

    
755
        #region Function
756

    
757
        #region Return_FilterConvertSource
758

    
759
        public static void Return_FilterConvertSource(ObservableCollection<FinalPDF> convertPDFs)
760
        {
761
            ConvertSource = new ObservableCollection<FinalPDF>();
762
            ConvertSource = convertPDFs;
763
        }
764

    
765
        public static ObservableCollection<FinalPDF> Return_FilterConvertSource()
766
        {
767
            return ConvertSource;
768
        }
769

    
770

    
771
        #endregion
772

    
773

    
774
        #region Data Select
775

    
776
        /// <summary>
777
        /// 상단 그리드 중앙 그리드 출력 데이터
778
        /// </summary>
779
        private void DataSelect()
780
        {
781

    
782
            if (FilterConvertSource == null)
783
            {
784
                FilterConvertSource = new System.Collections.ObjectModel.ObservableCollection<FinalPDF>();
785
            }
786

    
787
            if (RealConvertSource == null)
788
            {
789
                RealConvertSource = new System.Collections.ObjectModel.ObservableCollection<FinalPDF>();
790
            }
791

    
792
            /// combobox 에서 선택된 items
793
            if (SelectedStatus != null)
794
            {
795
                DataSelect(new[] { (StatusCodeType)(SelectedStatus.Value) }, FilterConvertSource);
796
            }
797

    
798
            /// 컨버터중인 items
799
            RealDataSelect(new[] { StatusCodeType.None, StatusCodeType.Wait, StatusCodeType.PageLoading, StatusCodeType.Saving }, RealConvertSource);
800

    
801
        }
802

    
803
        private async void RealDataSelect(IEnumerable<StatusCodeType> statusCodeTypeList, System.Collections.ObjectModel.ObservableCollection<FinalPDF> collection)
804
        {
805
            try
806
            {
807
                IEnumerable<FinalPDF> Listitems = Enumerable.Empty<FinalPDF>();
808

    
809
                foreach (var coll in collection)
810
                {
811
                   Listitems = from x in await WcfClient.GET_SELECT_FINAL_PDF_ITEMAsync(coll.ConvertID, coll.ProjectNumber, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null)
812
                                let MarkusLink = "kcom://" + CreateMarkusParam(x.PROJECT_NO, x.DOCUMENT_ID, "doftech")
813
                                select new FinalPDF(x.ID, x.PROJECT_NO, x.STATUS, x.DOCUMENT_ID, x.MARKUPINFO_ID, x.DOCINFO_ID, x.DOCUMENT_NAME, x.DOCUMENT_NO, x.CREATE_USER_ID, x.REVISION, x.CURRENT_PAGE,
814
                            x.TOTAL_PAGE, x.EXCEPTION, x.GROUP_NO, x.CREATE_DATETIME, x.START_DATETIME, x.END_DATETIME, x.ORIGINAL_FILE, x.CONVERT_PATH, MarkusLink);
815

    
816
                }
817

    
818
                foreach (var Listitem in Listitems)
819
                {
820
                    collection.UpdateWhere(changeitem =>
821
                    ConvertItemEx.ChangeValues(changeitem, Listitem), x => x.ProjectNumber == Listitem.ProjectNumber && x.ConvertID == Listitem.ConvertID);
822
                }
823

    
824
                RealConvert_Height = 80 + (10 * collection.Count());
825
                DataBase_ItemsHeight = 800 - (RealConvert_Height + Alive_Height);
826
            }
827
            catch (Exception ex)
828
            {
829
                MessageBox.Show(ex.ToString());
830
            }
831
        }
832

    
833
        private async void DataSelect(IEnumerable<StatusCodeType> statusCodeTypeList, System.Collections.ObjectModel.ObservableCollection<FinalPDF> collection)
834
        {
835
            try
836
            {
837
                int _status = 0;
838
                if (SelectedStatus != null)
839
                {
840
                    _status = (int)SelectedStatus.Value;
841
                }
842

    
843
                if (ProjectNames.Count() == 0)
844
                {
845
                    ProjectName Clear = new ProjectName("Clear", "Clear");
846
                    ProjectNames.Add(Clear);
847
                    foreach (var x in await WcfClient.GET_SELECT_RUN_PROJECTSAsync(0))
848
                    {
849
                        ProjectName projectName = new ProjectName(x.PROJECT_NO, x.PROJECT_NAME);
850
                        ProjectNames.Add(projectName);
851
                    }
852
                }
853

    
854
                var Listitems = from x in await WcfClient.GET_SELECT_FINAL_PDF_ITEMAsync(null, null, null, null, null, null, null, null, _status, SelectedCount.ValueMember, null, null, null, null, null, null, null, null, null, null)
855
                                let MarkusLink = "kcom://" + CreateMarkusParam(x.ID, x.DOCUMENT_ID, "doftech")
856
                                select new FinalPDF(x.ID, x.PROJECT_NO, x.STATUS, x.DOCUMENT_ID, x.MARKUPINFO_ID, x.DOCINFO_ID, x.DOCUMENT_NAME, x.DOCUMENT_NO, x.CREATE_USER_ID,
857
                        x.REVISION, x.CURRENT_PAGE, x.TOTAL_PAGE, x.EXCEPTION, x.GROUP_NO, x.CREATE_DATETIME, x.START_DATETIME, x.END_DATETIME
858
                     , x.ORIGINAL_FILE, x.CONVERT_PATH, MarkusLink);
859

    
860
                if (collection.Count() == 0)
861
                {
862
                    if (statusCodeTypeList.Count() == 1)
863
                    {
864
                        foreach (var x in Listitems)
865
                        {
866
                            collection.Add(x);
867
                        }
868
                    }
869
                }
870
                else
871
                {
872
                    foreach (var newitem in Listitems)
873
                    {
874
                        collection.UpdateWhere(changeitem =>
875
                        ConvertItemEx.ChangeValues(changeitem, newitem), x => x.ProjectNumber == newitem.ProjectNumber && x.ConvertID == newitem.ConvertID);
876
                    }
877

    
878
                    if (statusCodeTypeList.Count() == 1)
879
                    {
880
                        for (int i = collection.Count() - 1; i >= 0; --i)
881
                        {
882
                            var item = collection[i];
883

    
884
                            if (Listitems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
885
                            {
886
                                collection.RemoveAt(i);
887
                            }
888
                        }
889
                    }
890

    
891
                    if (statusCodeTypeList.Count() == 1)
892
                    {
893
                        foreach (var item in Listitems)
894
                        {
895
                            if (collection.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
896
                            {
897
                                for (int i = 0; i < 200; i++)
898
                                {
899
                                    if (i < collection.Count() - 1)
900
                                    {
901
                                        if (DateTime.Compare(collection[i].CreateTime, item.CreateTime) < 0)
902
                                        {
903
                                            collection.Insert(i, item);
904
                                            break;
905
                                        }
906
                                    }
907
                                    else
908
                                    {
909
                                        collection.Add(item);
910
                                        break;
911
                                    }
912
                                }
913

    
914
                            }
915

    
916
                        }
917
                    }
918
                }
919
            }
920
            catch (Exception ex)
921
            {
922
                MessageBox.Show(ex.ToString());
923
                System.Diagnostics.Debug.WriteLine(ex.ToString());
924
            }
925
        }
926

    
927
        private async void DataSearch(IEnumerable<StatusCodeType> statusCodeTypeList, System.Collections.ObjectModel.ObservableCollection<FinalPDF> collection)
928
        {
929
            try
930
            {
931
                int _status = 0;
932
                if (SelectedStatus != null)
933
                {
934
                    _status = (int)SelectedStatus.Value;
935
                }
936

    
937
                DateTime? Start_CreateTime = null;
938
                DateTime? Finish_CreateTime = null;
939
                if (SelectedCreateTimeBegin != DefaultCreateTime)
940
                {
941
                    Start_CreateTime = SelectedCreateTimeBegin;
942
                }
943
                if (SelectedCreateTimeEnd != DefaultCreateTime)
944
                {
945
                    Finish_CreateTime = SelectedCreateTimeEnd;
946
                }
947

    
948
                if (ProjectNames.Count() == 0)
949
                {
950
                    foreach (var x in await WcfClient.GET_SELECT_RUN_PROJECTSAsync(0))
951
                    {
952
                        ProjectName projectName = new ProjectName(x.PROJECT_NO, x.PROJECT_NAME);
953
                        ProjectNames.Add(projectName);
954
                    }
955
                }
956

    
957
                var Listitems = from x in await WcfClient.GET_SELECT_FINAL_PDF_ITEMAsync(null, ProjectNumberFilter.Project_NO, DocumentIDFilter, MarkupInfo_IDFilter, DOCINFO_IDFilter, Document_NameFilter, Document_NOFilter,
958
                    CreateUser_IDFilter, _status, SelectedCount.ValueMember, GROUP_NOFilter, REVISIONFilter, Start_CreateTime, Finish_CreateTime, null, null, null, null, Document_URLFilter, ExcptionCheck)
959
                                let MarkusLink = "kcom://" + CreateMarkusParam(x.ID, x.DOCUMENT_ID, "doftech")
960
                                select new FinalPDF(x.ID, x.PROJECT_NO, x.STATUS, x.DOCUMENT_ID, x.MARKUPINFO_ID, x.DOCINFO_ID, x.DOCUMENT_NAME, x.DOCUMENT_NO, x.CREATE_USER_ID,
961
                                    x.REVISION, x.CURRENT_PAGE, x.TOTAL_PAGE, x.EXCEPTION, x.GROUP_NO, x.CREATE_DATETIME, x.START_DATETIME, x.END_DATETIME
962
                                 , x.ORIGINAL_FILE, x.CONVERT_PATH, MarkusLink);
963

    
964
                if (collection.Count() == 0)
965
                {
966
                    if (statusCodeTypeList.Count() == 1)
967
                    {
968
                        foreach (var x in Listitems)
969
                        {
970
                            collection.Add(x);
971
                        }
972
                    }
973
                }
974
                else
975
                {
976
                    foreach (var newitem in Listitems)
977
                    {
978
                        collection.UpdateWhere(changeitem =>
979
                        ConvertItemEx.ChangeValues(changeitem, newitem), x => x.ProjectNumber == newitem.ProjectNumber && x.ConvertID == newitem.ConvertID);
980
                    }
981

    
982
                    if (statusCodeTypeList.Count() == 1)
983
                    {
984

    
985
                        for (int i = collection.Count() - 1; i >= 0; --i)
986
                        {
987
                            var item = collection[i];
988

    
989
                            if (Listitems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
990
                            {
991
                                collection.RemoveAt(i);
992
                            }
993
                        }
994
                    }
995

    
996
                    if (statusCodeTypeList.Count() == 1)
997
                    {
998
                        foreach (var item in Listitems)
999
                        {
1000
                            if (collection.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
1001
                            {
1002
                                for (int i = 0; i < 200; i++)
1003
                                {
1004
                                    if (i < collection.Count() - 1)
1005
                                    {
1006
                                        if (DateTime.Compare(collection[i].CreateTime, item.CreateTime) < 0)
1007
                                        {
1008
                                            collection.Insert(i, item);
1009
                                            break;
1010
                                        }
1011
                                    }
1012
                                    else
1013
                                    {
1014
                                        collection.Add(item);
1015
                                        break;
1016
                                    }
1017
                                }
1018

    
1019
                            }
1020

    
1021
                        }
1022
                    }
1023

    
1024
                }
1025
            }
1026
            catch (Exception ex)
1027
            {
1028
                MessageBox.Show(ex.ToString());
1029
                System.Diagnostics.Debug.WriteLine(ex.ToString());
1030
            }
1031
        }
1032
        /// <summary>
1033
        /// 서비스의 실시간 컨버터 Item
1034
        /// </summary>
1035
        private async void AliveDataSelect()
1036
        {
1037
            try
1038
            {
1039
                List<FinalPDF> newitems = new List<FinalPDF>();
1040
                foreach (var client in App.StationClientList)
1041
                {
1042
                    if (await SimplePingAsync(client.Endpoint.Address.ToString()))
1043
                    {
1044
                        try
1045
                        {
1046
                            List<FinalPDF> itemsToList = new List<FinalPDF>();
1047
                            var items = await client.AliveConvertListAsync();
1048
                            string result = "";
1049

    
1050
                            foreach (var item in items)
1051
                            {
1052
                                FinalPDF itemsToEach = new FinalPDF();
1053
                                itemsToEach.ConvertID = item.ConvertID;
1054
                                itemsToEach.ProjectNumber = item.ProjectNumber;
1055

    
1056
                                var MarkusLink = "kcom://" + CreateMarkusParam(item.ProjectNumber, item.DocumentID, "doftech");
1057

    
1058
                                if (item.ConvertState != null)
1059
                                {
1060
                                    itemsToEach.ConvertState = (StatusCodeType)Enum.Parse(typeof(StatusCodeType), item.ConvertState);
1061
                                }
1062

    
1063
                                if (item.OriginfilePath.Contains("/"))
1064
                                {
1065
                                    result = item.OriginfilePath.Substring(item.OriginfilePath.LastIndexOf("/") + 1);
1066
                                }
1067
                                else
1068
                                {
1069
                                    result = item.OriginfilePath.Substring(item.OriginfilePath.LastIndexOf("%") + 1);
1070
                                }
1071
                                itemsToEach.FileName = result;
1072

    
1073
                                itemsToEach.CurrentPageNo = item.CurrentPageNo;
1074
                                itemsToEach.TotalPage = item.TotalPage;
1075
                                itemsToEach.OriginfilePath = item.OriginfilePath;
1076
                                itemsToEach.ConvertPath = item.ConvertPath;
1077
                                itemsToEach.MarkusLink = MarkusLink;
1078
                                itemsToEach.DocumentID = item.DocumentID;
1079
                                itemsToEach.GroupNo = item.GroupNo;
1080
                                itemsToEach.DocumentName = item.DocumnetName;
1081
                                itemsToEach.Revision = item.Revision;
1082
                                itemsToEach.Exception = item.Exception;
1083
                                itemsToEach.ConvertPath = item.ConvertPath;
1084
                                itemsToEach.CreateTime = item.CreateTime;
1085
                                itemsToEach.StartTime = item.StartTime;
1086
                                itemsToEach.EndTime = item.EndTime;
1087

    
1088
                                itemsToList.Add(itemsToEach);
1089
                            }
1090
                            newitems.AddRange(itemsToList);
1091
                            System.Diagnostics.Trace.WriteLine($"{client.Endpoint.Address} ping");
1092

    
1093
                            if (items.Count() == 0)
1094
                            {
1095
                                System.Diagnostics.Trace.WriteLine($"{client.Endpoint.Address} Alive Items is zero.");
1096
                            }
1097
                        }
1098
                        catch (Exception ex)
1099
                        {
1100
                            System.Diagnostics.Trace.Fail($"{client.Endpoint.Address} {ex.Message}");
1101
                        }
1102
                    }
1103
                    else
1104
                    {
1105
                        System.Diagnostics.Trace.Fail($"{client.Endpoint.Address} ping Error");
1106
                    }
1107

    
1108
                }
1109
                ItemsUpdate(newitems);
1110
                await System.Windows.Application.Current.Dispatcher.InvokeAsync(() => ItemsUpdate(newitems));
1111
            }
1112
            catch (Exception ex)
1113
            {
1114
                System.Diagnostics.Debug.WriteLine(ex.ToString());
1115
            }
1116
        }
1117

    
1118
        /// <summary>
1119
        /// AliveDataSelect의 Data Update
1120
        /// </summary>
1121
        /// <param name = "newitems" ></ param >
1122
        private void ItemsUpdate(List<FinalPDF> newitems)
1123
        {
1124

    
1125
            foreach (var item in newitems)
1126
            {
1127
                item.OriginfilePath = HttpUtility.UrlDecode(item.OriginfilePath);
1128
            }
1129

    
1130
            if (AliveItems == null)
1131
            {
1132
                AliveItems = new System.Collections.ObjectModel.ObservableCollection<FinalPDF>();
1133

    
1134
                foreach (var item in newitems)
1135
                {
1136
                    AliveItems.Add(item);
1137
                }
1138
            }
1139
            else
1140
            {
1141
                newitems.ForEach(newitem =>
1142
                {
1143
                    AliveItems.UpdateWhere(changeitem => ConvertItemEx.ChangeValues(changeitem, newitem), x => x.ProjectNumber == newitem.ProjectNumber && x.ConvertID == newitem.ConvertID);
1144
                });
1145

    
1146
                foreach (var item in newitems)
1147
                {
1148
                    if (AliveItems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
1149
                    {
1150
                        AliveItems.Add(item);
1151
                    }
1152
                }
1153

    
1154
                for (int i = AliveItems.Count() - 1; i > -1; --i)
1155
                {
1156
                    var item = AliveItems[i];
1157

    
1158
                    if (newitems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
1159
                    {
1160
                        try
1161
                        {
1162
                            AliveItems.RemoveAt(i);
1163
                        }
1164
                        catch (Exception ex)
1165
                        {
1166
                            System.Diagnostics.Debug.WriteLine(ex.ToString());
1167
                        }
1168
                    }
1169
                }
1170
            }
1171

    
1172
            if (AliveItems.Count() > 1)
1173
            {
1174
                AliveShow = true;
1175
            }
1176

    
1177
            Alive_Height = 80 + (newitems.Count() * 10);
1178
            DataBase_ItemsHeight = 800 - (RealConvert_Height + Alive_Height);
1179
        }
1180

    
1181

    
1182
        public static async Task<bool> SimplePingAsync(string uri)
1183
        {
1184
            bool result = false;
1185

    
1186
            try
1187
            {
1188
                using (System.Net.Http.HttpClient Client = new System.Net.Http.HttpClient())
1189
                {
1190
                    Client.Timeout = new TimeSpan(0, 0, 60);
1191

    
1192
                    var message = await Client.GetAsync(uri);
1193

    
1194
                    System.Net.HttpStatusCode StatusCode = message.StatusCode;
1195

    
1196
                    switch (StatusCode)
1197
                    {
1198

    
1199
                        case System.Net.HttpStatusCode.Accepted:
1200
                        case System.Net.HttpStatusCode.OK:
1201
                            result = true;
1202
                            break;
1203
                    }
1204
                }
1205
            }
1206
            catch (Exception ex)
1207
            {
1208
                result = false;
1209
                System.Diagnostics.Debug.WriteLine(ex.ToString());
1210
            }
1211

    
1212
            return result;
1213
        }
1214

    
1215
        #endregion
1216

    
1217
        #region Data Convert
1218

    
1219
        private async void DataConvert(object obj)
1220
        {
1221
            if (SelectFilterConvert == null && SelectRealConvert == null)
1222
            {
1223
                MessageBox.Show("왼쪽 버튼 클릭 후 Converter 해주세요!");
1224
            }
1225
            else
1226
            {
1227
                var resultRealConvert = 0;
1228
                var resultFiltertConvert = 0;
1229

    
1230
                if (SelectRealConvert != null)
1231
                {
1232
                    resultRealConvert = SetCleanUpItem(SelectRealConvert).Result;
1233
                }
1234
                else if (SelectFilterConvert != null)
1235
                {
1236
                    resultFiltertConvert = SetCleanUpItem(SelectFilterConvert).Result;
1237
                }
1238
                System.Diagnostics.Debug.WriteLine(resultRealConvert + "  " + resultFiltertConvert);
1239

    
1240
                var items = from x in await WcfClient.GET_SELECT_FINAL_PDF_ITEMAsync(SelectFilterConvert.ConvertID, null, null, null, null, null, null, null, null, 1, null, null, null, null, null, null, null, null, null, null)
1241
                            let MarkusLink = "kcom://" + CreateMarkusParam(x.ID, x.DOCUMENT_ID, "doftech")
1242
                            select new FinalPDF(x.ID, x.PROJECT_NO, x.STATUS, x.DOCUMENT_ID, x.MARKUPINFO_ID, x.DOCINFO_ID, x.DOCUMENT_NAME, x.DOCUMENT_NO, x.CREATE_USER_ID,
1243
                        x.REVISION, x.CURRENT_PAGE, x.TOTAL_PAGE, x.EXCEPTION, x.GROUP_NO, x.CREATE_DATETIME, x.START_DATETIME, x.END_DATETIME
1244
                     , x.ORIGINAL_FILE, x.CONVERT_PATH, MarkusLink);
1245

    
1246

    
1247
                foreach (var item in items)
1248
                {
1249

    
1250
                    RealConvertSource.Add(item);
1251

    
1252
                    if (RealConvertSource.Count() == 1)
1253
                    {
1254
                        ConvertShow = true;
1255
                    }
1256
                }
1257
            }
1258
        }
1259

    
1260

    
1261
        public async Task<int> SetCleanUpItem(FinalPDF _ConvertItem)
1262
        {
1263
            int result = 0;
1264

    
1265
            var items = await WcfClient.GET_SELECT_FINAL_PDF_ITEMAsync(_ConvertItem.ConvertID, null, null, null, null, null, null, null, null, 1, null, null, null, null, null, null, null, null, null, null);
1266

    
1267
            if (items.Count() > 0)
1268
            {
1269
                var item = items.First();
1270

    
1271
                var _CREATE_DATETIME = DateTime.Now;
1272
                var _STATUS = (int)StatusCodeType.None;
1273

    
1274
                await WcfClient.GET_SELECT_RERECONVERT_ITEMAsync(_ConvertItem.ConvertID, 0, _CREATE_DATETIME, _STATUS, null);
1275

    
1276
            }
1277

    
1278
            return result;
1279
        }
1280

    
1281
        public static string CreateMarkusParam(string projectNo, string documentID, string userID)
1282
        {
1283
            ViewInfo viewInfo = new ViewInfo();
1284

    
1285
            viewInfo.DocumentItemID = documentID;
1286
            viewInfo.ProjectNO = projectNo;
1287
            viewInfo.UserID = userID;
1288

    
1289
            return ParamEncoding(JsonConvert.SerializeObject(viewInfo));
1290

    
1291
        }
1292

    
1293
        public static string ParamEncoding(string EncodingText, System.Text.Encoding oEncoding = null)
1294
        {
1295

    
1296
            if (oEncoding == null)
1297
                oEncoding = System.Text.Encoding.UTF8;
1298

    
1299
            return Convert.ToBase64String(oEncoding.GetBytes(EncodingText));
1300

    
1301
        }
1302

    
1303
        #endregion
1304

    
1305
        #region Validation
1306

    
1307
        private void DataValidate(object obj)
1308
        {
1309

    
1310
            bool result = false;
1311

    
1312
            WebRequest webRequest = WebRequest.Create(SelectFilterConvert.OriginfilePath);
1313
            webRequest.Timeout = 1200; // miliseconds
1314
            webRequest.Method = "HEAD";
1315

    
1316
            HttpWebResponse response = null;
1317

    
1318
            try
1319
            {
1320
                response = (HttpWebResponse)webRequest.GetResponse();
1321
                result = true;
1322
            }
1323
            catch (WebException webException)
1324
            {
1325
                MessageBox.Show(SelectFilterConvert.FileName + " doesn't exist: " + webException.Message);
1326
                result = true;
1327
            }
1328
            finally
1329
            {
1330
                if (response != null)
1331
                {
1332
                    response.Close();
1333
                }
1334
            }
1335
            if (result == true)
1336
            {
1337
                MessageBox.Show("File exists");
1338
            }
1339
        }
1340

    
1341
        #endregion
1342

    
1343
        #region DataFilter
1344

    
1345
        public void DataFilter(object obj)
1346
        {
1347
            dispatcherTimer.Tick -= new EventHandler(Timer_Tick);
1348
            dispatcherTimer.Tick += new EventHandler(SearchTimer_Tick);
1349
        }
1350

    
1351
        #endregion
1352

    
1353
        #region MarkusLink
1354

    
1355
        private void MarkusLink(object obj)///여기서 부터 
1356
        {
1357
            if (obj is FinalPDF)
1358
            {
1359
                if (obj != null)
1360
                {
1361
                    var convertitem = obj as FinalPDF;
1362

    
1363
                    SelectFilterConvertList.Add(convertitem);
1364

    
1365
                    SelectRealConvert = convertitem;
1366

    
1367
                    ProcessStartInfo startInfo = null;
1368

    
1369
                    startInfo = new ProcessStartInfo("iexplore.exe", convertitem.MarkusLink);
1370

    
1371
                    Process.Start(startInfo);
1372
                }
1373
            }
1374
        }
1375

    
1376
        #endregion
1377

    
1378
        #region Data Delete
1379

    
1380
        private void DataDelete(object obj)
1381
        {
1382
            RadWindow.Alert("do you want to delete it??", this.OnClosed);
1383
        }
1384

    
1385
        private async void OnClosed(object sender, WindowClosedEventArgs e)
1386
        {
1387
            var result = e.DialogResult;
1388
            if (result == true)
1389
            {
1390
                if (SelectFilterConvertList.Count() > 1)
1391
                {
1392
                    MessageBox.Show("하나만 클릭해 주세요!");
1393
                }
1394
                else
1395
                {
1396
                    if (SelectRealConvert != null)
1397
                    {
1398
                        await WcfClient.GET_SELECT_CONVERT_DELETEAsync(SelectRealConvert.ConvertID);
1399
                    }
1400
                    if (SelectFilterConvertList != null)
1401
                    {
1402
                        await WcfClient.GET_SELECT_CONVERT_DELETEAsync(SelectFilterConvertList[0].ConvertID);
1403
                    }
1404
                }
1405
            }
1406
        }
1407

    
1408

    
1409
        #endregion
1410

    
1411
        #region Data Export
1412

    
1413

    
1414
        /// <summary>
1415
        /// 필터된 상단 그리드 엑셀로 출력
1416
        /// </summary>
1417

    
1418
        public void DataExportData(object obj)
1419
        {
1420
            dispatcherTimer.Tick -= new EventHandler(Timer_Tick);
1421

    
1422
            Return_FilterConvertSource(FilterConvertSource);
1423

    
1424
            Views.FinalPDFExcelDialog finalPDFExcelDialog = new Views.FinalPDFExcelDialog();
1425

    
1426
            finalPDFExcelDialog.Owner = Application.Current.MainWindow;
1427
            finalPDFExcelDialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;
1428

    
1429
            finalPDFExcelDialog.ShowDialog();
1430

    
1431

    
1432
            dispatcherTimer.Tick += new EventHandler(Timer_Tick);
1433
        }
1434

    
1435
        #endregion
1436

    
1437
        #region Data Search
1438

    
1439
        public void RemoveCreateTimeFilter(object obj)
1440
        {
1441
            DefaultCreateTime = DateTime.Now;
1442
            SelectedCreateTimeBegin = DefaultCreateTime;
1443
            SelectedCreateTimeEnd = DefaultCreateTime;
1444

    
1445
        }
1446

    
1447
        #endregion
1448

    
1449
        #region Reset
1450

    
1451
        /// <summary>
1452
        /// 그리드 상단 원상복귀 버튼
1453
        /// 필터를 끝낸 후 다시 복귀
1454
        /// </summary>
1455

    
1456
        public void Reset(object obj)
1457
        {
1458
            ExcptionCheck = false;
1459
            SelectedInt = 10;
1460
            ProjectNumberFilter = ProjectNames[0];
1461
            DocumentIDFilter = null;
1462
            MarkupInfo_IDFilter = null;
1463
            DOCINFO_IDFilter = null;
1464
            Document_NameFilter = null;
1465
            Document_NOFilter = null;
1466
            CreateUser_IDFilter = null;
1467
            GROUP_NOFilter = null;
1468
            REVISIONFilter = null;
1469

    
1470
            DefaultCreateTime = DateTime.Now;
1471
            SelectedCreateTimeBegin = DefaultCreateTime;
1472
            SelectedCreateTimeEnd = DefaultCreateTime;
1473

    
1474
            dispatcherTimer.Tick -= new EventHandler(SearchTimer_Tick);
1475
            dispatcherTimer.Tick += new EventHandler(Timer_Tick);
1476

    
1477
        }
1478

    
1479
        #endregion
1480

    
1481

    
1482
        #region ConvertAddDialog
1483

    
1484
        /// <summary>
1485
        /// 그리드 상단 Conver 추가 버튼
1486
        /// ProjectNo, DocumentURL, DocumentID, 입력해서 저장 프로시저에서 추가 
1487
        /// </summary>
1488

    
1489
        public void ConverAdd(object obj)
1490
        {
1491
            dispatcherTimer.Tick -= new EventHandler(Timer_Tick);
1492

    
1493
            Views.FinalPDFAddDialog convertAddDialog = new Views.FinalPDFAddDialog();
1494

    
1495
            convertAddDialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;
1496

    
1497
            convertAddDialog.ShowDialog();
1498

    
1499
            dispatcherTimer.Tick += new EventHandler(Timer_Tick);
1500
        }
1501

    
1502
        #endregion
1503

    
1504

    
1505
        #region ConvertPathFileSearch
1506

    
1507
        /// <summary>
1508
        ///  ConvertPath 파일 탐색기로 열리는 아이콘
1509
        /// </summary>
1510

    
1511
        public void ConvertPathFileSearch(object obj)
1512
        {
1513
            if (obj is FinalPDF)
1514
            {
1515
                if (obj != null)
1516
                {
1517
                    var convertitem = obj as ConvertPDF;
1518

    
1519
                    SaveFileDialog saveFileDialog = new SaveFileDialog();
1520

    
1521
                    saveFileDialog.FileName = "Document"; // Default file name
1522
                    saveFileDialog.DefaultExt = ".txt"; // Default file extension
1523
                    saveFileDialog.Filter = "Csv documents (.Csv)|*.csv|Excel(2017~2019)Worksheets|*.xlsx"; // Filter files by extension
1524

    
1525

    
1526
                    if (saveFileDialog.ShowDialog() == true)
1527
                    {
1528
                    }
1529
                }
1530
            }
1531
        }
1532

    
1533
        #endregion
1534

    
1535

    
1536
        #endregion
1537
    }
1538
}
클립보드 이미지 추가 (최대 크기: 500 MB)