프로젝트

일반

사용자정보

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

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

이력 | 보기 | 이력해설 | 다운로드 (51.3 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 Markus.Service.Interface;
26
using static Markus.Service.StationController.Data.ConvertPDF;
27
using System.Collections.ObjectModel;
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
            ConverAddCommand = new DelegateCommand(ConverAdd);
50
            ConvertPathFileSearchCommand = new DelegateCommand(ConvertPathFileSearch);
51
        }
52

    
53
        #endregion
54

    
55
        #region Properties
56

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

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

    
76
        private System.Collections.ObjectModel.ObservableCollection<ConvertPDF> _FilterSearch;
77
        public System.Collections.ObjectModel.ObservableCollection<ConvertPDF> FilterSearch
78
        {
79
            get
80
            {
81
                if (_FilterSearch == null)
82
                {
83
                    _FilterSearch = new System.Collections.ObjectModel.ObservableCollection<ConvertPDF>
84
                    {
85
                        new ConvertPDF{ProjectNumber = "Filter Search"}
86
                    };
87
                }
88

    
89
                return _FilterSearch;
90
            }
91
        }
92

    
93
        private System.Collections.ObjectModel.ObservableCollection<ConvertPDF> _AliveItems;
94
        public System.Collections.ObjectModel.ObservableCollection<ConvertPDF> AliveItems
95
        {
96
            get => _AliveItems;
97
            set
98
            {
99
                _AliveItems = value;
100
                OnPropertyChanged(() => AliveItems);
101
            }
102
        }
103

    
104
        public ICollectionView FilterConvertSourceView
105
        {
106
            get
107
            {
108
                var view = CollectionViewSource.GetDefaultView(FilterConvertSource);
109
                return view;
110
            }
111
        }
112

    
113
        private System.Collections.ObjectModel.ObservableCollection<ConvertPDF> _FilterConvertSource;
114
        public System.Collections.ObjectModel.ObservableCollection<ConvertPDF> FilterConvertSource
115
        {
116
            get
117
            {
118
                if (_FilterConvertSource == null)
119
                {
120
                    _FilterConvertSource = new System.Collections.ObjectModel.ObservableCollection<ConvertPDF>();
121
                }
122
                return _FilterConvertSource;
123
            }
124
            set
125
            {
126
                _FilterConvertSource = value;
127
                OnPropertyChanged(() => FilterConvertSource);
128
            }
129
        }
130

    
131

    
132
        private System.Collections.ObjectModel.ObservableCollection<ConvertPDF> _RealConvertSource;
133
        public System.Collections.ObjectModel.ObservableCollection<ConvertPDF> RealConvertSource
134
        {
135
            get => _RealConvertSource;
136
            set
137
            {
138
                _RealConvertSource = value;
139
                OnPropertyChanged(() => RealConvertSource);
140
            }
141
        }
142

    
143

    
144
        private System.Windows.Documents.FlowDocument connectionLog;
145
        public System.Windows.Documents.FlowDocument ConnectionLog
146
        {
147
            get => connectionLog;
148
            set
149
            {
150
                if (connectionLog != value)
151
                {
152
                    connectionLog = value;
153
                    OnPropertyChanged(() => ConnectionLog);
154
                }
155
            }
156
        }
157

    
158

    
159
        private Telerik.Windows.Data.EnumMemberViewModel _SelectedStatus;
160
        public Telerik.Windows.Data.EnumMemberViewModel SelectedStatus
161
        {
162
            get => _SelectedStatus;
163
            set
164
            {
165
                _SelectedStatus = value;
166
                OnPropertyChanged(() => SelectedStatus);
167
            }
168
        }
169

    
170

    
171
        private SelectedCountItem _SelectedCount;
172
        public SelectedCountItem SelectedCount
173
        {
174
            get => _SelectedCount;
175
            set
176
            {
177
                _SelectedCount = value;
178
                OnPropertyChanged(() => SelectedCount);
179
            }
180
        }
181

    
182
        List<SelectedCountItem> _SelectedCountList;
183
        public List<SelectedCountItem> SelectedCountList
184
        {
185
            get
186
            {
187
                if (_SelectedCountList == null)
188
                {
189
                    _SelectedCountList = new List<SelectedCountItem>
190
                    {
191
                        new SelectedCountItem{DisplayMember = "50",ValueMember = 50},
192
                        new SelectedCountItem{DisplayMember = "100",ValueMember = 100},
193
                        new SelectedCountItem{DisplayMember = "150",ValueMember = 150},
194
                        new SelectedCountItem{DisplayMember = "200",ValueMember = 200}
195
                    };
196
                }
197

    
198
                return _SelectedCountList;
199
            }
200
        }
201

    
202
        private ConvertPDF _SelectFilterConvert;
203
        public ConvertPDF SelectFilterConvert
204
        {
205
            get
206
            {
207
                return _SelectFilterConvert;
208
            }
209
            set
210
            {
211
                _SelectFilterConvert = value;
212
                OnPropertyChanged(() => SelectFilterConvert);
213
            }
214
        }
215

    
216

    
217
        private ObservableCollection<ConvertPDF> _SelectFilterConvertList;
218
        public ObservableCollection<ConvertPDF> SelectFilterConvertList
219
        {
220
            get
221
            {
222
                if (_SelectFilterConvertList == null)
223
                {
224
                    _SelectFilterConvertList = new ObservableCollection<ConvertPDF>();
225
                }
226
                return _SelectFilterConvertList;
227
            }
228
            set
229
            {
230
                _SelectFilterConvertList = value;
231
                OnPropertyChanged(() => SelectFilterConvertList);
232
            }
233
        }
234

    
235

    
236

    
237
        private ConvertPDF _SelectRealConvert;
238
        public ConvertPDF SelectRealConvert
239
        {
240
            get => _SelectRealConvert;
241
            set
242
            {
243
                _SelectRealConvert = value;
244
                OnPropertyChanged(() => SelectRealConvert);
245
            }
246
        }
247

    
248

    
249
        private ConvertPDF _SelectAliveConvert;
250
        public ConvertPDF SelectAliveConvert
251
        {
252
            get => _SelectAliveConvert;
253
            set
254
            {
255
                _SelectAliveConvert = value;
256
                OnPropertyChanged(() => SelectAliveConvert);
257
            }
258
        }
259

    
260

    
261
        private StatusTypeList _StatusType;
262
        public StatusTypeList StatusType
263
        {
264
            get => _StatusType;
265
            set
266
            {
267
                _StatusType = value;
268
                OnPropertyChanged(() => StatusType);
269
            }
270
        }
271

    
272
        private bool _IsLoading;
273
        public bool IsLoading
274
        {
275
            get => _IsLoading;
276
            set
277
            {
278
                if (_IsLoading != value)
279
                {
280
                    _IsLoading = value;
281
                    OnPropertyChanged(() => IsLoading);
282
                }
283
            }
284
        }
285

    
286
        IEnumerable<Telerik.Windows.Data.EnumMemberViewModel> _StatusCodeList;
287
        public IEnumerable<Telerik.Windows.Data.EnumMemberViewModel> StatusCodeList
288
        {
289
            get
290
            {
291
                if (_StatusCodeList == null)
292
                {
293
                    _StatusCodeList = Telerik.Windows.Data.EnumDataSource.FromType<StatusCodeType>();
294
                }
295

    
296
                return _StatusCodeList;
297
            }
298
        }
299

    
300
        public ProjectName _ProjectNumberFilter;
301
        public ProjectName ProjectNumberFilter
302
        {
303
            get
304
            {
305
                if (_ProjectNumberFilter == null)
306
                {
307
                    _ProjectNumberFilter = new ProjectName();
308
                }
309
                return _ProjectNumberFilter;
310
            }
311
            set
312
            {
313
                _ProjectNumberFilter = value;
314
                OnPropertyChanged(() => ProjectNumberFilter);
315
            }
316
        }
317

    
318
        public string _UniqueKeyFilter;
319
        public string UniqueKeyFilter
320
        {
321
            get
322
            {
323
                return _UniqueKeyFilter;
324
            }
325
            set
326
            {
327
                if (_UniqueKeyFilter == "")
328
                {
329
                    _UniqueKeyFilter = null;
330
                }
331
                else if (_UniqueKeyFilter != value)
332
                {
333
                    _UniqueKeyFilter = value;
334
                    OnPropertyChanged(() => UniqueKeyFilter);
335
                }
336
            }
337
        }
338

    
339
        public StatusCodeType _ConvertStateFilter;
340
        public StatusCodeType ConvertStateFilter
341
        {
342
            get { return _ConvertStateFilter; }
343
            set
344
            {
345
                if (_ConvertStateFilter != value)
346
                {
347
                    _ConvertStateFilter = value;
348
                    OnPropertyChanged(() => ConvertStateFilter);
349
                }
350
            }
351
        }
352

    
353
        public string _Docuemnt_NOFilter;
354
        public string Docuemnt_NOFilter
355
        {
356
            get { return _Docuemnt_NOFilter; }
357
            set
358
            {
359
                if (_Docuemnt_NOFilter == "")
360
                {
361
                    _Docuemnt_NOFilter = null;
362
                }
363
                else if (_Docuemnt_NOFilter != value)
364
                {
365
                    _Docuemnt_NOFilter = value;
366
                    OnPropertyChanged(() => Docuemnt_NOFilter);
367
                }
368
            }
369
        }
370

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

    
389
        public int? _ReconverterFilter = 0;
390
        public int? ReconverterFilter
391
        {
392
            get { return _ReconverterFilter; }
393
            set
394
            {
395
                if (_ReconverterFilter == null)
396
                {
397
                    _ReconverterFilter = 0;
398
                }
399
                else if (_ReconverterFilter != value)
400
                {
401
                    _ReconverterFilter = value;
402
                    OnPropertyChanged(() => ReconverterFilter);
403

    
404
                }
405
            }
406
        }
407

    
408
        public string _Service_IDFilter;
409
        public string Service_IDFilter
410
        {
411
            get { return _Service_IDFilter; }
412
            set
413
            {
414
                if (_Service_IDFilter == "")
415
                {
416
                    _Service_IDFilter = null;
417
                }
418
                else if (_Service_IDFilter != value)
419
                {
420
                    _Service_IDFilter = value;
421
                    OnPropertyChanged(() => Service_IDFilter);
422
                }
423
            }
424
        }
425

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

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

    
462
        public string _DOCUMENT_URLFilter;
463
        public string DOCUMENT_URLFilter
464
        {
465
            get { return _DOCUMENT_URLFilter; }
466
            set
467
            {
468
                if (_DOCUMENT_URLFilter == "")
469
                {
470
                    _DOCUMENT_URLFilter = null;
471
                }
472
                else if (_DOCUMENT_URLFilter != value)
473
                {
474
                    _DOCUMENT_URLFilter = value;
475
                    OnPropertyChanged(() => DOCUMENT_URLFilter);
476
                }
477
            }
478
        }
479

    
480
        static DateTime DefaultCreateTime = DateTime.Now;
481
        private DateTime _SelectedCreateTimeBegin = DefaultCreateTime;
482
        public DateTime SelectedCreateTimeBegin
483
        {
484

    
485
            get { return _SelectedCreateTimeBegin; }
486
            set
487
            {
488
                if (_SelectedCreateTimeBegin == value)
489
                    return;
490
                _SelectedCreateTimeBegin = value;
491
                OnPropertyChanged(() => SelectedCreateTimeBegin);
492

    
493
            }
494
        }
495

    
496
        private DateTime _SelectedCreateTimeEnd = DefaultCreateTime;
497
        public DateTime SelectedCreateTimeEnd
498
        {
499

    
500
            get { return _SelectedCreateTimeEnd; }
501
            set
502
            {
503
                if (_SelectedCreateTimeEnd == value)
504
                    return;
505
                _SelectedCreateTimeEnd = value;
506
                OnPropertyChanged(() => SelectedCreateTimeEnd);
507
            }
508
        }
509

    
510
        public bool _ConvertShow;
511
        public bool ConvertShow
512
        {
513
            get => _ConvertShow;
514
            set
515
            {
516
                if (_ConvertShow = !value)
517
                {
518
                    _ConvertShow = false;
519
                }
520
                _ConvertShow = value;
521
                OnPropertyChanged(() => ConvertShow);
522
            }
523
        }
524

    
525
        #endregion
526

    
527
        #region Command
528

    
529
        public DelegateCommand ConvertCommand { get; private set; }
530
        public DelegateCommand DeleteCommand { get; private set; }
531
        public DelegateCommand ValidateCommand { get; private set; }
532
        public DelegateCommand DataSaveFileGemBoxCommand { get; private set; }
533
        public DelegateCommand MarkusLinkCommand { get; private set; }
534
        public DelegateCommand RemoveCreateTimeFilterCommand { get; private set; }
535

    
536
        public DelegateCommand DataFilterCommand { get; private set; }
537
        public DelegateCommand ResetCommand { get; private set; }
538
        public DelegateCommand ConverAddCommand { get; private set; }
539
        public DelegateCommand ConvertPathFileSearchCommand { get; private set; }
540

    
541
        #endregion
542

    
543
        #region Main Logic
544

    
545
        /// <summary>
546
        /// 각각의 Grid row 객체들 업데이트
547
        /// </summary>
548

    
549
        private DispatcherTimer dispatcherTimer;
550
        public override void Loaded()
551
        {
552
            base.Loaded();
553

    
554
            if (!App.IsDesignMode)
555
            {
556
                dispatcherTimer = new DispatcherTimer();
557
                dispatcherTimer.Tick += new EventHandler(Timer_Tick);
558
                dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
559
                dispatcherTimer.Start();
560
            }
561
        }
562

    
563
        private async void Timer_Tick(object sender, EventArgs e)
564
        {
565
            dispatcherTimer.Stop();
566

    
567
            if (IsAcitve)
568
            {
569
                await App.Current.Dispatcher.InvokeAsync(() =>
570
                {
571
                    DataSelect();
572

    
573
                    AliveDataSelect();
574
                });
575
            }
576

    
577
            await Task.Delay(5000);
578
            //await Task.Delay(10000);
579

    
580
            //System.Threading.Thread.Sleep(new TimeSpan(0,0,0,0,100));
581

    
582
            dispatcherTimer.Start();
583
        }
584

    
585
        private async void SearchTimer_Tick(object sender, EventArgs e)
586
        {
587
            dispatcherTimer.Stop();
588

    
589
            if (IsAcitve)
590
            {
591
                await App.Current.Dispatcher.InvokeAsync(() =>
592
                {
593
                    DataSearch(new[] { (StatusCodeType)(SelectedStatus.Value) }, FilterConvertSource);
594

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

    
597
                    AliveDataSelect();
598
                });
599
            }
600

    
601
            await Task.Delay(5000);
602
            //await Task.Delay(10000);
603

    
604
            //System.Threading.Thread.Sleep(new TimeSpan(0,0,0,0,100));
605

    
606
            dispatcherTimer.Start();
607
        }
608

    
609
        public override void Closed()
610
        {
611
            if (dispatcherTimer != null)
612
            {
613
                dispatcherTimer.Stop();
614
            }
615

    
616
            base.Closed();
617
        }
618

    
619

    
620
        #endregion
621

    
622
        #region Function
623

    
624
        #region Data Select
625

    
626
        /// <summary>
627
        /// 상단 그리드 중앙 그리드 출력 데이터
628
        /// </summary>
629
        private void DataSelect()
630
        {
631

    
632
            if (FilterConvertSource == null)
633
            {
634
                FilterConvertSource = new System.Collections.ObjectModel.ObservableCollection<ConvertPDF>();
635
            }
636

    
637
            if (RealConvertSource == null)
638
            {
639
                RealConvertSource = new System.Collections.ObjectModel.ObservableCollection<ConvertPDF>();
640
            }
641

    
642
            /// combobox 에서 선택된 items
643
            if (SelectedStatus != null)
644
            {
645
                DataSelect(new[] { (StatusCodeType)(SelectedStatus.Value) }, FilterConvertSource);
646
            }
647

    
648

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

    
652
        }
653

    
654
        private void RealDataSelect(IEnumerable<StatusCodeType> statusCodeTypeList, System.Collections.ObjectModel.ObservableCollection<ConvertPDF> collection)
655
        {
656
            try
657
            {
658
                using (markusEntities entities = new markusEntities(App.MarkusDataBaseConnecitonString))
659
                {
660
                    List<ConvertPDF> Listitems = new List<ConvertPDF>();
661

    
662
                    foreach (var coll in collection)
663
                    {
664
                        var items = entities.SELECT_CONVERT_ITEM(coll.ConvertID, coll.ProjectNumber, null, null, 1, null, null, null, null, null, null, null, null, null, null, null, null, null).ToList();
665

    
666
                        foreach (var x in items)
667
                        {
668
                            var MarkusLink = "kcom://" + CreateMarkusParam(x.PROJECT_NO, x.DOCUMENT_ID, "doftech");
669

    
670
                            ConvertPDF AddItem = 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,
671
                                x.TOTAL_PAGE, x.EXCEPTION, x.GROUP_NO, x.CREATE_DATETIME, x.START_DATETIME, x.END_DATETIME, x.DOCUMENT_URL, x.CONVERT_PATH, MarkusLink, x.RECONVERTER);
672
                            Listitems.Add(AddItem);
673

    
674
                        }
675
                    }
676

    
677
                    Listitems.ForEach(newitem =>
678
                    {
679
                        collection.UpdateWhere(changeitem =>
680
                        ConvertItemEx.ChangeValues(changeitem, newitem), x => x.ConvertID == newitem.ConvertID && x.ProjectNumber == newitem.ProjectNumber);
681
                    });
682

    
683
                }
684
            }
685
            catch (Exception ex)
686
            {
687
                MessageBox.Show(ex.ToString());
688
            }
689
        }
690

    
691
        private void DataSelect(IEnumerable<StatusCodeType> statusCodeTypeList, System.Collections.ObjectModel.ObservableCollection<ConvertPDF> collection)
692
        {
693
            try
694
            {
695
                using (markusEntities entities = new markusEntities(App.MarkusDataBaseConnecitonString))
696
                {
697

    
698
                    int _status = 0;
699
                    if (SelectedStatus != null)
700
                    {
701
                        _status = (int)SelectedStatus.Value;
702
                    }
703

    
704
                    if (ProjectNames.Count() == 0)
705
                    {
706
                        foreach (var x in entities.SELECT_RUN_PROJECTS(0))
707
                        {
708
                            ProjectName projectName = new ProjectName(x.PROJECT_NO, x.PROJECT_NAME);
709
                            ProjectNames.Add(projectName);
710
                        }
711
                    }
712

    
713
                    var Listitems = from num in entities.SELECT_CONVERT_ITEM(null, null, null, _status, SelectedCount.ValueMember, null, null, null, null, null, null, null, null, null, null, null, null, null).ToList()
714
                                                 let MarkusLink = "kcom://" + CreateMarkusParam(num.PROJECT_NO, num.DOCUMENT_ID, "doftech")
715
                                                 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,
716
                            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);
717

    
718
                    if (collection.Count() == 0)
719
                    {
720
                        if (statusCodeTypeList.Count() == 1)
721
                        {
722
                            //Listitems.ForEach(x => collection.Add(x));
723
                            foreach(var Listitem in Listitems.ToList())
724
                            {
725
                                collection.Add(Listitem);
726
                            }
727
                        }
728
                    }
729
                    else
730
                    {
731

    
732
                        ////세미 업데이트
733
                        //Listitems.ForEach(newitem =>
734
                        //{
735
                        //    collection.UpdateWhere(changeitem =>
736
                        //    ConvertItemEx.ChangeValues(changeitem, newitem), x => x.ProjectNumber == newitem.ProjectNumber && x.ConvertID == newitem.ConvertID);
737
                        //});
738
                        foreach (var Listitem in Listitems)
739
                        {
740
                            collection.UpdateWhere(changeitem =>
741
                            ConvertItemEx.ChangeValues(changeitem, Listitem), x => x.ProjectNumber == Listitem.ProjectNumber && x.ConvertID == Listitem.ConvertID);
742
                        }
743
                        if (statusCodeTypeList.Count() == 1)
744
                        {
745
                            //삭제
746
                            for (int i = collection.Count() - 1; i >= 0; --i)
747
                            {
748
                                var item = collection[i];
749

    
750
                                if (Listitems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)//디비에서 가져온 값과 마지막값부터 차례대로 비교
751
                                {//참=> 0제외한 모든 수
752
                                    collection.RemoveAt(i);
753
                                }
754
                            }
755
                        }
756

    
757
                        if (statusCodeTypeList.Count() == 1)
758
                        {
759
                            //추가 convert 후 추가됨
760
                            foreach (var item in Listitems)
761
                            {
762
                                if (collection.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)//그리드와 디비 변동 없으면 안들어감
763
                                {
764
                                    /*for (int i = 0; i < collection.Count()+1; i++)//위 그리드에서 카운드 개수 변함 없고 컨버터 끝난 후 추가할때 createtime 비교 하며 order by 순으로 추가*/
765
                                    for (int i = 0; i < 200; i++)
766
                                    {
767
                                        if (i < collection.Count() - 1)
768
                                        {
769
                                            if (DateTime.Compare(collection[i].CreateTime, item.CreateTime) < 0)
770
                                            {
771
                                                collection.Insert(i, item);
772
                                                break;
773
                                            }
774
                                        }
775
                                        else
776
                                        {
777
                                            collection.Add(item);
778
                                            break;
779
                                        }
780
                                    }
781

    
782
                                }
783

    
784
                            }
785
                        }
786

    
787
                    }
788
                }
789

    
790
            }
791
            catch (Exception ex)
792
            {
793
                MessageBox.Show(ex.ToString());
794
                //System.Diagnostics.Debug.WriteLine(ex.ToString());
795
            }
796
        }
797

    
798
        private void DataSearch(IEnumerable<StatusCodeType> statusCodeTypeList, System.Collections.ObjectModel.ObservableCollection<ConvertPDF> collection)
799
        {
800
            try
801
            {
802
                using (markusEntities entities = new markusEntities(App.MarkusDataBaseConnecitonString))
803
                {
804
                    int _status = 0;
805
                    if (SelectedStatus != null)
806
                    {
807
                        _status = (int)SelectedStatus.Value;
808
                    }
809

    
810
                    //DocumentID = unikey
811
                    DateTime? Start_CreateTime = null;
812
                    DateTime? Finish_CreateTime = null;
813
                    if (SelectedCreateTimeBegin != DefaultCreateTime)
814
                    {
815
                        Start_CreateTime = SelectedCreateTimeBegin;
816
                    }
817
                    if (SelectedCreateTimeEnd != DefaultCreateTime)
818
                    {
819
                        Finish_CreateTime = SelectedCreateTimeEnd;
820
                    }
821

    
822
                    if (ProjectNames.Count() == 0)
823
                    {
824
                        foreach (var x in entities.SELECT_RUN_PROJECTS(0))
825
                        {
826
                            ProjectName projectName = new ProjectName(x.PROJECT_NO, x.PROJECT_NAME);
827
                            ProjectNames.Add(projectName);
828
                        }
829
                    }
830

    
831
                    var Listitems = from num in entities.SELECT_CONVERT_ITEM(null, ProjectNumberFilter.Project_NO, UniqueKeyFilter, _status, SelectedCount.ValueMember, Start_CreateTime, Finish_CreateTime, null,
832
                null, null, null, GroupNOFilter, Document_NameFilter, Docuemnt_NOFilter, RevisionFilter, Service_IDFilter, ReconverterFilter, DOCUMENT_URLFilter).ToList()
833
                                    let MarkusLink = "kcom://" + CreateMarkusParam(num.PROJECT_NO, num.DOCUMENT_ID, "doftech")
834
                                    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,
835
               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);
836

    
837
                    if (collection.Count() == 0)
838
                    {
839
                        if (statusCodeTypeList.Count() == 1)
840
                        {
841
                            foreach (var x in Listitems)
842
                            {
843
                                collection.Add(x);
844
                            }
845
                        }
846
                    }
847
                    else
848
                    {
849

    
850
                        ////세미 업데이트
851
                        foreach (var newitem in Listitems)
852
                        {
853
                            collection.UpdateWhere(changeitem =>
854
                            ConvertItemEx.ChangeValues(changeitem, newitem), x => x.ProjectNumber == newitem.ProjectNumber && x.ConvertID == newitem.ConvertID);
855
                        }
856

    
857

    
858
                        if (statusCodeTypeList.Count() == 1)
859
                        {
860

    
861
                            //삭제
862
                            for (int i = collection.Count() - 1; i >= 0; --i)
863
                            {
864
                                var item = collection[i];
865

    
866
                                if (Listitems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
867
                                {
868
                                    collection.RemoveAt(i);
869
                                }
870
                            }
871
                        }
872

    
873
                        if (statusCodeTypeList.Count() == 1)
874
                        {
875
                            //추가 convert 후 추가됨
876
                            foreach (var item in Listitems)
877
                            {
878
                                if (collection.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
879
                                {
880
                                    for (int i = 0; i < 200; i++)
881
                                    {
882
                                        if (i < collection.Count() - 1)
883
                                        {
884
                                            if (DateTime.Compare(collection[i].CreateTime, item.CreateTime) < 0)
885
                                            {
886
                                                collection.Insert(i, item);
887
                                                break;
888
                                            }
889
                                        }
890
                                        else
891
                                        {
892
                                            collection.Add(item);
893
                                            break;
894
                                        }
895
                                    }
896

    
897
                                }
898

    
899
                            }
900
                        }
901

    
902
                    }
903

    
904
                }
905

    
906
            }
907
            catch (Exception ex)
908
            {
909
                MessageBox.Show(ex.ToString());
910
                //System.Diagnostics.Debug.WriteLine(ex.ToString());
911
            }
912
        }
913
        /// <summary>
914
        /// 서비스의 실시간 컨버터 Item
915
        /// </summary>
916
        private async void AliveDataSelect()
917
        {
918
            try
919
            {
920
                List<ConvertPDF> newitems = new List<ConvertPDF>();
921
                foreach (var client in App.StationClientList)
922
                {
923
                    if (await SimplePingAsync(client.Endpoint.Address.ToString()))
924
                    {
925
                        try
926
                        {
927
                            List<ConvertPDF> itemsToList = new List<ConvertPDF>();
928
                            var items = await client.AliveConvertListAsync();
929
                            string result = "";
930

    
931
                            foreach (var item in items)
932
                            {
933
                                ConvertPDF itemsToEach = new ConvertPDF();
934
                                itemsToEach.ServiceID = item.ServiceID;
935
                                itemsToEach.ConvertID = item.ConvertID;
936
                                itemsToEach.ProjectNumber = item.ProjectNumber;
937

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

    
940
                                if (item.ConvertState != null)
941
                                {
942
                                    itemsToEach.ConvertState = (StatusCodeType)Enum.Parse(typeof(StatusCodeType), item.ConvertState);
943
                                }
944

    
945
                                if (item.OriginfilePath.Contains("/"))
946
                                {
947
                                    result = item.OriginfilePath.Substring(item.OriginfilePath.LastIndexOf("/") + 1);
948
                                }
949
                                else
950
                                {
951
                                    result = item.OriginfilePath.Substring(item.OriginfilePath.LastIndexOf("%") + 1);
952
                                }
953
                                itemsToEach.FileName = result;
954

    
955
                                itemsToEach.CurrentPageNo = item.CurrentPageNo;
956
                                itemsToEach.TotalPage = item.TotalPage;
957
                                itemsToEach.OriginfilePath = item.OriginfilePath;
958
                                itemsToEach.ConvertPath = item.ConvertPath;
959
                                itemsToEach.MarkusLink = MarkusLink;
960
                                itemsToEach.UniqueKey = item.UniqueKey;//DocumentNO 없음
961
                                itemsToEach.GroupNo = item.GroupNo;//없음 
962
                                //itemsToEach.ProcessorAffinity = item.ProcessorAffinity;
963
                                itemsToEach.DocumentName = item.DocumnetName;
964
                                itemsToEach.Revision = item.Revision; //없음 
965
                                itemsToEach.Exception = item.Exception;//없음
966
                                itemsToEach.ConvertPath = item.ConvertPath;
967
                                itemsToEach.CreateTime = item.CreateTime;
968
                                itemsToEach.ReConverter = item.ReConverter;
969
                                itemsToEach.DocumentID = item.DocumentID;
970
                                itemsToEach.StartTime = item.StartTime;
971
                                itemsToEach.EndTime = item.EndTime;
972

    
973
                                itemsToList.Add(itemsToEach);
974
                            }
975
                            newitems.AddRange(itemsToList);
976
                            System.Diagnostics.Trace.WriteLine($"{client.Endpoint.Address} ping");
977

    
978
                            if (items.Count() == 0)
979
                            {
980
                                System.Diagnostics.Trace.WriteLine($"{client.Endpoint.Address} Alive Items is zero.");
981
                            }
982
                        }
983
                        catch (Exception ex)
984
                        {
985
                            System.Diagnostics.Trace.Fail($"{client.Endpoint.Address} {ex.Message}");
986
                        }
987
                    }
988
                    else
989
                    {
990
                        System.Diagnostics.Trace.Fail($"{client.Endpoint.Address} ping Error");
991
                    }
992

    
993
                }
994
                ItemsUpdate(newitems);
995
                await System.Windows.Application.Current.Dispatcher.InvokeAsync(() => ItemsUpdate(newitems));
996
            }
997
            catch (Exception ex)
998
            {
999
                System.Diagnostics.Debug.WriteLine(ex.ToString());
1000
            }
1001
        }
1002

    
1003
        /// <summary>
1004
        /// AliveDataSelect의 Data Update
1005
        /// </summary>
1006
        /// <param name="newitems"></param>
1007
        private void ItemsUpdate(List<ConvertPDF> newitems)
1008
        {
1009

    
1010
            foreach (var item in newitems)
1011
            {
1012
                item.OriginfilePath = HttpUtility.UrlDecode(item.OriginfilePath);
1013
            }
1014

    
1015
            if (AliveItems == null)
1016
            {
1017
                AliveItems = new System.Collections.ObjectModel.ObservableCollection<ConvertPDF>();
1018

    
1019
                foreach (var item in newitems)
1020
                {
1021
                    AliveItems.Add(item);
1022
                }
1023
            }
1024
            else
1025
            {
1026
                /// 데이터 업데이트
1027
                newitems.ForEach(newitem =>
1028
                {
1029
                    AliveItems.UpdateWhere(changeitem => ConvertItemEx.ChangeValues(changeitem, newitem), x => x.ProjectNumber == newitem.ProjectNumber && x.ConvertID == newitem.ConvertID);
1030
                });
1031

    
1032
                // 추가
1033
                foreach (var item in newitems)
1034
                {
1035
                    if (AliveItems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
1036
                    {
1037
                        AliveItems.Add(item);
1038
                    }
1039
                }
1040

    
1041
                /// 삭제
1042

    
1043
                for (int i = AliveItems.Count() - 1; i > -1; --i)
1044
                {
1045
                    var item = AliveItems[i];
1046

    
1047
                    if (newitems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
1048
                    {
1049
                        try
1050
                        {
1051
                            AliveItems.RemoveAt(i);
1052
                        }
1053
                        catch (Exception ex)
1054
                        {
1055
                            System.Diagnostics.Debug.WriteLine(ex.ToString());
1056
                        }
1057
                    }
1058
                }
1059
            }
1060
        }
1061

    
1062

    
1063
        public static async Task<bool> SimplePingAsync(string uri)
1064
        {
1065
            bool result = false;
1066

    
1067
            try
1068
            {
1069
                using (System.Net.Http.HttpClient Client = new System.Net.Http.HttpClient())
1070
                {
1071
                    Client.Timeout = new TimeSpan(0, 0, 60);
1072

    
1073
                    var message = await Client.GetAsync(uri);
1074

    
1075
                    System.Net.HttpStatusCode StatusCode = message.StatusCode;
1076

    
1077
                    switch (StatusCode)
1078
                    {
1079

    
1080
                        case System.Net.HttpStatusCode.Accepted:
1081
                        case System.Net.HttpStatusCode.OK:
1082
                            result = true;
1083
                            break;
1084
                    }
1085
                }
1086
            }
1087
            catch (Exception ex)
1088
            {
1089
                result = false;
1090
                System.Diagnostics.Debug.WriteLine(ex.ToString());
1091
            }
1092

    
1093
            return result;
1094
        }
1095

    
1096
        #endregion
1097

    
1098
        #region Data Convert
1099

    
1100
        private void DataConvert(object obj)
1101
        {
1102
            if (SelectFilterConvertList == null)
1103
            {
1104
                MessageBox.Show("왼쪽 버튼 클릭 후 Converter 해주세요!");
1105
            }
1106
            else
1107
            {
1108
                var resultRealConvert = 0;
1109
                var resultFiltertConvert = 0;
1110
                if (SelectRealConvert != null)
1111
                {
1112
                    resultRealConvert = SetCleanUpItem(SelectRealConvert);//ConvertDataBase
1113
                }
1114
                if (SelectFilterConvertList != null)
1115
                {
1116
                    foreach (var SelectFilterConvert in SelectFilterConvertList)
1117
                    {
1118
                        resultFiltertConvert = SetCleanUpItem(SelectFilterConvert);
1119
                    }
1120
                }
1121
                System.Diagnostics.Debug.WriteLine(resultRealConvert + "  " + resultFiltertConvert);
1122

    
1123
                using (markusEntities entities = new markusEntities(App.MarkusDataBaseConnecitonString))
1124
                {
1125
                    foreach (var SelectFilterConvert in SelectFilterConvertList)
1126
                    {
1127
                        var items = entities.SELECT_CONVERT_ITEM(SelectFilterConvert.ConvertID, null, null, null, 1, null, null, null, null, null, null, null, null, null, null, null, null, null); //프로시저 이용
1128

    
1129

    
1130
                        foreach (var x in items)
1131
                        {
1132
                            var MarkusLink = "kcom://" + CreateMarkusParam(x.PROJECT_NO, x.DOCUMENT_ID, "doftech");
1133

    
1134
                            ConvertPDF AddItem = 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
1135
                                 , x.DOCUMENT_URL, x.CONVERT_PATH, MarkusLink, x.RECONVERTER);
1136

    
1137
                            RealConvertSource.Add(AddItem);
1138

    
1139
                            if (RealConvertSource.Count() == 1)
1140
                            {
1141
                                ConvertShow = true;
1142
                            }
1143
                        }
1144
                    }
1145

    
1146
                }
1147

    
1148
            }
1149
        }
1150

    
1151

    
1152
        public int SetCleanUpItem(ConvertPDF _ConvertItem)
1153
        {
1154
            using (markusEntities entities = new markusEntities(App.MarkusDataBaseConnecitonString))
1155
            {
1156
                int result = 0;
1157

    
1158
                var items = entities.SELECT_CONVERT_ITEM(_ConvertItem.ConvertID, null, null, null, 1, null, null, null, null, null, null, null, null, null, null, null, null, null).ToList();
1159

    
1160
                if (items.Count() > 0)
1161
                {
1162
                    var item = items.First();
1163

    
1164
                    var _RECONVERTER = item.RECONVERTER - _ConvertItem.ReConverter;
1165
                    var _CREATE_DATETIME = DateTime.Now;
1166
                    var _STATUS = (int)StatusCodeType.None;
1167

    
1168
                    entities.SELECT_RERECONVERT_ITEM(_ConvertItem.ConvertID, _RECONVERTER, _CREATE_DATETIME, _STATUS, null);//_END_DATETIME = null 에러
1169

    
1170
                }
1171

    
1172
                return result;
1173
            }
1174
        }
1175

    
1176

    
1177
        public static string CreateMarkusParam(string projectNo, string documentID, string userID)
1178
        {
1179
            ViewInfo viewInfo = new ViewInfo();
1180

    
1181
            viewInfo.DocumentItemID = documentID;
1182
            viewInfo.ProjectNO = projectNo;
1183
            viewInfo.UserID = userID;
1184

    
1185
            return ParamEncoding(JsonConvert.SerializeObject(viewInfo));
1186

    
1187
        }
1188

    
1189
        public static string ParamEncoding(string EncodingText, System.Text.Encoding oEncoding = null)
1190
        {
1191

    
1192
            if (oEncoding == null)
1193
                oEncoding = System.Text.Encoding.UTF8;
1194

    
1195
            return Convert.ToBase64String(oEncoding.GetBytes(EncodingText));
1196

    
1197
        }
1198

    
1199

    
1200
        #endregion
1201

    
1202
        #region Validation
1203

    
1204
        private void DataValidate(object obj)
1205
        {
1206
            if (SelectFilterConvertList.Count() > 1)
1207
            {
1208
                MessageBox.Show("하나만 클릭해 주세요");
1209
            }
1210
            else
1211
            {
1212
                bool result = false;
1213
                WebRequest webRequest = WebRequest.Create(SelectFilterConvertList[0].OriginfilePath);
1214
                webRequest.Timeout = 1200; // miliseconds
1215
                webRequest.Method = "HEAD";
1216

    
1217
                HttpWebResponse response = null;
1218

    
1219
                try
1220
                {
1221
                    response = (HttpWebResponse)webRequest.GetResponse();
1222
                    result = true;
1223
                }
1224
                catch (WebException webException)
1225
                {
1226
                    MessageBox.Show(SelectFilterConvert.FileName + " doesn't exist: " + webException.Message);
1227
                    result = true;
1228
                }
1229
                finally
1230
                {
1231
                    if (response != null)
1232
                    {
1233
                        response.Close();
1234
                    }
1235
                }
1236
                if (result == true)
1237
                {
1238
                    MessageBox.Show("File exists");
1239
                }
1240
            }
1241

    
1242
        }
1243

    
1244
        #endregion
1245

    
1246
        #region DataFilter
1247

    
1248
        public void DataFilter(object obj)
1249
        {
1250
            dispatcherTimer.Tick -= new EventHandler(Timer_Tick);
1251
            dispatcherTimer.Tick += new EventHandler(SearchTimer_Tick);
1252
        }
1253

    
1254
        #endregion
1255

    
1256
        #region MarkusLink
1257

    
1258
        private void MarkusLink(object obj)
1259
        {
1260
            if (obj is ConvertPDF)
1261
            {
1262

    
1263
                if (obj != null)
1264
                {
1265
                    var convertitem = obj as ConvertPDF;
1266

    
1267
                    SelectFilterConvertList[0] = convertitem;
1268

    
1269
                    SelectRealConvert = convertitem;
1270

    
1271
                    ProcessStartInfo startInfo = null;
1272

    
1273
                    startInfo = new ProcessStartInfo("iexplore.exe", convertitem.MarkusLink);
1274

    
1275
                    Process.Start(startInfo);
1276
                }
1277

    
1278
            }
1279
        }
1280

    
1281
        #endregion
1282

    
1283
        #region Data Delete
1284

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

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

    
1316

    
1317
        #endregion
1318

    
1319
        #region Data Export
1320

    
1321

    
1322
        /// <summary>
1323
        /// 필터된 상단 그리드 엑셀로 출력
1324
        /// </summary>
1325

    
1326
        public void DataExportData(object obj)
1327
        {
1328
            SaveFileDialog saveFileDialog = new SaveFileDialog();
1329

    
1330
            saveFileDialog.FileName = "Document"; // Default file name
1331
            saveFileDialog.DefaultExt = ".txt"; // Default file extension
1332
            saveFileDialog.Filter = "Csv documents (.Csv)|*.csv|Excel(2017~2019)Worksheets|*.xlsx"; // Filter files by extension
1333

    
1334

    
1335
            if (saveFileDialog.ShowDialog() == true)
1336
            {
1337

    
1338

    
1339
                if (!string.IsNullOrWhiteSpace(saveFileDialog.FileName))
1340
                {
1341

    
1342
                    var extension = new System.IO.FileInfo(saveFileDialog.FileName).Extension;
1343

    
1344
                    if (extension == ".xlsx" || extension == ".csv")
1345
                    {
1346

    
1347
                        var headers = new List<HeaderMember>
1348
                        {
1349
                            new HeaderMember{HeaderName = "ServiceID", Property = "ServiceID" },
1350
                            new HeaderMember{HeaderName = "ConvertID", Property = "ConvertID" },
1351
                            new HeaderMember{HeaderName = "ProjectNumber", Property = "ProjectNumber" },
1352
                            new HeaderMember{HeaderName = "ConvertState", Property = "ConvertState" },
1353
                            new HeaderMember{HeaderName = "CurrentPageNo", Property = "CurrentPageNo" },
1354
                            new HeaderMember{HeaderName = "TotalPage", Property = "TotalPage" },
1355
                            new HeaderMember{HeaderName = "OriginfilePath", Property = "OriginfilePath" },
1356
                            new HeaderMember{HeaderName = "ConvertPath", Property = "ConvertPath" },
1357
                            new HeaderMember{HeaderName = "CreateTime", Property = "CreateTime" },
1358
                            new HeaderMember{HeaderName = "Exception", Property = "Exception" },
1359
                            new HeaderMember{HeaderName = "ProcessorAffinity", Property = "ProcessorAffinity" },
1360
                            new HeaderMember{HeaderName = "ReConverter", Property = "ReConverter" },
1361
                            new HeaderMember{HeaderName = "UniqueKey", Property = "UniqueKey" }
1362
                        };
1363

    
1364

    
1365
                        DataExport dataExport = new DataExport();
1366
                        dataExport.DataExportExcel(saveFileDialog.FileName, "Hello world", FilterConvertSource, headers);
1367
                    }
1368
                }
1369
            }
1370
        }
1371

    
1372
        #endregion
1373

    
1374
        #region Data Search
1375

    
1376
        public void RemoveCreateTimeFilter(object obj)
1377
        {
1378
            DefaultCreateTime = DateTime.Now;
1379
            SelectedCreateTimeBegin = DefaultCreateTime;
1380
            SelectedCreateTimeEnd = DefaultCreateTime;
1381
        }
1382

    
1383
        #endregion
1384

    
1385
        #region Reset
1386

    
1387
        /// <summary>
1388
        /// 그리드 상단 원상복귀 버튼
1389
        /// 필터를 끝낸 후 다시 복귀
1390
        /// </summary>
1391

    
1392
        public void Reset(object obj)
1393
        {
1394
            ProjectNumberFilter= null;
1395
            UniqueKeyFilter = null;
1396
            Service_IDFilter = null;
1397
            Document_NameFilter = null;
1398
            Docuemnt_NOFilter = null;
1399
            ReconverterFilter = null;
1400
            RevisionFilter = null;
1401
            GroupNOFilter = null;
1402
            DOCUMENT_URLFilter = null;
1403
            DefaultCreateTime = DateTime.Now;
1404
            SelectedCreateTimeBegin = DefaultCreateTime;
1405
            SelectedCreateTimeEnd = DefaultCreateTime;
1406
            dispatcherTimer.Tick -= new EventHandler(SearchTimer_Tick);
1407
            dispatcherTimer.Tick += new EventHandler(Timer_Tick);
1408
            ProjectNames.Clear();
1409
            using (markusEntities entities = new markusEntities(App.MarkusDataBaseConnecitonString))
1410
            {
1411
                foreach (var x in entities.SELECT_RUN_PROJECTS(0))
1412
                {
1413
                    ProjectName projectName = new ProjectName(x.PROJECT_NO, x.PROJECT_NAME);
1414
                    ProjectNames.Add(projectName);
1415
                }
1416
            }
1417
        }
1418

    
1419
        #endregion
1420

    
1421
        #region ConvertAddDialog
1422

    
1423
        /// <summary>
1424
        /// 그리드 상단 Conver 추가 버튼
1425
        /// ProjectNo, DocumentURL, DocumentID, 입력해서 저장 프로시저에서 추가 
1426
        /// </summary>
1427

    
1428
        public void ConverAdd(object obj)
1429
        {
1430
            dispatcherTimer.Tick -= new EventHandler(Timer_Tick);
1431

    
1432
            Views.ConvertAddDialog convertAddDialog = new Views.ConvertAddDialog();
1433

    
1434
            convertAddDialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;
1435

    
1436
            convertAddDialog.ShowDialog();
1437

    
1438
            dispatcherTimer.Tick += new EventHandler(Timer_Tick);
1439
        }
1440

    
1441
        #endregion
1442

    
1443

    
1444
        #region ConvertPathFileSearch
1445

    
1446
        /// <summary>
1447
        ///  ConvertPath 파일 탐색기로 열리는 아이콘
1448
        /// </summary>
1449

    
1450
        public void ConvertPathFileSearch(object obj)
1451
        {
1452
            if (obj is ConvertPDF)
1453
            {
1454
                if (obj != null)
1455
                {
1456
                    var convertitem = obj as ConvertPDF;
1457

    
1458
                    if (!string.IsNullOrEmpty(convertitem.ConvertPath))
1459
                    {
1460
                        System.Diagnostics.Process.Start("explorer.exe", convertitem.ConvertPath);
1461
                    }
1462
                }
1463
            }
1464
        }
1465

    
1466
        #endregion
1467

    
1468
        #endregion
1469
    }
1470
}
1471

    
클립보드 이미지 추가 (최대 크기: 500 MB)