프로젝트

일반

사용자정보

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

markus / ConvertService / ServiceBase / Markus.Service.StationController / ViewModel / DataBaseItemsModel.cs @ f5ec88b8

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

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

    
29
namespace Markus.Service.StationController.ViewModel
30
{
31
    //세미
32
    public class DataBaseItemsModel : Mvvm.ToolKit.ViewModelBase
33
    {
34
        #region Constructor
35

    
36
        /// <summary>
37
        /// 실행하면 처음 들어가는 부분
38
        /// </summary>
39
        public DataBaseItemsModel()
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
            ConvertAddCommand = new DelegateCommand(ConvertAdd);
50
            ConvertPathFileSearchCommand = new DelegateCommand(ConvertPathFileSearch);
51
            Stop_ProcessCommand = new DelegateCommand(Stop_Process);
52
        }
53

    
54
        #endregion
55

    
56
        #region Properties
57

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

    
60
        public ObservableCollection<ProjectName> _ProjectNames;
61
        public ObservableCollection<ProjectName> ProjectNames
62
        {
63
            get
64
            {
65
                if (_ProjectNames == null)
66
                {
67
                    _ProjectNames = new System.Collections.ObjectModel.ObservableCollection<ProjectName>();
68
                }
69

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

    
79
        private bool _ExcptionCheck = false;
80
        public bool ExcptionCheck
81
        {
82
            get
83
            {
84
                return _ExcptionCheck;
85
            }
86
            set
87
            {
88
                _ExcptionCheck = value;
89
                OnPropertyChanged(() => ExcptionCheck);
90
            }
91
        }
92

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

    
106
                return _FilterSearch;
107
            }
108
        }
109

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

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

    
130
        private static System.Collections.ObjectModel.ObservableCollection<ConvertPDF> _ConvertSource;
131
        public static System.Collections.ObjectModel.ObservableCollection<ConvertPDF> ConvertSource
132
        {
133
            get
134
            {
135
                if (_ConvertSource == null)
136
                {
137
                    _ConvertSource = new System.Collections.ObjectModel.ObservableCollection<ConvertPDF>();
138
                }
139
                return _ConvertSource;
140
            }
141
            set
142
            {
143
                _ConvertSource = value;
144
            }
145
        }
146

    
147
        private System.Collections.ObjectModel.ObservableCollection<ConvertPDF> _FilterConvertSource;
148
        public System.Collections.ObjectModel.ObservableCollection<ConvertPDF> FilterConvertSource
149
        {
150
            get
151
            {
152
                if (_FilterConvertSource == null)
153
                {
154
                    _FilterConvertSource = new System.Collections.ObjectModel.ObservableCollection<ConvertPDF>();
155
                }
156
                return _FilterConvertSource;
157
            }
158
            set
159
            {
160
                _FilterConvertSource = value;
161
               OnPropertyChanged(() => FilterConvertSource);
162
            }
163
        }
164

    
165
        private System.Collections.ObjectModel.ObservableCollection<ConvertPDF> _RealConvertSource;
166
        public System.Collections.ObjectModel.ObservableCollection<ConvertPDF> RealConvertSource
167
        {
168
            get => _RealConvertSource;
169
            set
170
            {
171
                _RealConvertSource = value;
172
                OnPropertyChanged(() => RealConvertSource);
173
            }
174
        }
175

    
176

    
177
        private System.Windows.Documents.FlowDocument connectionLog;
178
        public System.Windows.Documents.FlowDocument ConnectionLog
179
        {
180
            get => connectionLog;
181
            set
182
            {
183
                if (connectionLog != value)
184
                {
185
                    connectionLog = value;
186
                    OnPropertyChanged(() => ConnectionLog);
187
                }
188
            }
189
        }
190

    
191

    
192
        private int _SelectedInt = 4;
193
        public int SelectedInt
194
        {
195
            get => _SelectedInt;
196
            set
197
            {
198
                _SelectedInt = value;
199
                OnPropertyChanged(() => SelectedInt);
200
            }
201
        }
202

    
203
        private Telerik.Windows.Data.EnumMemberViewModel _SelectedStatus;
204
        public Telerik.Windows.Data.EnumMemberViewModel SelectedStatus
205
        {
206
            get => _SelectedStatus;
207
            set
208
            {
209
                _SelectedStatus = value;
210
                OnPropertyChanged(() => SelectedStatus);
211
            }
212
        }
213

    
214

    
215
        private SelectedCountItem _SelectedCount;
216
        public SelectedCountItem SelectedCount
217
        {
218
            get => _SelectedCount;
219
            set
220
            {
221
                _SelectedCount = value;
222
                OnPropertyChanged(() => SelectedCount);
223
            }
224
        }
225

    
226
        List<SelectedCountItem> _SelectedCountList;
227
        public List<SelectedCountItem> SelectedCountList
228
        {
229
            get
230
            {
231
                if (_SelectedCountList == null)
232
                {
233
                    _SelectedCountList = new List<SelectedCountItem>
234
                    {
235
                        new SelectedCountItem{DisplayMember = "50",ValueMember = 50},
236
                        new SelectedCountItem{DisplayMember = "100",ValueMember = 100},
237
                        new SelectedCountItem{DisplayMember = "150",ValueMember = 150},
238
                        new SelectedCountItem{DisplayMember = "200",ValueMember = 200}
239
                    };
240
                }
241

    
242
                return _SelectedCountList;
243
            }
244
        }
245

    
246
        private ConvertPDF _SelectFilterConvert;
247
        public ConvertPDF SelectFilterConvert
248
        {
249
            get
250
            {
251
                return _SelectFilterConvert;
252
            }
253
            set
254
            {
255
                _SelectFilterConvert = value;
256
                OnPropertyChanged(() => SelectFilterConvert);
257
            }
258
        }
259

    
260

    
261
        private ObservableCollection<ConvertPDF> _SelectFilterConvertList;
262
        public ObservableCollection<ConvertPDF> SelectFilterConvertList
263
        {
264
            get
265
            {
266
                if (_SelectFilterConvertList == null)
267
                {
268
                    _SelectFilterConvertList = new ObservableCollection<ConvertPDF>();
269
                }
270
                return _SelectFilterConvertList;
271
            }
272
            set
273
            {
274
                _SelectFilterConvertList = value;
275
                OnPropertyChanged(() => SelectFilterConvertList);
276
            }
277
        }
278

    
279

    
280

    
281
        private ConvertPDF _SelectRealConvert;
282
        public ConvertPDF SelectRealConvert
283
        {
284
            get => _SelectRealConvert;
285
            set
286
            {
287
                _SelectRealConvert = value;
288
                OnPropertyChanged(() => SelectRealConvert);
289
            }
290
        }
291

    
292

    
293
        private ConvertPDF _SelectAliveConvert;
294
        public ConvertPDF SelectAliveConvert
295
        {
296
            get => _SelectAliveConvert;
297
            set
298
            {
299
                _SelectAliveConvert = value;
300
                OnPropertyChanged(() => SelectAliveConvert);
301
            }
302
        }
303

    
304

    
305
        private StatusTypeList _StatusType;
306
        public StatusTypeList StatusType
307
        {
308
            get => _StatusType;
309
            set
310
            {
311
                _StatusType = value;
312
                OnPropertyChanged(() => StatusType);
313
            }
314
        }
315

    
316
        private bool _IsLoading;
317
        public bool IsLoading
318
        {
319
            get => _IsLoading;
320
            set
321
            {
322
                if (_IsLoading != value)
323
                {
324
                    _IsLoading = value;
325
                    OnPropertyChanged(() => IsLoading);
326
                }
327
            }
328
        }
329

    
330
        IEnumerable<Telerik.Windows.Data.EnumMemberViewModel> _StatusCodeList;
331
        public IEnumerable<Telerik.Windows.Data.EnumMemberViewModel> StatusCodeList
332
        {
333
            get
334
            {
335
                if (_StatusCodeList == null)
336
                {
337
                    _StatusCodeList = Telerik.Windows.Data.EnumDataSource.FromType<StatusCodeType>();
338
                }
339

    
340
                return _StatusCodeList;
341
            }
342
        }
343

    
344
        public ProjectName _ProjectNumberFilter;
345
        public ProjectName ProjectNumberFilter
346
        {
347
            get
348
            {
349
                if (_ProjectNumberFilter == null)
350
                {
351
                    _ProjectNumberFilter = new ProjectName();
352
                }
353
                return _ProjectNumberFilter;
354
            }
355
            set
356
            {
357
                _ProjectNumberFilter = value;
358
                OnPropertyChanged(() => ProjectNumberFilter);
359
            }
360
        }
361

    
362
        public string _UniqueKeyFilter;
363
        public string UniqueKeyFilter
364
        {
365
            get
366
            {
367
                return _UniqueKeyFilter;
368
            }
369
            set
370
            {
371
                if (_UniqueKeyFilter == "")
372
                {
373
                    _UniqueKeyFilter = null;
374
                }
375
                else if (_UniqueKeyFilter != value)
376
                {
377
                    _UniqueKeyFilter = value;
378
                    OnPropertyChanged(() => UniqueKeyFilter);
379
                }
380
            }
381
        }
382

    
383
        public StatusCodeType _ConvertStateFilter;
384
        public StatusCodeType ConvertStateFilter
385
        {
386
            get { return _ConvertStateFilter; }
387
            set
388
            {
389
                if (_ConvertStateFilter != value)
390
                {
391
                    _ConvertStateFilter = value;
392
                    OnPropertyChanged(() => ConvertStateFilter);
393
                }
394
            }
395
        }
396

    
397
        public string _Docuemnt_NOFilter;
398
        public string Docuemnt_NOFilter
399
        {
400
            get { return _Docuemnt_NOFilter; }
401
            set
402
            {
403
                if (_Docuemnt_NOFilter == "")
404
                {
405
                    _Docuemnt_NOFilter = null;
406
                }
407
                else if (_Docuemnt_NOFilter != value)
408
                {
409
                    _Docuemnt_NOFilter = value;
410
                    OnPropertyChanged(() => Docuemnt_NOFilter);
411
                }
412
            }
413
        }
414

    
415
        public string _Document_NameFilter;
416
        public string Document_NameFilter
417
        {
418
            get { return _Document_NameFilter; }
419
            set
420
            {
421
                if (_Document_NameFilter == "")
422
                {
423
                    _Document_NameFilter = null;
424
                }
425
                else if (_Document_NameFilter != value)
426
                {
427
                    _Document_NameFilter = value;
428
                    OnPropertyChanged(() => Document_NameFilter);
429
                }
430
            }
431
        }
432

    
433
        public int? _ReconverterFilter = 0;
434
        public int? ReconverterFilter
435
        {
436
            get { return _ReconverterFilter; }
437
            set
438
            {
439
                if (_ReconverterFilter == null)
440
                {
441
                    _ReconverterFilter = 0;
442
                }
443
                else if (_ReconverterFilter != value)
444
                {
445
                    _ReconverterFilter = value;
446
                    OnPropertyChanged(() => ReconverterFilter);
447

    
448
                }
449
            }
450
        }
451

    
452
        public string _Service_IDFilter;
453
        public string Service_IDFilter
454
        {
455
            get { return _Service_IDFilter; }
456
            set
457
            {
458
                if (_Service_IDFilter == "")
459
                {
460
                    _Service_IDFilter = null;
461
                }
462
                else if (_Service_IDFilter != value)
463
                {
464
                    _Service_IDFilter = value;
465
                    OnPropertyChanged(() => Service_IDFilter);
466
                }
467
            }
468
        }
469

    
470
        public string _RevisionFilter;
471
        public string RevisionFilter
472
        {
473
            get { return _RevisionFilter; }
474
            set
475
            {
476
                if (_RevisionFilter == "")
477
                {
478
                    _RevisionFilter = null;
479
                }
480
                else if (_RevisionFilter != value)
481
                {
482
                    _RevisionFilter = value;
483
                    OnPropertyChanged(() => RevisionFilter);
484
                }
485
            }
486
        }
487

    
488
        public string _GroupNOFilter;
489
        public string GroupNOFilter
490
        {
491
            get { return _GroupNOFilter; }
492
            set
493
            {
494
                if (_GroupNOFilter == "")
495
                {
496
                    _GroupNOFilter = null;
497
                }
498
                else if (_GroupNOFilter != value)
499
                {
500
                    _GroupNOFilter = value;
501
                    OnPropertyChanged(() => GroupNOFilter);
502
                }
503
            }
504
        }
505

    
506
        public string _DOCUMENT_URLFilter;
507
        public string DOCUMENT_URLFilter
508
        {
509
            get { return _DOCUMENT_URLFilter; }
510
            set
511
            {
512
                if (_DOCUMENT_URLFilter == "")
513
                {
514
                    _DOCUMENT_URLFilter = null;
515
                }
516
                else if (_DOCUMENT_URLFilter != value)
517
                {
518
                    _DOCUMENT_URLFilter = value;
519
                    OnPropertyChanged(() => DOCUMENT_URLFilter);
520
                }
521
            }
522
        }
523

    
524
        static DateTime DefaultCreateTime = DateTime.Now.AddHours(-1);
525
        private DateTime _SelectedCreateTimeBegin = DefaultCreateTime;
526
        public DateTime SelectedCreateTimeBegin
527
        {
528

    
529
            get { return _SelectedCreateTimeBegin; }
530
            set
531
            {
532
                if (_SelectedCreateTimeBegin == value)
533
                    return;
534
                _SelectedCreateTimeBegin = value;
535
                OnPropertyChanged(() => SelectedCreateTimeBegin);
536

    
537
            }
538
        }
539

    
540
        private DateTime _SelectedCreateTimeEnd = DefaultCreateTime;
541
        public DateTime SelectedCreateTimeEnd
542
        {
543

    
544
            get { return _SelectedCreateTimeEnd; }
545
            set
546
            {
547
                if (_SelectedCreateTimeEnd == value)
548
                    return;
549
                _SelectedCreateTimeEnd = value;
550
                OnPropertyChanged(() => SelectedCreateTimeEnd);
551
            }
552
        }
553

    
554
        public bool _ConvertShow;
555
        public bool ConvertShow
556
        {
557
            get => _ConvertShow;
558
            set
559
            {
560
                if (_ConvertShow = !value)
561
                {
562
                    _ConvertShow = false;
563
                }
564
                _ConvertShow = value;
565
                OnPropertyChanged(() => ConvertShow);
566
            }
567
        }
568

    
569
        public bool _AliveShow;
570
        public bool AliveShow
571
        {
572
            get => _AliveShow;
573
            set
574
            {
575
                if (_AliveShow = !value)
576
                {
577
                    _AliveShow = false;
578
                }
579
                _AliveShow = value;
580
                OnPropertyChanged(() => AliveShow);
581
            }
582
        }
583

    
584
        public bool _SearchTimerOn = false;
585
        public bool SearchTimerOn
586
        {
587
            get => _SearchTimerOn;
588
            set
589
            {
590
                if (_SearchTimerOn = !value)
591
                {
592
                    _SearchTimerOn = false;
593
                }
594
                _SearchTimerOn = value;
595
                OnPropertyChanged(() => SearchTimerOn);
596
            }
597
        }
598

    
599
        
600

    
601
        #endregion
602

    
603
        #region Command
604

    
605
        public DelegateCommand ConvertCommand { get; private set; }
606
        public DelegateCommand DeleteCommand { get; private set; }
607
        public DelegateCommand ValidateCommand { get; private set; }
608
        public DelegateCommand DataSaveFileGemBoxCommand { get; private set; }
609
        public DelegateCommand MarkusLinkCommand { get; private set; }
610
        public DelegateCommand RemoveCreateTimeFilterCommand { get; private set; }
611

    
612
        public DelegateCommand DataFilterCommand { get; private set; }
613
        public DelegateCommand ResetCommand { get; private set; }
614
        public DelegateCommand ConvertAddCommand { get; private set; }
615
        public DelegateCommand ConvertPathFileSearchCommand { get; private set; }
616
        public DelegateCommand Stop_ProcessCommand { get; private set; }
617

    
618

    
619
        #endregion
620

    
621
        #region Main Logic
622

    
623
        /// <summary>
624
        /// 각각의 Grid row 객체들 업데이트
625
        /// </summary>
626

    
627
        private DispatcherTimer dispatcherTimer;
628
        public override void Loaded()
629
        {
630
            base.Loaded();
631

    
632
            if (!App.IsDesignMode)
633
            {
634
                dispatcherTimer = new DispatcherTimer();
635
                dispatcherTimer.Tick += new EventHandler(Timer_Tick);
636
                dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
637
                dispatcherTimer.Start();
638
            }
639
        }
640

    
641
        private async void Timer_Tick(object sender, EventArgs e)
642
        {
643
            dispatcherTimer.Stop();
644

    
645
            if (IsAcitve)
646
            {
647
                await App.Current.Dispatcher.InvokeAsync(() =>
648
                {
649
                    DataSelect();
650

    
651
                    AliveDataSelect();
652
                });
653
            }
654

    
655
            await Task.Delay(5000);
656

    
657
            System.Threading.Thread.Sleep(new TimeSpan(0, 0, 0, 0, 100));
658

    
659
            dispatcherTimer.Start();
660
        }
661

    
662
        private async void SearchTimer_Tick(object sender, EventArgs e)
663
        {
664
            dispatcherTimer.Stop();
665

    
666
            if (IsAcitve)
667
            {
668
                await App.Current.Dispatcher.InvokeAsync(() =>
669
                {
670
                    DataSearch(new[] { (StatusCodeType)(SelectedStatus.Value) }, FilterConvertSource);
671

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

    
674
                    AliveDataSelect();
675
                });
676
            }
677

    
678
            await Task.Delay(5000);
679

    
680
            System.Threading.Thread.Sleep(new TimeSpan(0, 0, 0, 0, 100));
681

    
682
            dispatcherTimer.Start();
683
        }
684

    
685
        public override void Closed()
686
        {
687
            if (dispatcherTimer != null)
688
            {
689
                dispatcherTimer.Stop();
690
            }
691

    
692
            base.Closed();
693
        }
694

    
695

    
696
        #endregion
697

    
698
        #region Function
699

    
700
        #region Return_FilterConvertSource
701

    
702
        public static void Return_FilterConvertSource(ObservableCollection<ConvertPDF> convertPDFs)
703
        {
704
            ConvertSource = new ObservableCollection<ConvertPDF>();
705
            ConvertSource = convertPDFs;
706
        }
707

    
708
        public static ObservableCollection<ConvertPDF> Return_FilterConvertSource()
709
        {
710
            return ConvertSource;
711
        }
712

    
713
        #endregion
714

    
715
        #region Data Select
716

    
717
        /// <summary>
718
        /// 상단 그리드 중앙 그리드 출력 데이터
719
        /// </summary>
720
        private void DataSelect()
721
        {
722

    
723
            if (FilterConvertSource == null)
724
            {
725
                FilterConvertSource = new System.Collections.ObjectModel.ObservableCollection<ConvertPDF>();
726
            }
727

    
728
            if (RealConvertSource == null)
729
            {
730
                RealConvertSource = new System.Collections.ObjectModel.ObservableCollection<ConvertPDF>();
731
            }
732

    
733
            /// combobox 에서 선택된 items
734
            if (SelectedStatus != null)
735
            {
736
                DataSelect(new[] { (StatusCodeType)(SelectedStatus.Value) }, FilterConvertSource);
737
            }
738

    
739

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

    
743
        }
744

    
745
        private async void RealDataSelect(IEnumerable<StatusCodeType> statusCodeTypeList, System.Collections.ObjectModel.ObservableCollection<ConvertPDF> collection)
746
        {
747
            try
748
            {
749
                List<ConvertPDF> Listitems = new List<ConvertPDF>();
750

    
751
                foreach (var coll in collection)
752
                {
753
                   var collectionItems = from num in await WcfClient.GET_SELECT_CONVERT_ITEMAsync(coll.ConvertID, coll.ProjectNumber, null, null, 1, null, null, null, null, null, null, null, null, null, null, null, null, null, null)
754
                                let MarkusLink = "kcom://" + CreateMarkusParam(num.PROJECT_NO, num.DOCUMENT_ID, "doftech")
755
                                select new ConvertPDF(num.SERVICE_ID, num.ID, num.PROJECT_NO, num.STATUS, num.DOCUMENT_ID, num.DOCUMENT_NAME, num.DOCUMENT_NO, num.DOCUMENT_URL, num.REVISION, num.CURRENT_PAGE,
756
                            num.TOTAL_PAGE, num.EXCEPTION, num.GROUP_NO, num.CREATE_DATETIME, num.START_DATETIME, num.END_DATETIME, num.DOCUMENT_URL, num.CONVERT_PATH, MarkusLink, num.RECONVERTER);
757

    
758
                    var collectionItem = collectionItems.Cast<ConvertPDF>().ToList();
759

    
760
                    Listitems.AddRange(collectionItem);
761
                }
762

    
763
                foreach (var Listitem in Listitems)
764
                {
765
                    collection.UpdateWhere(changeitem =>
766
                    ConvertItemEx.ChangeValues(changeitem, Listitem), x => x.ProjectNumber == Listitem.ProjectNumber && x.ConvertID == Listitem.ConvertID);
767
                }
768
            }
769
            catch (Exception ex)
770
            {
771
                MessageBox.Show(ex.ToString());
772
            }
773
        }
774

    
775
        private async void DataSelect(IEnumerable<StatusCodeType> statusCodeTypeList, System.Collections.ObjectModel.ObservableCollection<ConvertPDF> collection)
776
        {
777
            try
778
            {
779
                int _status = 0;
780
                if (SelectedStatus != null)
781
                {
782
                    _status = (int)SelectedStatus.Value;
783
                }
784

    
785
                if (ProjectNames.Count() == 0)
786
                {
787
                    ProjectName Clear = new ProjectName("Clear", "Clear");
788
                    ProjectNames.Add(Clear);
789

    
790
                    foreach (var x in await WcfClient.GET_SELECT_RUN_PROJECTSAsync(0))
791
                    {
792
                        ProjectName projectName = new ProjectName(x.PROJECT_NO, x.PROJECT_NAME);
793
                        ProjectNames.Add(projectName);
794
                    }
795
                }
796

    
797
                var Listitems = from num in await WcfClient.GET_SELECT_CONVERT_ITEMAsync(null, null, null, _status, SelectedCount.ValueMember, null, null, null, null, null, null, null, null, null, null, null, null, null, null)
798
                                let MarkusLink = "kcom://" + CreateMarkusParam(num.PROJECT_NO, num.DOCUMENT_ID, "doftech")
799
                                select new ConvertPDF(num.SERVICE_ID, num.ID, num.PROJECT_NO, num.STATUS, num.DOCUMENT_ID, num.DOCUMENT_NAME, num.DOCUMENT_NO, num.DOCUMENT_URL, num.REVISION, num.CURRENT_PAGE,
800
                                                        num.TOTAL_PAGE, num.EXCEPTION, num.GROUP_NO, num.CREATE_DATETIME, num.START_DATETIME, num.END_DATETIME, num.DOCUMENT_URL, num.CONVERT_PATH, MarkusLink, num.RECONVERTER);
801

    
802
                if (collection.Count() == 0)
803
                {
804
                    if (statusCodeTypeList.Count() == 1)
805
                    {
806
                        foreach (var Listitem in Listitems.ToList())
807
                        {
808
                            collection.Add(Listitem);
809
                        }
810
                    }
811
                }
812
                else
813
                {
814
                    foreach (var Listitem in Listitems)
815
                    {
816
                        collection.UpdateWhere(changeitem =>
817
                        ConvertItemEx.ChangeValues(changeitem, Listitem), x => x.ProjectNumber == Listitem.ProjectNumber && x.ConvertID == Listitem.ConvertID);
818
                    }
819
                    if (statusCodeTypeList.Count() == 1)
820
                    {
821
                        for (int i = collection.Count() - 1; i >= 0; --i)
822
                        {
823
                            var item = collection[i];
824

    
825
                            if (Listitems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
826
                            {
827
                                collection.RemoveAt(i);
828
                            }
829
                        }
830
                    }
831

    
832
                    if (statusCodeTypeList.Count() == 1)
833
                    {
834
                        foreach (var item in Listitems)
835
                        {
836
                            if (collection.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
837
                            {
838
                                for (int i = 0; i < 200; i++)
839
                                {
840
                                    if (i < collection.Count() - 1)
841
                                    {
842
                                        if (DateTime.Compare(collection[i].CreateTime, item.CreateTime) < 0)
843
                                        {
844
                                            collection.Insert(i, item);
845
                                            break;
846
                                        }
847
                                    }
848
                                    else
849
                                    {
850
                                        collection.Add(item);
851
                                        break;
852
                                    }
853
                                }
854

    
855
                            }
856

    
857
                        }
858
                    }
859
                }
860
            }
861
            catch (Exception ex)
862
            {
863
                MessageBox.Show(ex.ToString());
864
            }
865
        }
866

    
867
        private async void DataSearch(IEnumerable<StatusCodeType> statusCodeTypeList, System.Collections.ObjectModel.ObservableCollection<ConvertPDF> collection)
868
        {
869
            try
870
            {
871
                int _status = 0;
872
                if (SelectedStatus != null)
873
                {
874
                    _status = (int)SelectedStatus.Value;
875
                }
876
                DateTime? Start_CreateTime = null;
877
                DateTime? Finish_CreateTime = null;
878
                if (SelectedCreateTimeBegin != DefaultCreateTime)
879
                {
880
                    Start_CreateTime = SelectedCreateTimeBegin;
881
                }
882
                if (SelectedCreateTimeEnd != DefaultCreateTime)
883
                {
884
                    Finish_CreateTime = SelectedCreateTimeEnd;
885
                }
886

    
887
                if (ProjectNames.Count() == 0)
888
                {
889
                    foreach (var x in await WcfClient.GET_SELECT_RUN_PROJECTSAsync(0))
890
                    {
891
                        ProjectName projectName = new ProjectName(x.PROJECT_NO, x.PROJECT_NAME);
892
                        ProjectNames.Add(projectName);
893
                    }
894
                }
895

    
896
                var Listitems = from num in await WcfClient.GET_SELECT_CONVERT_ITEMAsync(null, ProjectNumberFilter.Project_NO, UniqueKeyFilter, _status, SelectedCount.ValueMember, Start_CreateTime, Finish_CreateTime, null,
897
            null, null, null, GroupNOFilter, Document_NameFilter, Docuemnt_NOFilter, RevisionFilter, Service_IDFilter, ReconverterFilter, DOCUMENT_URLFilter, ExcptionCheck)
898
                                let MarkusLink = "kcom://" + CreateMarkusParam(num.PROJECT_NO, num.DOCUMENT_ID, "doftech")
899
                                select new ConvertPDF(num.SERVICE_ID, num.ID, num.PROJECT_NO, num.STATUS, num.DOCUMENT_ID, num.DOCUMENT_NAME, num.DOCUMENT_NO, num.DOCUMENT_URL, num.REVISION, num.CURRENT_PAGE,
900
           num.TOTAL_PAGE, num.EXCEPTION, num.GROUP_NO, num.CREATE_DATETIME, num.START_DATETIME, num.END_DATETIME, num.DOCUMENT_URL, num.CONVERT_PATH, MarkusLink, num.RECONVERTER);
901

    
902
                if (collection.Count() == 0)
903
                {
904
                    if (statusCodeTypeList.Count() == 1)
905
                    {
906
                        foreach (var x in Listitems)
907
                        {
908
                            collection.Add(x);
909
                        }
910
                    }
911
                }
912
                else
913
                {
914
                    foreach (var newitem in Listitems)
915
                    {
916
                        collection.UpdateWhere(changeitem =>
917
                        ConvertItemEx.ChangeValues(changeitem, newitem), x => x.ProjectNumber == newitem.ProjectNumber && x.ConvertID == newitem.ConvertID);
918
                    }
919

    
920

    
921
                    if (statusCodeTypeList.Count() == 1)
922
                    {
923
                        for (int i = collection.Count() - 1; i >= 0; --i)
924
                        {
925
                            var item = collection[i];
926

    
927
                            if (Listitems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
928
                            {
929
                                collection.RemoveAt(i);
930
                            }
931
                        }
932
                    }
933

    
934
                    if (statusCodeTypeList.Count() == 1)
935
                    {
936
                        foreach (var item in Listitems)
937
                        {
938
                            if (collection.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
939
                            {
940
                                for (int i = 0; i < 200; i++)
941
                                {
942
                                    if (i < collection.Count() - 1)
943
                                    {
944
                                        if (DateTime.Compare(collection[i].CreateTime, item.CreateTime) < 0)
945
                                        {
946
                                            collection.Insert(i, item);
947
                                            break;
948
                                        }
949
                                    }
950
                                    else
951
                                    {
952
                                        collection.Add(item);
953
                                        break;
954
                                    }
955
                                }
956
                            }
957
                        }
958
                    }
959
                }
960
            }
961
            catch (Exception ex)
962
            {
963
                MessageBox.Show(ex.ToString());
964
            }
965
        }
966
        /// <summary>
967
        /// 서비스의 실시간 컨버터 Item
968
        /// </summary>
969
        private async void AliveDataSelect()
970
        {
971
            try
972
            {
973
                List<ConvertPDF> newitems = new List<ConvertPDF>();
974
                foreach (var client in App.StationClientList)
975
                {
976
                    if (await SimplePingAsync(client.Endpoint.Address.ToString()))
977
                    {
978
                        try
979
                        {
980
                            List<ConvertPDF> itemsToList = new List<ConvertPDF>();
981
                            var items = await client.AliveConvertListAsync();
982
                            string result = "";
983

    
984
                            foreach (var item in items)
985
                            {
986
                                ConvertPDF itemsToEach = new ConvertPDF();
987
                                itemsToEach.ServiceID = item.ServiceID;
988
                                itemsToEach.ConvertID = item.ConvertID;
989
                                itemsToEach.ProjectNumber = item.ProjectNumber;
990

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

    
993
                                if (item.ConvertState != null)
994
                                {
995
                                    itemsToEach.ConvertState = (StatusCodeType)Enum.Parse(typeof(StatusCodeType), item.ConvertState);
996
                                }
997

    
998
                                if (item.OriginfilePath.Contains("/"))
999
                                {
1000
                                    result = item.OriginfilePath.Substring(item.OriginfilePath.LastIndexOf("/") + 1);
1001
                                }
1002
                                else
1003
                                {
1004
                                    result = item.OriginfilePath.Substring(item.OriginfilePath.LastIndexOf("%") + 1);
1005
                                }
1006
                                itemsToEach.FileName = result;
1007

    
1008
                                itemsToEach.CurrentPageNo = item.CurrentPageNo;
1009
                                itemsToEach.TotalPage = item.TotalPage;
1010
                                itemsToEach.OriginfilePath = item.OriginfilePath;
1011
                                itemsToEach.ConvertPath = item.ConvertPath;
1012
                                itemsToEach.MarkusLink = MarkusLink;
1013
                                itemsToEach.UniqueKey = item.UniqueKey;
1014
                                itemsToEach.GroupNo = item.GroupNo;
1015
                                itemsToEach.DocumentName = item.DocumnetName;
1016
                                itemsToEach.Revision = item.Revision; 
1017
                                itemsToEach.Exception = item.Exception;
1018
                                itemsToEach.ConvertPath = item.ConvertPath;
1019
                                itemsToEach.CreateTime = item.CreateTime;
1020
                                itemsToEach.ReConverter = item.ReConverter;
1021
                                itemsToEach.DocumentID = item.DocumentID;
1022
                                itemsToEach.StartTime = item.StartTime;
1023
                                itemsToEach.EndTime = item.EndTime;
1024

    
1025
                                itemsToList.Add(itemsToEach);
1026
                            }
1027
                            newitems.AddRange(itemsToList);
1028
                            System.Diagnostics.Trace.WriteLine($"{client.Endpoint.Address} ping");
1029

    
1030
                            if (items.Count() == 0)
1031
                            {
1032
                                System.Diagnostics.Trace.WriteLine($"{client.Endpoint.Address} Alive Items is zero.");
1033
                            }
1034
                        }
1035
                        catch (Exception ex)
1036
                        {
1037
                            System.Diagnostics.Trace.Fail($"{client.Endpoint.Address} {ex.Message}");
1038
                        }
1039
                    }
1040
                    else
1041
                    {
1042
                        System.Diagnostics.Trace.Fail($"{client.Endpoint.Address} ping Error");
1043
                    }
1044

    
1045
                }
1046
                ItemsUpdate(newitems);
1047
                await System.Windows.Application.Current.Dispatcher.InvokeAsync(() => ItemsUpdate(newitems));
1048
            }
1049
            catch (Exception ex)
1050
            {
1051
                System.Diagnostics.Debug.WriteLine(ex.ToString());
1052
            }
1053
        }
1054

    
1055
        /// <summary>
1056
        /// AliveDataSelect의 Data Update
1057
        /// </summary>
1058
        /// <param name="newitems"></param>
1059
        private void ItemsUpdate(List<ConvertPDF> newitems)
1060
        {
1061

    
1062
            foreach (var item in newitems)
1063
            {
1064
                item.OriginfilePath = HttpUtility.UrlDecode(item.OriginfilePath);
1065
            }
1066

    
1067
            if (AliveItems == null)
1068
            {
1069
                AliveItems = new System.Collections.ObjectModel.ObservableCollection<ConvertPDF>();
1070

    
1071
                foreach (var item in newitems)
1072
                {
1073
                    AliveItems.Add(item);
1074
                }
1075
            }
1076
            else
1077
            {
1078
                newitems.ForEach(newitem =>
1079
                {
1080
                    AliveItems.UpdateWhere(changeitem => ConvertItemEx.ChangeValues(changeitem, newitem), x => x.ProjectNumber == newitem.ProjectNumber && x.ConvertID == newitem.ConvertID);
1081
                });
1082

    
1083
                foreach (var item in newitems)
1084
                {
1085
                    if (AliveItems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
1086
                    {
1087
                        AliveItems.Add(item);
1088
                    }
1089
                }
1090

    
1091
                for (int i = AliveItems.Count() - 1; i > -1; --i)
1092
                {
1093
                    var item = AliveItems[i];
1094

    
1095
                    if (newitems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
1096
                    {
1097
                        try
1098
                        {
1099
                            AliveItems.RemoveAt(i);
1100
                        }
1101
                        catch (Exception ex)
1102
                        {
1103
                            System.Diagnostics.Debug.WriteLine(ex.ToString());
1104
                        }
1105
                    }
1106
                }
1107
            }
1108

    
1109
            if (AliveItems.Count() > 1)
1110
            {
1111
                AliveShow = true;
1112
            }
1113
        }
1114

    
1115

    
1116
        public static async Task<bool> SimplePingAsync(string uri)
1117
        {
1118
            bool result = false;
1119

    
1120
            try
1121
            {
1122
                using (System.Net.Http.HttpClient Client = new System.Net.Http.HttpClient())
1123
                {
1124
                    Client.Timeout = new TimeSpan(0, 0, 60);
1125

    
1126
                    var message = await Client.GetAsync(uri);
1127

    
1128
                    System.Net.HttpStatusCode StatusCode = message.StatusCode;
1129

    
1130
                    switch (StatusCode)
1131
                    {
1132

    
1133
                        case System.Net.HttpStatusCode.Accepted:
1134
                        case System.Net.HttpStatusCode.OK:
1135
                            result = true;
1136
                            break;
1137
                    }
1138
                }
1139
            }
1140
            catch (Exception ex)
1141
            {
1142
                result = false;
1143
                System.Diagnostics.Debug.WriteLine(ex.ToString());
1144
            }
1145

    
1146
            return result;
1147
        }
1148

    
1149
        #endregion
1150

    
1151
        #region Data Convert
1152

    
1153
        private async void DataConvert(object obj)
1154
        {
1155
            if (SelectFilterConvertList == null)
1156
            {
1157
                MessageBox.Show("왼쪽 버튼 클릭 후 Converter 해주세요!");
1158
            }
1159
            else
1160
            {
1161
                if (SelectRealConvert != null)
1162
                {
1163
                    SetCleanUpItem(SelectRealConvert);
1164
                }
1165
                if (SelectFilterConvertList != null)
1166
                {
1167
                    foreach (var SelectFilterConvert in SelectFilterConvertList)
1168
                    {
1169
                        SetCleanUpItem(SelectFilterConvert);
1170
                    }
1171
                }
1172

    
1173
                foreach (var SelectFilterConvert in SelectFilterConvertList)
1174
                {
1175

    
1176
                    var items = from x in await WcfClient.GET_SELECT_CONVERT_ITEMAsync(SelectFilterConvert.ConvertID, null, null, null, 1, null, null, null, null, null, null, null, null, null, null, null, null, null, null)
1177
                                let MarkusLink = "kcom://" + CreateMarkusParam(x.PROJECT_NO, x.DOCUMENT_ID, "doftech")
1178
                                select new ConvertPDF(x.SERVICE_ID, x.ID, x.PROJECT_NO, x.STATUS, x.DOCUMENT_ID, x.DOCUMENT_NAME, x.DOCUMENT_NO, x.DOCUMENT_URL, x.REVISION, x.CURRENT_PAGE, x.TOTAL_PAGE, x.EXCEPTION, x.GROUP_NO, x.CREATE_DATETIME, x.START_DATETIME, x.END_DATETIME
1179
                             , x.DOCUMENT_URL, x.CONVERT_PATH, MarkusLink, x.RECONVERTER);
1180

    
1181
                    foreach (var item in items)
1182
                    {
1183
                        RealConvertSource.Add(item);
1184

    
1185
                        if (RealConvertSource.Count() == 1)
1186
                        {
1187
                            ConvertShow = true;
1188
                        }
1189
                    }
1190
                }
1191
            }
1192
        }
1193

    
1194

    
1195
        public async void SetCleanUpItem(ConvertPDF _ConvertItem)
1196
        {
1197
        
1198
            var items = await WcfClient.GET_SELECT_CONVERT_ITEMAsync(_ConvertItem.ConvertID, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null);
1199
       
1200
            if (items.Count() > 0)
1201
            {
1202
                var item = items.First();
1203

    
1204
                var _RECONVERTER = item.RECONVERTER - _ConvertItem.ReConverter;
1205
                var _CREATE_DATETIME = DateTime.Now;
1206
                var _STATUS = (int)StatusCodeType.None;
1207

    
1208
                await WcfClient.GET_SELECT_RERECONVERT_ITEMAsync(_ConvertItem.ConvertID, _RECONVERTER, _CREATE_DATETIME, _STATUS, null);
1209
            }
1210
        }
1211

    
1212

    
1213
        public static string CreateMarkusParam(string projectNo, string documentID, string userID)
1214
        {
1215
            ViewInfo viewInfo = new ViewInfo();
1216

    
1217
            viewInfo.DocumentItemID = documentID;
1218
            viewInfo.ProjectNO = projectNo;
1219
            viewInfo.UserID = userID;
1220

    
1221
            return ParamEncoding(JsonConvert.SerializeObject(viewInfo));
1222

    
1223
        }
1224

    
1225
        public static string ParamEncoding(string EncodingText, System.Text.Encoding oEncoding = null)
1226
        {
1227

    
1228
            if (oEncoding == null)
1229
                oEncoding = System.Text.Encoding.UTF8;
1230

    
1231
            return Convert.ToBase64String(oEncoding.GetBytes(EncodingText));
1232

    
1233
        }
1234

    
1235

    
1236
        #endregion
1237

    
1238
        #region Validation
1239

    
1240
        private void DataValidate(object obj)
1241
        {
1242
            if (SelectFilterConvertList.Count() > 1)
1243
            {
1244
                MessageBox.Show("하나만 클릭해 주세요");
1245
            }
1246
            else
1247
            {
1248
                bool result = false;
1249
                WebRequest webRequest = WebRequest.Create(SelectFilterConvertList[0].OriginfilePath);
1250
                webRequest.Timeout = 1200; // miliseconds
1251
                webRequest.Method = "HEAD";
1252

    
1253
                HttpWebResponse response = null;
1254

    
1255
                try
1256
                {
1257
                    response = (HttpWebResponse)webRequest.GetResponse();
1258
                    result = true;
1259
                }
1260
                catch (WebException webException)
1261
                {
1262
                    MessageBox.Show(SelectFilterConvert.FileName + " doesn't exist: " + webException.Message);
1263
                    result = true;
1264
                }
1265
                finally
1266
                {
1267
                    if (response != null)
1268
                    {
1269
                        response.Close();
1270
                    }
1271
                }
1272
                if (result == true)
1273
                {
1274
                    MessageBox.Show("File exists");
1275
                }
1276
            }
1277

    
1278
        }
1279

    
1280
        #endregion
1281

    
1282
        #region Data Delete
1283

    
1284
        private void DataDelete(object obj)
1285
        {
1286
            RadWindow.Alert("Do you want to delete it??", this.OnClosed);
1287
        }
1288

    
1289
        private async void OnClosed(object sender, WindowClosedEventArgs e)
1290
        {
1291
            {
1292
                var result = e.DialogResult;
1293
                if (result == true)
1294
                {
1295
                    if (SelectFilterConvertList.Count() > 1)
1296
                    {
1297
                        MessageBox.Show("하나만 클릭해 주세요!");
1298
                    }
1299
                    else
1300
                    {
1301
                        if (SelectRealConvert != null)
1302
                        {
1303
                            await WcfClient.GET_SELECT_CONVERT_DELETEAsync(SelectRealConvert.ConvertID);
1304
                        }
1305
                        if (SelectFilterConvertList != null)
1306
                        {
1307
                            await WcfClient.GET_SELECT_CONVERT_DELETEAsync(SelectFilterConvertList[0].ConvertID);
1308
                        }
1309
                    }
1310
                }
1311
            }
1312
        }
1313
        #endregion
1314

    
1315
        #region Stop Process
1316

    
1317
        private void Stop_Process(object obj)
1318
        {
1319
            if (SelectFilterConvertList.Count() > 1)
1320
            {
1321
                MessageBox.Show("하나만 클릭해 주세요");
1322
            }
1323
            else
1324
            {
1325
                //ID 찾아서 멈춰라 
1326
                RadWindow.Alert("프로세스 종료 할까요??", this.ON_Stop_Process);
1327

    
1328
            }
1329

    
1330
        }
1331

    
1332
        private void ON_Stop_Process(object sender, WindowClosedEventArgs e)
1333
        {
1334
            {
1335
                var result = e.DialogResult;
1336
                if (result == true)
1337
                {
1338
                    var process = Process.GetProcessesByName("Markus.Service.ConvertProcess");
1339

    
1340
                    for (int i = process.Count() - 1; i >= 0; i--)
1341
                    {
1342
                        try
1343
                        {
1344
                            var commandLines = process[i].Arguments().CommandLine;
1345

    
1346
                            if (commandLines.Count() > 0)
1347
                            {
1348
                                if (commandLines[0] == "TEST" && commandLines[1] == "1")
1349
                                {
1350
                                    process[i].Kill();
1351
                                }
1352
                                //if (ServiceStation.AliveConvertQueue.Count(f => f.ConvertID == commandLines[0]) == 0)
1353
                                //{
1354
                                //    process[i].Kill();
1355
                                //}
1356
                            }
1357
                        }
1358
                        catch (Exception ex)
1359
                        {
1360
                            System.Diagnostics.Debug.WriteLine(ex.ToString());
1361
                        }
1362
                    }
1363
                }
1364
            }
1365
        }
1366
        #endregion
1367

    
1368
        #region DataFilter
1369

    
1370
        public void DataFilter(object obj)
1371
        {
1372
            SearchTimerOn = true; 
1373
            dispatcherTimer.Tick -= new EventHandler(Timer_Tick);
1374
            dispatcherTimer.Tick += new EventHandler(SearchTimer_Tick);
1375
        }
1376

    
1377
        #endregion
1378

    
1379
        #region MarkusLink
1380

    
1381
        private void MarkusLink(object obj)
1382
        {
1383
            if (obj is ConvertPDF)
1384
            {
1385

    
1386
                if (obj != null)
1387
                {
1388
                    var convertitem = obj as ConvertPDF;
1389

    
1390
                    SelectFilterConvertList.Add(convertitem);
1391

    
1392
                    SelectRealConvert = convertitem;
1393

    
1394
                    ProcessStartInfo startInfo = null;
1395

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

    
1398
                    Process.Start(startInfo);
1399
                }
1400

    
1401
            }
1402
        }
1403

    
1404
        #endregion
1405

    
1406
        #region Data Export
1407

    
1408

    
1409
        /// <summary>
1410
        /// 필터된 상단 그리드 엑셀로 출력
1411
        /// </summary>
1412

    
1413
        public void DataExportData(object obj)
1414
        {
1415
            if(SearchTimerOn == true)
1416
            {
1417
                dispatcherTimer.Tick -= new EventHandler(SearchTimer_Tick);
1418
            }
1419
            else
1420
            {
1421
                dispatcherTimer.Tick -= new EventHandler(Timer_Tick);
1422
            }
1423

    
1424
            Return_FilterConvertSource(FilterConvertSource);
1425

    
1426
            Views.ConvertExcelDialog convertExcelDialog = new Views.ConvertExcelDialog();
1427

    
1428
            convertExcelDialog.Owner = Application.Current.MainWindow;
1429
            convertExcelDialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;
1430

    
1431
            convertExcelDialog.ShowDialog();
1432

    
1433
            if (SearchTimerOn == true)
1434
            {
1435
                dispatcherTimer.Tick += new EventHandler(SearchTimer_Tick);
1436
            }
1437
            else
1438
            {
1439
                dispatcherTimer.Tick += new EventHandler(Timer_Tick);
1440
            }
1441
        }
1442

    
1443
        #endregion
1444

    
1445
        #region Data Search
1446

    
1447
        public void RemoveCreateTimeFilter(object obj)
1448
        {
1449
            DefaultCreateTime = DateTime.Now.AddHours(-1);
1450
            SelectedCreateTimeBegin = DefaultCreateTime;
1451
            SelectedCreateTimeEnd = DefaultCreateTime;
1452
        }
1453

    
1454
        #endregion
1455

    
1456
        #region Reset
1457

    
1458
        /// <summary>
1459
        /// 그리드 상단 원상복귀 버튼
1460
        /// 필터를 끝낸 후 다시 복귀
1461
        /// </summary>
1462

    
1463
        public void Reset(object obj)
1464
        {
1465
            SearchTimerOn = false;
1466
            ExcptionCheck = false;
1467
            SelectedInt = 10;
1468
            ProjectNumberFilter = ProjectNames[0];
1469
            UniqueKeyFilter = null;
1470
            Service_IDFilter = null;
1471
            Document_NameFilter = null;
1472
            Docuemnt_NOFilter = null;
1473
            ReconverterFilter = null;
1474
            RevisionFilter = null;
1475
            GroupNOFilter = null;
1476
            DOCUMENT_URLFilter = null;
1477
            DefaultCreateTime = DateTime.Now.AddHours(-1);
1478
            SelectedCreateTimeBegin = DefaultCreateTime;
1479
            SelectedCreateTimeEnd = DefaultCreateTime;
1480
            dispatcherTimer.Tick -= new EventHandler(SearchTimer_Tick);
1481
            dispatcherTimer.Tick += new EventHandler(Timer_Tick);
1482
        }
1483

    
1484
        #endregion
1485

    
1486
        #region ConvertAddDialog
1487

    
1488
        /// <summary>
1489
        /// 그리드 상단 Conver 추가 버튼
1490
        /// ProjectNo, DocumentURL, DocumentID, 입력해서 저장 프로시저에서 추가 
1491
        /// </summary>
1492

    
1493
        public void ConvertAdd(object obj)
1494
        {
1495
            try
1496
            {
1497
                if (SearchTimerOn == true)
1498
                {
1499
                    dispatcherTimer.Tick -= new EventHandler(SearchTimer_Tick);
1500
                }
1501
                else
1502
                {
1503
                    dispatcherTimer.Tick -= new EventHandler(Timer_Tick);
1504
                }
1505

    
1506
                Views.ConvertAddDialog convertAddDialog = new Views.ConvertAddDialog();
1507

    
1508
                convertAddDialog.Owner = Application.Current.MainWindow;
1509
                convertAddDialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;
1510

    
1511
                convertAddDialog.ShowDialog();
1512

    
1513
                if (SearchTimerOn == true)
1514
                {
1515
                    dispatcherTimer.Tick += new EventHandler(SearchTimer_Tick);
1516
                }
1517
                else
1518
                {
1519
                    dispatcherTimer.Tick += new EventHandler(Timer_Tick);
1520
                }
1521
            }
1522
            catch(Exception ex)
1523
            {
1524
                MessageBox.Show(ex.ToString());
1525
            }
1526
        }
1527

    
1528
        #endregion
1529

    
1530
        #region ConvertPathFileSearch
1531

    
1532
        /// <summary>
1533
        ///  ConvertPath 파일 탐색기로 열리는 아이콘
1534
        /// </summary>
1535

    
1536
        public void ConvertPathFileSearch(object obj)
1537
        {
1538
            if (obj is ConvertPDF)
1539
            {
1540
                if (obj != null)
1541
                {
1542
                    var convertitem = obj as ConvertPDF;
1543

    
1544
                    if (!string.IsNullOrEmpty(convertitem.ConvertPath))
1545
                    {
1546
                        System.Diagnostics.Process.Start("explorer.exe", convertitem.ConvertPath);
1547
                    }
1548
                }
1549
            }
1550
        }
1551

    
1552
        #endregion
1553

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