프로젝트

일반

사용자정보

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

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

이력 | 보기 | 이력해설 | 다운로드 (52 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

    
246

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

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

    
276

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

    
288

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

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

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

    
324
                return _StatusCodeList;
325
            }
326
        }
327

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

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

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

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

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

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

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

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

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

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

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

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

    
553

    
554
        static DateTime DefaultCreateTime = DateTime.Now;
555
        private DateTime _SelectedCreateTimeBegin = DefaultCreateTime;
556
        public DateTime SelectedCreateTimeBegin
557
        {
558

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

    
567
            }
568
        }
569

    
570
        private DateTime _SelectedCreateTimeEnd = DefaultCreateTime;
571
        public DateTime SelectedCreateTimeEnd
572
        {
573

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

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

    
595

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

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

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

    
633

    
634
        private bool _ExcptionCheck = false;
635
        public bool ExcptionCheck
636
        {
637
            get
638
            {
639
                return _ExcptionCheck;
640
            }
641
            set
642
            {
643
                _ExcptionCheck = value;
644
                OnPropertyChanged(() => ExcptionCheck);
645
            }
646
        }
647

    
648
        #endregion
649

    
650
        #region Command
651

    
652
        public DelegateCommand ConvertCommand { get; private set; }
653
        public DelegateCommand DeleteCommand { get; private set; }
654
        public DelegateCommand ValidateCommand { get; private set; }
655
        public DelegateCommand DataSaveFileGemBoxCommand { get; private set; }
656
        public DelegateCommand MarkusLinkCommand { get; private set; }
657
        public DelegateCommand RemoveCreateTimeFilterCommand { get; private set; }
658

    
659
        public DelegateCommand DataFilterCommand { get; private set; }
660
        public DelegateCommand ResetCommand { get; private set; }
661
        public DelegateCommand ConverAddCommand { get; private set; }
662
        public DelegateCommand ConvertPathFileSearchCommand { get; private set; }
663

    
664
        #endregion
665

    
666
        #region Main Logic
667

    
668
        /// <summary>
669
        /// 각각의 Grid row 객체들 업데이트
670
        /// </summary>
671

    
672
        private DispatcherTimer dispatcherTimer;
673
        public override void Loaded()
674
        {
675
            base.Loaded();
676

    
677
            if (!App.IsDesignMode)
678
            {
679
                dispatcherTimer = new DispatcherTimer();
680
                dispatcherTimer.Tick += new EventHandler(Timer_Tick);
681
                dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
682
                dispatcherTimer.Start();
683
            }
684
        }
685

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

    
690
            if (IsAcitve)
691
            {
692
                await App.Current.Dispatcher.InvokeAsync(() =>
693
                {
694
                    DataSelect();
695

    
696
                    AliveDataSelect();
697
                });
698
            }
699

    
700
            await Task.Delay(5000);
701

    
702
            System.Threading.Thread.Sleep(new TimeSpan(0, 0, 0, 0, 100));
703

    
704
            dispatcherTimer.Start();
705
        }
706

    
707
        private async void SearchTimer_Tick(object sender, EventArgs e)
708
        {
709
            dispatcherTimer.Stop();
710

    
711
            if (IsAcitve)
712
            {
713
                await App.Current.Dispatcher.InvokeAsync(() =>
714
                {
715
                    DataSearch(new[] { (StatusCodeType)(SelectedStatus.Value) }, FilterConvertSource);
716

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

    
719
                    AliveDataSelect();
720
                });
721
            }
722

    
723
            await Task.Delay(5000);
724
            //await Task.Delay(10000);
725

    
726
            //System.Threading.Thread.Sleep(new TimeSpan(0,0,0,0,100));
727

    
728
            dispatcherTimer.Start();
729
        }
730

    
731

    
732
        public override void Closed()
733
        {
734
            if (dispatcherTimer != null)
735
            {
736
                dispatcherTimer.Stop();
737
            }
738

    
739
            base.Closed();
740
        }
741

    
742

    
743
        #endregion
744

    
745
        #region Function
746

    
747
        #region Return_FilterConvertSource
748

    
749
        public static void Return_FilterConvertSource(ObservableCollection<FinalPDF> convertPDFs)
750
        {
751
            ConvertSource = new ObservableCollection<FinalPDF>();
752
            ConvertSource = convertPDFs;
753
        }
754

    
755
        public static ObservableCollection<FinalPDF> Return_FilterConvertSource()
756
        {
757
            return ConvertSource;
758
        }
759

    
760

    
761
        #endregion
762

    
763

    
764
        #region Data Select
765

    
766
        /// <summary>
767
        /// 상단 그리드 중앙 그리드 출력 데이터
768
        /// </summary>
769
        private void DataSelect()
770
        {
771

    
772
            if (FilterConvertSource == null)
773
            {
774
                FilterConvertSource = new System.Collections.ObjectModel.ObservableCollection<FinalPDF>();
775
            }
776

    
777
            if (RealConvertSource == null)
778
            {
779
                RealConvertSource = new System.Collections.ObjectModel.ObservableCollection<FinalPDF>();
780
            }
781

    
782
            /// combobox 에서 선택된 items
783
            if (SelectedStatus != null)
784
            {
785
                DataSelect(new[] { (StatusCodeType)(SelectedStatus.Value) }, FilterConvertSource);
786
            }
787

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

    
791
        }
792

    
793
        private async void RealDataSelect(IEnumerable<StatusCodeType> statusCodeTypeList, System.Collections.ObjectModel.ObservableCollection<FinalPDF> collection)
794
        {
795
            try
796
            {
797
                IEnumerable<FinalPDF> Listitems = Enumerable.Empty<FinalPDF>();
798

    
799
                foreach (var coll in collection)
800
                {
801
                   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)
802
                                let MarkusLink = "kcom://" + CreateMarkusParam(x.PROJECT_NO, x.DOCUMENT_ID, "doftech")
803
                                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,
804
                            x.TOTAL_PAGE, x.EXCEPTION, x.GROUP_NO, x.CREATE_DATETIME, x.START_DATETIME, x.END_DATETIME, x.ORIGINAL_FILE, x.CONVERT_PATH, MarkusLink);
805

    
806
                }
807

    
808
                foreach (var Listitem in Listitems)
809
                {
810
                    collection.UpdateWhere(changeitem =>
811
                    ConvertItemEx.ChangeValues(changeitem, Listitem), x => x.ProjectNumber == Listitem.ProjectNumber && x.ConvertID == Listitem.ConvertID);
812
                }
813

    
814
                RealConvert_Height = 80 + (10 * collection.Count());
815
                DataBase_ItemsHeight = 800 - (RealConvert_Height + Alive_Height);
816
            }
817
            catch (Exception ex)
818
            {
819
                MessageBox.Show(ex.ToString());
820
            }
821
        }
822

    
823
        private async void DataSelect(IEnumerable<StatusCodeType> statusCodeTypeList, System.Collections.ObjectModel.ObservableCollection<FinalPDF> collection)
824
        {
825
            try
826
            {
827
                int _status = 0;
828
                if (SelectedStatus != null)
829
                {
830
                    _status = (int)SelectedStatus.Value;
831
                }
832

    
833
                if (ProjectNames.Count() == 0)
834
                {
835
                    ProjectName Clear = new ProjectName("Clear", "Clear");
836
                    ProjectNames.Add(Clear);
837
                    foreach (var x in await WcfClient.GET_SELECT_RUN_PROJECTSAsync(0))
838
                    {
839
                        ProjectName projectName = new ProjectName(x.PROJECT_NO, x.PROJECT_NAME);
840
                        ProjectNames.Add(projectName);
841
                    }
842
                }
843

    
844
                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)
845
                                let MarkusLink = "kcom://" + CreateMarkusParam(x.ID, x.DOCUMENT_ID, "doftech")
846
                                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,
847
                        x.REVISION, x.CURRENT_PAGE, x.TOTAL_PAGE, x.EXCEPTION, x.GROUP_NO, x.CREATE_DATETIME, x.START_DATETIME, x.END_DATETIME
848
                     , x.ORIGINAL_FILE, x.CONVERT_PATH, MarkusLink);
849

    
850
                if (collection.Count() == 0)
851
                {
852
                    if (statusCodeTypeList.Count() == 1)
853
                    {
854
                        foreach (var x in Listitems)
855
                        {
856
                            collection.Add(x);
857
                        }
858
                    }
859
                }
860
                else
861
                {
862
                    foreach (var newitem in Listitems)
863
                    {
864
                        collection.UpdateWhere(changeitem =>
865
                        ConvertItemEx.ChangeValues(changeitem, newitem), x => x.ProjectNumber == newitem.ProjectNumber && x.ConvertID == newitem.ConvertID);
866
                    }
867

    
868
                    if (statusCodeTypeList.Count() == 1)
869
                    {
870
                        for (int i = collection.Count() - 1; i >= 0; --i)
871
                        {
872
                            var item = collection[i];
873

    
874
                            if (Listitems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
875
                            {
876
                                collection.RemoveAt(i);
877
                            }
878
                        }
879
                    }
880

    
881
                    if (statusCodeTypeList.Count() == 1)
882
                    {
883
                        foreach (var item in Listitems)
884
                        {
885
                            if (collection.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
886
                            {
887
                                for (int i = 0; i < 200; i++)
888
                                {
889
                                    if (i < collection.Count() - 1)
890
                                    {
891
                                        if (DateTime.Compare(collection[i].CreateTime, item.CreateTime) < 0)
892
                                        {
893
                                            collection.Insert(i, item);
894
                                            break;
895
                                        }
896
                                    }
897
                                    else
898
                                    {
899
                                        collection.Add(item);
900
                                        break;
901
                                    }
902
                                }
903

    
904
                            }
905

    
906
                        }
907
                    }
908
                }
909
            }
910
            catch (Exception ex)
911
            {
912
                MessageBox.Show(ex.ToString());
913
                System.Diagnostics.Debug.WriteLine(ex.ToString());
914
            }
915
        }
916

    
917
        private async void DataSearch(IEnumerable<StatusCodeType> statusCodeTypeList, System.Collections.ObjectModel.ObservableCollection<FinalPDF> collection)
918
        {
919
            try
920
            {
921
                int _status = 0;
922
                if (SelectedStatus != null)
923
                {
924
                    _status = (int)SelectedStatus.Value;
925
                }
926

    
927
                DateTime? Start_CreateTime = null;
928
                DateTime? Finish_CreateTime = null;
929
                if (SelectedCreateTimeBegin != DefaultCreateTime)
930
                {
931
                    Start_CreateTime = SelectedCreateTimeBegin;
932
                }
933
                if (SelectedCreateTimeEnd != DefaultCreateTime)
934
                {
935
                    Finish_CreateTime = SelectedCreateTimeEnd;
936
                }
937

    
938
                if (ProjectNames.Count() == 0)
939
                {
940
                    foreach (var x in await WcfClient.GET_SELECT_RUN_PROJECTSAsync(0))
941
                    {
942
                        ProjectName projectName = new ProjectName(x.PROJECT_NO, x.PROJECT_NAME);
943
                        ProjectNames.Add(projectName);
944
                    }
945
                }
946

    
947
                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,
948
                    CreateUser_IDFilter, _status, SelectedCount.ValueMember, GROUP_NOFilter, REVISIONFilter, Start_CreateTime, Finish_CreateTime, null, null, null, null, Document_URLFilter, ExcptionCheck)
949
                                let MarkusLink = "kcom://" + CreateMarkusParam(x.ID, x.DOCUMENT_ID, "doftech")
950
                                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,
951
                                    x.REVISION, x.CURRENT_PAGE, x.TOTAL_PAGE, x.EXCEPTION, x.GROUP_NO, x.CREATE_DATETIME, x.START_DATETIME, x.END_DATETIME
952
                                 , x.ORIGINAL_FILE, x.CONVERT_PATH, MarkusLink);
953

    
954
                if (collection.Count() == 0)
955
                {
956
                    if (statusCodeTypeList.Count() == 1)
957
                    {
958
                        foreach (var x in Listitems)
959
                        {
960
                            collection.Add(x);
961
                        }
962
                    }
963
                }
964
                else
965
                {
966
                    foreach (var newitem in Listitems)
967
                    {
968
                        collection.UpdateWhere(changeitem =>
969
                        ConvertItemEx.ChangeValues(changeitem, newitem), x => x.ProjectNumber == newitem.ProjectNumber && x.ConvertID == newitem.ConvertID);
970
                    }
971

    
972
                    if (statusCodeTypeList.Count() == 1)
973
                    {
974

    
975
                        for (int i = collection.Count() - 1; i >= 0; --i)
976
                        {
977
                            var item = collection[i];
978

    
979
                            if (Listitems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
980
                            {
981
                                collection.RemoveAt(i);
982
                            }
983
                        }
984
                    }
985

    
986
                    if (statusCodeTypeList.Count() == 1)
987
                    {
988
                        foreach (var item in Listitems)
989
                        {
990
                            if (collection.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
991
                            {
992
                                for (int i = 0; i < 200; i++)
993
                                {
994
                                    if (i < collection.Count() - 1)
995
                                    {
996
                                        if (DateTime.Compare(collection[i].CreateTime, item.CreateTime) < 0)
997
                                        {
998
                                            collection.Insert(i, item);
999
                                            break;
1000
                                        }
1001
                                    }
1002
                                    else
1003
                                    {
1004
                                        collection.Add(item);
1005
                                        break;
1006
                                    }
1007
                                }
1008

    
1009
                            }
1010

    
1011
                        }
1012
                    }
1013

    
1014
                }
1015
            }
1016
            catch (Exception ex)
1017
            {
1018
                MessageBox.Show(ex.ToString());
1019
                System.Diagnostics.Debug.WriteLine(ex.ToString());
1020
            }
1021
        }
1022
        /// <summary>
1023
        /// 서비스의 실시간 컨버터 Item
1024
        /// </summary>
1025
        private async void AliveDataSelect()
1026
        {
1027
            try
1028
            {
1029
                List<FinalPDF> newitems = new List<FinalPDF>();
1030
                foreach (var client in App.StationClientList)
1031
                {
1032
                    if (await SimplePingAsync(client.Endpoint.Address.ToString()))
1033
                    {
1034
                        try
1035
                        {
1036
                            List<FinalPDF> itemsToList = new List<FinalPDF>();
1037
                            var items = await client.AliveConvertListAsync();
1038
                            string result = "";
1039

    
1040
                            foreach (var item in items)
1041
                            {
1042
                                FinalPDF itemsToEach = new FinalPDF();
1043
                                itemsToEach.ConvertID = item.ConvertID;
1044
                                itemsToEach.ProjectNumber = item.ProjectNumber;
1045

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

    
1048
                                //var convertpath = GetSearchConvertPathAndMarkus(item.ProjectNumber, item.UniqueKey);
1049

    
1050
                                if (item.ConvertState != null)
1051
                                {
1052
                                    itemsToEach.ConvertState = (StatusCodeType)Enum.Parse(typeof(StatusCodeType), item.ConvertState);
1053
                                }
1054

    
1055
                                if (item.OriginfilePath.Contains("/"))
1056
                                {
1057
                                    result = item.OriginfilePath.Substring(item.OriginfilePath.LastIndexOf("/") + 1);
1058
                                }
1059
                                else
1060
                                {
1061
                                    result = item.OriginfilePath.Substring(item.OriginfilePath.LastIndexOf("%") + 1);
1062
                                }
1063
                                itemsToEach.FileName = result;
1064

    
1065
                                itemsToEach.CurrentPageNo = item.CurrentPageNo;
1066
                                itemsToEach.TotalPage = item.TotalPage;
1067
                                itemsToEach.OriginfilePath = item.OriginfilePath;
1068
                                itemsToEach.ConvertPath = item.ConvertPath;
1069
                                itemsToEach.MarkusLink = MarkusLink;
1070
                                itemsToEach.DocumentID = item.DocumentID;
1071
                                itemsToEach.GroupNo = item.GroupNo;
1072
                                itemsToEach.DocumentName = item.DocumnetName;
1073
                                itemsToEach.Revision = item.Revision;
1074
                                itemsToEach.Exception = item.Exception;
1075
                                itemsToEach.ConvertPath = item.ConvertPath;
1076
                                itemsToEach.CreateTime = item.CreateTime;
1077
                                itemsToEach.StartTime = item.StartTime;
1078
                                itemsToEach.EndTime = item.EndTime;
1079
                                //itemsToEach.MarkupInfo_ID = 
1080
                                //itemsToEach.DocInfo_ID =
1081
                                //itemsToEach.Create_User_ID =
1082

    
1083
                                itemsToList.Add(itemsToEach);
1084
                            }
1085
                            newitems.AddRange(itemsToList);
1086
                            System.Diagnostics.Trace.WriteLine($"{client.Endpoint.Address} ping");
1087

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

    
1103
                }
1104
                ItemsUpdate(newitems);
1105
                await System.Windows.Application.Current.Dispatcher.InvokeAsync(() => ItemsUpdate(newitems));
1106
            }
1107
            catch (Exception ex)
1108
            {
1109
                System.Diagnostics.Debug.WriteLine(ex.ToString());
1110
            }
1111
        }
1112

    
1113
        /// <summary>
1114
        /// AliveDataSelect의 Data Update
1115
        /// </summary>
1116
        /// <param name = "newitems" ></ param >
1117
        private void ItemsUpdate(List<FinalPDF> newitems)
1118
        {
1119

    
1120
            foreach (var item in newitems)
1121
            {
1122
                item.OriginfilePath = HttpUtility.UrlDecode(item.OriginfilePath);
1123
            }
1124

    
1125
            if (AliveItems == null)
1126
            {
1127
                AliveItems = new System.Collections.ObjectModel.ObservableCollection<FinalPDF>();
1128

    
1129
                foreach (var item in newitems)
1130
                {
1131
                    AliveItems.Add(item);
1132
                }
1133
            }
1134
            else
1135
            {
1136
                // 데이터 업데이트
1137
                newitems.ForEach(newitem =>
1138
                {
1139
                    AliveItems.UpdateWhere(changeitem => ConvertItemEx.ChangeValues(changeitem, newitem), x => x.ProjectNumber == newitem.ProjectNumber && x.ConvertID == newitem.ConvertID);
1140
                });
1141

    
1142
                ///추가
1143
                foreach (var item in newitems)
1144
                {
1145
                    if (AliveItems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
1146
                    {
1147
                        AliveItems.Add(item);
1148
                    }
1149
                }
1150

    
1151
                // 삭제
1152

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

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

    
1171
            Alive_Height = 80 + (newitems.Count() * 10);
1172
            DataBase_ItemsHeight = 800 - (RealConvert_Height + Alive_Height);
1173
        }
1174

    
1175

    
1176
        public static async Task<bool> SimplePingAsync(string uri)
1177
        {
1178
            bool result = false;
1179

    
1180
            try
1181
            {
1182
                using (System.Net.Http.HttpClient Client = new System.Net.Http.HttpClient())
1183
                {
1184
                    Client.Timeout = new TimeSpan(0, 0, 60);
1185

    
1186
                    var message = await Client.GetAsync(uri);
1187

    
1188
                    System.Net.HttpStatusCode StatusCode = message.StatusCode;
1189

    
1190
                    switch (StatusCode)
1191
                    {
1192

    
1193
                        case System.Net.HttpStatusCode.Accepted:
1194
                        case System.Net.HttpStatusCode.OK:
1195
                            result = true;
1196
                            break;
1197
                    }
1198
                }
1199
            }
1200
            catch (Exception ex)
1201
            {
1202
                result = false;
1203
                System.Diagnostics.Debug.WriteLine(ex.ToString());
1204
            }
1205

    
1206
            return result;
1207
        }
1208

    
1209
        #endregion
1210

    
1211
        #region Data Convert
1212

    
1213
        private async void DataConvert(object obj)
1214
        {
1215
            if (SelectFilterConvert == null && SelectRealConvert == null)
1216
            {
1217
                MessageBox.Show("왼쪽 버튼 클릭 후 Converter 해주세요!");
1218
            }
1219
            else
1220
            {
1221
                //ConvertDatabase _DataConvert = new ConvertDatabase(App.MarkusDataBaseConnecitonString);
1222
                var resultRealConvert = 0;
1223
                var resultFiltertConvert = 0;
1224

    
1225
                if (SelectRealConvert != null)
1226
                {
1227
                    //resultRealConvert = _DataConvert.SetCleanUpItem(SelectRealConvert);//ConvertDataBase
1228
                    resultRealConvert = SetCleanUpItem(SelectRealConvert).Result;//ConvertDataBase
1229
                }
1230
                else if (SelectFilterConvert != null)
1231
                {
1232
                    //resultFiltertConvert = _DataConvert.SetCleanUpItem(SelectFilterConvert);//ConvertDataBase
1233
                    resultFiltertConvert = SetCleanUpItem(SelectFilterConvert).Result;
1234
                }
1235
                System.Diagnostics.Debug.WriteLine(resultRealConvert + "  " + resultFiltertConvert);
1236

    
1237
                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)
1238
                            let MarkusLink = "kcom://" + CreateMarkusParam(x.ID, x.DOCUMENT_ID, "doftech")
1239
                            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,
1240
                        x.REVISION, x.CURRENT_PAGE, x.TOTAL_PAGE, x.EXCEPTION, x.GROUP_NO, x.CREATE_DATETIME, x.START_DATETIME, x.END_DATETIME
1241
                     , x.ORIGINAL_FILE, x.CONVERT_PATH, MarkusLink);
1242

    
1243

    
1244
                foreach (var item in items)
1245
                {
1246

    
1247
                    RealConvertSource.Add(item);
1248

    
1249
                    if (RealConvertSource.Count() == 1)
1250
                    {
1251
                        ConvertShow = true;
1252
                    }
1253
                }
1254
            }
1255
        }
1256

    
1257

    
1258
        public async Task<int> SetCleanUpItem(FinalPDF _ConvertItem)
1259
        {
1260
            int result = 0;
1261

    
1262
            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);
1263

    
1264
            if (items.Count() > 0)
1265
            {
1266
                var item = items.First();
1267

    
1268
                var _CREATE_DATETIME = DateTime.Now;
1269
                var _STATUS = (int)StatusCodeType.None;
1270

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

    
1273
            }
1274

    
1275
            return result;
1276
        }
1277

    
1278
        //public string[] GetSearchConvertPathAndMarkus(string PROJECT_NO, string DOCUMENT_ID)
1279
        //{
1280
        //    string[] ConvertPath = new string[2];
1281
        //    ConvertPath[0] = GetConvertPath(PROJECT_NO, DOCUMENT_ID);
1282
        //    ConvertPath[1] = "kcom://" + CreateMarkusParam(PROJECT_NO, DOCUMENT_ID, "doftech");
1283

    
1284
        //    return ConvertPath;
1285
        //}
1286

    
1287
        public static string CreateMarkusParam(string projectNo, string documentID, string userID)
1288
        {
1289
            ViewInfo viewInfo = new ViewInfo();
1290

    
1291
            viewInfo.DocumentItemID = documentID;
1292
            viewInfo.ProjectNO = projectNo;
1293
            viewInfo.UserID = userID;
1294

    
1295
            return ParamEncoding(JsonConvert.SerializeObject(viewInfo));
1296

    
1297
        }
1298

    
1299
        public static string ParamEncoding(string EncodingText, System.Text.Encoding oEncoding = null)
1300
        {
1301

    
1302
            if (oEncoding == null)
1303
                oEncoding = System.Text.Encoding.UTF8;
1304

    
1305
            return Convert.ToBase64String(oEncoding.GetBytes(EncodingText));
1306

    
1307
        }
1308

    
1309
        #region Convert Path
1310

    
1311
        //private string GetConvertPath(string ProjectNo, string DocumentID)
1312
        //{
1313
        //    try
1314
        //    {
1315
        //        return Path.Combine(BaseStorage(ProjectNo), ProjectNo + "_Tile", (System.Convert.ToInt64(DocumentID) / 100).ToString(), DocumentID);
1316
        //    }
1317
        //    catch (Exception)
1318
        //    {
1319
        //        throw new Exception("GetConvertPath Error");
1320
        //    }
1321

    
1322
        //}
1323

    
1324
        //private async string BaseStorage(string ProjectNo)
1325
        //{
1326
        //    using (markusEntities entities = new markusEntities(App.MarkusDataBaseConnecitonString))
1327
        //    {
1328
        //        string result = "";
1329

    
1330
        //        var properties = await WcfClient.GET_SELECT_FINAL_PDF_ITEM(null, ProjectNo, null, null, null, null, null, null, null, 1, null, null, null, null,
1331
        //                null, null, null, null, null);
1332

    
1333

    
1334
        //        if (properties.Count() > 0)
1335
        //        {
1336
        //            result = properties.First().PROPERTIES_VALUE;
1337
        //        }
1338
        //        else
1339
        //        {
1340
        //            throw new Exception($"Project {ProjectNo} BaseStorage Not Setting.");
1341
        //        }
1342

    
1343
        //        return result;
1344
        //    }
1345
        //}
1346

    
1347
        #endregion
1348

    
1349
        #endregion
1350

    
1351
        #region Validation
1352

    
1353
        private void DataValidate(object obj)
1354
        {
1355

    
1356
            bool result = false;
1357

    
1358
            WebRequest webRequest = WebRequest.Create(SelectFilterConvert.OriginfilePath);
1359
            webRequest.Timeout = 1200; // miliseconds
1360
            webRequest.Method = "HEAD";
1361

    
1362
            HttpWebResponse response = null;
1363

    
1364
            try
1365
            {
1366
                response = (HttpWebResponse)webRequest.GetResponse();
1367
                result = true;
1368
            }
1369
            catch (WebException webException)
1370
            {
1371
                MessageBox.Show(SelectFilterConvert.FileName + " doesn't exist: " + webException.Message);
1372
                result = true;
1373
            }
1374
            finally
1375
            {
1376
                if (response != null)
1377
                {
1378
                    response.Close();
1379
                }
1380
            }
1381
            if (result == true)
1382
            {
1383
                MessageBox.Show("File exists");
1384
            }
1385
        }
1386

    
1387
        #endregion
1388

    
1389
        #region DataFilter
1390

    
1391
        public void DataFilter(object obj)
1392
        {
1393
            dispatcherTimer.Tick -= new EventHandler(Timer_Tick);
1394
            dispatcherTimer.Tick += new EventHandler(SearchTimer_Tick);
1395
            //DataSearch(new[] { (StatusCodeType)(SelectedStatus.Value) }, FilterConvertSource);
1396
        }
1397

    
1398
        #endregion
1399

    
1400
        #region MarkusLink
1401

    
1402
        private void MarkusLink(object obj)///여기서 부터 
1403
        {
1404
            if (obj is FinalPDF)
1405
            {
1406
                if (obj != null)
1407
                {
1408
                    var convertitem = obj as FinalPDF;
1409

    
1410
                    //SelectFilterConvert = convertitem;
1411
                    SelectFilterConvertList.Add(convertitem);
1412

    
1413
                    SelectRealConvert = convertitem;
1414

    
1415
                    ProcessStartInfo startInfo = null;
1416

    
1417
                    startInfo = new ProcessStartInfo("iexplore.exe", convertitem.MarkusLink);
1418

    
1419
                    Process.Start(startInfo);
1420
                }
1421
            }
1422
        }
1423

    
1424
        #endregion
1425

    
1426
        #region Data Delete
1427

    
1428
        private void DataDelete(object obj)
1429
        {
1430
            RadWindow.Alert("do you want to delete it??", this.OnClosed);
1431
        }
1432

    
1433
        private async void OnClosed(object sender, WindowClosedEventArgs e)
1434
        {
1435
            var result = e.DialogResult;
1436
            if (result == true)
1437
            {
1438
                if (SelectFilterConvertList.Count() > 1)
1439
                {
1440
                    MessageBox.Show("하나만 클릭해 주세요!");
1441
                }
1442
                else
1443
                {
1444
                    if (SelectRealConvert != null)
1445
                    {
1446
                        await WcfClient.GET_SELECT_CONVERT_DELETEAsync(SelectRealConvert.ConvertID);
1447
                    }
1448
                    if (SelectFilterConvertList != null)
1449
                    {
1450
                        await WcfClient.GET_SELECT_CONVERT_DELETEAsync(SelectFilterConvertList[0].ConvertID);
1451
                    }
1452
                }
1453
            }
1454
        }
1455

    
1456

    
1457
        #endregion
1458

    
1459
        #region Data Export
1460

    
1461

    
1462
        /// <summary>
1463
        /// 필터된 상단 그리드 엑셀로 출력
1464
        /// </summary>
1465

    
1466
        public void DataExportData(object obj)
1467
        {
1468
            dispatcherTimer.Tick -= new EventHandler(Timer_Tick);
1469

    
1470
            Return_FilterConvertSource(FilterConvertSource);
1471

    
1472
            Views.FinalPDFExcelDialog finalPDFExcelDialog = new Views.FinalPDFExcelDialog();
1473

    
1474
            finalPDFExcelDialog.Owner = Application.Current.MainWindow;
1475
            finalPDFExcelDialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;
1476

    
1477
            finalPDFExcelDialog.ShowDialog();
1478

    
1479

    
1480
            dispatcherTimer.Tick += new EventHandler(Timer_Tick);
1481
        }
1482

    
1483
        #endregion
1484

    
1485
        #region Data Search
1486

    
1487
        public void RemoveCreateTimeFilter(object obj)
1488
        {
1489
            DefaultCreateTime = DateTime.Now;
1490
            SelectedCreateTimeBegin = DefaultCreateTime;
1491
            SelectedCreateTimeEnd = DefaultCreateTime;
1492

    
1493
        }
1494

    
1495
        #endregion
1496

    
1497
        #region Reset
1498

    
1499
        /// <summary>
1500
        /// 그리드 상단 원상복귀 버튼
1501
        /// 필터를 끝낸 후 다시 복귀
1502
        /// </summary>
1503

    
1504
        public void Reset(object obj)
1505
        {
1506
            SelectedInt = 10;
1507
            ProjectNumberFilter = ProjectNames[0];
1508
            DocumentIDFilter = null;
1509
            MarkupInfo_IDFilter = null;
1510
            DOCINFO_IDFilter = null;
1511
            Document_NameFilter = null;
1512
            Document_NOFilter = null;
1513
            CreateUser_IDFilter = null;
1514
            GROUP_NOFilter = null;
1515
            REVISIONFilter = null;
1516

    
1517
            DefaultCreateTime = DateTime.Now;
1518
            SelectedCreateTimeBegin = DefaultCreateTime;
1519
            SelectedCreateTimeEnd = DefaultCreateTime;
1520

    
1521
            dispatcherTimer.Tick -= new EventHandler(SearchTimer_Tick);
1522
            dispatcherTimer.Tick += new EventHandler(Timer_Tick);
1523

    
1524
        }
1525

    
1526
        #endregion
1527

    
1528

    
1529
        #region ConvertAddDialog
1530

    
1531
        /// <summary>
1532
        /// 그리드 상단 Conver 추가 버튼
1533
        /// ProjectNo, DocumentURL, DocumentID, 입력해서 저장 프로시저에서 추가 
1534
        /// </summary>
1535

    
1536
        public void ConverAdd(object obj)
1537
        {
1538
            dispatcherTimer.Tick -= new EventHandler(Timer_Tick);
1539

    
1540
            Views.FinalPDFAddDialog convertAddDialog = new Views.FinalPDFAddDialog();
1541

    
1542
            convertAddDialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;
1543

    
1544
            convertAddDialog.ShowDialog();
1545

    
1546
            dispatcherTimer.Tick += new EventHandler(Timer_Tick);
1547
        }
1548

    
1549
        #endregion
1550

    
1551

    
1552
        #region ConvertPathFileSearch
1553

    
1554
        /// <summary>
1555
        ///  ConvertPath 파일 탐색기로 열리는 아이콘
1556
        /// </summary>
1557

    
1558
        public void ConvertPathFileSearch(object obj)
1559
        {
1560
            if (obj is FinalPDF)
1561
            {
1562
                if (obj != null)
1563
                {
1564
                    var convertitem = obj as ConvertPDF;
1565

    
1566
                    SaveFileDialog saveFileDialog = new SaveFileDialog();
1567

    
1568
                    saveFileDialog.FileName = "Document"; // Default file name
1569
                    saveFileDialog.DefaultExt = ".txt"; // Default file extension
1570
                    saveFileDialog.Filter = "Csv documents (.Csv)|*.csv|Excel(2017~2019)Worksheets|*.xlsx"; // Filter files by extension
1571

    
1572

    
1573
                    if (saveFileDialog.ShowDialog() == true)
1574
                    {
1575
                    }
1576
                }
1577
            }
1578
        }
1579

    
1580
        #endregion
1581

    
1582

    
1583
        #endregion
1584
    }
1585
}
클립보드 이미지 추가 (최대 크기: 500 MB)