프로젝트

일반

사용자정보

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

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

이력 | 보기 | 이력해설 | 다운로드 (51.1 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 ConvertItem = Markus.Service.Interface.ConvertItem;
17
using System.Net;
18
using System.Windows.Threading;
19
using System.Diagnostics;
20
using System.Windows.Input;
21
using Markus.Mvvm.ToolKit;
22
using System.Windows.Data;
23
using System.Windows.Controls;
24
using System.IO;
25
using Newtonsoft.Json;
26
//using Markus.Service.Interface;
27
using static Markus.Service.StationController.Data.FinalPDF;
28
using System.Collections.ObjectModel;
29

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

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

    
53
        #endregion
54

    
55
        #region Properties
56

    
57
        DataService.DataServiceClient WcfClient = new DataService.DataServiceClient();
58

    
59

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

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

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

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

    
109
                return _FilterSearch;
110
            }
111
        }
112

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

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

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

    
151

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

    
163

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

    
178

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

    
190

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

    
202

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

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

    
230
                return _SelectedCountList;
231
            }
232
        }
233

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

    
245
        private FinalPDF _SelectRealConvert;
246
        public FinalPDF SelectRealConvert
247
        {
248
            get => _SelectRealConvert;
249
            set
250
            {
251
                _SelectRealConvert = value;
252
                OnPropertyChanged(() => SelectRealConvert);
253
            }
254
        }
255

    
256

    
257
        private FinalPDF _SelectAliveConvert;
258
        public FinalPDF SelectAliveConvert
259
        {
260
            get => _SelectAliveConvert;
261
            set
262
            {
263
                _SelectAliveConvert = value;
264
                OnPropertyChanged(() => SelectAliveConvert);
265
            }
266
        }
267

    
268

    
269
        private StatusTypeList _StatusType;
270
        public StatusTypeList StatusType
271
        {
272
            get => _StatusType;
273
            set
274
            {
275
                _StatusType = value;
276
                OnPropertyChanged(() => StatusType);
277
            }
278
        }
279

    
280
        private bool _IsLoading;
281
        public bool IsLoading
282
        {
283
            get => _IsLoading;
284
            set
285
            {
286
                if (_IsLoading != value)
287
                {
288
                    _IsLoading = value;
289
                    OnPropertyChanged(() => IsLoading);
290
                }
291
            }
292
        }
293

    
294
        IEnumerable<Telerik.Windows.Data.EnumMemberViewModel> _StatusCodeList;
295
        public IEnumerable<Telerik.Windows.Data.EnumMemberViewModel> StatusCodeList
296
        {
297
            get
298
            {
299
                if (_StatusCodeList == null)
300
                {
301
                    _StatusCodeList = Telerik.Windows.Data.EnumDataSource.FromType<StatusCodeType>();
302
                }
303

    
304
                return _StatusCodeList;
305
            }
306
        }
307

    
308
        public ProjectName _ProjectNumberFilter;
309
        public ProjectName ProjectNumberFilter
310
        {
311
            get
312
            {
313
                if (_ProjectNumberFilter == null)
314
                {
315
                    _ProjectNumberFilter = new ProjectName();
316
                }
317
                return _ProjectNumberFilter;
318
            }
319
            set
320
            {
321
                _ProjectNumberFilter = value;
322
                OnPropertyChanged(() => ProjectNumberFilter);
323
            }
324
        }
325

    
326
        public string _DocumentIDFilter;
327
        public string DocumentIDFilter
328
        {
329
            get
330
            {
331
                return _DocumentIDFilter;
332
            }
333
            set
334
            {
335
                if (_DocumentIDFilter == "")
336
                {
337
                    _DocumentIDFilter = null;
338
                }
339
                else if (_DocumentIDFilter != value)
340
                {
341
                    _DocumentIDFilter = value;
342
                    OnPropertyChanged(() => DocumentIDFilter);
343
                }
344
            }
345
        }
346

    
347
        public string _DOCINFO_IDFilter;
348
        public string DOCINFO_IDFilter
349
        {
350
            get
351
            {
352
                return _DOCINFO_IDFilter;
353
            }
354
            set
355
            {
356
                if (_DOCINFO_IDFilter == "")
357
                {
358
                    _DOCINFO_IDFilter = null;
359
                }
360
                else if (_DOCINFO_IDFilter != value)
361
                {
362
                    _DOCINFO_IDFilter = value;
363
                    OnPropertyChanged(() => DOCINFO_IDFilter);
364
                }
365
            }
366
        }
367

    
368
        public string _Document_URLFilter;
369
        public string Document_URLFilter
370
        {
371
            get
372
            {
373
                return _Document_URLFilter;
374
            }
375
            set
376
            {
377
                if (_Document_URLFilter != value)
378
                {
379
                    _Document_URLFilter = value;
380
                    OnPropertyChanged(() => Document_URLFilter);
381
                }
382
            }
383
        }
384

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

    
402
        public string _CreateUser_IDFilter;
403
        public string CreateUser_IDFilter
404
        {
405
            get
406
            {
407
                return _CreateUser_IDFilter;
408
            }
409
            set
410
            {
411
                if (_CreateUser_IDFilter == "")
412
                {
413
                    _CreateUser_IDFilter = null;
414
                }
415
                else if (_CreateUser_IDFilter != value)
416
                {
417
                    _CreateUser_IDFilter = value;
418
                    OnPropertyChanged(() => CreateUser_IDFilter);
419
                }
420
            }
421
        }
422

    
423
        public string _GROUP_NOFilter;
424
        public string GROUP_NOFilter
425
        {
426
            get
427
            {
428
                return _GROUP_NOFilter;
429
            }
430
            set
431
            {
432
                if (_GROUP_NOFilter == "")
433
                {
434
                    _GROUP_NOFilter = null;
435
                }
436
                else if (_GROUP_NOFilter != value)
437
                {
438
                    _GROUP_NOFilter = value;
439
                    OnPropertyChanged(() => GROUP_NOFilter);
440
                }
441
            }
442
        }
443

    
444
        public string _REVISIONFilter;
445
        public string REVISIONFilter
446
        {
447
            get
448
            {
449
                return _REVISIONFilter;
450
            }
451
            set
452
            {
453
                if (_REVISIONFilter == "")
454
                {
455
                    _REVISIONFilter = null;
456
                }
457
                else if (_REVISIONFilter != value)
458
                {
459
                    _REVISIONFilter = value;
460
                    OnPropertyChanged(() => REVISIONFilter);
461
                }
462
            }
463
        }
464

    
465
        public StatusCodeType _ConvertStateFilter;
466
        public StatusCodeType ConvertStateFilter
467
        {
468
            get { return _ConvertStateFilter; }
469
            set
470
            {
471
                if (_ConvertStateFilter != value)
472
                {
473
                    _ConvertStateFilter = value;
474
                    OnPropertyChanged(() => ConvertStateFilter);
475
                }
476
            }
477
        }
478

    
479
        public string _Document_NOFilter;
480
        public string Document_NOFilter
481
        {
482
            get { return _Document_NOFilter; }
483
            set
484
            {
485
                if (_Document_NOFilter == "")
486
                {
487
                    _Document_NOFilter = null;
488
                }
489
                else if (_Document_NOFilter != value)
490
                {
491
                    _Document_NOFilter = value;
492
                    OnPropertyChanged(() => Document_NOFilter);
493
                }
494
            }
495
        }
496

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

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

    
533

    
534
        static DateTime DefaultCreateTime = DateTime.Now;
535
        private DateTime _SelectedCreateTimeBegin = DefaultCreateTime;
536
        public DateTime SelectedCreateTimeBegin
537
        {
538

    
539
            get { return _SelectedCreateTimeBegin; }
540
            set
541
            {
542
                if (_SelectedCreateTimeBegin == value)
543
                    return;
544
                _SelectedCreateTimeBegin = value;
545
                OnPropertyChanged(() => SelectedCreateTimeBegin);
546

    
547
            }
548
        }
549

    
550
        private DateTime _SelectedCreateTimeEnd = DefaultCreateTime;
551
        public DateTime SelectedCreateTimeEnd
552
        {
553

    
554
            get { return _SelectedCreateTimeEnd; }
555
            set
556
            {
557
                if (_SelectedCreateTimeEnd == value)
558
                    return;
559
                _SelectedCreateTimeEnd = value;
560
                OnPropertyChanged(() => SelectedCreateTimeEnd);
561
            }
562
        }
563

    
564
        public int _DataBase_ItemsHeight = 800;
565
        public int DataBase_ItemsHeight
566
        {
567
            get { return _DataBase_ItemsHeight; }
568
            set
569
            {
570
                _DataBase_ItemsHeight = value;
571
                OnPropertyChanged(() => DataBase_ItemsHeight);
572
            }
573
        }
574

    
575

    
576
        public int _RealConvert_Height = 80;
577
        public int RealConvert_Height
578
        {
579
            get { return _RealConvert_Height; }
580
            set
581
            {
582
                _RealConvert_Height = value;
583
                OnPropertyChanged(() => RealConvert_Height);
584
            }
585
        }
586

    
587
        public int _Alive_Height = 80;
588
        public int Alive_Height
589
        {
590
            get { return _Alive_Height; }
591
            set
592
            {
593
                _Alive_Height = value;
594
                OnPropertyChanged(() => Alive_Height);
595
            }
596
        }
597

    
598
        public bool _ConvertShow;
599
        public bool ConvertShow
600
        {
601
            get => _ConvertShow;
602
            set
603
            {
604
                if (_ConvertShow = !value)
605
                {
606
                    _ConvertShow = false;
607
                }
608
                _ConvertShow = value;
609
                OnPropertyChanged(() => ConvertShow);
610
            }
611
        }
612

    
613

    
614
        private bool _ExcptionCheck = false;
615
        public bool ExcptionCheck
616
        {
617
            get
618
            {
619
                return _ExcptionCheck;
620
            }
621
            set
622
            {
623
                _ExcptionCheck = value;
624
                OnPropertyChanged(() => ExcptionCheck);
625
            }
626
        }
627

    
628
        #endregion
629

    
630
        #region Command
631

    
632
        public DelegateCommand ConvertCommand { get; private set; }
633
        public DelegateCommand DeleteCommand { get; private set; }
634
        public DelegateCommand ValidateCommand { get; private set; }
635
        public DelegateCommand DataSaveFileGemBoxCommand { get; private set; }
636
        public DelegateCommand MarkusLinkCommand { get; private set; }
637
        public DelegateCommand RemoveCreateTimeFilterCommand { get; private set; }
638

    
639
        public DelegateCommand DataFilterCommand { get; private set; }
640
        public DelegateCommand ResetCommand { get; private set; }
641
        public DelegateCommand ConverAddCommand { get; private set; }
642
        public DelegateCommand ConvertPathFileSearchCommand { get; private set; }
643

    
644
        #endregion
645

    
646
        #region Main Logic
647

    
648
        /// <summary>
649
        /// 각각의 Grid row 객체들 업데이트
650
        /// </summary>
651

    
652
        private DispatcherTimer dispatcherTimer;
653
        public override void Loaded()
654
        {
655
            base.Loaded();
656

    
657
            if (!App.IsDesignMode)
658
            {
659
                dispatcherTimer = new DispatcherTimer();
660
                dispatcherTimer.Tick += new EventHandler(Timer_Tick);
661
                dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
662
                dispatcherTimer.Start();
663
            }
664
        }
665

    
666
        private async void Timer_Tick(object sender, EventArgs e)
667
        {
668
            dispatcherTimer.Stop();
669

    
670
            if (IsAcitve)
671
            {
672
                await App.Current.Dispatcher.InvokeAsync(() =>
673
                {
674
                    DataSelect();
675

    
676
                    AliveDataSelect();
677
                });
678
            }
679

    
680
            await Task.Delay(5000);
681

    
682
            System.Threading.Thread.Sleep(new TimeSpan(0, 0, 0, 0, 100));
683

    
684
            dispatcherTimer.Start();
685
        }
686

    
687
        private async void SearchTimer_Tick(object sender, EventArgs e)
688
        {
689
            dispatcherTimer.Stop();
690

    
691
            if (IsAcitve)
692
            {
693
                await App.Current.Dispatcher.InvokeAsync(() =>
694
                {
695
                    DataSearch(new[] { (StatusCodeType)(SelectedStatus.Value) }, FilterConvertSource);
696

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

    
699
                    AliveDataSelect();
700
                });
701
            }
702

    
703
            await Task.Delay(5000);
704
            //await Task.Delay(10000);
705

    
706
            //System.Threading.Thread.Sleep(new TimeSpan(0,0,0,0,100));
707

    
708
            dispatcherTimer.Start();
709
        }
710

    
711

    
712
        public override void Closed()
713
        {
714
            if (dispatcherTimer != null)
715
            {
716
                dispatcherTimer.Stop();
717
            }
718

    
719
            base.Closed();
720
        }
721

    
722

    
723
        #endregion
724

    
725
        #region Function
726

    
727
        #region Return_FilterConvertSource
728

    
729
        public static void Return_FilterConvertSource(ObservableCollection<FinalPDF> convertPDFs)
730
        {
731
            ConvertSource = new ObservableCollection<FinalPDF>();
732
            ConvertSource = convertPDFs;
733
        }
734

    
735
        public static ObservableCollection<FinalPDF> Return_FilterConvertSource()
736
        {
737
            return ConvertSource;
738
        }
739

    
740

    
741
        #endregion
742

    
743

    
744
        #region Data Select
745

    
746
        /// <summary>
747
        /// 상단 그리드 중앙 그리드 출력 데이터
748
        /// </summary>
749
        private void DataSelect()
750
        {
751

    
752
            if (FilterConvertSource == null)
753
            {
754
                FilterConvertSource = new System.Collections.ObjectModel.ObservableCollection<FinalPDF>();
755
            }
756

    
757
            if (RealConvertSource == null)
758
            {
759
                RealConvertSource = new System.Collections.ObjectModel.ObservableCollection<FinalPDF>();
760
            }
761

    
762
            /// combobox 에서 선택된 items
763
            if (SelectedStatus != null)
764
            {
765
                DataSelect(new[] { (StatusCodeType)(SelectedStatus.Value) }, FilterConvertSource);
766
            }
767

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

    
771
        }
772

    
773
        private async void RealDataSelect(IEnumerable<StatusCodeType> statusCodeTypeList, System.Collections.ObjectModel.ObservableCollection<FinalPDF> collection)
774
        {
775
            try
776
            {
777
                IEnumerable<FinalPDF> Listitems = Enumerable.Empty<FinalPDF>();
778

    
779
                foreach (var coll in collection)
780
                {
781
                   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)
782
                                let MarkusLink = "kcom://" + CreateMarkusParam(x.PROJECT_NO, x.DOCUMENT_ID, "doftech")
783
                                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,
784
                            x.TOTAL_PAGE, x.EXCEPTION, x.GROUP_NO, x.CREATE_DATETIME, x.START_DATETIME, x.END_DATETIME, x.ORIGINAL_FILE, x.CONVERT_PATH, MarkusLink);
785

    
786
                }
787

    
788
                foreach (var Listitem in Listitems)
789
                {
790
                    collection.UpdateWhere(changeitem =>
791
                    ConvertItemEx.ChangeValues(changeitem, Listitem), x => x.ProjectNumber == Listitem.ProjectNumber && x.ConvertID == Listitem.ConvertID);
792
                }
793

    
794
                RealConvert_Height = 80 + (10 * collection.Count());
795
                DataBase_ItemsHeight = 800 - (RealConvert_Height + Alive_Height);
796
            }
797
            catch (Exception ex)
798
            {
799
                MessageBox.Show(ex.ToString());
800
            }
801
        }
802

    
803
        private async void DataSelect(IEnumerable<StatusCodeType> statusCodeTypeList, System.Collections.ObjectModel.ObservableCollection<FinalPDF> collection)
804
        {
805
            try
806
            {
807
                int _status = 0;
808
                if (SelectedStatus != null)
809
                {
810
                    _status = (int)SelectedStatus.Value;
811
                }
812

    
813
                if (ProjectNames.Count() == 0)
814
                {
815
                    ProjectName Clear = new ProjectName("Clear", "Clear");
816
                    ProjectNames.Add(Clear);
817
                    foreach (var x in await WcfClient.GET_SELECT_RUN_PROJECTSAsync(0))
818
                    {
819
                        ProjectName projectName = new ProjectName(x.PROJECT_NO, x.PROJECT_NAME);
820
                        ProjectNames.Add(projectName);
821
                    }
822
                }
823

    
824
                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)
825
                                let MarkusLink = "kcom://" + CreateMarkusParam(x.ID, x.DOCUMENT_ID, "doftech")
826
                                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,
827
                        x.REVISION, x.CURRENT_PAGE, x.TOTAL_PAGE, x.EXCEPTION, x.GROUP_NO, x.CREATE_DATETIME, x.START_DATETIME, x.END_DATETIME
828
                     , x.ORIGINAL_FILE, x.CONVERT_PATH, MarkusLink);
829

    
830
                if (collection.Count() == 0)
831
                {
832
                    if (statusCodeTypeList.Count() == 1)
833
                    {
834
                        foreach (var x in Listitems)
835
                        {
836
                            collection.Add(x);
837
                        }
838
                    }
839
                }
840
                else
841
                {
842
                    foreach (var newitem in Listitems)
843
                    {
844
                        collection.UpdateWhere(changeitem =>
845
                        ConvertItemEx.ChangeValues(changeitem, newitem), x => x.ProjectNumber == newitem.ProjectNumber && x.ConvertID == newitem.ConvertID);
846
                    }
847

    
848
                    if (statusCodeTypeList.Count() == 1)
849
                    {
850
                        for (int i = collection.Count() - 1; i >= 0; --i)
851
                        {
852
                            var item = collection[i];
853

    
854
                            if (Listitems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
855
                            {
856
                                collection.RemoveAt(i);
857
                            }
858
                        }
859
                    }
860

    
861
                    if (statusCodeTypeList.Count() == 1)
862
                    {
863
                        foreach (var item in Listitems)
864
                        {
865
                            if (collection.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
866
                            {
867
                                for (int i = 0; i < 200; i++)
868
                                {
869
                                    if (i < collection.Count() - 1)
870
                                    {
871
                                        if (DateTime.Compare(collection[i].CreateTime, item.CreateTime) < 0)
872
                                        {
873
                                            collection.Insert(i, item);
874
                                            break;
875
                                        }
876
                                    }
877
                                    else
878
                                    {
879
                                        collection.Add(item);
880
                                        break;
881
                                    }
882
                                }
883

    
884
                            }
885

    
886
                        }
887
                    }
888
                }
889
            }
890
            catch (Exception ex)
891
            {
892
                MessageBox.Show(ex.ToString());
893
                System.Diagnostics.Debug.WriteLine(ex.ToString());
894
            }
895
        }
896

    
897
        private async void DataSearch(IEnumerable<StatusCodeType> statusCodeTypeList, System.Collections.ObjectModel.ObservableCollection<FinalPDF> collection)
898
        {
899
            try
900
            {
901
                int _status = 0;
902
                if (SelectedStatus != null)
903
                {
904
                    _status = (int)SelectedStatus.Value;
905
                }
906

    
907
                DateTime? Start_CreateTime = null;
908
                DateTime? Finish_CreateTime = null;
909
                if (SelectedCreateTimeBegin != DefaultCreateTime)
910
                {
911
                    Start_CreateTime = SelectedCreateTimeBegin;
912
                }
913
                if (SelectedCreateTimeEnd != DefaultCreateTime)
914
                {
915
                    Finish_CreateTime = SelectedCreateTimeEnd;
916
                }
917

    
918
                if (ProjectNames.Count() == 0)
919
                {
920
                    foreach (var x in await WcfClient.GET_SELECT_RUN_PROJECTSAsync(0))
921
                    {
922
                        ProjectName projectName = new ProjectName(x.PROJECT_NO, x.PROJECT_NAME);
923
                        ProjectNames.Add(projectName);
924
                    }
925
                }
926

    
927
                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,
928
                    CreateUser_IDFilter, _status, SelectedCount.ValueMember, GROUP_NOFilter, REVISIONFilter, Start_CreateTime, Finish_CreateTime, null, null, null, null, Document_URLFilter, ExcptionCheck)
929
                                let MarkusLink = "kcom://" + CreateMarkusParam(x.ID, x.DOCUMENT_ID, "doftech")
930
                                select new FinalPDF(x.ID, x.PROJECT_NO, _status, x.DOCUMENT_ID, x.MARKUPINFO_ID, x.DOCINFO_ID, x.DOCUMENT_NAME, x.DOCUMENT_NO, x.CREATE_USER_ID,
931
                                    x.REVISION, x.CURRENT_PAGE, x.TOTAL_PAGE, x.EXCEPTION, x.GROUP_NO, x.CREATE_DATETIME, x.START_DATETIME, x.END_DATETIME
932
                                 , x.ORIGINAL_FILE, x.CONVERT_PATH, MarkusLink);
933

    
934
                if (collection.Count() == 0)
935
                {
936
                    if (statusCodeTypeList.Count() == 1)
937
                    {
938
                        foreach (var x in Listitems)
939
                        {
940
                            collection.Add(x);
941
                        }
942
                    }
943
                }
944
                else
945
                {
946
                    foreach (var newitem in Listitems)
947
                    {
948
                        collection.UpdateWhere(changeitem =>
949
                        ConvertItemEx.ChangeValues(changeitem, newitem), x => x.ProjectNumber == newitem.ProjectNumber && x.ConvertID == newitem.ConvertID);
950
                    }
951

    
952
                    if (statusCodeTypeList.Count() == 1)
953
                    {
954

    
955
                        for (int i = collection.Count() - 1; i >= 0; --i)
956
                        {
957
                            var item = collection[i];
958

    
959
                            if (Listitems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
960
                            {
961
                                collection.RemoveAt(i);
962
                            }
963
                        }
964
                    }
965

    
966
                    if (statusCodeTypeList.Count() == 1)
967
                    {
968
                        foreach (var item in Listitems)
969
                        {
970
                            if (collection.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
971
                            {
972
                                for (int i = 0; i < 200; i++)
973
                                {
974
                                    if (i < collection.Count() - 1)
975
                                    {
976
                                        if (DateTime.Compare(collection[i].CreateTime, item.CreateTime) < 0)
977
                                        {
978
                                            collection.Insert(i, item);
979
                                            break;
980
                                        }
981
                                    }
982
                                    else
983
                                    {
984
                                        collection.Add(item);
985
                                        break;
986
                                    }
987
                                }
988

    
989
                            }
990

    
991
                        }
992
                    }
993

    
994
                }
995
            }
996
            catch (Exception ex)
997
            {
998
                MessageBox.Show(ex.ToString());
999
                System.Diagnostics.Debug.WriteLine(ex.ToString());
1000
            }
1001
        }
1002
        /// <summary>
1003
        /// 서비스의 실시간 컨버터 Item
1004
        /// </summary>
1005
        private async void AliveDataSelect()
1006
        {
1007
            try
1008
            {
1009
                List<FinalPDF> newitems = new List<FinalPDF>();
1010
                foreach (var client in App.StationClientList)
1011
                {
1012
                    if (await SimplePingAsync(client.Endpoint.Address.ToString()))
1013
                    {
1014
                        try
1015
                        {
1016
                            List<FinalPDF> itemsToList = new List<FinalPDF>();
1017
                            var items = await client.AliveConvertListAsync();
1018
                            string result = "";
1019

    
1020
                            foreach (var item in items)
1021
                            {
1022
                                FinalPDF itemsToEach = new FinalPDF();
1023
                                itemsToEach.ConvertID = item.ConvertID;
1024
                                itemsToEach.ProjectNumber = item.ProjectNumber;
1025

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

    
1028
                                //var convertpath = GetSearchConvertPathAndMarkus(item.ProjectNumber, item.UniqueKey);
1029

    
1030
                                if (item.ConvertState != null)
1031
                                {
1032
                                    itemsToEach.ConvertState = (StatusCodeType)Enum.Parse(typeof(StatusCodeType), item.ConvertState);
1033
                                }
1034

    
1035
                                if (item.OriginfilePath.Contains("/"))
1036
                                {
1037
                                    result = item.OriginfilePath.Substring(item.OriginfilePath.LastIndexOf("/") + 1);
1038
                                }
1039
                                else
1040
                                {
1041
                                    result = item.OriginfilePath.Substring(item.OriginfilePath.LastIndexOf("%") + 1);
1042
                                }
1043
                                itemsToEach.FileName = result;
1044

    
1045
                                itemsToEach.CurrentPageNo = item.CurrentPageNo;
1046
                                itemsToEach.TotalPage = item.TotalPage;
1047
                                itemsToEach.OriginfilePath = item.OriginfilePath;
1048
                                itemsToEach.ConvertPath = item.ConvertPath;
1049
                                itemsToEach.MarkusLink = MarkusLink;
1050
                                itemsToEach.DocumentID = item.DocumentID;
1051
                                itemsToEach.GroupNo = item.GroupNo;
1052
                                itemsToEach.DocumentName = item.DocumnetName;
1053
                                itemsToEach.Revision = item.Revision;
1054
                                itemsToEach.Exception = item.Exception;
1055
                                itemsToEach.ConvertPath = item.ConvertPath;
1056
                                itemsToEach.CreateTime = item.CreateTime;
1057
                                itemsToEach.StartTime = item.StartTime;
1058
                                itemsToEach.EndTime = item.EndTime;
1059
                                //itemsToEach.MarkupInfo_ID = 
1060
                                //itemsToEach.DocInfo_ID =
1061
                                //itemsToEach.Create_User_ID =
1062

    
1063
                                itemsToList.Add(itemsToEach);
1064
                            }
1065
                            newitems.AddRange(itemsToList);
1066
                            System.Diagnostics.Trace.WriteLine($"{client.Endpoint.Address} ping");
1067

    
1068
                            if (items.Count() == 0)
1069
                            {
1070
                                System.Diagnostics.Trace.WriteLine($"{client.Endpoint.Address} Alive Items is zero.");
1071
                            }
1072
                        }
1073
                        catch (Exception ex)
1074
                        {
1075
                            System.Diagnostics.Trace.Fail($"{client.Endpoint.Address} {ex.Message}");
1076
                        }
1077
                    }
1078
                    else
1079
                    {
1080
                        System.Diagnostics.Trace.Fail($"{client.Endpoint.Address} ping Error");
1081
                    }
1082

    
1083
                }
1084
                ItemsUpdate(newitems);
1085
                await System.Windows.Application.Current.Dispatcher.InvokeAsync(() => ItemsUpdate(newitems));
1086
            }
1087
            catch (Exception ex)
1088
            {
1089
                System.Diagnostics.Debug.WriteLine(ex.ToString());
1090
            }
1091
        }
1092

    
1093
        /// <summary>
1094
        /// AliveDataSelect의 Data Update
1095
        /// </summary>
1096
        /// <param name = "newitems" ></ param >
1097
        private void ItemsUpdate(List<FinalPDF> newitems)
1098
        {
1099

    
1100
            foreach (var item in newitems)
1101
            {
1102
                item.OriginfilePath = HttpUtility.UrlDecode(item.OriginfilePath);
1103
            }
1104

    
1105
            if (AliveItems == null)
1106
            {
1107
                AliveItems = new System.Collections.ObjectModel.ObservableCollection<FinalPDF>();
1108

    
1109
                foreach (var item in newitems)
1110
                {
1111
                    AliveItems.Add(item);
1112
                }
1113
            }
1114
            else
1115
            {
1116
                // 데이터 업데이트
1117
                newitems.ForEach(newitem =>
1118
                {
1119
                    AliveItems.UpdateWhere(changeitem => ConvertItemEx.ChangeValues(changeitem, newitem), x => x.ProjectNumber == newitem.ProjectNumber && x.ConvertID == newitem.ConvertID);
1120
                });
1121

    
1122
                ///추가
1123
                foreach (var item in newitems)
1124
                {
1125
                    if (AliveItems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
1126
                    {
1127
                        AliveItems.Add(item);
1128
                    }
1129
                }
1130

    
1131
                // 삭제
1132

    
1133
                for (int i = AliveItems.Count() - 1; i > -1; --i)
1134
                {
1135
                    var item = AliveItems[i];
1136

    
1137
                    if (newitems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
1138
                    {
1139
                        try
1140
                        {
1141
                            AliveItems.RemoveAt(i);
1142
                        }
1143
                        catch (Exception ex)
1144
                        {
1145
                            System.Diagnostics.Debug.WriteLine(ex.ToString());
1146
                        }
1147
                    }
1148
                }
1149
            }
1150

    
1151
            Alive_Height = 80 + (newitems.Count() * 10);
1152
            DataBase_ItemsHeight = 800 - (RealConvert_Height + Alive_Height);
1153
        }
1154

    
1155

    
1156
        public static async Task<bool> SimplePingAsync(string uri)
1157
        {
1158
            bool result = false;
1159

    
1160
            try
1161
            {
1162
                using (System.Net.Http.HttpClient Client = new System.Net.Http.HttpClient())
1163
                {
1164
                    Client.Timeout = new TimeSpan(0, 0, 60);
1165

    
1166
                    var message = await Client.GetAsync(uri);
1167

    
1168
                    System.Net.HttpStatusCode StatusCode = message.StatusCode;
1169

    
1170
                    switch (StatusCode)
1171
                    {
1172

    
1173
                        case System.Net.HttpStatusCode.Accepted:
1174
                        case System.Net.HttpStatusCode.OK:
1175
                            result = true;
1176
                            break;
1177
                    }
1178
                }
1179
            }
1180
            catch (Exception ex)
1181
            {
1182
                result = false;
1183
                System.Diagnostics.Debug.WriteLine(ex.ToString());
1184
            }
1185

    
1186
            return result;
1187
        }
1188

    
1189
        #endregion
1190

    
1191
        #region Data Convert
1192

    
1193
        private async void DataConvert(object obj)
1194
        {
1195
            if (SelectFilterConvert == null && SelectRealConvert == null)
1196
            {
1197
                MessageBox.Show("왼쪽 버튼 클릭 후 Converter 해주세요!");
1198
            }
1199
            else
1200
            {
1201
                //ConvertDatabase _DataConvert = new ConvertDatabase(App.MarkusDataBaseConnecitonString);
1202
                var resultRealConvert = 0;
1203
                var resultFiltertConvert = 0;
1204

    
1205
                if (SelectRealConvert != null)
1206
                {
1207
                    //resultRealConvert = _DataConvert.SetCleanUpItem(SelectRealConvert);//ConvertDataBase
1208
                    resultRealConvert = SetCleanUpItem(SelectRealConvert).Result;//ConvertDataBase
1209
                }
1210
                else if (SelectFilterConvert != null)
1211
                {
1212
                    //resultFiltertConvert = _DataConvert.SetCleanUpItem(SelectFilterConvert);//ConvertDataBase
1213
                    resultFiltertConvert = SetCleanUpItem(SelectFilterConvert).Result;
1214
                }
1215
                System.Diagnostics.Debug.WriteLine(resultRealConvert + "  " + resultFiltertConvert);
1216

    
1217
                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)
1218
                            let MarkusLink = "kcom://" + CreateMarkusParam(x.ID, x.DOCUMENT_ID, "doftech")
1219
                            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,
1220
                        x.REVISION, x.CURRENT_PAGE, x.TOTAL_PAGE, x.EXCEPTION, x.GROUP_NO, x.CREATE_DATETIME, x.START_DATETIME, x.END_DATETIME
1221
                     , x.ORIGINAL_FILE, x.CONVERT_PATH, MarkusLink);
1222

    
1223

    
1224
                foreach (var item in items)
1225
                {
1226

    
1227
                    RealConvertSource.Add(item);
1228

    
1229
                    if (RealConvertSource.Count() == 1)
1230
                    {
1231
                        ConvertShow = true;
1232
                    }
1233
                }
1234
            }
1235
        }
1236

    
1237

    
1238
        public async Task<int> SetCleanUpItem(FinalPDF _ConvertItem)
1239
        {
1240
            int result = 0;
1241

    
1242
            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);
1243

    
1244
            if (items.Count() > 0)
1245
            {
1246
                var item = items.First();
1247

    
1248
                var _CREATE_DATETIME = DateTime.Now;
1249
                var _STATUS = (int)StatusCodeType.None;
1250

    
1251
                await WcfClient.GET_SELECT_RERECONVERT_ITEMAsync(_ConvertItem.ConvertID, 0, _CREATE_DATETIME, _STATUS, null);//_END_DATETIME = null 에러
1252

    
1253
            }
1254

    
1255
            return result;
1256
        }
1257

    
1258
        //public string[] GetSearchConvertPathAndMarkus(string PROJECT_NO, string DOCUMENT_ID)
1259
        //{
1260
        //    string[] ConvertPath = new string[2];
1261
        //    ConvertPath[0] = GetConvertPath(PROJECT_NO, DOCUMENT_ID);
1262
        //    ConvertPath[1] = "kcom://" + CreateMarkusParam(PROJECT_NO, DOCUMENT_ID, "doftech");
1263

    
1264
        //    return ConvertPath;
1265
        //}
1266

    
1267
        public static string CreateMarkusParam(string projectNo, string documentID, string userID)
1268
        {
1269
            ViewInfo viewInfo = new ViewInfo();
1270

    
1271
            viewInfo.DocumentItemID = documentID;
1272
            viewInfo.ProjectNO = projectNo;
1273
            viewInfo.UserID = userID;
1274

    
1275
            return ParamEncoding(JsonConvert.SerializeObject(viewInfo));
1276

    
1277
        }
1278

    
1279
        public static string ParamEncoding(string EncodingText, System.Text.Encoding oEncoding = null)
1280
        {
1281

    
1282
            if (oEncoding == null)
1283
                oEncoding = System.Text.Encoding.UTF8;
1284

    
1285
            return Convert.ToBase64String(oEncoding.GetBytes(EncodingText));
1286

    
1287
        }
1288

    
1289
        #region Convert Path
1290

    
1291
        //private string GetConvertPath(string ProjectNo, string DocumentID)
1292
        //{
1293
        //    try
1294
        //    {
1295
        //        return Path.Combine(BaseStorage(ProjectNo), ProjectNo + "_Tile", (System.Convert.ToInt64(DocumentID) / 100).ToString(), DocumentID);
1296
        //    }
1297
        //    catch (Exception)
1298
        //    {
1299
        //        throw new Exception("GetConvertPath Error");
1300
        //    }
1301

    
1302
        //}
1303

    
1304
        //private async string BaseStorage(string ProjectNo)
1305
        //{
1306
        //    using (markusEntities entities = new markusEntities(App.MarkusDataBaseConnecitonString))
1307
        //    {
1308
        //        string result = "";
1309

    
1310
        //        var properties = await WcfClient.GET_SELECT_FINAL_PDF_ITEM(null, ProjectNo, null, null, null, null, null, null, null, 1, null, null, null, null,
1311
        //                null, null, null, null, null);
1312

    
1313

    
1314
        //        if (properties.Count() > 0)
1315
        //        {
1316
        //            result = properties.First().PROPERTIES_VALUE;
1317
        //        }
1318
        //        else
1319
        //        {
1320
        //            throw new Exception($"Project {ProjectNo} BaseStorage Not Setting.");
1321
        //        }
1322

    
1323
        //        return result;
1324
        //    }
1325
        //}
1326

    
1327
        #endregion
1328

    
1329
        #endregion
1330

    
1331
        #region Validation
1332

    
1333
        private void DataValidate(object obj)
1334
        {
1335

    
1336
            bool result = false;
1337

    
1338
            WebRequest webRequest = WebRequest.Create(SelectFilterConvert.OriginfilePath);
1339
            webRequest.Timeout = 1200; // miliseconds
1340
            webRequest.Method = "HEAD";
1341

    
1342
            HttpWebResponse response = null;
1343

    
1344
            try
1345
            {
1346
                response = (HttpWebResponse)webRequest.GetResponse();
1347
                result = true;
1348
            }
1349
            catch (WebException webException)
1350
            {
1351
                MessageBox.Show(SelectFilterConvert.FileName + " doesn't exist: " + webException.Message);
1352
                result = true;
1353
            }
1354
            finally
1355
            {
1356
                if (response != null)
1357
                {
1358
                    response.Close();
1359
                }
1360
            }
1361
            if (result == true)
1362
            {
1363
                MessageBox.Show("File exists");
1364
            }
1365
        }
1366

    
1367
        #endregion
1368

    
1369
        #region DataFilter
1370

    
1371
        public void DataFilter(object obj)
1372
        {
1373
            dispatcherTimer.Tick -= new EventHandler(Timer_Tick);
1374
            dispatcherTimer.Tick += new EventHandler(SearchTimer_Tick);
1375
            //DataSearch(new[] { (StatusCodeType)(SelectedStatus.Value) }, FilterConvertSource);
1376
        }
1377

    
1378
        #endregion
1379

    
1380
        #region MarkusLink
1381

    
1382
        private void MarkusLink(object obj)///여기서 부터 
1383
        {
1384
            if (obj is FinalPDF)
1385
            {
1386
                if (obj != null)
1387
                {
1388
                    var convertitem = obj as FinalPDF;
1389

    
1390
                    SelectFilterConvert = convertitem;
1391

    
1392
                    SelectRealConvert = convertitem;
1393

    
1394
                    ProcessStartInfo startInfo = null;
1395

    
1396
                    startInfo = new ProcessStartInfo("iexplore.exe", convertitem.MarkusLink);
1397

    
1398
                    Process.Start(startInfo);
1399
                }
1400
            }
1401
        }
1402

    
1403
        #endregion
1404

    
1405
        #region Data Delete
1406

    
1407
        private void DataDelete(object obj)
1408
        {
1409
            RadWindow.Alert("do you want to delete it??", this.OnClosed);
1410
        }
1411

    
1412
        private async void OnClosed(object sender, WindowClosedEventArgs e)
1413
        {
1414
            var result = e.DialogResult;
1415
            if (result == true)
1416
            {
1417
                if (SelectRealConvert != null)
1418
                {
1419
                    await WcfClient.GET_SELECT_CONVERT_DELETEAsync(SelectRealConvert.ConvertID);
1420
                }
1421
                if (SelectFilterConvert != null)
1422
                {
1423
                    await WcfClient.GET_SELECT_CONVERT_DELETEAsync(SelectFilterConvert.ConvertID);
1424
                }
1425
            }
1426
        }
1427

    
1428

    
1429
        #endregion
1430

    
1431
        #region Data Export
1432

    
1433

    
1434
        /// <summary>
1435
        /// 필터된 상단 그리드 엑셀로 출력
1436
        /// </summary>
1437

    
1438
        public void DataExportData(object obj)
1439
        {
1440
            dispatcherTimer.Tick -= new EventHandler(Timer_Tick);
1441

    
1442
            Return_FilterConvertSource(FilterConvertSource);
1443

    
1444
            Views.FinalPDFExcelDialog finalPDFExcelDialog = new Views.FinalPDFExcelDialog();
1445

    
1446
            finalPDFExcelDialog.Owner = Application.Current.MainWindow;
1447
            finalPDFExcelDialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;
1448

    
1449
            finalPDFExcelDialog.ShowDialog();
1450

    
1451

    
1452
            dispatcherTimer.Tick += new EventHandler(Timer_Tick);
1453
        }
1454

    
1455
        #endregion
1456

    
1457
        #region Data Search
1458

    
1459
        public void RemoveCreateTimeFilter(object obj)
1460
        {
1461
            DefaultCreateTime = DateTime.Now;
1462
            SelectedCreateTimeBegin = DefaultCreateTime;
1463
            SelectedCreateTimeEnd = DefaultCreateTime;
1464

    
1465
        }
1466

    
1467
        #endregion
1468

    
1469
        #region Reset
1470

    
1471
        /// <summary>
1472
        /// 그리드 상단 원상복귀 버튼
1473
        /// 필터를 끝낸 후 다시 복귀
1474
        /// </summary>
1475

    
1476
        public void Reset(object obj)
1477
        {
1478
            SelectedInt = 10;
1479
            ProjectNumberFilter = ProjectNames[0];
1480
            DocumentIDFilter = null;
1481
            MarkupInfo_IDFilter = null;
1482
            DOCINFO_IDFilter = null;
1483
            Document_NameFilter = null;
1484
            Document_NOFilter = null;
1485
            CreateUser_IDFilter = null;
1486
            GROUP_NOFilter = null;
1487
            REVISIONFilter = null;
1488

    
1489
            DefaultCreateTime = DateTime.Now;
1490
            SelectedCreateTimeBegin = DefaultCreateTime;
1491
            SelectedCreateTimeEnd = DefaultCreateTime;
1492

    
1493
            dispatcherTimer.Tick -= new EventHandler(SearchTimer_Tick);
1494
            dispatcherTimer.Tick += new EventHandler(Timer_Tick);
1495

    
1496
        }
1497

    
1498
        #endregion
1499

    
1500

    
1501
        #region ConvertAddDialog
1502

    
1503
        /// <summary>
1504
        /// 그리드 상단 Conver 추가 버튼
1505
        /// ProjectNo, DocumentURL, DocumentID, 입력해서 저장 프로시저에서 추가 
1506
        /// </summary>
1507

    
1508
        public void ConverAdd(object obj)
1509
        {
1510
            dispatcherTimer.Tick -= new EventHandler(Timer_Tick);
1511

    
1512
            Views.FinalPDFAddDialog convertAddDialog = new Views.FinalPDFAddDialog();
1513

    
1514
            convertAddDialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;
1515

    
1516
            convertAddDialog.ShowDialog();
1517

    
1518
            dispatcherTimer.Tick += new EventHandler(Timer_Tick);
1519
        }
1520

    
1521
        #endregion
1522

    
1523

    
1524
        #region ConvertPathFileSearch
1525

    
1526
        /// <summary>
1527
        ///  ConvertPath 파일 탐색기로 열리는 아이콘
1528
        /// </summary>
1529

    
1530
        public void ConvertPathFileSearch(object obj)
1531
        {
1532
            if (obj is FinalPDF)
1533
            {
1534
                if (obj != null)
1535
                {
1536
                    var convertitem = obj as ConvertPDF;
1537

    
1538
                    SaveFileDialog saveFileDialog = new SaveFileDialog();
1539

    
1540
                    saveFileDialog.FileName = "Document"; // Default file name
1541
                    saveFileDialog.DefaultExt = ".txt"; // Default file extension
1542
                    saveFileDialog.Filter = "Csv documents (.Csv)|*.csv|Excel(2017~2019)Worksheets|*.xlsx"; // Filter files by extension
1543

    
1544

    
1545
                    if (saveFileDialog.ShowDialog() == true)
1546
                    {
1547
                    }
1548
                }
1549
            }
1550
        }
1551

    
1552
        #endregion
1553

    
1554

    
1555
        #endregion
1556
    }
1557
}
클립보드 이미지 추가 (최대 크기: 500 MB)