프로젝트

일반

사용자정보

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

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

이력 | 보기 | 이력해설 | 다운로드 (51.5 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 = false;
570
        public bool AliveShow
571
        {
572
            get => _AliveShow;
573
            set
574
            {
575
                _AliveShow = value;
576
                OnPropertyChanged(() => AliveShow);
577
            }
578
        }
579

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

    
595
        
596

    
597
        #endregion
598

    
599
        #region Command
600

    
601
        public DelegateCommand ConvertCommand { get; private set; }
602
        public DelegateCommand DeleteCommand { get; private set; }
603
        public DelegateCommand ValidateCommand { get; private set; }
604
        public DelegateCommand DataSaveFileGemBoxCommand { get; private set; }
605
        public DelegateCommand MarkusLinkCommand { get; private set; }
606
        public DelegateCommand RemoveCreateTimeFilterCommand { get; private set; }
607

    
608
        public DelegateCommand DataFilterCommand { get; private set; }
609
        public DelegateCommand ResetCommand { get; private set; }
610
        public DelegateCommand ConvertAddCommand { get; private set; }
611
        public DelegateCommand ConvertPathFileSearchCommand { get; private set; }
612
        public DelegateCommand Stop_ProcessCommand { get; private set; }
613

    
614

    
615
        #endregion
616

    
617
        #region Main Logic
618

    
619
        /// <summary>
620
        /// 각각의 Grid row 객체들 업데이트
621
        /// </summary>
622

    
623
        private DispatcherTimer dispatcherTimer;
624
        public override void Loaded()
625
        {
626
            base.Loaded();
627

    
628
            if (!App.IsDesignMode)
629
            {
630
                dispatcherTimer = new DispatcherTimer();
631
                dispatcherTimer.Tick += new EventHandler(Timer_Tick);
632
                dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
633
                dispatcherTimer.Start();
634
            }
635
        }
636

    
637
        private async void Timer_Tick(object sender, EventArgs e)
638
        {
639
            dispatcherTimer.Stop();
640

    
641
            if (IsAcitve)
642
            {
643
                await App.Current.Dispatcher.InvokeAsync(() =>
644
                {
645
                    DataSelect();
646

    
647
                    AliveDataSelect();
648
                });
649
            }
650

    
651
            await Task.Delay(5000);
652

    
653
            System.Threading.Thread.Sleep(new TimeSpan(0, 0, 0, 0, 100));
654

    
655
            dispatcherTimer.Start();
656
        }
657

    
658
        private async void SearchTimer_Tick(object sender, EventArgs e)
659
        {
660
            dispatcherTimer.Stop();
661

    
662
            if (IsAcitve)
663
            {
664
                await App.Current.Dispatcher.InvokeAsync(() =>
665
                {
666
                    DataSearch(new[] { (StatusCodeType)(SelectedStatus.Value) }, FilterConvertSource);
667

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

    
670
                    AliveDataSelect();
671
                });
672
            }
673

    
674
            await Task.Delay(5000);
675

    
676
            System.Threading.Thread.Sleep(new TimeSpan(0, 0, 0, 0, 100));
677

    
678
            dispatcherTimer.Start();
679
        }
680

    
681
        public override void Closed()
682
        {
683
            if (dispatcherTimer != null)
684
            {
685
                dispatcherTimer.Stop();
686
            }
687

    
688
            base.Closed();
689
        }
690

    
691

    
692
        #endregion
693

    
694
        #region Function
695

    
696
        #region Return_FilterConvertSource
697

    
698
        public static void Return_FilterConvertSource(ObservableCollection<ConvertPDF> convertPDFs)
699
        {
700
            ConvertSource = new ObservableCollection<ConvertPDF>();
701
            ConvertSource = convertPDFs;
702
        }
703

    
704
        public static ObservableCollection<ConvertPDF> Return_FilterConvertSource()
705
        {
706
            return ConvertSource;
707
        }
708

    
709
        #endregion
710

    
711
        #region Data Select
712

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

    
719
            if (FilterConvertSource == null)
720
            {
721
                FilterConvertSource = new System.Collections.ObjectModel.ObservableCollection<ConvertPDF>();
722
            }
723

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

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

    
735

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

    
739
        }
740

    
741
        private async void RealDataSelect(IEnumerable<StatusCodeType> statusCodeTypeList, System.Collections.ObjectModel.ObservableCollection<ConvertPDF> collection)
742
        {
743
            try
744
            {
745
                List<ConvertPDF> Listitems = new List<ConvertPDF>();
746

    
747
                foreach (var coll in collection)
748
                {
749
                   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)
750
                                let MarkusLink = "kcom://" + CreateMarkusParam(num.PROJECT_NO, num.DOCUMENT_ID, "doftech")
751
                                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,
752
                            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);
753

    
754
                    var collectionItem = collectionItems.Cast<ConvertPDF>().ToList();
755

    
756
                    Listitems.AddRange(collectionItem);
757
                }
758

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

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

    
781
                if (ProjectNames.Count() == 0)
782
                {
783
                    ProjectName Clear = new ProjectName("Clear", "Clear");
784
                    ProjectNames.Add(Clear);
785

    
786
                    foreach (var x in await WcfClient.GET_SELECT_RUN_PROJECTSAsync(0))
787
                    {
788
                        ProjectName projectName = new ProjectName(x.PROJECT_NO, x.PROJECT_NAME);
789
                        ProjectNames.Add(projectName);
790
                    }
791
                }
792

    
793
                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)
794
                                let MarkusLink = "kcom://" + CreateMarkusParam(num.PROJECT_NO, num.DOCUMENT_ID, "doftech")
795
                                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,
796
                                                        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);
797

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

    
821
                            if (Listitems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
822
                            {
823
                                collection.RemoveAt(i);
824
                            }
825
                        }
826
                    }
827

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

    
851
                            }
852

    
853
                        }
854
                    }
855
                }
856
            }
857
            catch (Exception ex)
858
            {
859
                MessageBox.Show(ex.ToString());
860
            }
861
        }
862

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

    
883
                if (ProjectNames.Count() == 0)
884
                {
885
                    foreach (var x in await WcfClient.GET_SELECT_RUN_PROJECTSAsync(0))
886
                    {
887
                        ProjectName projectName = new ProjectName(x.PROJECT_NO, x.PROJECT_NAME);
888
                        ProjectNames.Add(projectName);
889
                    }
890
                }
891

    
892
                var Listitems = from num in await WcfClient.GET_SELECT_CONVERT_ITEMAsync(null, ProjectNumberFilter.Project_NO, UniqueKeyFilter, _status, SelectedCount.ValueMember, Start_CreateTime, Finish_CreateTime, null,
893
            null, null, null, GroupNOFilter, Document_NameFilter, Docuemnt_NOFilter, RevisionFilter, Service_IDFilter, ReconverterFilter, DOCUMENT_URLFilter, ExcptionCheck)
894
                                let MarkusLink = "kcom://" + CreateMarkusParam(num.PROJECT_NO, num.DOCUMENT_ID, "doftech")
895
                                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,
896
           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);
897

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

    
916

    
917
                    if (statusCodeTypeList.Count() == 1)
918
                    {
919
                        for (int i = collection.Count() - 1; i >= 0; --i)
920
                        {
921
                            var item = collection[i];
922

    
923
                            if (Listitems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
924
                            {
925
                                collection.RemoveAt(i);
926
                            }
927
                        }
928
                    }
929

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

    
980
                            foreach (var item in items)
981
                            {
982
                                ConvertPDF itemsToEach = new ConvertPDF();
983
                                itemsToEach.ServiceID = item.ServiceID;
984
                                itemsToEach.ConvertID = item.ConvertID;
985
                                itemsToEach.ProjectNumber = item.ProjectNumber;
986

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

    
989
                                if (item.ConvertState != null)
990
                                {
991
                                    itemsToEach.ConvertState = (StatusCodeType)Enum.Parse(typeof(StatusCodeType), item.ConvertState);
992
                                }
993

    
994
                                if (item.OriginfilePath.Contains("/"))
995
                                {
996
                                    result = item.OriginfilePath.Substring(item.OriginfilePath.LastIndexOf("/") + 1);
997
                                }
998
                                else
999
                                {
1000
                                    result = item.OriginfilePath.Substring(item.OriginfilePath.LastIndexOf("%") + 1);
1001
                                }
1002
                                itemsToEach.FileName = result;
1003

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

    
1021
                                itemsToList.Add(itemsToEach);
1022
                            }
1023
                            newitems.AddRange(itemsToList);
1024
                            System.Diagnostics.Trace.WriteLine($"{client.Endpoint.Address} ping");
1025

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

    
1041
                }
1042
                ItemsUpdate(newitems);
1043
                await System.Windows.Application.Current.Dispatcher.InvokeAsync(() => ItemsUpdate(newitems));
1044
            }
1045
            catch (Exception ex)
1046
            {
1047
                System.Diagnostics.Debug.WriteLine(ex.ToString());
1048
            }
1049
        }
1050

    
1051
        /// <summary>
1052
        /// AliveDataSelect의 Data Update
1053
        /// </summary>
1054
        /// <param name="newitems"></param>
1055
        private void ItemsUpdate(List<ConvertPDF> newitems)
1056
        {
1057

    
1058
            foreach (var item in newitems)
1059
            {
1060
                item.OriginfilePath = HttpUtility.UrlDecode(item.OriginfilePath);
1061
            }
1062

    
1063
            if (AliveItems == null)
1064
            {
1065
                AliveItems = new System.Collections.ObjectModel.ObservableCollection<ConvertPDF>();
1066

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

    
1079
                foreach (var item in newitems)
1080
                {
1081
                    if (AliveItems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
1082
                    {
1083
                        AliveItems.Add(item);
1084
                    }
1085
                }
1086

    
1087
                for (int i = AliveItems.Count() - 1; i > -1; --i)
1088
                {
1089
                    var item = AliveItems[i];
1090

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

    
1105
            if (AliveItems.Count() > 1)
1106
            {
1107
                AliveShow = true;
1108
            }
1109
        }
1110

    
1111

    
1112
        public static async Task<bool> SimplePingAsync(string uri)
1113
        {
1114
            bool result = false;
1115

    
1116
            try
1117
            {
1118
                using (System.Net.Http.HttpClient Client = new System.Net.Http.HttpClient())
1119
                {
1120
                    Client.Timeout = new TimeSpan(0, 0, 60);
1121

    
1122
                    var message = await Client.GetAsync(uri);
1123

    
1124
                    System.Net.HttpStatusCode StatusCode = message.StatusCode;
1125

    
1126
                    switch (StatusCode)
1127
                    {
1128

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

    
1142
            return result;
1143
        }
1144

    
1145
        #endregion
1146

    
1147
        #region Data Convert
1148

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

    
1169
                foreach (var SelectFilterConvert in SelectFilterConvertList)
1170
                {
1171

    
1172
                    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)
1173
                                let MarkusLink = "kcom://" + CreateMarkusParam(x.PROJECT_NO, x.DOCUMENT_ID, "doftech")
1174
                                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
1175
                             , x.DOCUMENT_URL, x.CONVERT_PATH, MarkusLink, x.RECONVERTER);
1176

    
1177
                    foreach (var item in items)
1178
                    {
1179
                        RealConvertSource.Add(item);
1180

    
1181
                        if (RealConvertSource.Count() == 1)
1182
                        {
1183
                            ConvertShow = true;
1184
                        }
1185
                    }
1186
                }
1187
            }
1188
        }
1189

    
1190

    
1191
        public async void SetCleanUpItem(ConvertPDF _ConvertItem)
1192
        {
1193
        
1194
            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);
1195
       
1196
            if (items.Count() > 0)
1197
            {
1198
                var item = items.First();
1199

    
1200
                var _RECONVERTER = item.RECONVERTER - _ConvertItem.ReConverter;
1201
                var _CREATE_DATETIME = DateTime.Now;
1202
                var _STATUS = (int)StatusCodeType.None;
1203

    
1204
                await WcfClient.GET_SELECT_RERECONVERT_ITEMAsync(_ConvertItem.ConvertID, _RECONVERTER, _CREATE_DATETIME, _STATUS, null);
1205
            }
1206
        }
1207

    
1208

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

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

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

    
1219
        }
1220

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

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

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

    
1229
        }
1230

    
1231

    
1232
        #endregion
1233

    
1234
        #region Validation
1235

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

    
1249
                HttpWebResponse response = null;
1250

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

    
1274
        }
1275

    
1276
        #endregion
1277

    
1278
        #region Data Delete
1279

    
1280
        private void DataDelete(object obj)
1281
        {
1282
            RadWindow.Alert("Do you want to delete it??", this.OnClosed);
1283
        }
1284

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

    
1311
        #region Stop Process
1312

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

    
1324
            }
1325

    
1326
        }
1327

    
1328
        private void ON_Stop_Process(object sender, WindowClosedEventArgs e)
1329
        {
1330
            var result = e.DialogResult;
1331
            if (result == true)
1332
            {
1333
                var process = Process.GetProcessesByName("Markus.Service.ConvertProcess");
1334

    
1335
                for (int i = process.Count() - 1; i >= 0; i--)
1336
                {
1337
                    try
1338
                    {
1339
                        var commandLines = process[i].Arguments().CommandLine;
1340

    
1341
                        if (commandLines.Count() > 0)
1342
                        {
1343
                            if (commandLines[0] == "TEST" && commandLines[1] == "1")
1344
                            {
1345
                                process[i].Kill();
1346
                            }
1347
                            //if (AliveItems.Count(f => f.ConvertID == commandLines[0]) == 0) //프로세스 종료후 그 종료된 프로세스 누르면 real에 있던 애들 다 convert됨 
1348
                            //{
1349
                            //    process[i].Kill();
1350
                            //}
1351
                        }
1352
                    }
1353
                    catch (Exception ex)
1354
                    {
1355
                        System.Diagnostics.Debug.WriteLine(ex.ToString());
1356
                    }
1357
                }
1358
            }
1359
        }
1360
        #endregion
1361

    
1362
        #region DataFilter
1363

    
1364
        public void DataFilter(object obj)
1365
        {
1366
            SearchTimerOn = true; 
1367
            dispatcherTimer.Tick -= new EventHandler(Timer_Tick);
1368
            dispatcherTimer.Tick += new EventHandler(SearchTimer_Tick);
1369
        }
1370

    
1371
        #endregion
1372

    
1373
        #region MarkusLink
1374

    
1375
        private void MarkusLink(object obj)
1376
        {
1377
            if (obj is ConvertPDF)
1378
            {
1379

    
1380
                if (obj != null)
1381
                {
1382
                    var convertitem = obj as ConvertPDF;
1383

    
1384
                    SelectFilterConvertList.Add(convertitem);
1385

    
1386
                    SelectRealConvert = convertitem;
1387

    
1388
                    SelectAliveConvert = convertitem;
1389

    
1390
                    ProcessStartInfo startInfo = null;
1391

    
1392
                    startInfo = new ProcessStartInfo("iexplore.exe", convertitem.MarkusLink);
1393

    
1394
                    Process.Start(startInfo);
1395
                }
1396

    
1397
            }
1398
        }
1399

    
1400
        #endregion
1401

    
1402
        #region Data Export
1403

    
1404

    
1405
        /// <summary>
1406
        /// 필터된 상단 그리드 엑셀로 출력
1407
        /// </summary>
1408

    
1409
        public void DataExportData(object obj)
1410
        {
1411
            if(SearchTimerOn == true)
1412
            {
1413
                dispatcherTimer.Tick -= new EventHandler(SearchTimer_Tick);
1414
            }
1415
            else
1416
            {
1417
                dispatcherTimer.Tick -= new EventHandler(Timer_Tick);
1418
            }
1419

    
1420
            Return_FilterConvertSource(FilterConvertSource);
1421

    
1422
            Views.ConvertExcelDialog convertExcelDialog = new Views.ConvertExcelDialog();
1423

    
1424
            convertExcelDialog.Owner = Application.Current.MainWindow;
1425
            convertExcelDialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;
1426

    
1427
            convertExcelDialog.ShowDialog();
1428

    
1429
            if (SearchTimerOn == true)
1430
            {
1431
                dispatcherTimer.Tick += new EventHandler(SearchTimer_Tick);
1432
            }
1433
            else
1434
            {
1435
                dispatcherTimer.Tick += new EventHandler(Timer_Tick);
1436
            }
1437
        }
1438

    
1439
        #endregion
1440

    
1441
        #region Data Search
1442

    
1443
        public void RemoveCreateTimeFilter(object obj)
1444
        {
1445
            DefaultCreateTime = DateTime.Now.AddHours(-1);
1446
            SelectedCreateTimeBegin = DefaultCreateTime;
1447
            SelectedCreateTimeEnd = DefaultCreateTime;
1448
        }
1449

    
1450
        #endregion
1451

    
1452
        #region Reset
1453

    
1454
        /// <summary>
1455
        /// 그리드 상단 원상복귀 버튼
1456
        /// 필터를 끝낸 후 다시 복귀
1457
        /// </summary>
1458

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

    
1480
        #endregion
1481

    
1482
        #region ConvertAddDialog
1483

    
1484
        /// <summary>
1485
        /// 그리드 상단 Conver 추가 버튼
1486
        /// ProjectNo, DocumentURL, DocumentID, 입력해서 저장 프로시저에서 추가 
1487
        /// </summary>
1488

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

    
1502
                Views.ConvertAddDialog convertAddDialog = new Views.ConvertAddDialog();
1503

    
1504
                convertAddDialog.Owner = Application.Current.MainWindow;
1505
                convertAddDialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;
1506

    
1507
                convertAddDialog.ShowDialog();
1508

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

    
1524
        #endregion
1525

    
1526
        #region ConvertPathFileSearch
1527

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

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

    
1540
                    if (!string.IsNullOrEmpty(convertitem.ConvertPath))
1541
                    {
1542
                        System.Diagnostics.Process.Start("explorer.exe", convertitem.ConvertPath);
1543
                    }
1544
                }
1545
            }
1546
        }
1547

    
1548
        #endregion
1549

    
1550
        #endregion
1551
    }
1552
}
클립보드 이미지 추가 (최대 크기: 500 MB)