프로젝트

일반

사용자정보

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

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

이력 | 보기 | 이력해설 | 다운로드 (51.3 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
        public ObservableCollection<ProjectName> _ProjectNames;
60
        public ObservableCollection<ProjectName> ProjectNames
61
        {
62
            get
63
            {
64
                if (_ProjectNames == null)
65
                {
66
                    _ProjectNames = new System.Collections.ObjectModel.ObservableCollection<ProjectName>();
67
                }
68

    
69
                return _ProjectNames;
70
            }
71
            set
72
            {
73
                _ProjectNames = value;
74
                OnPropertyChanged(() => ProjectNames);
75
            }
76
        }
77

    
78
        private System.Collections.ObjectModel.ObservableCollection<FinalPDF> _FilterSearch;
79
        public System.Collections.ObjectModel.ObservableCollection<FinalPDF> FilterSearch
80
        {
81
            get
82
            {
83
                if (_FilterSearch == null)
84
                {
85
                    _FilterSearch = new System.Collections.ObjectModel.ObservableCollection<FinalPDF>
86
                            {
87
                                new FinalPDF{ProjectNumber = "Filter Search"}
88
                            };
89
                }
90

    
91
                return _FilterSearch;
92
            }
93
        }
94

    
95
        private System.Collections.ObjectModel.ObservableCollection<FinalPDF> _AliveItems;
96
        public System.Collections.ObjectModel.ObservableCollection<FinalPDF> AliveItems
97
        {
98
            get => _AliveItems;
99
            set
100
            {
101
                _AliveItems = value;
102
                OnPropertyChanged(() => AliveItems);
103
            }
104
        }
105

    
106
        public ICollectionView FilterConvertSourceView
107
        {
108
            get
109
            {
110
                var view = CollectionViewSource.GetDefaultView(FilterConvertSource);
111
                return view;
112
            }
113
        }
114

    
115
        private System.Collections.ObjectModel.ObservableCollection<FinalPDF> _FilterConvertSource;
116
        public System.Collections.ObjectModel.ObservableCollection<FinalPDF> FilterConvertSource
117
        {
118
            get
119
            {
120
                if (_FilterConvertSource == null)
121
                {
122
                    _FilterConvertSource = new System.Collections.ObjectModel.ObservableCollection<FinalPDF>();
123
                }
124
                return _FilterConvertSource;
125
            }
126
            set
127
            {
128
                _FilterConvertSource = value;
129
                OnPropertyChanged(() => FilterConvertSource);
130
            }
131
        }
132

    
133

    
134
        private System.Collections.ObjectModel.ObservableCollection<FinalPDF> _RealConvertSource;
135
        public System.Collections.ObjectModel.ObservableCollection<FinalPDF> RealConvertSource
136
        {
137
            get => _RealConvertSource;
138
            set
139
            {
140
                _RealConvertSource = value;
141
                OnPropertyChanged(() => RealConvertSource);
142
            }
143
        }
144

    
145

    
146
        private System.Windows.Documents.FlowDocument connectionLog;
147
        public System.Windows.Documents.FlowDocument ConnectionLog
148
        {
149
            get => connectionLog;
150
            set
151
            {
152
                if (connectionLog != value)
153
                {
154
                    connectionLog = value;
155
                    OnPropertyChanged(() => ConnectionLog);
156
                }
157
            }
158
        }
159

    
160

    
161
        private int _SelectedInt = 4;
162
        public int SelectedInt
163
        {
164
            get => _SelectedInt;
165
            set
166
            {
167
                _SelectedInt = value;
168
                OnPropertyChanged(() => SelectedInt);
169
            }
170
        }
171

    
172

    
173
        private Telerik.Windows.Data.EnumMemberViewModel _SelectedStatus;
174
        public Telerik.Windows.Data.EnumMemberViewModel SelectedStatus
175
        {
176
            get => _SelectedStatus;
177
            set
178
            {
179
                _SelectedStatus = value;
180
                OnPropertyChanged(() => SelectedStatus);
181
            }
182
        }
183

    
184

    
185
        private SelectedCountItem _SelectedCount;
186
        public SelectedCountItem SelectedCount
187
        {
188
            get => _SelectedCount;
189
            set
190
            {
191
                _SelectedCount = value;
192
                OnPropertyChanged(() => SelectedCount);
193
            }
194
        }
195

    
196
        List<SelectedCountItem> _SelectedCountList;
197
        public List<SelectedCountItem> SelectedCountList
198
        {
199
            get
200
            {
201
                if (_SelectedCountList == null)
202
                {
203
                    _SelectedCountList = new List<SelectedCountItem>
204
                            {
205
                                new SelectedCountItem{DisplayMember = "50",ValueMember = 50},
206
                                new SelectedCountItem{DisplayMember = "100",ValueMember = 100},
207
                                new SelectedCountItem{DisplayMember = "150",ValueMember = 150},
208
                                new SelectedCountItem{DisplayMember = "200",ValueMember = 200}
209
                            };
210
                }
211

    
212
                return _SelectedCountList;
213
            }
214
        }
215

    
216
        private FinalPDF _SelectFilterConvert;
217
        public FinalPDF SelectFilterConvert
218
        {
219
            get => _SelectFilterConvert;
220
            set
221
            {
222
                _SelectFilterConvert = value;
223
                OnPropertyChanged(() => SelectFilterConvert);
224
            }
225
        }
226

    
227
        private FinalPDF _SelectRealConvert;
228
        public FinalPDF SelectRealConvert
229
        {
230
            get => _SelectRealConvert;
231
            set
232
            {
233
                _SelectRealConvert = value;
234
                OnPropertyChanged(() => SelectRealConvert);
235
            }
236
        }
237

    
238

    
239
        private FinalPDF _SelectAliveConvert;
240
        public FinalPDF SelectAliveConvert
241
        {
242
            get => _SelectAliveConvert;
243
            set
244
            {
245
                _SelectAliveConvert = value;
246
                OnPropertyChanged(() => SelectAliveConvert);
247
            }
248
        }
249

    
250

    
251
        private StatusTypeList _StatusType;
252
        public StatusTypeList StatusType
253
        {
254
            get => _StatusType;
255
            set
256
            {
257
                _StatusType = value;
258
                OnPropertyChanged(() => StatusType);
259
            }
260
        }
261

    
262
        private bool _IsLoading;
263
        public bool IsLoading
264
        {
265
            get => _IsLoading;
266
            set
267
            {
268
                if (_IsLoading != value)
269
                {
270
                    _IsLoading = value;
271
                    OnPropertyChanged(() => IsLoading);
272
                }
273
            }
274
        }
275

    
276
        IEnumerable<Telerik.Windows.Data.EnumMemberViewModel> _StatusCodeList;
277
        public IEnumerable<Telerik.Windows.Data.EnumMemberViewModel> StatusCodeList
278
        {
279
            get
280
            {
281
                if (_StatusCodeList == null)
282
                {
283
                    _StatusCodeList = Telerik.Windows.Data.EnumDataSource.FromType<StatusCodeType>();
284
                }
285

    
286
                return _StatusCodeList;
287
            }
288
        }
289

    
290
        public ProjectName _ProjectNumberFilter;
291
        public ProjectName ProjectNumberFilter
292
        {
293
            get
294
            {
295
                if (_ProjectNumberFilter == null)
296
                {
297
                    _ProjectNumberFilter = new ProjectName();
298
                }
299
                return _ProjectNumberFilter;
300
            }
301
            set
302
            {
303
                _ProjectNumberFilter = value;
304
                OnPropertyChanged(() => ProjectNumberFilter);
305
            }
306
        }
307

    
308
        public string _DocumentIDFilter;
309
        public string DocumentIDFilter
310
        {
311
            get
312
            {
313
                return _DocumentIDFilter;
314
            }
315
            set
316
            {
317
                if (_DocumentIDFilter == "")
318
                {
319
                    _DocumentIDFilter = null;
320
                }
321
                else if (_DocumentIDFilter != value)
322
                {
323
                    _DocumentIDFilter = value;
324
                    OnPropertyChanged(() => DocumentIDFilter);
325
                }
326
            }
327
        }
328

    
329
        public string _DOCINFO_IDFilter;
330
        public string DOCINFO_IDFilter
331
        {
332
            get
333
            {
334
                return _DOCINFO_IDFilter;
335
            }
336
            set
337
            {
338
                if (_DOCINFO_IDFilter == "")
339
                {
340
                    _DOCINFO_IDFilter = null;
341
                }
342
                else if (_DOCINFO_IDFilter != value)
343
                {
344
                    _DOCINFO_IDFilter = value;
345
                    OnPropertyChanged(() => DOCINFO_IDFilter);
346
                }
347
            }
348
        }
349

    
350
        public string _Document_URLFilter;
351
        public string Document_URLFilter
352
        {
353
            get
354
            {
355
                return _Document_URLFilter;
356
            }
357
            set
358
            {
359
                if (_Document_URLFilter != value)
360
                {
361
                    _Document_URLFilter = value;
362
                    OnPropertyChanged(() => Document_URLFilter);
363
                }
364
            }
365
        }
366

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

    
384
        public string _CreateUser_IDFilter;
385
        public string CreateUser_IDFilter
386
        {
387
            get
388
            {
389
                return _CreateUser_IDFilter;
390
            }
391
            set
392
            {
393
                if (_CreateUser_IDFilter == "")
394
                {
395
                    _CreateUser_IDFilter = null;
396
                }
397
                else if (_CreateUser_IDFilter != value)
398
                {
399
                    _CreateUser_IDFilter = value;
400
                    OnPropertyChanged(() => CreateUser_IDFilter);
401
                }
402
            }
403
        }
404

    
405
        public string _GROUP_NOFilter;
406
        public string GROUP_NOFilter
407
        {
408
            get
409
            {
410
                return _GROUP_NOFilter;
411
            }
412
            set
413
            {
414
                if (_GROUP_NOFilter == "")
415
                {
416
                    _GROUP_NOFilter = null;
417
                }
418
                else if (_GROUP_NOFilter != value)
419
                {
420
                    _GROUP_NOFilter = value;
421
                    OnPropertyChanged(() => GROUP_NOFilter);
422
                }
423
            }
424
        }
425

    
426
        public string _REVISIONFilter;
427
        public string REVISIONFilter
428
        {
429
            get
430
            {
431
                return _REVISIONFilter;
432
            }
433
            set
434
            {
435
                if (_REVISIONFilter == "")
436
                {
437
                    _REVISIONFilter = null;
438
                }
439
                else if (_REVISIONFilter != value)
440
                {
441
                    _REVISIONFilter = value;
442
                    OnPropertyChanged(() => REVISIONFilter);
443
                }
444
            }
445
        }
446

    
447
        public StatusCodeType _ConvertStateFilter;
448
        public StatusCodeType ConvertStateFilter
449
        {
450
            get { return _ConvertStateFilter; }
451
            set
452
            {
453
                if (_ConvertStateFilter != value)
454
                {
455
                    _ConvertStateFilter = value;
456
                    OnPropertyChanged(() => ConvertStateFilter);
457
                }
458
            }
459
        }
460

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

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

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

    
515

    
516
        static DateTime DefaultCreateTime = DateTime.Now;
517
        private DateTime _SelectedCreateTimeBegin = DefaultCreateTime;
518
        public DateTime SelectedCreateTimeBegin
519
        {
520

    
521
            get { return _SelectedCreateTimeBegin; }
522
            set
523
            {
524
                if (_SelectedCreateTimeBegin == value)
525
                    return;
526
                _SelectedCreateTimeBegin = value;
527
                OnPropertyChanged(() => SelectedCreateTimeBegin);
528

    
529
            }
530
        }
531

    
532
        private DateTime _SelectedCreateTimeEnd = DefaultCreateTime;
533
        public DateTime SelectedCreateTimeEnd
534
        {
535

    
536
            get { return _SelectedCreateTimeEnd; }
537
            set
538
            {
539
                if (_SelectedCreateTimeEnd == value)
540
                    return;
541
                _SelectedCreateTimeEnd = value;
542
                OnPropertyChanged(() => SelectedCreateTimeEnd);
543
            }
544
        }
545

    
546
        public int _DataBase_ItemsHeight = 800;
547
        public int DataBase_ItemsHeight
548
        {
549
            get { return _DataBase_ItemsHeight; }
550
            set
551
            {
552
                _DataBase_ItemsHeight = value;
553
                OnPropertyChanged(() => DataBase_ItemsHeight);
554
            }
555
        }
556

    
557

    
558
        public int _RealConvert_Height = 80;
559
        public int RealConvert_Height
560
        {
561
            get { return _RealConvert_Height; }
562
            set
563
            {
564
                _RealConvert_Height = value;
565
                OnPropertyChanged(() => RealConvert_Height);
566
            }
567
        }
568

    
569
        public int _Alive_Height = 80;
570
        public int Alive_Height
571
        {
572
            get { return _Alive_Height; }
573
            set
574
            {
575
                _Alive_Height = value;
576
                OnPropertyChanged(() => Alive_Height);
577
            }
578
        }
579

    
580
        public bool _ConvertShow;
581
        public bool ConvertShow
582
        {
583
            get => _ConvertShow;
584
            set
585
            {
586
                if (_ConvertShow = !value)
587
                {
588
                    _ConvertShow = false;
589
                }
590
                _ConvertShow = value;
591
                OnPropertyChanged(() => ConvertShow);
592
            }
593
        }
594

    
595

    
596
        private bool _ExcptionCheck = false;
597
        public bool ExcptionCheck
598
        {
599
            get
600
            {
601
                return _ExcptionCheck;
602
            }
603
            set
604
            {
605
                _ExcptionCheck = value;
606
                OnPropertyChanged(() => ExcptionCheck);
607
            }
608
        }
609
        #endregion
610

    
611
        #region Command
612

    
613
        public DelegateCommand ConvertCommand { get; private set; }
614
        public DelegateCommand DeleteCommand { get; private set; }
615
        public DelegateCommand ValidateCommand { get; private set; }
616
        public DelegateCommand DataSaveFileGemBoxCommand { get; private set; }
617
        public DelegateCommand MarkusLinkCommand { get; private set; }
618
        public DelegateCommand RemoveCreateTimeFilterCommand { get; private set; }
619

    
620
        public DelegateCommand DataFilterCommand { get; private set; }
621
        public DelegateCommand ResetCommand { get; private set; }
622
        public DelegateCommand ConverAddCommand { get; private set; }
623
        public DelegateCommand ConvertPathFileSearchCommand { get; private set; }
624

    
625
        #endregion
626

    
627
        #region Main Logic
628

    
629
        /// <summary>
630
        /// 각각의 Grid row 객체들 업데이트
631
        /// </summary>
632

    
633
        private DispatcherTimer dispatcherTimer;
634
        public override void Loaded()
635
        {
636
            base.Loaded();
637

    
638
            if (!App.IsDesignMode)
639
            {
640
                dispatcherTimer = new DispatcherTimer();
641
                dispatcherTimer.Tick += new EventHandler(Timer_Tick);
642
                dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
643
                dispatcherTimer.Start();
644
            }
645
        }
646

    
647
        private async void Timer_Tick(object sender, EventArgs e)
648
        {
649
            dispatcherTimer.Stop();
650

    
651
            if (IsAcitve)
652
            {
653
                await App.Current.Dispatcher.InvokeAsync(() =>
654
                {
655
                    DataSelect();
656

    
657
                    AliveDataSelect();
658
                });
659
            }
660

    
661
            await Task.Delay(5000);
662

    
663
            System.Threading.Thread.Sleep(new TimeSpan(0, 0, 0, 0, 100));
664

    
665
            dispatcherTimer.Start();
666
        }
667

    
668
        private async void SearchTimer_Tick(object sender, EventArgs e)
669
        {
670
            dispatcherTimer.Stop();
671

    
672
            if (IsAcitve)
673
            {
674
                await App.Current.Dispatcher.InvokeAsync(() =>
675
                {
676
                    DataSearch(new[] { (StatusCodeType)(SelectedStatus.Value) }, FilterConvertSource);
677

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

    
680
                    AliveDataSelect();
681
                });
682
            }
683

    
684
            await Task.Delay(5000);
685
            //await Task.Delay(10000);
686

    
687
            //System.Threading.Thread.Sleep(new TimeSpan(0,0,0,0,100));
688

    
689
            dispatcherTimer.Start();
690
        }
691

    
692

    
693
        public override void Closed()
694
        {
695
            if (dispatcherTimer != null)
696
            {
697
                dispatcherTimer.Stop();
698
            }
699

    
700
            base.Closed();
701
        }
702

    
703

    
704
        #endregion
705

    
706
        #region Function
707

    
708
        #region Data Select
709

    
710
        /// <summary>
711
        /// 상단 그리드 중앙 그리드 출력 데이터
712
        /// </summary>
713
        private void DataSelect()
714
        {
715

    
716
            if (FilterConvertSource == null)
717
            {
718
                FilterConvertSource = new System.Collections.ObjectModel.ObservableCollection<FinalPDF>();
719
            }
720

    
721
            if (RealConvertSource == null)
722
            {
723
                RealConvertSource = new System.Collections.ObjectModel.ObservableCollection<FinalPDF>();
724
            }
725

    
726
            /// combobox 에서 선택된 items
727
            if (SelectedStatus != null)
728
            {
729
                DataSelect(new[] { (StatusCodeType)(SelectedStatus.Value) }, FilterConvertSource);
730
            }
731

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

    
735
        }
736

    
737
        private async void RealDataSelect(IEnumerable<StatusCodeType> statusCodeTypeList, System.Collections.ObjectModel.ObservableCollection<FinalPDF> collection)
738
        {
739
            try
740
            {
741
                IEnumerable<FinalPDF> Listitems = null;
742

    
743
                foreach (var coll in collection)
744
                {
745
                    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)
746
                                let MarkusLink = "kcom://" + CreateMarkusParam(x.PROJECT_NO, x.DOCUMENT_ID, "doftech")
747
                                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,
748
                            x.TOTAL_PAGE, x.EXCEPTION, x.GROUP_NO, x.CREATE_DATETIME, x.START_DATETIME, x.END_DATETIME, x.ORIGINAL_FILE, x.CONVERT_PATH, MarkusLink);
749
                }
750

    
751
                foreach (var Listitem in Listitems)
752
                {
753
                    collection.UpdateWhere(changeitem =>
754
                    ConvertItemEx.ChangeValues(changeitem, Listitem), x => x.ProjectNumber == Listitem.ProjectNumber && x.ConvertID == Listitem.ConvertID);
755
                }
756

    
757
                RealConvert_Height = 80 + (10 * collection.Count());
758
                DataBase_ItemsHeight = 800 - (RealConvert_Height + Alive_Height);
759
            }
760
            catch (Exception ex)
761
            {
762
                MessageBox.Show(ex.ToString());
763
            }
764
        }
765

    
766
        private async void DataSelect(IEnumerable<StatusCodeType> statusCodeTypeList, System.Collections.ObjectModel.ObservableCollection<FinalPDF> collection)
767
        {
768
            try
769
            {
770
                int _status = 0;
771
                if (SelectedStatus != null)
772
                {
773
                    _status = (int)SelectedStatus.Value;
774
                }
775

    
776
                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)
777
                                let MarkusLink = "kcom://" + CreateMarkusParam(x.ID, x.DOCUMENT_ID, "doftech")
778
                                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,
779
                        x.REVISION, x.CURRENT_PAGE, x.TOTAL_PAGE, x.EXCEPTION, x.GROUP_NO, x.CREATE_DATETIME, x.START_DATETIME, x.END_DATETIME
780
                     , x.ORIGINAL_FILE, x.CONVERT_PATH, MarkusLink);
781

    
782
                if (collection.Count() == 0)
783
                {
784
                    if (statusCodeTypeList.Count() == 1)
785
                    {
786
                        foreach (var x in Listitems)
787
                        {
788
                            collection.Add(x);
789
                        }
790
                    }
791
                }
792
                else
793
                {
794
                    foreach (var newitem in Listitems)
795
                    {
796
                        collection.UpdateWhere(changeitem =>
797
                        ConvertItemEx.ChangeValues(changeitem, newitem), x => x.ProjectNumber == newitem.ProjectNumber && x.ConvertID == newitem.ConvertID);
798
                    }
799

    
800
                    if (statusCodeTypeList.Count() == 1)
801
                    {
802
                        for (int i = collection.Count() - 1; i >= 0; --i)
803
                        {
804
                            var item = collection[i];
805

    
806
                            if (Listitems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
807
                            {
808
                                collection.RemoveAt(i);
809
                            }
810
                        }
811
                    }
812

    
813
                    if (statusCodeTypeList.Count() == 1)
814
                    {
815
                        foreach (var item in Listitems)
816
                        {
817
                            if (collection.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
818
                            {
819
                                for (int i = 0; i < 200; i++)
820
                                {
821
                                    if (i < collection.Count() - 1)
822
                                    {
823
                                        if (DateTime.Compare(collection[i].CreateTime, item.CreateTime) < 0)
824
                                        {
825
                                            collection.Insert(i, item);
826
                                            break;
827
                                        }
828
                                    }
829
                                    else
830
                                    {
831
                                        collection.Add(item);
832
                                        break;
833
                                    }
834
                                }
835

    
836
                            }
837

    
838
                        }
839
                    }
840
                }
841
            }
842
            catch (Exception ex)
843
            {
844
                MessageBox.Show(ex.ToString());
845
                System.Diagnostics.Debug.WriteLine(ex.ToString());
846
            }
847
        }
848

    
849
        private async void DataSearch(IEnumerable<StatusCodeType> statusCodeTypeList, System.Collections.ObjectModel.ObservableCollection<FinalPDF> collection)
850
        {
851
            try
852
            {
853
                int _status = 0;
854
                if (SelectedStatus != null)
855
                {
856
                    _status = (int)SelectedStatus.Value;
857
                }
858

    
859
                DateTime? Start_CreateTime = null;
860
                DateTime? Finish_CreateTime = null;
861
                if (SelectedCreateTimeBegin != DefaultCreateTime)
862
                {
863
                    Start_CreateTime = SelectedCreateTimeBegin;
864
                }
865
                if (SelectedCreateTimeEnd != DefaultCreateTime)
866
                {
867
                    Finish_CreateTime = SelectedCreateTimeEnd;
868
                }
869

    
870
                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,
871
                    CreateUser_IDFilter, _status, SelectedCount.ValueMember, GROUP_NOFilter, REVISIONFilter, Start_CreateTime, Finish_CreateTime, null, null, null, null, Document_URLFilter, ExcptionCheck)
872
                                let MarkusLink = "kcom://" + CreateMarkusParam(x.ID, x.DOCUMENT_ID, "doftech")
873
                                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,
874
                                    x.REVISION, x.CURRENT_PAGE, x.TOTAL_PAGE, x.EXCEPTION, x.GROUP_NO, x.CREATE_DATETIME, x.START_DATETIME, x.END_DATETIME
875
                                 , x.ORIGINAL_FILE, x.CONVERT_PATH, MarkusLink);
876

    
877
                if (collection.Count() == 0)
878
                {
879
                    if (statusCodeTypeList.Count() == 1)
880
                    {
881
                        foreach (var x in Listitems)
882
                        {
883
                            collection.Add(x);
884
                        }
885
                    }
886
                }
887
                else
888
                {
889
                    foreach (var newitem in Listitems)
890
                    {
891
                        collection.UpdateWhere(changeitem =>
892
                        ConvertItemEx.ChangeValues(changeitem, newitem), x => x.ProjectNumber == newitem.ProjectNumber && x.ConvertID == newitem.ConvertID);
893
                    }
894

    
895
                    if (statusCodeTypeList.Count() == 1)
896
                    {
897

    
898
                        for (int i = collection.Count() - 1; i >= 0; --i)
899
                        {
900
                            var item = collection[i];
901

    
902
                            if (Listitems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
903
                            {
904
                                collection.RemoveAt(i);
905
                            }
906
                        }
907
                    }
908

    
909
                    if (statusCodeTypeList.Count() == 1)
910
                    {
911
                        foreach (var item in Listitems)
912
                        {
913
                            if (collection.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
914
                            {
915
                                for (int i = 0; i < 200; i++)
916
                                {
917
                                    if (i < collection.Count() - 1)
918
                                    {
919
                                        if (DateTime.Compare(collection[i].CreateTime, item.CreateTime) < 0)
920
                                        {
921
                                            collection.Insert(i, item);
922
                                            break;
923
                                        }
924
                                    }
925
                                    else
926
                                    {
927
                                        collection.Add(item);
928
                                        break;
929
                                    }
930
                                }
931

    
932
                            }
933

    
934
                        }
935
                    }
936

    
937
                }
938
            }
939
            catch (Exception ex)
940
            {
941
                MessageBox.Show(ex.ToString());
942
                System.Diagnostics.Debug.WriteLine(ex.ToString());
943
            }
944
        }
945
        /// <summary>
946
        /// 서비스의 실시간 컨버터 Item
947
        /// </summary>
948
        private async void AliveDataSelect()
949
        {
950
            try
951
            {
952
                List<FinalPDF> newitems = new List<FinalPDF>();
953
                foreach (var client in App.StationClientList)
954
                {
955
                    if (await SimplePingAsync(client.Endpoint.Address.ToString()))
956
                    {
957
                        try
958
                        {
959
                            List<FinalPDF> itemsToList = new List<FinalPDF>();
960
                            var items = await client.AliveConvertListAsync();
961
                            string result = "";
962

    
963
                            foreach (var item in items)
964
                            {
965
                                FinalPDF itemsToEach = new FinalPDF();
966
                                itemsToEach.ConvertID = item.ConvertID;
967
                                itemsToEach.ProjectNumber = item.ProjectNumber;
968

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

    
971
                                //var convertpath = GetSearchConvertPathAndMarkus(item.ProjectNumber, item.UniqueKey);
972

    
973
                                if (item.ConvertState != null)
974
                                {
975
                                    itemsToEach.ConvertState = (StatusCodeType)Enum.Parse(typeof(StatusCodeType), item.ConvertState);
976
                                }
977

    
978
                                if (item.OriginfilePath.Contains("/"))
979
                                {
980
                                    result = item.OriginfilePath.Substring(item.OriginfilePath.LastIndexOf("/") + 1);
981
                                }
982
                                else
983
                                {
984
                                    result = item.OriginfilePath.Substring(item.OriginfilePath.LastIndexOf("%") + 1);
985
                                }
986
                                itemsToEach.FileName = result;
987

    
988
                                itemsToEach.CurrentPageNo = item.CurrentPageNo;
989
                                itemsToEach.TotalPage = item.TotalPage;
990
                                itemsToEach.OriginfilePath = item.OriginfilePath;
991
                                itemsToEach.ConvertPath = item.ConvertPath;
992
                                itemsToEach.MarkusLink = MarkusLink;
993
                                itemsToEach.DocumentID = item.DocumentID;
994
                                itemsToEach.GroupNo = item.GroupNo;
995
                                itemsToEach.DocumentName = item.DocumnetName;
996
                                itemsToEach.Revision = item.Revision;
997
                                itemsToEach.Exception = item.Exception;
998
                                itemsToEach.ConvertPath = item.ConvertPath;
999
                                itemsToEach.CreateTime = item.CreateTime;
1000
                                itemsToEach.StartTime = item.StartTime;
1001
                                itemsToEach.EndTime = item.EndTime;
1002
                                //itemsToEach.MarkupInfo_ID = 
1003
                                //itemsToEach.DocInfo_ID =
1004
                                //itemsToEach.Create_User_ID =
1005

    
1006
                                itemsToList.Add(itemsToEach);
1007
                            }
1008
                            newitems.AddRange(itemsToList);
1009
                            System.Diagnostics.Trace.WriteLine($"{client.Endpoint.Address} ping");
1010

    
1011
                            if (items.Count() == 0)
1012
                            {
1013
                                System.Diagnostics.Trace.WriteLine($"{client.Endpoint.Address} Alive Items is zero.");
1014
                            }
1015
                        }
1016
                        catch (Exception ex)
1017
                        {
1018
                            System.Diagnostics.Trace.Fail($"{client.Endpoint.Address} {ex.Message}");
1019
                        }
1020
                    }
1021
                    else
1022
                    {
1023
                        System.Diagnostics.Trace.Fail($"{client.Endpoint.Address} ping Error");
1024
                    }
1025

    
1026
                }
1027
                ItemsUpdate(newitems);
1028
                await System.Windows.Application.Current.Dispatcher.InvokeAsync(() => ItemsUpdate(newitems));
1029
            }
1030
            catch (Exception ex)
1031
            {
1032
                System.Diagnostics.Debug.WriteLine(ex.ToString());
1033
            }
1034
        }
1035

    
1036
        /// <summary>
1037
        /// AliveDataSelect의 Data Update
1038
        /// </summary>
1039
        /// <param name = "newitems" ></ param >
1040
        private void ItemsUpdate(List<FinalPDF> newitems)
1041
        {
1042

    
1043
            foreach (var item in newitems)
1044
            {
1045
                item.OriginfilePath = HttpUtility.UrlDecode(item.OriginfilePath);
1046
            }
1047

    
1048
            if (AliveItems == null)
1049
            {
1050
                AliveItems = new System.Collections.ObjectModel.ObservableCollection<FinalPDF>();
1051

    
1052
                foreach (var item in newitems)
1053
                {
1054
                    AliveItems.Add(item);
1055
                }
1056
            }
1057
            else
1058
            {
1059
                // 데이터 업데이트
1060
                newitems.ForEach(newitem =>
1061
                {
1062
                    AliveItems.UpdateWhere(changeitem => ConvertItemEx.ChangeValues(changeitem, newitem), x => x.ProjectNumber == newitem.ProjectNumber && x.ConvertID == newitem.ConvertID);
1063
                });
1064

    
1065
                ///추가
1066
                foreach (var item in newitems)
1067
                {
1068
                    if (AliveItems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
1069
                    {
1070
                        AliveItems.Add(item);
1071
                    }
1072
                }
1073

    
1074
                // 삭제
1075

    
1076
                for (int i = AliveItems.Count() - 1; i > -1; --i)
1077
                {
1078
                    var item = AliveItems[i];
1079

    
1080
                    if (newitems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
1081
                    {
1082
                        try
1083
                        {
1084
                            AliveItems.RemoveAt(i);
1085
                        }
1086
                        catch (Exception ex)
1087
                        {
1088
                            System.Diagnostics.Debug.WriteLine(ex.ToString());
1089
                        }
1090
                    }
1091
                }
1092
            }
1093

    
1094
            Alive_Height = 80 + (newitems.Count() * 10);
1095
            DataBase_ItemsHeight = 800 - (RealConvert_Height + Alive_Height);
1096
        }
1097

    
1098

    
1099
        public static async Task<bool> SimplePingAsync(string uri)
1100
        {
1101
            bool result = false;
1102

    
1103
            try
1104
            {
1105
                using (System.Net.Http.HttpClient Client = new System.Net.Http.HttpClient())
1106
                {
1107
                    Client.Timeout = new TimeSpan(0, 0, 60);
1108

    
1109
                    var message = await Client.GetAsync(uri);
1110

    
1111
                    System.Net.HttpStatusCode StatusCode = message.StatusCode;
1112

    
1113
                    switch (StatusCode)
1114
                    {
1115

    
1116
                        case System.Net.HttpStatusCode.Accepted:
1117
                        case System.Net.HttpStatusCode.OK:
1118
                            result = true;
1119
                            break;
1120
                    }
1121
                }
1122
            }
1123
            catch (Exception ex)
1124
            {
1125
                result = false;
1126
                System.Diagnostics.Debug.WriteLine(ex.ToString());
1127
            }
1128

    
1129
            return result;
1130
        }
1131

    
1132
        #endregion
1133

    
1134
        #region Data Convert
1135

    
1136
        private async void DataConvert(object obj)
1137
        {
1138
            if (SelectFilterConvert == null && SelectRealConvert == null)
1139
            {
1140
                MessageBox.Show("왼쪽 버튼 클릭 후 Converter 해주세요!");
1141
            }
1142
            else
1143
            {
1144
                //ConvertDatabase _DataConvert = new ConvertDatabase(App.MarkusDataBaseConnecitonString);
1145
                var resultRealConvert = 0;
1146
                var resultFiltertConvert = 0;
1147

    
1148
                if (SelectRealConvert != null)
1149
                {
1150
                    //resultRealConvert = _DataConvert.SetCleanUpItem(SelectRealConvert);//ConvertDataBase
1151
                    resultRealConvert = SetCleanUpItem(SelectRealConvert).Result;//ConvertDataBase
1152
                }
1153
                else if (SelectFilterConvert != null)
1154
                {
1155
                    //resultFiltertConvert = _DataConvert.SetCleanUpItem(SelectFilterConvert);//ConvertDataBase
1156
                    resultFiltertConvert = SetCleanUpItem(SelectFilterConvert).Result;
1157
                }
1158
                System.Diagnostics.Debug.WriteLine(resultRealConvert + "  " + resultFiltertConvert);
1159

    
1160
                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)
1161
                            let MarkusLink = "kcom://" + CreateMarkusParam(x.ID, x.DOCUMENT_ID, "doftech")
1162
                            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,
1163
                        x.REVISION, x.CURRENT_PAGE, x.TOTAL_PAGE, x.EXCEPTION, x.GROUP_NO, x.CREATE_DATETIME, x.START_DATETIME, x.END_DATETIME
1164
                     , x.ORIGINAL_FILE, x.CONVERT_PATH, MarkusLink);
1165

    
1166

    
1167
                foreach (var item in items)
1168
                {
1169

    
1170
                    RealConvertSource.Add(item);
1171

    
1172
                    if (RealConvertSource.Count() == 1)
1173
                    {
1174
                        ConvertShow = true;
1175
                    }
1176
                }
1177
            }
1178
        }
1179

    
1180

    
1181
        public async Task<int> SetCleanUpItem(FinalPDF _ConvertItem)
1182
        {
1183
            int result = 0;
1184

    
1185
            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);
1186

    
1187
            if (items.Count() > 0)
1188
            {
1189
                var item = items.First();
1190

    
1191
                var _CREATE_DATETIME = DateTime.Now;
1192
                var _STATUS = (int)StatusCodeType.None;
1193

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

    
1196
            }
1197

    
1198
            return result;
1199
        }
1200

    
1201
        //public string[] GetSearchConvertPathAndMarkus(string PROJECT_NO, string DOCUMENT_ID)
1202
        //{
1203
        //    string[] ConvertPath = new string[2];
1204
        //    ConvertPath[0] = GetConvertPath(PROJECT_NO, DOCUMENT_ID);
1205
        //    ConvertPath[1] = "kcom://" + CreateMarkusParam(PROJECT_NO, DOCUMENT_ID, "doftech");
1206

    
1207
        //    return ConvertPath;
1208
        //}
1209

    
1210
        public static string CreateMarkusParam(string projectNo, string documentID, string userID)
1211
        {
1212
            ViewInfo viewInfo = new ViewInfo();
1213

    
1214
            viewInfo.DocumentItemID = documentID;
1215
            viewInfo.ProjectNO = projectNo;
1216
            viewInfo.UserID = userID;
1217

    
1218
            return ParamEncoding(JsonConvert.SerializeObject(viewInfo));
1219

    
1220
        }
1221

    
1222
        public static string ParamEncoding(string EncodingText, System.Text.Encoding oEncoding = null)
1223
        {
1224

    
1225
            if (oEncoding == null)
1226
                oEncoding = System.Text.Encoding.UTF8;
1227

    
1228
            return Convert.ToBase64String(oEncoding.GetBytes(EncodingText));
1229

    
1230
        }
1231

    
1232
        #region Convert Path
1233

    
1234
        //private string GetConvertPath(string ProjectNo, string DocumentID)
1235
        //{
1236
        //    try
1237
        //    {
1238
        //        return Path.Combine(BaseStorage(ProjectNo), ProjectNo + "_Tile", (System.Convert.ToInt64(DocumentID) / 100).ToString(), DocumentID);
1239
        //    }
1240
        //    catch (Exception)
1241
        //    {
1242
        //        throw new Exception("GetConvertPath Error");
1243
        //    }
1244

    
1245
        //}
1246

    
1247
        //private async string BaseStorage(string ProjectNo)
1248
        //{
1249
        //    using (markusEntities entities = new markusEntities(App.MarkusDataBaseConnecitonString))
1250
        //    {
1251
        //        string result = "";
1252

    
1253
        //        var properties = await WcfClient.GET_SELECT_FINAL_PDF_ITEM(null, ProjectNo, null, null, null, null, null, null, null, 1, null, null, null, null,
1254
        //                null, null, null, null, null);
1255

    
1256

    
1257
        //        if (properties.Count() > 0)
1258
        //        {
1259
        //            result = properties.First().PROPERTIES_VALUE;
1260
        //        }
1261
        //        else
1262
        //        {
1263
        //            throw new Exception($"Project {ProjectNo} BaseStorage Not Setting.");
1264
        //        }
1265

    
1266
        //        return result;
1267
        //    }
1268
        //}
1269

    
1270
        #endregion
1271

    
1272
        #endregion
1273

    
1274
        #region Validation
1275

    
1276
        private void DataValidate(object obj)
1277
        {
1278

    
1279
            bool result = false;
1280

    
1281
            WebRequest webRequest = WebRequest.Create(SelectFilterConvert.OriginfilePath);
1282
            webRequest.Timeout = 1200; // miliseconds
1283
            webRequest.Method = "HEAD";
1284

    
1285
            HttpWebResponse response = null;
1286

    
1287
            try
1288
            {
1289
                response = (HttpWebResponse)webRequest.GetResponse();
1290
                result = true;
1291
            }
1292
            catch (WebException webException)
1293
            {
1294
                MessageBox.Show(SelectFilterConvert.FileName + " doesn't exist: " + webException.Message);
1295
                result = true;
1296
            }
1297
            finally
1298
            {
1299
                if (response != null)
1300
                {
1301
                    response.Close();
1302
                }
1303
            }
1304
            if (result == true)
1305
            {
1306
                MessageBox.Show("File exists");
1307
            }
1308
        }
1309

    
1310
        #endregion
1311

    
1312
        #region DataFilter
1313

    
1314
        public void DataFilter(object obj)
1315
        {
1316
            dispatcherTimer.Tick -= new EventHandler(Timer_Tick);
1317
            DataSearch(new[] { (StatusCodeType)(SelectedStatus.Value) }, FilterConvertSource);
1318
        }
1319

    
1320
        #endregion
1321

    
1322
        #region MarkusLink
1323

    
1324
        private void MarkusLink(object obj)///여기서 부터 
1325
        {
1326
            if (obj is FinalPDF)
1327
            {
1328
                if (obj != null)
1329
                {
1330
                    var convertitem = obj as FinalPDF;
1331

    
1332
                    SelectFilterConvert = convertitem;
1333

    
1334
                    SelectRealConvert = convertitem;
1335

    
1336
                    ProcessStartInfo startInfo = null;
1337

    
1338
                    startInfo = new ProcessStartInfo("iexplore.exe", convertitem.MarkusLink);
1339

    
1340
                    Process.Start(startInfo);
1341
                }
1342
            }
1343
        }
1344

    
1345
        #endregion
1346

    
1347
        #region Data Delete
1348

    
1349
        private void DataDelete(object obj)
1350
        {
1351
            RadWindow.Alert("do you want to delete it??", this.OnClosed);
1352
        }
1353

    
1354
        private async void OnClosed(object sender, WindowClosedEventArgs e)
1355
        {
1356
            var result = e.DialogResult;
1357
            if (result == true)
1358
            {
1359
                if (SelectRealConvert != null)
1360
                {
1361
                    await WcfClient.GET_SELECT_CONVERT_DELETEAsync(SelectRealConvert.ConvertID);
1362
                }
1363
                if (SelectFilterConvert != null)
1364
                {
1365
                    await WcfClient.GET_SELECT_CONVERT_DELETEAsync(SelectFilterConvert.ConvertID);
1366
                }
1367
            }
1368
        }
1369

    
1370

    
1371
        #endregion
1372

    
1373
        #region Data Export
1374

    
1375

    
1376
        /// <summary>
1377
        /// 필터된 상단 그리드 엑셀로 출력
1378
        /// </summary>
1379

    
1380
        public void DataExportData(object obj)
1381
        {
1382
            SaveFileDialog saveFileDialog = new SaveFileDialog();
1383

    
1384
            saveFileDialog.FileName = "Document"; // Default file name
1385
            saveFileDialog.DefaultExt = ".txt"; // Default file extension
1386
            saveFileDialog.Filter = "Csv documents (.Csv)|*.csv|Excel(2017~2019)Worksheets|*.xlsx"; // Filter files by extension
1387

    
1388

    
1389
            if (saveFileDialog.ShowDialog() == true)
1390
            {
1391

    
1392

    
1393
                if (!string.IsNullOrWhiteSpace(saveFileDialog.FileName))
1394
                {
1395

    
1396
                    var extension = new System.IO.FileInfo(saveFileDialog.FileName).Extension;
1397

    
1398
                    if (extension == ".xlsx" || extension == ".csv")
1399
                    {
1400

    
1401
                        var headers = new List<HeaderMember>
1402
                                {
1403
                                    new HeaderMember{HeaderName = "ServiceID", Property = "ServiceID" },
1404
                                    new HeaderMember{HeaderName = "ConvertID", Property = "ConvertID" },
1405
                                    new HeaderMember{HeaderName = "ProjectNumber", Property = "ProjectNumber" },
1406
                                    new HeaderMember{HeaderName = "ConvertState", Property = "ConvertState" },
1407
                                    new HeaderMember{HeaderName = "CurrentPageNo", Property = "CurrentPageNo" },
1408
                                    new HeaderMember{HeaderName = "TotalPage", Property = "TotalPage" },
1409
                                    new HeaderMember{HeaderName = "OriginfilePath", Property = "OriginfilePath" },
1410
                                    new HeaderMember{HeaderName = "ConvertPath", Property = "ConvertPath" },
1411
                                    new HeaderMember{HeaderName = "CreateTime", Property = "CreateTime" },
1412
                                    new HeaderMember{HeaderName = "Exception", Property = "Exception" },
1413
                                    new HeaderMember{HeaderName = "ProcessorAffinity", Property = "ProcessorAffinity" },
1414
                                    new HeaderMember{HeaderName = "ReConverter", Property = "ReConverter" },
1415
                                    new HeaderMember{HeaderName = "UniqueKey", Property = "UniqueKey" }
1416
                                };
1417

    
1418

    
1419
                        DataExport dataExport = new DataExport();
1420
                        dataExport.DataExportExcel(saveFileDialog.FileName, "Hello world", FilterConvertSource, headers);
1421
                        //_dataExport.DataExportExcel(saveFileDialog.FileName, saveFileDialog.FileName.ToString(), Projectsource, headers);
1422
                        //GemBoxFileSave(obj);
1423
                    }
1424
                }
1425
            }
1426
        }
1427

    
1428
        #endregion
1429

    
1430
        #region Data Search
1431

    
1432
        public void RemoveCreateTimeFilter(object obj)
1433
        {
1434
            DefaultCreateTime = DateTime.Now;
1435
            SelectedCreateTimeBegin = DefaultCreateTime;
1436
            SelectedCreateTimeEnd = DefaultCreateTime;
1437

    
1438
        }
1439

    
1440
        #endregion
1441

    
1442
        #region Reset
1443

    
1444
        /// <summary>
1445
        /// 그리드 상단 원상복귀 버튼
1446
        /// 필터를 끝낸 후 다시 복귀
1447
        /// </summary>
1448

    
1449
        public void Reset(object obj)
1450
        {
1451
            SelectedInt = 10;
1452
            ProjectNumberFilter = ProjectNames[0];
1453
            DocumentIDFilter = null;
1454
            MarkupInfo_IDFilter = null;
1455
            DOCINFO_IDFilter = null;
1456
            Document_NameFilter = null;
1457
            Document_NOFilter = null;
1458
            CreateUser_IDFilter = null;
1459
            GROUP_NOFilter = null;
1460
            REVISIONFilter = null;
1461

    
1462
            DefaultCreateTime = DateTime.Now;
1463
            SelectedCreateTimeBegin = DefaultCreateTime;
1464
            SelectedCreateTimeEnd = DefaultCreateTime;
1465

    
1466
            dispatcherTimer.Tick -= new EventHandler(SearchTimer_Tick);
1467
            dispatcherTimer.Tick += new EventHandler(Timer_Tick);
1468

    
1469
        }
1470

    
1471
        #endregion
1472

    
1473

    
1474
        #region ConvertAddDialog
1475

    
1476
        /// <summary>
1477
        /// 그리드 상단 Conver 추가 버튼
1478
        /// ProjectNo, DocumentURL, DocumentID, 입력해서 저장 프로시저에서 추가 
1479
        /// </summary>
1480

    
1481
        public void ConverAdd(object obj)
1482
        {
1483
            dispatcherTimer.Tick -= new EventHandler(Timer_Tick);
1484

    
1485
            Views.FinalPDFAddDialog convertAddDialog = new Views.FinalPDFAddDialog();
1486

    
1487
            convertAddDialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;
1488

    
1489
            convertAddDialog.ShowDialog();
1490

    
1491
            dispatcherTimer.Tick += new EventHandler(Timer_Tick);
1492
        }
1493

    
1494
        #endregion
1495

    
1496

    
1497
        #region ConvertPathFileSearch
1498

    
1499
        /// <summary>
1500
        ///  ConvertPath 파일 탐색기로 열리는 아이콘
1501
        /// </summary>
1502

    
1503
        public void ConvertPathFileSearch(object obj)
1504
        {
1505
            if (obj is FinalPDF)
1506
            {
1507
                if (obj != null)
1508
                {
1509
                    var convertitem = obj as ConvertPDF;
1510

    
1511
                    SaveFileDialog saveFileDialog = new SaveFileDialog();
1512

    
1513
                    saveFileDialog.FileName = "Document"; // Default file name
1514
                    saveFileDialog.DefaultExt = ".txt"; // Default file extension
1515
                    saveFileDialog.Filter = "Csv documents (.Csv)|*.csv|Excel(2017~2019)Worksheets|*.xlsx"; // Filter files by extension
1516

    
1517

    
1518
                    if (saveFileDialog.ShowDialog() == true)
1519
                    {
1520
                    }
1521
                }
1522
            }
1523
        }
1524

    
1525
        #endregion
1526

    
1527

    
1528
        #endregion
1529
    }
1530
}
클립보드 이미지 추가 (최대 크기: 500 MB)