프로젝트

일반

사용자정보

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

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

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

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

    
35
        /// <summary>
36
        /// 실행하면 처음 들어가는 부분
37
        /// </summary>
38
        public DataBaseItemsModel()
39
        {
40
            DataFilterCommand = new DelegateCommand(DataFilter);
41
            DataSaveFileGemBoxCommand = new DelegateCommand(DataExportData);
42
            ConvertCommand = new DelegateCommand(DataConvert);
43
            DeleteCommand = new DelegateCommand(DataDelete);
44
            ValidateCommand = new DelegateCommand(DataValidate);
45
            MarkusLinkCommand = new DelegateCommand(MarkusLink);
46
            RemoveCreateTimeFilterCommand = new DelegateCommand(RemoveCreateTimeFilter);
47
            ResetCommand = new DelegateCommand(Reset);
48
            ConvertAddCommand = new DelegateCommand(ConvertAdd);
49
            ConvertPathFileSearchCommand = new DelegateCommand(ConvertPathFileSearch);
50
        }
51

    
52
        #endregion
53

    
54
        #region Properties
55

    
56
        DataService.DataServiceClient WcfClient = new DataService.DataServiceClient();
57

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

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

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

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

    
104
                return _FilterSearch;
105
            }
106
        }
107

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

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

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

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

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

    
174

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

    
189

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

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

    
212

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

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

    
240
                return _SelectedCountList;
241
            }
242
        }
243

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

    
258

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

    
277

    
278

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

    
290

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

    
302

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

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

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

    
338
                return _StatusCodeList;
339
            }
340
        }
341

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

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

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

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

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

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

    
446
                }
447
            }
448
        }
449

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

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

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

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

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

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

    
535
            }
536
        }
537

    
538
        private DateTime _SelectedCreateTimeEnd = DefaultCreateTime;
539
        public DateTime SelectedCreateTimeEnd
540
        {
541

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

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

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

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

    
597
        
598

    
599
        #endregion
600

    
601
        #region Command
602

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

    
610
        public DelegateCommand DataFilterCommand { get; private set; }
611
        public DelegateCommand ResetCommand { get; private set; }
612
        public DelegateCommand ConvertAddCommand { get; private set; }
613
        public DelegateCommand ConvertPathFileSearchCommand { get; private set; }
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

    
712
        #region Data Select
713

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

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

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

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

    
736

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

    
740
        }
741

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

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

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

    
757
                    Listitems.AddRange(collectionItem);
758
                }
759

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

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

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

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

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

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

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

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

    
852
                            }
853

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

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

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

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

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

    
917

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
1112

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

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

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

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

    
1127
                    switch (StatusCode)
1128
                    {
1129

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

    
1143
            return result;
1144
        }
1145

    
1146
        #endregion
1147

    
1148
        #region Data Convert
1149

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

    
1170
                foreach (var SelectFilterConvert in SelectFilterConvertList)
1171
                {
1172

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

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

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

    
1191

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

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

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

    
1209

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

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

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

    
1220
        }
1221

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

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

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

    
1230
        }
1231

    
1232

    
1233
        #endregion
1234

    
1235
        #region Validation
1236

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

    
1250
                HttpWebResponse response = null;
1251

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

    
1275
        }
1276

    
1277
        #endregion
1278

    
1279
        #region DataFilter
1280

    
1281
        public void DataFilter(object obj)
1282
        {
1283
            SearchTimerOn = true; 
1284
            dispatcherTimer.Tick -= new EventHandler(Timer_Tick);
1285
            dispatcherTimer.Tick += new EventHandler(SearchTimer_Tick);
1286
        }
1287

    
1288
        #endregion
1289

    
1290
        #region MarkusLink
1291

    
1292
        private void MarkusLink(object obj)
1293
        {
1294
            if (obj is ConvertPDF)
1295
            {
1296

    
1297
                if (obj != null)
1298
                {
1299
                    var convertitem = obj as ConvertPDF;
1300

    
1301
                    SelectFilterConvertList.Add(convertitem);
1302

    
1303
                    SelectRealConvert = convertitem;
1304

    
1305
                    ProcessStartInfo startInfo = null;
1306

    
1307
                    startInfo = new ProcessStartInfo("iexplore.exe", convertitem.MarkusLink);
1308

    
1309
                    Process.Start(startInfo);
1310
                }
1311

    
1312
            }
1313
        }
1314

    
1315
        #endregion
1316

    
1317
        #region Data Delete
1318

    
1319
        private void DataDelete(object obj)
1320
        {
1321
            RadWindow.Alert("Do you want to delete it??", this.OnClosed);
1322
        }
1323

    
1324
        private async void OnClosed(object sender, WindowClosedEventArgs e)
1325
        {
1326
            {
1327
                var result = e.DialogResult;
1328
                if (result == true)
1329
                {
1330
                    if (SelectFilterConvertList.Count() > 1)
1331
                    {
1332
                        MessageBox.Show("하나만 클릭해 주세요!");
1333
                    }
1334
                    else
1335
                    {
1336
                        if (SelectRealConvert != null)
1337
                        {
1338
                            await WcfClient.GET_SELECT_CONVERT_DELETEAsync(SelectRealConvert.ConvertID);
1339
                        }
1340
                        if (SelectFilterConvertList != null)
1341
                        {
1342
                            await WcfClient.GET_SELECT_CONVERT_DELETEAsync(SelectFilterConvertList[0].ConvertID);
1343
                        }
1344
                    }
1345
                }
1346
            }
1347
        }
1348
        #endregion
1349

    
1350
        #region Data Export
1351

    
1352

    
1353
        /// <summary>
1354
        /// 필터된 상단 그리드 엑셀로 출력
1355
        /// </summary>
1356

    
1357
        public void DataExportData(object obj)
1358
        {
1359
            if(SearchTimerOn == true)
1360
            {
1361
                dispatcherTimer.Tick -= new EventHandler(SearchTimer_Tick);
1362
            }
1363
            else
1364
            {
1365
                dispatcherTimer.Tick -= new EventHandler(Timer_Tick);
1366
            }
1367

    
1368
            Return_FilterConvertSource(FilterConvertSource);
1369

    
1370
            Views.ConvertExcelDialog convertExcelDialog = new Views.ConvertExcelDialog();
1371

    
1372
            convertExcelDialog.Owner = Application.Current.MainWindow;
1373
            convertExcelDialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;
1374

    
1375
            convertExcelDialog.ShowDialog();
1376

    
1377
            if (SearchTimerOn == true)
1378
            {
1379
                dispatcherTimer.Tick += new EventHandler(SearchTimer_Tick);
1380
            }
1381
            else
1382
            {
1383
                dispatcherTimer.Tick += new EventHandler(Timer_Tick);
1384
            }
1385
        }
1386

    
1387
        #endregion
1388

    
1389
        #region Data Search
1390

    
1391
        public void RemoveCreateTimeFilter(object obj)
1392
        {
1393
            DefaultCreateTime = DateTime.Now.AddHours(-1);
1394
            SelectedCreateTimeBegin = DefaultCreateTime;
1395
            SelectedCreateTimeEnd = DefaultCreateTime;
1396
        }
1397

    
1398
        #endregion
1399

    
1400
        #region Reset
1401

    
1402
        /// <summary>
1403
        /// 그리드 상단 원상복귀 버튼
1404
        /// 필터를 끝낸 후 다시 복귀
1405
        /// </summary>
1406

    
1407
        public void Reset(object obj)
1408
        {
1409
            SearchTimerOn = false;
1410
            ExcptionCheck = false;
1411
            SelectedInt = 10;
1412
            ProjectNumberFilter = ProjectNames[0];
1413
            UniqueKeyFilter = null;
1414
            Service_IDFilter = null;
1415
            Document_NameFilter = null;
1416
            Docuemnt_NOFilter = null;
1417
            ReconverterFilter = null;
1418
            RevisionFilter = null;
1419
            GroupNOFilter = null;
1420
            DOCUMENT_URLFilter = null;
1421
            DefaultCreateTime = DateTime.Now.AddHours(-1);
1422
            SelectedCreateTimeBegin = DefaultCreateTime;
1423
            SelectedCreateTimeEnd = DefaultCreateTime;
1424
            dispatcherTimer.Tick -= new EventHandler(SearchTimer_Tick);
1425
            dispatcherTimer.Tick += new EventHandler(Timer_Tick);
1426
        }
1427

    
1428
        #endregion
1429

    
1430
        #region ConvertAddDialog
1431

    
1432
        /// <summary>
1433
        /// 그리드 상단 Conver 추가 버튼
1434
        /// ProjectNo, DocumentURL, DocumentID, 입력해서 저장 프로시저에서 추가 
1435
        /// </summary>
1436

    
1437
        public void ConvertAdd(object obj)
1438
        {
1439
            try
1440
            {
1441
                if (SearchTimerOn == true)
1442
                {
1443
                    dispatcherTimer.Tick -= new EventHandler(SearchTimer_Tick);
1444
                }
1445
                else
1446
                {
1447
                    dispatcherTimer.Tick -= new EventHandler(Timer_Tick);
1448
                }
1449

    
1450
                Views.ConvertAddDialog convertAddDialog = new Views.ConvertAddDialog();
1451

    
1452
                convertAddDialog.Owner = Application.Current.MainWindow;
1453
                convertAddDialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;
1454

    
1455
                convertAddDialog.ShowDialog();
1456

    
1457
                if (SearchTimerOn == true)
1458
                {
1459
                    dispatcherTimer.Tick += new EventHandler(SearchTimer_Tick);
1460
                }
1461
                else
1462
                {
1463
                    dispatcherTimer.Tick += new EventHandler(Timer_Tick);
1464
                }
1465
            }
1466
            catch(Exception ex)
1467
            {
1468
                MessageBox.Show(ex.ToString());
1469
            }
1470
        }
1471

    
1472
        #endregion
1473

    
1474

    
1475
        #region ConvertPathFileSearch
1476

    
1477
        /// <summary>
1478
        ///  ConvertPath 파일 탐색기로 열리는 아이콘
1479
        /// </summary>
1480

    
1481
        public void ConvertPathFileSearch(object obj)
1482
        {
1483
            if (obj is ConvertPDF)
1484
            {
1485
                if (obj != null)
1486
                {
1487
                    var convertitem = obj as ConvertPDF;
1488

    
1489
                    if (!string.IsNullOrEmpty(convertitem.ConvertPath))
1490
                    {
1491
                        System.Diagnostics.Process.Start("explorer.exe", convertitem.ConvertPath);
1492
                    }
1493
                }
1494
            }
1495
        }
1496

    
1497
        #endregion
1498

    
1499
        #endregion
1500
    }
1501
}
클립보드 이미지 추가 (최대 크기: 500 MB)