프로젝트

일반

사용자정보

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

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

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

1 31beca73 semi
using Markus.Service.Extensions;
2 3bde451b semi
using Markus.Service.StationController.Data;
3
using Markus.Service.StationController.Behaviors;
4
using Markus.Service.StationController.Extensions;
5
using Markus.Service.StationController.Controls;
6
using Microsoft.Win32;
7
using System;
8
using System.Collections.Generic;
9
using System.ComponentModel;
10
using System.Linq;
11
using System.Threading.Tasks;
12
using System.Web;
13
using System.Windows;
14
using Telerik.Windows.Controls;
15
using Telerik.Windows.Data;
16
using System.Net;
17
using System.Windows.Threading;
18
using System.Diagnostics;
19
using System.Windows.Input;
20
using Markus.Mvvm.ToolKit;
21
using System.Windows.Data;
22
using System.Windows.Controls;
23
using System.IO;
24 2c634aed semi
using Newtonsoft.Json;
25 78683624 semi
using static Markus.Service.StationController.Data.FinalPDF;
26 037ab674 semi
using System.Collections.ObjectModel;
27 3bde451b semi
28
namespace Markus.Service.StationController.ViewModel
29
{
30
    class FinalPDFViewModel : Mvvm.ToolKit.ViewModelBase
31
    {
32
        #region Constructor
33
34
        /// <summary>
35
        /// 실행하면 처음 들어가는 부분
36
        /// </summary>
37
        public FinalPDFViewModel()
38
        {
39
            DataFilterCommand = new DelegateCommand(DataFilter);
40
            DataSaveFileGemBoxCommand = new DelegateCommand(DataExportData);
41
            ConvertCommand = new DelegateCommand(DataConvert);
42
            DeleteCommand = new DelegateCommand(DataDelete);
43
            ValidateCommand = new DelegateCommand(DataValidate);
44
            MarkusLinkCommand = new DelegateCommand(MarkusLink);
45
            RemoveCreateTimeFilterCommand = new DelegateCommand(RemoveCreateTimeFilter);
46
            ResetCommand = new DelegateCommand(Reset);
47
            ConverAddCommand = new DelegateCommand(ConverAdd);
48 95e7bd84 semi
            FinalPDFPathFileSearchCommand = new DelegateCommand(FinalPDFPathFileSearch);
49 3bde451b semi
        }
50
51
        #endregion
52
53
        #region Properties
54
55 037ab674 semi
        DataService.DataServiceClient WcfClient = new DataService.DataServiceClient();
56
57 19d6b221 semi
58
        private static System.Collections.ObjectModel.ObservableCollection<FinalPDF> _ConvertSource;
59
        public static System.Collections.ObjectModel.ObservableCollection<FinalPDF> ConvertSource
60
        {
61
            get
62
            {
63
                if (_ConvertSource == null)
64
                {
65
                    _ConvertSource = new System.Collections.ObjectModel.ObservableCollection<FinalPDF>();
66
                }
67
                return _ConvertSource;
68
            }
69
            set
70
            {
71
                _ConvertSource = value;
72
            }
73
        }
74
75 037ab674 semi
        public ObservableCollection<ProjectName> _ProjectNames;
76
        public ObservableCollection<ProjectName> ProjectNames
77
        {
78
            get
79
            {
80
                if (_ProjectNames == null)
81
                {
82
                    _ProjectNames = new System.Collections.ObjectModel.ObservableCollection<ProjectName>();
83
                }
84
85
                return _ProjectNames;
86
            }
87
            set
88
            {
89
                _ProjectNames = value;
90
                OnPropertyChanged(() => ProjectNames);
91
            }
92
        }
93
94 78683624 semi
        private System.Collections.ObjectModel.ObservableCollection<FinalPDF> _FilterSearch;
95
        public System.Collections.ObjectModel.ObservableCollection<FinalPDF> FilterSearch
96 3bde451b semi
        {
97
            get
98
            {
99
                if (_FilterSearch == null)
100
                {
101 78683624 semi
                    _FilterSearch = new System.Collections.ObjectModel.ObservableCollection<FinalPDF>
102 3bde451b semi
                            {
103 78683624 semi
                                new FinalPDF{ProjectNumber = "Filter Search"}
104 3bde451b semi
                            };
105
                }
106
107
                return _FilterSearch;
108
            }
109
        }
110
111 78683624 semi
        private System.Collections.ObjectModel.ObservableCollection<FinalPDF> _AliveItems;
112
        public System.Collections.ObjectModel.ObservableCollection<FinalPDF> AliveItems
113 3bde451b semi
        {
114
            get => _AliveItems;
115
            set
116
            {
117
                _AliveItems = value;
118
                OnPropertyChanged(() => AliveItems);
119
            }
120
        }
121
122
        public ICollectionView FilterConvertSourceView
123
        {
124
            get
125
            {
126
                var view = CollectionViewSource.GetDefaultView(FilterConvertSource);
127
                return view;
128
            }
129
        }
130
131 78683624 semi
        private System.Collections.ObjectModel.ObservableCollection<FinalPDF> _FilterConvertSource;
132
        public System.Collections.ObjectModel.ObservableCollection<FinalPDF> FilterConvertSource
133 3bde451b semi
        {
134
            get
135
            {
136
                if (_FilterConvertSource == null)
137
                {
138 78683624 semi
                    _FilterConvertSource = new System.Collections.ObjectModel.ObservableCollection<FinalPDF>();
139 3bde451b semi
                }
140
                return _FilterConvertSource;
141
            }
142
            set
143
            {
144
                _FilterConvertSource = value;
145
                OnPropertyChanged(() => FilterConvertSource);
146
            }
147
        }
148
149
150 78683624 semi
        private System.Collections.ObjectModel.ObservableCollection<FinalPDF> _RealConvertSource;
151
        public System.Collections.ObjectModel.ObservableCollection<FinalPDF> RealConvertSource
152 3bde451b semi
        {
153
            get => _RealConvertSource;
154
            set
155
            {
156
                _RealConvertSource = value;
157
                OnPropertyChanged(() => RealConvertSource);
158
            }
159
        }
160
161
162
        private System.Windows.Documents.FlowDocument connectionLog;
163
        public System.Windows.Documents.FlowDocument ConnectionLog
164
        {
165
            get => connectionLog;
166
            set
167
            {
168
                if (connectionLog != value)
169
                {
170
                    connectionLog = value;
171
                    OnPropertyChanged(() => ConnectionLog);
172
                }
173
            }
174
        }
175
176
177 037ab674 semi
        private int _SelectedInt = 4;
178
        public int SelectedInt
179
        {
180
            get => _SelectedInt;
181
            set
182
            {
183
                _SelectedInt = value;
184
                OnPropertyChanged(() => SelectedInt);
185
            }
186
        }
187
188
189 3bde451b semi
        private Telerik.Windows.Data.EnumMemberViewModel _SelectedStatus;
190
        public Telerik.Windows.Data.EnumMemberViewModel SelectedStatus
191
        {
192
            get => _SelectedStatus;
193
            set
194
            {
195
                _SelectedStatus = value;
196
                OnPropertyChanged(() => SelectedStatus);
197
            }
198
        }
199
200
201
        private SelectedCountItem _SelectedCount;
202
        public SelectedCountItem SelectedCount
203
        {
204
            get => _SelectedCount;
205
            set
206
            {
207
                _SelectedCount = value;
208
                OnPropertyChanged(() => SelectedCount);
209
            }
210
        }
211
212
        List<SelectedCountItem> _SelectedCountList;
213
        public List<SelectedCountItem> SelectedCountList
214
        {
215
            get
216
            {
217
                if (_SelectedCountList == null)
218
                {
219
                    _SelectedCountList = new List<SelectedCountItem>
220
                            {
221
                                new SelectedCountItem{DisplayMember = "50",ValueMember = 50},
222
                                new SelectedCountItem{DisplayMember = "100",ValueMember = 100},
223
                                new SelectedCountItem{DisplayMember = "150",ValueMember = 150},
224
                                new SelectedCountItem{DisplayMember = "200",ValueMember = 200}
225
                            };
226
                }
227
228
                return _SelectedCountList;
229
            }
230
        }
231
232 78683624 semi
        private FinalPDF _SelectFilterConvert;
233
        public FinalPDF SelectFilterConvert
234 3bde451b semi
        {
235
            get => _SelectFilterConvert;
236
            set
237
            {
238
                _SelectFilterConvert = value;
239
                OnPropertyChanged(() => SelectFilterConvert);
240
            }
241
        }
242
243 9b2f01e1 semi
244
245
        private ObservableCollection<FinalPDF> _SelectFilterConvertList;
246
        public ObservableCollection<FinalPDF> SelectFilterConvertList
247
        {
248
            get
249
            {
250
                if (_SelectFilterConvertList == null)
251
                {
252
                    _SelectFilterConvertList = new ObservableCollection<FinalPDF>();
253
                }
254
                return _SelectFilterConvertList;
255
            }
256
            set
257
            {
258
                _SelectFilterConvertList = value;
259
                OnPropertyChanged(() => SelectFilterConvertList);
260
            }
261
        }
262
263 78683624 semi
        private FinalPDF _SelectRealConvert;
264
        public FinalPDF SelectRealConvert
265 3bde451b semi
        {
266
            get => _SelectRealConvert;
267
            set
268
            {
269
                _SelectRealConvert = value;
270
                OnPropertyChanged(() => SelectRealConvert);
271
            }
272
        }
273
274
275 78683624 semi
        private FinalPDF _SelectAliveConvert;
276
        public FinalPDF SelectAliveConvert
277 3bde451b semi
        {
278
            get => _SelectAliveConvert;
279
            set
280
            {
281
                _SelectAliveConvert = value;
282
                OnPropertyChanged(() => SelectAliveConvert);
283
            }
284
        }
285
286
287
        private StatusTypeList _StatusType;
288
        public StatusTypeList StatusType
289
        {
290
            get => _StatusType;
291
            set
292
            {
293
                _StatusType = value;
294
                OnPropertyChanged(() => StatusType);
295
            }
296
        }
297
298
        private bool _IsLoading;
299
        public bool IsLoading
300
        {
301
            get => _IsLoading;
302
            set
303
            {
304
                if (_IsLoading != value)
305
                {
306
                    _IsLoading = value;
307
                    OnPropertyChanged(() => IsLoading);
308
                }
309
            }
310
        }
311
312
        IEnumerable<Telerik.Windows.Data.EnumMemberViewModel> _StatusCodeList;
313
        public IEnumerable<Telerik.Windows.Data.EnumMemberViewModel> StatusCodeList
314
        {
315
            get
316
            {
317
                if (_StatusCodeList == null)
318
                {
319
                    _StatusCodeList = Telerik.Windows.Data.EnumDataSource.FromType<StatusCodeType>();
320
                }
321
322
                return _StatusCodeList;
323
            }
324
        }
325
326 037ab674 semi
        public ProjectName _ProjectNumberFilter;
327
        public ProjectName ProjectNumberFilter
328 3bde451b semi
        {
329 037ab674 semi
            get
330 3bde451b semi
            {
331 037ab674 semi
                if (_ProjectNumberFilter == null)
332 3bde451b semi
                {
333 037ab674 semi
                    _ProjectNumberFilter = new ProjectName();
334 3bde451b semi
                }
335 037ab674 semi
                return _ProjectNumberFilter;
336
            }
337
            set
338
            {
339
                _ProjectNumberFilter = value;
340
                OnPropertyChanged(() => ProjectNumberFilter);
341 3bde451b semi
            }
342
        }
343
344
        public string _DocumentIDFilter;
345
        public string DocumentIDFilter
346
        {
347
            get
348
            {
349
                return _DocumentIDFilter;
350
            }
351
            set
352
            {
353
                if (_DocumentIDFilter == "")
354
                {
355
                    _DocumentIDFilter = null;
356
                }
357
                else if (_DocumentIDFilter != value)
358
                {
359
                    _DocumentIDFilter = value;
360
                    OnPropertyChanged(() => DocumentIDFilter);
361
                }
362
            }
363
        }
364
365
        public string _DOCINFO_IDFilter;
366
        public string DOCINFO_IDFilter
367
        {
368
            get
369
            {
370
                return _DOCINFO_IDFilter;
371
            }
372
            set
373
            {
374
                if (_DOCINFO_IDFilter == "")
375
                {
376
                    _DOCINFO_IDFilter = null;
377
                }
378
                else if (_DOCINFO_IDFilter != value)
379
                {
380
                    _DOCINFO_IDFilter = value;
381
                    OnPropertyChanged(() => DOCINFO_IDFilter);
382
                }
383
            }
384
        }
385
386 31beca73 semi
        public string _Document_URLFilter;
387
        public string Document_URLFilter
388
        {
389
            get
390
            {
391
                return _Document_URLFilter;
392
            }
393
            set
394
            {
395
                if (_Document_URLFilter != value)
396
                {
397
                    _Document_URLFilter = value;
398
                    OnPropertyChanged(() => Document_URLFilter);
399
                }
400
            }
401
        }
402 3bde451b semi
403
        public string _MarkupInfo_IDFilter;
404
        public string MarkupInfo_IDFilter
405
        {
406
            get
407
            {
408
                return _MarkupInfo_IDFilter;
409
            }
410
            set
411
            {
412
                if (_MarkupInfo_IDFilter != value)
413
                {
414
                    _MarkupInfo_IDFilter = value;
415
                    OnPropertyChanged(() => MarkupInfo_IDFilter);
416
                }
417
            }
418
        }
419
420
        public string _CreateUser_IDFilter;
421
        public string CreateUser_IDFilter
422
        {
423
            get
424
            {
425
                return _CreateUser_IDFilter;
426
            }
427
            set
428
            {
429
                if (_CreateUser_IDFilter == "")
430
                {
431
                    _CreateUser_IDFilter = null;
432
                }
433
                else if (_CreateUser_IDFilter != value)
434
                {
435
                    _CreateUser_IDFilter = value;
436
                    OnPropertyChanged(() => CreateUser_IDFilter);
437
                }
438
            }
439
        }
440
441
        public string _GROUP_NOFilter;
442
        public string GROUP_NOFilter
443
        {
444
            get
445
            {
446
                return _GROUP_NOFilter;
447
            }
448
            set
449
            {
450
                if (_GROUP_NOFilter == "")
451
                {
452
                    _GROUP_NOFilter = null;
453
                }
454
                else if (_GROUP_NOFilter != value)
455
                {
456
                    _GROUP_NOFilter = value;
457
                    OnPropertyChanged(() => GROUP_NOFilter);
458
                }
459
            }
460
        }
461
462
        public string _REVISIONFilter;
463
        public string REVISIONFilter
464
        {
465
            get
466
            {
467
                return _REVISIONFilter;
468
            }
469
            set
470
            {
471
                if (_REVISIONFilter == "")
472
                {
473
                    _REVISIONFilter = null;
474
                }
475
                else if (_REVISIONFilter != value)
476
                {
477
                    _REVISIONFilter = value;
478
                    OnPropertyChanged(() => REVISIONFilter);
479
                }
480
            }
481
        }
482
483
        public StatusCodeType _ConvertStateFilter;
484
        public StatusCodeType ConvertStateFilter
485
        {
486
            get { return _ConvertStateFilter; }
487
            set
488
            {
489
                if (_ConvertStateFilter != value)
490
                {
491
                    _ConvertStateFilter = value;
492
                    OnPropertyChanged(() => ConvertStateFilter);
493
                }
494
            }
495
        }
496
497
        public string _Document_NOFilter;
498
        public string Document_NOFilter
499
        {
500
            get { return _Document_NOFilter; }
501
            set
502
            {
503
                if (_Document_NOFilter == "")
504
                {
505
                    _Document_NOFilter = null;
506
                }
507
                else if (_Document_NOFilter != value)
508
                {
509
                    _Document_NOFilter = value;
510
                    OnPropertyChanged(() => Document_NOFilter);
511
                }
512
            }
513
        }
514
515
        public string _Exception;
516
        public string Exception
517
        {
518
            get { return _Exception; }
519
            set
520
            {
521
                if (_Exception == "")
522
                {
523
                    _Exception = null;
524
                }
525
                else if (_Exception != value)
526
                {
527
                    _Exception = value;
528
                    OnPropertyChanged(() => Exception);
529
                }
530
            }
531
        }
532
533
        public string _Document_NameFilter;
534
        public string Document_NameFilter
535
        {
536
            get { return _Document_NameFilter; }
537
            set
538
            {
539
                if (_Document_NameFilter == "")
540
                {
541
                    _Document_NameFilter = null;
542
                }
543
                else if (_Document_NameFilter != value)
544
                {
545
                    _Document_NameFilter = value;
546
                    OnPropertyChanged(() => Document_NameFilter);
547
                }
548
            }
549
        }
550
551
552 95e7bd84 semi
        static DateTime DefaultCreateTime = DateTime.Now.AddHours(-1);
553 3bde451b semi
        private DateTime _SelectedCreateTimeBegin = DefaultCreateTime;
554
        public DateTime SelectedCreateTimeBegin
555
        {
556
557
            get { return _SelectedCreateTimeBegin; }
558
            set
559
            {
560
                if (_SelectedCreateTimeBegin == value)
561
                    return;
562
                _SelectedCreateTimeBegin = value;
563
                OnPropertyChanged(() => SelectedCreateTimeBegin);
564
565
            }
566
        }
567
568
        private DateTime _SelectedCreateTimeEnd = DefaultCreateTime;
569
        public DateTime SelectedCreateTimeEnd
570
        {
571
572
            get { return _SelectedCreateTimeEnd; }
573
            set
574
            {
575
                if (_SelectedCreateTimeEnd == value)
576
                    return;
577
                _SelectedCreateTimeEnd = value;
578
                OnPropertyChanged(() => SelectedCreateTimeEnd);
579
            }
580
        }
581
582
        public int _DataBase_ItemsHeight = 800;
583
        public int DataBase_ItemsHeight
584
        {
585
            get { return _DataBase_ItemsHeight; }
586
            set
587
            {
588
                _DataBase_ItemsHeight = value;
589
                OnPropertyChanged(() => DataBase_ItemsHeight);
590
            }
591
        }
592
593
594
        public int _RealConvert_Height = 80;
595
        public int RealConvert_Height
596
        {
597
            get { return _RealConvert_Height; }
598
            set
599
            {
600
                _RealConvert_Height = value;
601
                OnPropertyChanged(() => RealConvert_Height);
602
            }
603
        }
604
605
        public int _Alive_Height = 80;
606
        public int Alive_Height
607
        {
608
            get { return _Alive_Height; }
609
            set
610
            {
611
                _Alive_Height = value;
612
                OnPropertyChanged(() => Alive_Height);
613
            }
614
        }
615
616
        public bool _ConvertShow;
617
        public bool ConvertShow
618
        {
619
            get => _ConvertShow;
620
            set
621
            {
622
                if (_ConvertShow = !value)
623
                {
624
                    _ConvertShow = false;
625
                }
626
                _ConvertShow = value;
627
                OnPropertyChanged(() => ConvertShow);
628
            }
629
        }
630 037ab674 semi
631 cb806a91 semi
        public bool _AliveShow;
632
        public bool AliveShow
633
        {
634
            get => _AliveShow;
635
            set
636
            {
637
                if (_AliveShow = !value)
638
                {
639
                    _AliveShow = false;
640
                }
641
                _AliveShow = value;
642
                OnPropertyChanged(() => AliveShow);
643
            }
644
        }
645
646 037ab674 semi
647
        private bool _ExcptionCheck = false;
648
        public bool ExcptionCheck
649
        {
650
            get
651
            {
652
                return _ExcptionCheck;
653
            }
654
            set
655
            {
656
                _ExcptionCheck = value;
657
                OnPropertyChanged(() => ExcptionCheck);
658
            }
659
        }
660 19d6b221 semi
661 50b63148 semi
        public bool _SearchTimerOn = false;
662
        public bool SearchTimerOn
663
        {
664
            get => _SearchTimerOn;
665
            set
666
            {
667
                if (_SearchTimerOn = !value)
668
                {
669
                    _SearchTimerOn = false;
670
                }
671
                _SearchTimerOn = value;
672
                OnPropertyChanged(() => SearchTimerOn);
673
            }
674
        }
675
676 3bde451b semi
        #endregion
677
678
        #region Command
679
680
        public DelegateCommand ConvertCommand { get; private set; }
681
        public DelegateCommand DeleteCommand { get; private set; }
682
        public DelegateCommand ValidateCommand { get; private set; }
683
        public DelegateCommand DataSaveFileGemBoxCommand { get; private set; }
684
        public DelegateCommand MarkusLinkCommand { get; private set; }
685
        public DelegateCommand RemoveCreateTimeFilterCommand { get; private set; }
686
687
        public DelegateCommand DataFilterCommand { get; private set; }
688
        public DelegateCommand ResetCommand { get; private set; }
689
        public DelegateCommand ConverAddCommand { get; private set; }
690 95e7bd84 semi
        public DelegateCommand FinalPDFPathFileSearchCommand { get; private set; }
691 3bde451b semi
692
        #endregion
693
694
        #region Main Logic
695
696
        /// <summary>
697
        /// 각각의 Grid row 객체들 업데이트
698
        /// </summary>
699
700
        private DispatcherTimer dispatcherTimer;
701
        public override void Loaded()
702
        {
703
            base.Loaded();
704
705
            if (!App.IsDesignMode)
706
            {
707
                dispatcherTimer = new DispatcherTimer();
708
                dispatcherTimer.Tick += new EventHandler(Timer_Tick);
709
                dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
710
                dispatcherTimer.Start();
711
            }
712
        }
713
714
        private async void Timer_Tick(object sender, EventArgs e)
715
        {
716
            dispatcherTimer.Stop();
717
718
            if (IsAcitve)
719
            {
720
                await App.Current.Dispatcher.InvokeAsync(() =>
721
                {
722
                    DataSelect();
723
724
                    AliveDataSelect();
725
                });
726
            }
727
728
            await Task.Delay(5000);
729
730
            System.Threading.Thread.Sleep(new TimeSpan(0, 0, 0, 0, 100));
731
732
            dispatcherTimer.Start();
733
        }
734
735 037ab674 semi
        private async void SearchTimer_Tick(object sender, EventArgs e)
736
        {
737
            dispatcherTimer.Stop();
738
739
            if (IsAcitve)
740
            {
741
                await App.Current.Dispatcher.InvokeAsync(() =>
742
                {
743
                    DataSearch(new[] { (StatusCodeType)(SelectedStatus.Value) }, FilterConvertSource);
744
745
                    RealDataSelect(new[] { StatusCodeType.None, StatusCodeType.Wait, StatusCodeType.PageLoading, StatusCodeType.Saving }, RealConvertSource);
746
747
                    AliveDataSelect();
748
                });
749
            }
750
751
            await Task.Delay(5000);
752
753
            dispatcherTimer.Start();
754
        }
755
756
757 3bde451b semi
        public override void Closed()
758
        {
759
            if (dispatcherTimer != null)
760
            {
761
                dispatcherTimer.Stop();
762
            }
763
764
            base.Closed();
765
        }
766
767
768
        #endregion
769
770
        #region Function
771
772 19d6b221 semi
        #region Return_FilterConvertSource
773
774
        public static void Return_FilterConvertSource(ObservableCollection<FinalPDF> convertPDFs)
775
        {
776
            ConvertSource = new ObservableCollection<FinalPDF>();
777
            ConvertSource = convertPDFs;
778
        }
779
780
        public static ObservableCollection<FinalPDF> Return_FilterConvertSource()
781
        {
782
            return ConvertSource;
783
        }
784
785
786
        #endregion
787
788
789 3bde451b semi
        #region Data Select
790
791
        /// <summary>
792
        /// 상단 그리드 중앙 그리드 출력 데이터
793
        /// </summary>
794
        private void DataSelect()
795
        {
796
797
            if (FilterConvertSource == null)
798
            {
799 78683624 semi
                FilterConvertSource = new System.Collections.ObjectModel.ObservableCollection<FinalPDF>();
800 3bde451b semi
            }
801
802
            if (RealConvertSource == null)
803
            {
804 78683624 semi
                RealConvertSource = new System.Collections.ObjectModel.ObservableCollection<FinalPDF>();
805 3bde451b semi
            }
806
807
            /// combobox 에서 선택된 items
808
            if (SelectedStatus != null)
809
            {
810
                DataSelect(new[] { (StatusCodeType)(SelectedStatus.Value) }, FilterConvertSource);
811
            }
812
813
            /// 컨버터중인 items
814
            RealDataSelect(new[] { StatusCodeType.None, StatusCodeType.Wait, StatusCodeType.PageLoading, StatusCodeType.Saving }, RealConvertSource);
815
816
        }
817
818 037ab674 semi
        private async void RealDataSelect(IEnumerable<StatusCodeType> statusCodeTypeList, System.Collections.ObjectModel.ObservableCollection<FinalPDF> collection)
819 3bde451b semi
        {
820
            try
821
            {
822 19d6b221 semi
                IEnumerable<FinalPDF> Listitems = Enumerable.Empty<FinalPDF>();
823 3bde451b semi
824 037ab674 semi
                foreach (var coll in collection)
825
                {
826 19d6b221 semi
                   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)
827 037ab674 semi
                                let MarkusLink = "kcom://" + CreateMarkusParam(x.PROJECT_NO, x.DOCUMENT_ID, "doftech")
828
                                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,
829
                            x.TOTAL_PAGE, x.EXCEPTION, x.GROUP_NO, x.CREATE_DATETIME, x.START_DATETIME, x.END_DATETIME, x.ORIGINAL_FILE, x.CONVERT_PATH, MarkusLink);
830 19d6b221 semi
831 037ab674 semi
                }
832 3bde451b semi
833 037ab674 semi
                foreach (var Listitem in Listitems)
834
                {
835
                    collection.UpdateWhere(changeitem =>
836
                    ConvertItemEx.ChangeValues(changeitem, Listitem), x => x.ProjectNumber == Listitem.ProjectNumber && x.ConvertID == Listitem.ConvertID);
837 3bde451b semi
                }
838 037ab674 semi
839
                RealConvert_Height = 80 + (10 * collection.Count());
840
                DataBase_ItemsHeight = 800 - (RealConvert_Height + Alive_Height);
841 3bde451b semi
            }
842
            catch (Exception ex)
843
            {
844
                MessageBox.Show(ex.ToString());
845
            }
846
        }
847
848 037ab674 semi
        private async void DataSelect(IEnumerable<StatusCodeType> statusCodeTypeList, System.Collections.ObjectModel.ObservableCollection<FinalPDF> collection)
849 3bde451b semi
        {
850
            try
851
            {
852 037ab674 semi
                int _status = 0;
853
                if (SelectedStatus != null)
854 3bde451b semi
                {
855 037ab674 semi
                    _status = (int)SelectedStatus.Value;
856
                }
857 3bde451b semi
858 72862ad1 semi
                if (ProjectNames.Count() == 0)
859
                {
860
                    ProjectName Clear = new ProjectName("Clear", "Clear");
861
                    ProjectNames.Add(Clear);
862
                    foreach (var x in await WcfClient.GET_SELECT_RUN_PROJECTSAsync(0))
863
                    {
864
                        ProjectName projectName = new ProjectName(x.PROJECT_NO, x.PROJECT_NAME);
865
                        ProjectNames.Add(projectName);
866
                    }
867
                }
868
869 037ab674 semi
                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)
870
                                let MarkusLink = "kcom://" + CreateMarkusParam(x.ID, x.DOCUMENT_ID, "doftech")
871
                                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,
872
                        x.REVISION, x.CURRENT_PAGE, x.TOTAL_PAGE, x.EXCEPTION, x.GROUP_NO, x.CREATE_DATETIME, x.START_DATETIME, x.END_DATETIME
873
                     , x.ORIGINAL_FILE, x.CONVERT_PATH, MarkusLink);
874 3bde451b semi
875 037ab674 semi
                if (collection.Count() == 0)
876
                {
877
                    if (statusCodeTypeList.Count() == 1)
878 3bde451b semi
                    {
879 037ab674 semi
                        foreach (var x in Listitems)
880 3bde451b semi
                        {
881 037ab674 semi
                            collection.Add(x);
882 3bde451b semi
                        }
883
                    }
884 037ab674 semi
                }
885
                else
886
                {
887
                    foreach (var newitem in Listitems)
888 3bde451b semi
                    {
889 037ab674 semi
                        collection.UpdateWhere(changeitem =>
890
                        ConvertItemEx.ChangeValues(changeitem, newitem), x => x.ProjectNumber == newitem.ProjectNumber && x.ConvertID == newitem.ConvertID);
891
                    }
892 3bde451b semi
893 037ab674 semi
                    if (statusCodeTypeList.Count() == 1)
894
                    {
895
                        for (int i = collection.Count() - 1; i >= 0; --i)
896 3bde451b semi
                        {
897 037ab674 semi
                            var item = collection[i];
898 3bde451b semi
899 037ab674 semi
                            if (Listitems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
900 3bde451b semi
                            {
901 037ab674 semi
                                collection.RemoveAt(i);
902 3bde451b semi
                            }
903
                        }
904 037ab674 semi
                    }
905 3bde451b semi
906 037ab674 semi
                    if (statusCodeTypeList.Count() == 1)
907
                    {
908
                        foreach (var item in Listitems)
909 3bde451b semi
                        {
910 037ab674 semi
                            if (collection.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
911 3bde451b semi
                            {
912 037ab674 semi
                                for (int i = 0; i < 200; i++)
913 3bde451b semi
                                {
914 037ab674 semi
                                    if (i < collection.Count() - 1)
915 3bde451b semi
                                    {
916 037ab674 semi
                                        if (DateTime.Compare(collection[i].CreateTime, item.CreateTime) < 0)
917 3bde451b semi
                                        {
918 037ab674 semi
                                            collection.Insert(i, item);
919 3bde451b semi
                                            break;
920
                                        }
921
                                    }
922 037ab674 semi
                                    else
923
                                    {
924
                                        collection.Add(item);
925
                                        break;
926
                                    }
927 3bde451b semi
                                }
928
929
                            }
930 037ab674 semi
931 3bde451b semi
                        }
932
                    }
933
                }
934
            }
935
            catch (Exception ex)
936
            {
937
                MessageBox.Show(ex.ToString());
938
                System.Diagnostics.Debug.WriteLine(ex.ToString());
939
            }
940
        }
941
942 037ab674 semi
        private async void DataSearch(IEnumerable<StatusCodeType> statusCodeTypeList, System.Collections.ObjectModel.ObservableCollection<FinalPDF> collection)
943 3bde451b semi
        {
944
            try
945
            {
946 037ab674 semi
                int _status = 0;
947
                if (SelectedStatus != null)
948 3bde451b semi
                {
949 037ab674 semi
                    _status = (int)SelectedStatus.Value;
950
                }
951 3bde451b semi
952 037ab674 semi
                DateTime? Start_CreateTime = null;
953
                DateTime? Finish_CreateTime = null;
954
                if (SelectedCreateTimeBegin != DefaultCreateTime)
955
                {
956
                    Start_CreateTime = SelectedCreateTimeBegin;
957
                }
958
                if (SelectedCreateTimeEnd != DefaultCreateTime)
959
                {
960
                    Finish_CreateTime = SelectedCreateTimeEnd;
961
                }
962 3bde451b semi
963 72862ad1 semi
                if (ProjectNames.Count() == 0)
964
                {
965
                    foreach (var x in await WcfClient.GET_SELECT_RUN_PROJECTSAsync(0))
966
                    {
967
                        ProjectName projectName = new ProjectName(x.PROJECT_NO, x.PROJECT_NAME);
968
                        ProjectNames.Add(projectName);
969
                    }
970
                }
971
972 037ab674 semi
                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,
973
                    CreateUser_IDFilter, _status, SelectedCount.ValueMember, GROUP_NOFilter, REVISIONFilter, Start_CreateTime, Finish_CreateTime, null, null, null, null, Document_URLFilter, ExcptionCheck)
974
                                let MarkusLink = "kcom://" + CreateMarkusParam(x.ID, x.DOCUMENT_ID, "doftech")
975 cb806a91 semi
                                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,
976 037ab674 semi
                                    x.REVISION, x.CURRENT_PAGE, x.TOTAL_PAGE, x.EXCEPTION, x.GROUP_NO, x.CREATE_DATETIME, x.START_DATETIME, x.END_DATETIME
977
                                 , x.ORIGINAL_FILE, x.CONVERT_PATH, MarkusLink);
978 3bde451b semi
979 037ab674 semi
                if (collection.Count() == 0)
980
                {
981
                    if (statusCodeTypeList.Count() == 1)
982 3bde451b semi
                    {
983 037ab674 semi
                        foreach (var x in Listitems)
984 3bde451b semi
                        {
985 037ab674 semi
                            collection.Add(x);
986 3bde451b semi
                        }
987
                    }
988 037ab674 semi
                }
989
                else
990
                {
991
                    foreach (var newitem in Listitems)
992 3bde451b semi
                    {
993 037ab674 semi
                        collection.UpdateWhere(changeitem =>
994
                        ConvertItemEx.ChangeValues(changeitem, newitem), x => x.ProjectNumber == newitem.ProjectNumber && x.ConvertID == newitem.ConvertID);
995
                    }
996 3bde451b semi
997 037ab674 semi
                    if (statusCodeTypeList.Count() == 1)
998
                    {
999 3bde451b semi
1000 037ab674 semi
                        for (int i = collection.Count() - 1; i >= 0; --i)
1001 3bde451b semi
                        {
1002 037ab674 semi
                            var item = collection[i];
1003 3bde451b semi
1004 037ab674 semi
                            if (Listitems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
1005 3bde451b semi
                            {
1006 037ab674 semi
                                collection.RemoveAt(i);
1007 3bde451b semi
                            }
1008
                        }
1009 037ab674 semi
                    }
1010 3bde451b semi
1011 037ab674 semi
                    if (statusCodeTypeList.Count() == 1)
1012
                    {
1013
                        foreach (var item in Listitems)
1014 3bde451b semi
                        {
1015 037ab674 semi
                            if (collection.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
1016 3bde451b semi
                            {
1017 037ab674 semi
                                for (int i = 0; i < 200; i++)
1018 3bde451b semi
                                {
1019 037ab674 semi
                                    if (i < collection.Count() - 1)
1020 3bde451b semi
                                    {
1021 037ab674 semi
                                        if (DateTime.Compare(collection[i].CreateTime, item.CreateTime) < 0)
1022 3bde451b semi
                                        {
1023 037ab674 semi
                                            collection.Insert(i, item);
1024 3bde451b semi
                                            break;
1025
                                        }
1026
                                    }
1027 037ab674 semi
                                    else
1028
                                    {
1029
                                        collection.Add(item);
1030
                                        break;
1031
                                    }
1032 3bde451b semi
                                }
1033
1034
                            }
1035
1036 037ab674 semi
                        }
1037 3bde451b semi
                    }
1038
1039 037ab674 semi
                }
1040 3bde451b semi
            }
1041
            catch (Exception ex)
1042
            {
1043
                MessageBox.Show(ex.ToString());
1044
                System.Diagnostics.Debug.WriteLine(ex.ToString());
1045
            }
1046
        }
1047
        /// <summary>
1048
        /// 서비스의 실시간 컨버터 Item
1049
        /// </summary>
1050
        private async void AliveDataSelect()
1051
        {
1052
            try
1053
            {
1054 78683624 semi
                List<FinalPDF> newitems = new List<FinalPDF>();
1055 3bde451b semi
                foreach (var client in App.StationClientList)
1056
                {
1057
                    if (await SimplePingAsync(client.Endpoint.Address.ToString()))
1058
                    {
1059
                        try
1060
                        {
1061 78683624 semi
                            List<FinalPDF> itemsToList = new List<FinalPDF>();
1062 3bde451b semi
                            var items = await client.AliveConvertListAsync();
1063
                            string result = "";
1064
1065
                            foreach (var item in items)
1066
                            {
1067 78683624 semi
                                FinalPDF itemsToEach = new FinalPDF();
1068 3bde451b semi
                                itemsToEach.ConvertID = item.ConvertID;
1069
                                itemsToEach.ProjectNumber = item.ProjectNumber;
1070
1071 037ab674 semi
                                var MarkusLink = "kcom://" + CreateMarkusParam(item.ProjectNumber, item.DocumentID, "doftech");
1072
1073 3bde451b semi
                                if (item.ConvertState != null)
1074
                                {
1075
                                    itemsToEach.ConvertState = (StatusCodeType)Enum.Parse(typeof(StatusCodeType), item.ConvertState);
1076
                                }
1077
1078
                                if (item.OriginfilePath.Contains("/"))
1079
                                {
1080
                                    result = item.OriginfilePath.Substring(item.OriginfilePath.LastIndexOf("/") + 1);
1081
                                }
1082
                                else
1083
                                {
1084
                                    result = item.OriginfilePath.Substring(item.OriginfilePath.LastIndexOf("%") + 1);
1085
                                }
1086
                                itemsToEach.FileName = result;
1087
1088
                                itemsToEach.CurrentPageNo = item.CurrentPageNo;
1089
                                itemsToEach.TotalPage = item.TotalPage;
1090
                                itemsToEach.OriginfilePath = item.OriginfilePath;
1091
                                itemsToEach.ConvertPath = item.ConvertPath;
1092 037ab674 semi
                                itemsToEach.MarkusLink = MarkusLink;
1093 3bde451b semi
                                itemsToEach.DocumentID = item.DocumentID;
1094
                                itemsToEach.GroupNo = item.GroupNo;
1095 5feff9f0 semi
                                itemsToEach.DocumentName = item.DocumnetName;
1096 3bde451b semi
                                itemsToEach.Revision = item.Revision;
1097
                                itemsToEach.Exception = item.Exception;
1098 037ab674 semi
                                itemsToEach.ConvertPath = item.ConvertPath;
1099 3bde451b semi
                                itemsToEach.CreateTime = item.CreateTime;
1100
                                itemsToEach.StartTime = item.StartTime;
1101
                                itemsToEach.EndTime = item.EndTime;
1102
1103
                                itemsToList.Add(itemsToEach);
1104
                            }
1105
                            newitems.AddRange(itemsToList);
1106
                            System.Diagnostics.Trace.WriteLine($"{client.Endpoint.Address} ping");
1107
1108
                            if (items.Count() == 0)
1109
                            {
1110
                                System.Diagnostics.Trace.WriteLine($"{client.Endpoint.Address} Alive Items is zero.");
1111
                            }
1112
                        }
1113
                        catch (Exception ex)
1114
                        {
1115
                            System.Diagnostics.Trace.Fail($"{client.Endpoint.Address} {ex.Message}");
1116
                        }
1117
                    }
1118
                    else
1119
                    {
1120
                        System.Diagnostics.Trace.Fail($"{client.Endpoint.Address} ping Error");
1121
                    }
1122
1123
                }
1124
                ItemsUpdate(newitems);
1125
                await System.Windows.Application.Current.Dispatcher.InvokeAsync(() => ItemsUpdate(newitems));
1126
            }
1127
            catch (Exception ex)
1128
            {
1129
                System.Diagnostics.Debug.WriteLine(ex.ToString());
1130
            }
1131
        }
1132
1133
        /// <summary>
1134
        /// AliveDataSelect의 Data Update
1135
        /// </summary>
1136
        /// <param name = "newitems" ></ param >
1137 78683624 semi
        private void ItemsUpdate(List<FinalPDF> newitems)
1138 3bde451b semi
        {
1139
1140
            foreach (var item in newitems)
1141
            {
1142
                item.OriginfilePath = HttpUtility.UrlDecode(item.OriginfilePath);
1143
            }
1144
1145
            if (AliveItems == null)
1146
            {
1147 78683624 semi
                AliveItems = new System.Collections.ObjectModel.ObservableCollection<FinalPDF>();
1148 3bde451b semi
1149
                foreach (var item in newitems)
1150
                {
1151
                    AliveItems.Add(item);
1152
                }
1153
            }
1154
            else
1155
            {
1156
                newitems.ForEach(newitem =>
1157
                {
1158
                    AliveItems.UpdateWhere(changeitem => ConvertItemEx.ChangeValues(changeitem, newitem), x => x.ProjectNumber == newitem.ProjectNumber && x.ConvertID == newitem.ConvertID);
1159
                });
1160
1161
                foreach (var item in newitems)
1162
                {
1163
                    if (AliveItems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
1164
                    {
1165
                        AliveItems.Add(item);
1166
                    }
1167
                }
1168
1169
                for (int i = AliveItems.Count() - 1; i > -1; --i)
1170
                {
1171
                    var item = AliveItems[i];
1172
1173
                    if (newitems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
1174
                    {
1175
                        try
1176
                        {
1177
                            AliveItems.RemoveAt(i);
1178
                        }
1179
                        catch (Exception ex)
1180
                        {
1181
                            System.Diagnostics.Debug.WriteLine(ex.ToString());
1182
                        }
1183
                    }
1184
                }
1185
            }
1186
1187 cb806a91 semi
            if (AliveItems.Count() > 1)
1188
            {
1189
                AliveShow = true;
1190
            }
1191
1192 3bde451b semi
            Alive_Height = 80 + (newitems.Count() * 10);
1193
            DataBase_ItemsHeight = 800 - (RealConvert_Height + Alive_Height);
1194
        }
1195
1196
1197
        public static async Task<bool> SimplePingAsync(string uri)
1198
        {
1199
            bool result = false;
1200
1201
            try
1202
            {
1203
                using (System.Net.Http.HttpClient Client = new System.Net.Http.HttpClient())
1204
                {
1205
                    Client.Timeout = new TimeSpan(0, 0, 60);
1206
1207
                    var message = await Client.GetAsync(uri);
1208
1209
                    System.Net.HttpStatusCode StatusCode = message.StatusCode;
1210
1211
                    switch (StatusCode)
1212
                    {
1213
1214
                        case System.Net.HttpStatusCode.Accepted:
1215
                        case System.Net.HttpStatusCode.OK:
1216
                            result = true;
1217
                            break;
1218
                    }
1219
                }
1220
            }
1221
            catch (Exception ex)
1222
            {
1223
                result = false;
1224
                System.Diagnostics.Debug.WriteLine(ex.ToString());
1225
            }
1226
1227
            return result;
1228
        }
1229
1230
        #endregion
1231
1232
        #region Data Convert
1233
1234 037ab674 semi
        private async void DataConvert(object obj)
1235 3bde451b semi
        {
1236
            if (SelectFilterConvert == null && SelectRealConvert == null)
1237
            {
1238
                MessageBox.Show("왼쪽 버튼 클릭 후 Converter 해주세요!");
1239
            }
1240
            else
1241
            {
1242
                var resultRealConvert = 0;
1243
                var resultFiltertConvert = 0;
1244
1245
                if (SelectRealConvert != null)
1246
                {
1247 cb806a91 semi
                    resultRealConvert = SetCleanUpItem(SelectRealConvert).Result;
1248 3bde451b semi
                }
1249
                else if (SelectFilterConvert != null)
1250
                {
1251 037ab674 semi
                    resultFiltertConvert = SetCleanUpItem(SelectFilterConvert).Result;
1252 3bde451b semi
                }
1253
                System.Diagnostics.Debug.WriteLine(resultRealConvert + "  " + resultFiltertConvert);
1254
1255 037ab674 semi
                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)
1256
                            let MarkusLink = "kcom://" + CreateMarkusParam(x.ID, x.DOCUMENT_ID, "doftech")
1257
                            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,
1258
                        x.REVISION, x.CURRENT_PAGE, x.TOTAL_PAGE, x.EXCEPTION, x.GROUP_NO, x.CREATE_DATETIME, x.START_DATETIME, x.END_DATETIME
1259
                     , x.ORIGINAL_FILE, x.CONVERT_PATH, MarkusLink);
1260 3bde451b semi
1261
1262 037ab674 semi
                foreach (var item in items)
1263
                {
1264 3bde451b semi
1265 037ab674 semi
                    RealConvertSource.Add(item);
1266 3bde451b semi
1267 037ab674 semi
                    if (RealConvertSource.Count() == 1)
1268
                    {
1269
                        ConvertShow = true;
1270 3bde451b semi
                    }
1271
                }
1272
            }
1273
        }
1274
1275
1276 037ab674 semi
        public async Task<int> SetCleanUpItem(FinalPDF _ConvertItem)
1277 3bde451b semi
        {
1278 037ab674 semi
            int result = 0;
1279 3bde451b semi
1280 037ab674 semi
            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);
1281 3bde451b semi
1282 037ab674 semi
            if (items.Count() > 0)
1283
            {
1284
                var item = items.First();
1285 3bde451b semi
1286 95e7bd84 semi
                var _CREATE_DATETIME = DateTime.Now.AddHours(-1);
1287 037ab674 semi
                var _STATUS = (int)StatusCodeType.None;
1288 3bde451b semi
1289 cb806a91 semi
                await WcfClient.GET_SELECT_RERECONVERT_ITEMAsync(_ConvertItem.ConvertID, 0, _CREATE_DATETIME, _STATUS, null);
1290 3bde451b semi
1291
            }
1292 037ab674 semi
1293
            return result;
1294 3bde451b semi
        }
1295
1296 2c634aed semi
        public static string CreateMarkusParam(string projectNo, string documentID, string userID)
1297
        {
1298
            ViewInfo viewInfo = new ViewInfo();
1299
1300
            viewInfo.DocumentItemID = documentID;
1301
            viewInfo.ProjectNO = projectNo;
1302
            viewInfo.UserID = userID;
1303
1304
            return ParamEncoding(JsonConvert.SerializeObject(viewInfo));
1305
1306
        }
1307
1308
        public static string ParamEncoding(string EncodingText, System.Text.Encoding oEncoding = null)
1309
        {
1310
1311
            if (oEncoding == null)
1312
                oEncoding = System.Text.Encoding.UTF8;
1313
1314
            return Convert.ToBase64String(oEncoding.GetBytes(EncodingText));
1315
1316
        }
1317
1318 3bde451b semi
        #endregion
1319
1320
        #region Validation
1321
1322
        private void DataValidate(object obj)
1323
        {
1324
1325
            bool result = false;
1326
1327
            WebRequest webRequest = WebRequest.Create(SelectFilterConvert.OriginfilePath);
1328
            webRequest.Timeout = 1200; // miliseconds
1329
            webRequest.Method = "HEAD";
1330
1331
            HttpWebResponse response = null;
1332
1333
            try
1334
            {
1335
                response = (HttpWebResponse)webRequest.GetResponse();
1336
                result = true;
1337
            }
1338
            catch (WebException webException)
1339
            {
1340
                MessageBox.Show(SelectFilterConvert.FileName + " doesn't exist: " + webException.Message);
1341
                result = true;
1342
            }
1343
            finally
1344
            {
1345
                if (response != null)
1346
                {
1347
                    response.Close();
1348
                }
1349
            }
1350
            if (result == true)
1351
            {
1352
                MessageBox.Show("File exists");
1353
            }
1354
        }
1355
1356
        #endregion
1357
1358
        #region DataFilter
1359
1360
        public void DataFilter(object obj)
1361
        {
1362 50b63148 semi
            SearchTimerOn = true;
1363 3bde451b semi
            dispatcherTimer.Tick -= new EventHandler(Timer_Tick);
1364 72862ad1 semi
            dispatcherTimer.Tick += new EventHandler(SearchTimer_Tick);
1365 3bde451b semi
        }
1366
1367
        #endregion
1368
1369
        #region MarkusLink
1370
1371
        private void MarkusLink(object obj)///여기서 부터 
1372
        {
1373 78683624 semi
            if (obj is FinalPDF)
1374 3bde451b semi
            {
1375
                if (obj != null)
1376
                {
1377 78683624 semi
                    var convertitem = obj as FinalPDF;
1378 3bde451b semi
1379 9b2f01e1 semi
                    SelectFilterConvertList.Add(convertitem);
1380 3bde451b semi
1381
                    SelectRealConvert = convertitem;
1382
1383
                    ProcessStartInfo startInfo = null;
1384
1385
                    startInfo = new ProcessStartInfo("iexplore.exe", convertitem.MarkusLink);
1386
1387
                    Process.Start(startInfo);
1388
                }
1389
            }
1390
        }
1391
1392
        #endregion
1393
1394
        #region Data Delete
1395
1396
        private void DataDelete(object obj)
1397
        {
1398
            RadWindow.Alert("do you want to delete it??", this.OnClosed);
1399
        }
1400
1401 037ab674 semi
        private async void OnClosed(object sender, WindowClosedEventArgs e)
1402 3bde451b semi
        {
1403 037ab674 semi
            var result = e.DialogResult;
1404
            if (result == true)
1405 3bde451b semi
            {
1406 9b2f01e1 semi
                if (SelectFilterConvertList.Count() > 1)
1407 3bde451b semi
                {
1408 9b2f01e1 semi
                    MessageBox.Show("하나만 클릭해 주세요!");
1409 037ab674 semi
                }
1410 9b2f01e1 semi
                else
1411 037ab674 semi
                {
1412 9b2f01e1 semi
                    if (SelectRealConvert != null)
1413
                    {
1414
                        await WcfClient.GET_SELECT_CONVERT_DELETEAsync(SelectRealConvert.ConvertID);
1415
                    }
1416
                    if (SelectFilterConvertList != null)
1417
                    {
1418
                        await WcfClient.GET_SELECT_CONVERT_DELETEAsync(SelectFilterConvertList[0].ConvertID);
1419
                    }
1420 3bde451b semi
                }
1421
            }
1422
        }
1423
1424
1425
        #endregion
1426
1427
        #region Data Export
1428
1429
1430
        /// <summary>
1431
        /// 필터된 상단 그리드 엑셀로 출력
1432
        /// </summary>
1433
1434
        public void DataExportData(object obj)
1435
        {
1436 50b63148 semi
            if (SearchTimerOn == true)
1437
            {
1438
                dispatcherTimer.Tick -= new EventHandler(SearchTimer_Tick);
1439
            }
1440
            else
1441
            {
1442
                dispatcherTimer.Tick -= new EventHandler(Timer_Tick);
1443
            }
1444 3bde451b semi
1445 19d6b221 semi
            Return_FilterConvertSource(FilterConvertSource);
1446 3bde451b semi
1447 19d6b221 semi
            Views.FinalPDFExcelDialog finalPDFExcelDialog = new Views.FinalPDFExcelDialog();
1448 3bde451b semi
1449 19d6b221 semi
            finalPDFExcelDialog.Owner = Application.Current.MainWindow;
1450
            finalPDFExcelDialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;
1451 3bde451b semi
1452 19d6b221 semi
            finalPDFExcelDialog.ShowDialog();
1453 3bde451b semi
1454
1455 50b63148 semi
            if (SearchTimerOn == true)
1456
            {
1457
                dispatcherTimer.Tick += new EventHandler(SearchTimer_Tick);
1458
            }
1459
            else
1460
            {
1461
                dispatcherTimer.Tick += new EventHandler(Timer_Tick);
1462
            }
1463 3bde451b semi
        }
1464
1465
        #endregion
1466
1467
        #region Data Search
1468
1469
        public void RemoveCreateTimeFilter(object obj)
1470
        {
1471 95e7bd84 semi
            DefaultCreateTime = DateTime.Now.AddHours(-1); ;
1472 3bde451b semi
            SelectedCreateTimeBegin = DefaultCreateTime;
1473
            SelectedCreateTimeEnd = DefaultCreateTime;
1474
1475
        }
1476
1477
        #endregion
1478
1479
        #region Reset
1480
1481
        /// <summary>
1482
        /// 그리드 상단 원상복귀 버튼
1483
        /// 필터를 끝낸 후 다시 복귀
1484
        /// </summary>
1485
1486
        public void Reset(object obj)
1487
        {
1488 50b63148 semi
            SearchTimerOn = false;
1489 93f5e32a semi
            ExcptionCheck = false;
1490 037ab674 semi
            SelectedInt = 10;
1491
            ProjectNumberFilter = ProjectNames[0];
1492 3bde451b semi
            DocumentIDFilter = null;
1493
            MarkupInfo_IDFilter = null;
1494
            DOCINFO_IDFilter = null;
1495
            Document_NameFilter = null;
1496
            Document_NOFilter = null;
1497
            CreateUser_IDFilter = null;
1498
            GROUP_NOFilter = null;
1499
            REVISIONFilter = null;
1500
1501 95e7bd84 semi
            DefaultCreateTime = DateTime.Now.AddHours(-1);
1502 3bde451b semi
            SelectedCreateTimeBegin = DefaultCreateTime;
1503 037ab674 semi
            SelectedCreateTimeEnd = DefaultCreateTime;
1504 3bde451b semi
1505 037ab674 semi
            dispatcherTimer.Tick -= new EventHandler(SearchTimer_Tick);
1506 3bde451b semi
            dispatcherTimer.Tick += new EventHandler(Timer_Tick);
1507
1508
        }
1509
1510
        #endregion
1511
1512
1513
        #region ConvertAddDialog
1514
1515
        /// <summary>
1516
        /// 그리드 상단 Conver 추가 버튼
1517
        /// ProjectNo, DocumentURL, DocumentID, 입력해서 저장 프로시저에서 추가 
1518
        /// </summary>
1519
1520
        public void ConverAdd(object obj)
1521
        {
1522 50b63148 semi
            if (SearchTimerOn == true)
1523
            {
1524
                dispatcherTimer.Tick -= new EventHandler(SearchTimer_Tick);
1525
            }
1526
            else
1527
            {
1528
                dispatcherTimer.Tick -= new EventHandler(Timer_Tick);
1529
            }
1530 3bde451b semi
1531
            Views.FinalPDFAddDialog convertAddDialog = new Views.FinalPDFAddDialog();
1532
1533 50b63148 semi
            convertAddDialog.Owner = Application.Current.MainWindow;
1534 3bde451b semi
            convertAddDialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;
1535
1536
            convertAddDialog.ShowDialog();
1537
1538 50b63148 semi
            if (SearchTimerOn == true)
1539
            {
1540
                dispatcherTimer.Tick += new EventHandler(SearchTimer_Tick);
1541
            }
1542
            else
1543
            {
1544
                dispatcherTimer.Tick += new EventHandler(Timer_Tick);
1545
            }
1546 3bde451b semi
        }
1547
1548
        #endregion
1549
1550 78683624 semi
1551 95e7bd84 semi
        #region FinalPDFPathFileSearch
1552 78683624 semi
1553
        /// <summary>
1554
        ///  ConvertPath 파일 탐색기로 열리는 아이콘
1555
        /// </summary>
1556
1557 95e7bd84 semi
        public void FinalPDFPathFileSearch(object obj)
1558 78683624 semi
        {
1559
            if (obj is FinalPDF)
1560
            {
1561
                if (obj != null)
1562
                {
1563 95e7bd84 semi
                    var convertitem = obj as FinalPDF;
1564 78683624 semi
1565
                    SaveFileDialog saveFileDialog = new SaveFileDialog();
1566
1567
                    saveFileDialog.FileName = "Document"; // Default file name
1568
                    saveFileDialog.DefaultExt = ".txt"; // Default file extension
1569
                    saveFileDialog.Filter = "Csv documents (.Csv)|*.csv|Excel(2017~2019)Worksheets|*.xlsx"; // Filter files by extension
1570
1571
1572
                    if (saveFileDialog.ShowDialog() == true)
1573
                    {
1574
                    }
1575
                }
1576
            }
1577
        }
1578
1579
        #endregion
1580
1581
1582 3bde451b semi
        #endregion
1583
    }
1584
}
클립보드 이미지 추가 (최대 크기: 500 MB)