프로젝트

일반

사용자정보

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

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

이력 | 보기 | 이력해설 | 다운로드 (49.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
        private System.Collections.ObjectModel.ObservableCollection<ConvertPDF> _FilterSearch;
58
        public System.Collections.ObjectModel.ObservableCollection<ConvertPDF> FilterSearch
59
        {
60
            get
61
            {
62
                if (_FilterSearch == null)
63
                {
64
                    _FilterSearch = new System.Collections.ObjectModel.ObservableCollection<ConvertPDF>
65
                    {
66
                        new ConvertPDF{ProjectNumber = "Filter Search"}
67
                    };
68
                }
69

    
70
                return _FilterSearch;
71
            }
72
        }
73

    
74
        private System.Collections.ObjectModel.ObservableCollection<ConvertPDF> _AliveItems;
75
        public System.Collections.ObjectModel.ObservableCollection<ConvertPDF> AliveItems
76
        {
77
            get => _AliveItems;
78
            set
79
            {
80
                _AliveItems = value;
81
                OnPropertyChanged(() => AliveItems);
82
            }
83
        }
84

    
85
        public ICollectionView FilterConvertSourceView
86
        {
87
            get
88
            {
89
                var view = CollectionViewSource.GetDefaultView(FilterConvertSource);
90
                return view;
91
            }
92
        }
93

    
94
        private System.Collections.ObjectModel.ObservableCollection<ConvertPDF> _FilterConvertSource;
95
        public System.Collections.ObjectModel.ObservableCollection<ConvertPDF> FilterConvertSource
96
        {
97
            get
98
            {
99
                if (_FilterConvertSource == null)
100
                {
101
                    _FilterConvertSource = new System.Collections.ObjectModel.ObservableCollection<ConvertPDF>();
102
                }
103
                return _FilterConvertSource;
104
            }
105
            set
106
            {
107
                _FilterConvertSource = value;
108
                OnPropertyChanged(() => FilterConvertSource);
109
            }
110
        }
111

    
112

    
113
        private System.Collections.ObjectModel.ObservableCollection<ConvertPDF> _RealConvertSource;
114
        public System.Collections.ObjectModel.ObservableCollection<ConvertPDF> RealConvertSource
115
        {
116
            get => _RealConvertSource;
117
            set
118
            {
119
                _RealConvertSource = value;
120
                OnPropertyChanged(() => RealConvertSource);
121
            }
122
        }
123

    
124

    
125
        private System.Windows.Documents.FlowDocument connectionLog;
126
        public System.Windows.Documents.FlowDocument ConnectionLog
127
        {
128
            get => connectionLog;
129
            set
130
            {
131
                if (connectionLog != value)
132
                {
133
                    connectionLog = value;
134
                    OnPropertyChanged(() => ConnectionLog);
135
                }
136
            }
137
        }
138

    
139

    
140
        private Telerik.Windows.Data.EnumMemberViewModel _SelectedStatus;
141
        public Telerik.Windows.Data.EnumMemberViewModel SelectedStatus
142
        {
143
            get => _SelectedStatus;
144
            set
145
            {
146
                _SelectedStatus = value;
147
                OnPropertyChanged(() => SelectedStatus);
148
            }
149
        }
150

    
151

    
152
        private SelectedCountItem _SelectedCount;
153
        public SelectedCountItem SelectedCount
154
        {
155
            get => _SelectedCount;
156
            set
157
            {
158
                _SelectedCount = value;
159
                OnPropertyChanged(() => SelectedCount);
160
            }
161
        }
162

    
163
        List<SelectedCountItem> _SelectedCountList;
164
        public List<SelectedCountItem> SelectedCountList
165
        {
166
            get
167
            {
168
                if (_SelectedCountList == null)
169
                {
170
                    _SelectedCountList = new List<SelectedCountItem>
171
                    {
172
                        new SelectedCountItem{DisplayMember = "50",ValueMember = 50},
173
                        new SelectedCountItem{DisplayMember = "100",ValueMember = 100},
174
                        new SelectedCountItem{DisplayMember = "150",ValueMember = 150},
175
                        new SelectedCountItem{DisplayMember = "200",ValueMember = 200}
176
                    };
177
                }
178

    
179
                return _SelectedCountList;
180
            }
181
        }
182

    
183
        private ConvertPDF _SelectFilterConvert;
184
        public ConvertPDF SelectFilterConvert
185
        {
186
            get
187
            {
188
                return _SelectFilterConvert;
189
            }
190
            set
191
            {
192
                _SelectFilterConvert = value;
193
                OnPropertyChanged(() => SelectFilterConvert);
194
            }
195
        }
196

    
197

    
198
        private ObservableCollection<ConvertPDF> _SelectFilterConvertList;
199
        public ObservableCollection<ConvertPDF> SelectFilterConvertList
200
        {
201
            get
202
            {
203
                if (_SelectFilterConvertList == null)
204
                {
205
                    _SelectFilterConvertList = new ObservableCollection<ConvertPDF>();
206
                }
207
                return _SelectFilterConvertList;
208
            }
209
            set
210
            {
211
                _SelectFilterConvertList = value;
212
                OnPropertyChanged(() => SelectFilterConvertList);
213
            }
214
        }
215

    
216

    
217

    
218
        private ConvertPDF _SelectRealConvert;
219
        public ConvertPDF SelectRealConvert
220
        {
221
            get => _SelectRealConvert;
222
            set
223
            {
224
                _SelectRealConvert = value;
225
                OnPropertyChanged(() => SelectRealConvert);
226
            }
227
        }
228

    
229

    
230
        private ConvertPDF _SelectAliveConvert;
231
        public ConvertPDF SelectAliveConvert
232
        {
233
            get => _SelectAliveConvert;
234
            set
235
            {
236
                _SelectAliveConvert = value;
237
                OnPropertyChanged(() => SelectAliveConvert);
238
            }
239
        }
240

    
241

    
242
        private StatusTypeList _StatusType;
243
        public StatusTypeList StatusType
244
        {
245
            get => _StatusType;
246
            set
247
            {
248
                _StatusType = value;
249
                OnPropertyChanged(() => StatusType);
250
            }
251
        }
252

    
253
        private bool _IsLoading;
254
        public bool IsLoading
255
        {
256
            get => _IsLoading;
257
            set
258
            {
259
                if (_IsLoading != value)
260
                {
261
                    _IsLoading = value;
262
                    OnPropertyChanged(() => IsLoading);
263
                }
264
            }
265
        }
266

    
267
        IEnumerable<Telerik.Windows.Data.EnumMemberViewModel> _StatusCodeList;
268
        public IEnumerable<Telerik.Windows.Data.EnumMemberViewModel> StatusCodeList
269
        {
270
            get
271
            {
272
                if (_StatusCodeList == null)
273
                {
274
                    _StatusCodeList = Telerik.Windows.Data.EnumDataSource.FromType<StatusCodeType>();
275
                }
276

    
277
                return _StatusCodeList;
278
            }
279
        }
280

    
281
        public string _ProjectNumberFilter;
282
        public string ProjectNumberFilter
283
        {
284
            get { return _ProjectNumberFilter; }
285
            set
286
            {
287
                if (_ProjectNumberFilter == "")
288
                {
289
                    _ProjectNumberFilter = null;
290
                }
291
                else if (_ProjectNumberFilter != value)
292
                {
293
                    _ProjectNumberFilter = value;
294
                    OnPropertyChanged(() => ProjectNumberFilter);
295
                }
296
            }
297
        }
298

    
299
        public string _UniqueKeyFilter;
300
        public string UniqueKeyFilter
301
        {
302
            get
303
            {
304
                return _UniqueKeyFilter;
305
            }
306
            set
307
            {
308
                if (_UniqueKeyFilter == "")
309
                {
310
                    _UniqueKeyFilter = null;
311
                }
312
                else if (_UniqueKeyFilter != value)
313
                {
314
                    _UniqueKeyFilter = value;
315
                    OnPropertyChanged(() => UniqueKeyFilter);
316
                }
317
            }
318
        }
319

    
320
        public StatusCodeType _ConvertStateFilter;
321
        public StatusCodeType ConvertStateFilter
322
        {
323
            get { return _ConvertStateFilter; }
324
            set
325
            {
326
                if (_ConvertStateFilter != value)
327
                {
328
                    _ConvertStateFilter = value;
329
                    OnPropertyChanged(() => ConvertStateFilter);
330
                }
331
            }
332
        }
333

    
334
        public string _Docuemnt_NOFilter;
335
        public string Docuemnt_NOFilter
336
        {
337
            get { return _Docuemnt_NOFilter; }
338
            set
339
            {
340
                if (_Docuemnt_NOFilter == "")
341
                {
342
                    _Docuemnt_NOFilter = null;
343
                }
344
                else if (_Docuemnt_NOFilter != value)
345
                {
346
                    _Docuemnt_NOFilter = value;
347
                    OnPropertyChanged(() => Docuemnt_NOFilter);
348
                }
349
            }
350
        }
351

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

    
370
        public int? _ReconverterFilter = 0;
371
        public int? ReconverterFilter
372
        {
373
            get { return _ReconverterFilter; }
374
            set
375
            {
376
                if (_ReconverterFilter == null)
377
                {
378
                    _ReconverterFilter = 0;
379
                }
380
                else if (_ReconverterFilter != value)
381
                {
382
                    _ReconverterFilter = value;
383
                    OnPropertyChanged(() => ReconverterFilter);
384

    
385
                }
386
            }
387
        }
388

    
389
        public string _Service_IDFilter;
390
        public string Service_IDFilter
391
        {
392
            get { return _Service_IDFilter; }
393
            set
394
            {
395
                if (_Service_IDFilter == "")
396
                {
397
                    _Service_IDFilter = null;
398
                }
399
                else if (_Service_IDFilter != value)
400
                {
401
                    _Service_IDFilter = value;
402
                    OnPropertyChanged(() => Service_IDFilter);
403
                }
404
            }
405
        }
406

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

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

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

    
461
        static DateTime DefaultCreateTime = DateTime.Now;
462
        private DateTime _SelectedCreateTimeBegin = DefaultCreateTime;
463
        public DateTime SelectedCreateTimeBegin
464
        {
465

    
466
            get { return _SelectedCreateTimeBegin; }
467
            set
468
            {
469
                if (_SelectedCreateTimeBegin == value)
470
                    return;
471
                _SelectedCreateTimeBegin = value;
472
                OnPropertyChanged(() => SelectedCreateTimeBegin);
473

    
474
            }
475
        }
476

    
477
        private DateTime _SelectedCreateTimeEnd = DefaultCreateTime;
478
        public DateTime SelectedCreateTimeEnd
479
        {
480

    
481
            get { return _SelectedCreateTimeEnd; }
482
            set
483
            {
484
                if (_SelectedCreateTimeEnd == value)
485
                    return;
486
                _SelectedCreateTimeEnd = value;
487
                OnPropertyChanged(() => SelectedCreateTimeEnd);
488
            }
489
        }
490

    
491
        public bool _ConvertShow;
492
        public bool ConvertShow
493
        {
494
            get => _ConvertShow;
495
            set
496
            {
497
                if (_ConvertShow = !value)
498
                {
499
                    _ConvertShow = false;
500
                }
501
                _ConvertShow = value;
502
                OnPropertyChanged(() => ConvertShow);
503
            }
504
        }
505

    
506
        #endregion
507

    
508
        #region Command
509

    
510
        public DelegateCommand ConvertCommand { get; private set; }
511
        public DelegateCommand DeleteCommand { get; private set; }
512
        public DelegateCommand ValidateCommand { get; private set; }
513
        public DelegateCommand DataSaveFileGemBoxCommand { get; private set; }
514
        public DelegateCommand MarkusLinkCommand { get; private set; }
515
        public DelegateCommand RemoveCreateTimeFilterCommand { get; private set; }
516

    
517
        public DelegateCommand DataFilterCommand { get; private set; }
518
        public DelegateCommand ResetCommand { get; private set; }
519
        public DelegateCommand ConverAddCommand { get; private set; }
520
        public DelegateCommand ConvertPathFileSearchCommand { get; private set; }
521

    
522
        #endregion
523

    
524
        #region Main Logic
525

    
526
        /// <summary>
527
        /// 각각의 Grid row 객체들 업데이트
528
        /// </summary>
529

    
530
        private DispatcherTimer dispatcherTimer;
531
        public override void Loaded()
532
        {
533
            base.Loaded();
534

    
535
            if (!App.IsDesignMode)
536
            {
537
                dispatcherTimer = new DispatcherTimer();
538
                dispatcherTimer.Tick += new EventHandler(Timer_Tick);
539
                dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
540
                dispatcherTimer.Start();
541
            }
542
        }
543

    
544
        private async void Timer_Tick(object sender, EventArgs e)
545
        {
546
            dispatcherTimer.Stop();
547

    
548
            if (IsAcitve)
549
            {
550
                await App.Current.Dispatcher.InvokeAsync(() =>
551
                {
552
                    DataSelect();
553

    
554
                    AliveDataSelect();
555
                });
556
            }
557

    
558
            //await Task.Delay(5000);
559
            await Task.Delay(10000);
560

    
561
            //System.Threading.Thread.Sleep(new TimeSpan(0,0,0,0,100));
562

    
563
            dispatcherTimer.Start();
564
        }
565

    
566
        private async void SearchTimer_Tick(object sender, EventArgs e)
567
        {
568
            dispatcherTimer.Stop();
569

    
570
            if (IsAcitve)
571
            {
572
                await App.Current.Dispatcher.InvokeAsync(() =>
573
                {
574
                    DataSearch(new[] { (StatusCodeType)(SelectedStatus.Value) }, FilterConvertSource);
575

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

    
578
                    AliveDataSelect();
579
                });
580
            }
581

    
582
            //await Task.Delay(5000);
583
            await Task.Delay(10000);
584

    
585
            //System.Threading.Thread.Sleep(new TimeSpan(0,0,0,0,100));
586

    
587
            dispatcherTimer.Start();
588
        }
589

    
590
        public override void Closed()
591
        {
592
            if (dispatcherTimer != null)
593
            {
594
                dispatcherTimer.Stop();
595
            }
596

    
597
            base.Closed();
598
        }
599

    
600

    
601
        #endregion
602

    
603
        #region Function
604

    
605
        #region Data Select
606

    
607
        /// <summary>
608
        /// 상단 그리드 중앙 그리드 출력 데이터
609
        /// </summary>
610
        private void DataSelect()
611
        {
612

    
613
            if (FilterConvertSource == null)
614
            {
615
                FilterConvertSource = new System.Collections.ObjectModel.ObservableCollection<ConvertPDF>();
616
            }
617

    
618
            if (RealConvertSource == null)
619
            {
620
                RealConvertSource = new System.Collections.ObjectModel.ObservableCollection<ConvertPDF>();
621
            }
622

    
623
            /// combobox 에서 선택된 items
624
            if (SelectedStatus != null)
625
            {
626
                DataSelect(new[] { (StatusCodeType)(SelectedStatus.Value) }, FilterConvertSource);
627
            }
628

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

    
632
        }
633

    
634
        private void RealDataSelect(IEnumerable<StatusCodeType> statusCodeTypeList, System.Collections.ObjectModel.ObservableCollection<ConvertPDF> collection)
635
        {
636
            try
637
            {
638
                using (markusEntities entities = new markusEntities(App.MarkusDataBaseConnecitonString))
639
                {
640
                    List<ConvertPDF> Listitems = new List<ConvertPDF>();
641

    
642
                    foreach (var coll in collection)
643
                    {
644
                        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();
645

    
646
                        foreach (var x in items)
647
                        {
648
                            var MarkusLink = "kcom://" + CreateMarkusParam(x.PROJECT_NO, x.DOCUMENT_ID, "doftech");
649

    
650
                            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,
651
                                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);
652
                            Listitems.Add(AddItem);
653
 
654
                        }
655
                    }
656

    
657
                    Listitems.ForEach(newitem =>
658
                    {
659
                        collection.UpdateWhere(changeitem =>
660
                        ConvertItemEx.ChangeValues(changeitem, newitem), x => x.ConvertID == newitem.ConvertID && x.ProjectNumber == newitem.ProjectNumber);
661
                    });
662

    
663
                }
664
            }
665
            catch (Exception ex)
666
            {
667
                MessageBox.Show(ex.ToString());
668
            }
669
        }
670

    
671
        private void DataSelect(IEnumerable<StatusCodeType> statusCodeTypeList, System.Collections.ObjectModel.ObservableCollection<ConvertPDF> collection)
672
        {
673
            try
674
            {
675
                using (markusEntities entities = new markusEntities(App.MarkusDataBaseConnecitonString))
676
                {
677

    
678
                    int _status = 0;
679
                    if (SelectedStatus != null)
680
                    {
681
                        _status = (int)SelectedStatus.Value;
682
                    }
683

    
684
                    var items = entities.SELECT_CONVERT_ITEM(null, null, null, _status, SelectedCount.ValueMember, null, null, null,
685
                        null, null, null, null, null, null, null, null, null, null).ToList();
686

    
687
                    List<ConvertPDF> Listitems = new List<ConvertPDF>();
688

    
689
                    foreach (var x in items)
690
                    {
691
                        var MarkusLink = "kcom://" + CreateMarkusParam(x.PROJECT_NO, x.DOCUMENT_ID, "doftech");
692

    
693
                        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,
694
                            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);
695
                        Listitems.Add(AddItem);
696

    
697
                    }
698

    
699
                    if (collection.Count() == 0)
700
                    {
701
                        if (statusCodeTypeList.Count() == 1)
702
                        {
703
                            Listitems.ForEach(x => collection.Add(x));
704
                        }
705
                    }
706
                    else
707
                    {
708

    
709
                        ////세미 업데이트
710
                        Listitems.ForEach(newitem =>
711
                        {
712
                            collection.UpdateWhere(changeitem =>
713
                            ConvertItemEx.ChangeValues(changeitem, newitem), x => x.ProjectNumber == newitem.ProjectNumber && x.ConvertID == newitem.ConvertID);
714
                        });
715

    
716
                        if (statusCodeTypeList.Count() == 1)
717
                        {
718
                            //삭제
719
                            for (int i = collection.Count() - 1; i >= 0; --i)
720
                            {
721
                                var item = collection[i];
722

    
723
                                if (Listitems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)//디비에서 가져온 값과 마지막값부터 차례대로 비교
724
                                {//참=> 0제외한 모든 수
725
                                    collection.RemoveAt(i);
726
                                }
727
                            }
728
                        }
729

    
730
                        if (statusCodeTypeList.Count() == 1)
731
                        {
732
                            //추가 convert 후 추가됨
733
                            foreach (var item in Listitems)
734
                            {
735
                                if (collection.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)//그리드와 디비 변동 없으면 안들어감
736
                                {
737
                                    /*for (int i = 0; i < collection.Count()+1; i++)//위 그리드에서 카운드 개수 변함 없고 컨버터 끝난 후 추가할때 createtime 비교 하며 order by 순으로 추가*/
738
                                    for (int i = 0; i < 200; i++)
739
                                    {
740
                                        if (i < collection.Count() - 1)
741
                                        {
742
                                            if (DateTime.Compare(collection[i].CreateTime, item.CreateTime) < 0)
743
                                            {
744
                                                collection.Insert(i, item);
745
                                                break;
746
                                            }
747
                                        }
748
                                        else
749
                                        {
750
                                            collection.Add(item);
751
                                            break;
752
                                        }
753
                                    }
754

    
755
                                }
756

    
757
                            }
758
                        }
759

    
760
                    }
761
                }
762

    
763
            }
764
            catch (Exception ex)
765
            {
766
                MessageBox.Show(ex.ToString());
767
                //System.Diagnostics.Debug.WriteLine(ex.ToString());
768
            }
769
        }
770

    
771
        private void DataSearch(IEnumerable<StatusCodeType> statusCodeTypeList, System.Collections.ObjectModel.ObservableCollection<ConvertPDF> collection)
772
        {
773
            try
774
            {
775
                using (markusEntities entities = new markusEntities(App.MarkusDataBaseConnecitonString))
776
                {
777
                    int _status = 0;
778
                    if (SelectedStatus != null)
779
                    {
780
                        _status = (int)SelectedStatus.Value;
781
                    }
782

    
783
                    //DocumentID = unikey
784
                    DateTime? Start_CreateTime = null;
785
                    DateTime? Finish_CreateTime = null;
786
                    if(SelectedCreateTimeBegin != DefaultCreateTime)
787
                    {
788
                        Start_CreateTime = SelectedCreateTimeBegin;
789
                    }
790
                    if(SelectedCreateTimeEnd != DefaultCreateTime)
791
                    {
792
                        Finish_CreateTime = SelectedCreateTimeEnd;
793
                    }
794

    
795
                    var items = entities.SELECT_CONVERT_ITEM(null, ProjectNumberFilter, UniqueKeyFilter, _status, SelectedCount.ValueMember, Start_CreateTime, Finish_CreateTime, null,
796
                        null, null, null, GroupNOFilter, Document_NameFilter, Docuemnt_NOFilter, RevisionFilter, Service_IDFilter, ReconverterFilter, DOCUMENT_URLFilter).ToList();
797

    
798
                    List<ConvertPDF> Listitems = new List<ConvertPDF>();
799

    
800
                    foreach (var x in items)
801
                    {
802
                        var MarkusLink = "kcom://" + CreateMarkusParam(x.PROJECT_NO, x.DOCUMENT_ID, "doftech");
803

    
804
                        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,
805
                            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);
806
                        Listitems.Add(AddItem);
807

    
808
                    }
809

    
810
                    if (collection.Count() == 0)
811
                    {
812
                        if (statusCodeTypeList.Count() == 1)
813
                        {
814
                            foreach (var x in Listitems)
815
                            {
816
                                collection.Add(x);
817
                            }
818
                        }
819
                    }
820
                    else
821
                    {
822

    
823
                        ////세미 업데이트
824
                        foreach (var newitem in Listitems)
825
                        {
826
                            collection.UpdateWhere(changeitem =>
827
                            ConvertItemEx.ChangeValues(changeitem, newitem), x => x.ProjectNumber == newitem.ProjectNumber && x.ConvertID == newitem.ConvertID);
828
                        }
829

    
830

    
831
                        if (statusCodeTypeList.Count() == 1)
832
                        {
833

    
834
                            //삭제
835
                            for (int i = collection.Count() - 1; i >= 0; --i)
836
                            {
837
                                var item = collection[i];
838

    
839
                                if (Listitems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
840
                                {
841
                                    collection.RemoveAt(i);
842
                                }
843
                            }
844
                        }
845

    
846
                        if (statusCodeTypeList.Count() == 1)
847
                        {
848
                            //추가 convert 후 추가됨
849
                            foreach (var item in Listitems)
850
                            {
851
                                if (collection.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
852
                                {
853
                                    for (int i = 0; i < 200; i++)
854
                                    {
855
                                        if (i < collection.Count() - 1)
856
                                        {
857
                                            if (DateTime.Compare(collection[i].CreateTime, item.CreateTime) < 0)
858
                                            {
859
                                                collection.Insert(i, item);
860
                                                break;
861
                                            }
862
                                        }
863
                                        else
864
                                        {
865
                                            collection.Add(item);
866
                                            break;
867
                                        }
868
                                    }
869

    
870
                                }
871

    
872
                            }
873
                        }
874

    
875
                    }
876

    
877
                }
878

    
879
            }
880
            catch (Exception ex)
881
            {
882
                MessageBox.Show(ex.ToString());
883
                //System.Diagnostics.Debug.WriteLine(ex.ToString());
884
            }
885
        }
886
        /// <summary>
887
        /// 서비스의 실시간 컨버터 Item
888
        /// </summary>
889
        private async void AliveDataSelect()
890
        {
891
            try
892
            {
893
                List<ConvertPDF> newitems = new List<ConvertPDF>();
894
                foreach (var client in App.StationClientList)
895
                {
896
                    if (await SimplePingAsync(client.Endpoint.Address.ToString()))
897
                    {
898
                        try
899
                        {
900
                            List<ConvertPDF> itemsToList = new List<ConvertPDF>();
901
                            var items = await client.AliveConvertListAsync();
902
                            string result = "";
903

    
904
                            foreach (var item in items)
905
                            {
906
                                ConvertPDF itemsToEach = new ConvertPDF();
907
                                itemsToEach.ServiceID = item.ServiceID;
908
                                itemsToEach.ConvertID = item.ConvertID;
909
                                itemsToEach.ProjectNumber = item.ProjectNumber;
910

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

    
913
                                if (item.ConvertState != null)
914
                                {
915
                                    itemsToEach.ConvertState = (StatusCodeType)Enum.Parse(typeof(StatusCodeType), item.ConvertState);
916
                                }
917

    
918
                                if (item.OriginfilePath.Contains("/"))
919
                                {
920
                                    result = item.OriginfilePath.Substring(item.OriginfilePath.LastIndexOf("/") + 1);
921
                                }
922
                                else
923
                                {
924
                                    result = item.OriginfilePath.Substring(item.OriginfilePath.LastIndexOf("%") + 1);
925
                                }
926
                                itemsToEach.FileName = result;
927

    
928
                                itemsToEach.CurrentPageNo = item.CurrentPageNo;
929
                                itemsToEach.TotalPage = item.TotalPage;
930
                                itemsToEach.OriginfilePath = item.OriginfilePath;
931
                                itemsToEach.ConvertPath = item.ConvertPath;
932
                                itemsToEach.MarkusLink = MarkusLink;
933
                                itemsToEach.UniqueKey = item.UniqueKey;//DocumentNO 없음
934
                                itemsToEach.GroupNo = item.GroupNo;//없음 
935
                                //itemsToEach.ProcessorAffinity = item.ProcessorAffinity;
936
                                itemsToEach.DocumentName = item.DocumnetName;
937
                                itemsToEach.Revision = item.Revision; //없음 
938
                                itemsToEach.Exception = item.Exception;//없음
939
                                itemsToEach.ConvertPath = item.ConvertPath;
940
                                itemsToEach.CreateTime = item.CreateTime;
941
                                itemsToEach.ReConverter = item.ReConverter;
942
                                itemsToEach.DocumentID = item.DocumentID;
943
                                itemsToEach.StartTime = item.StartTime;
944
                                itemsToEach.EndTime = item.EndTime;
945

    
946
                                itemsToList.Add(itemsToEach);
947
                            }
948
                            newitems.AddRange(itemsToList);
949
                            System.Diagnostics.Trace.WriteLine($"{client.Endpoint.Address} ping");
950

    
951
                            if (items.Count() == 0)
952
                            {
953
                                System.Diagnostics.Trace.WriteLine($"{client.Endpoint.Address} Alive Items is zero.");
954
                            }
955
                        }
956
                        catch (Exception ex)
957
                        {
958
                            System.Diagnostics.Trace.Fail($"{client.Endpoint.Address} {ex.Message}");
959
                        }
960
                    }
961
                    else
962
                    {
963
                        System.Diagnostics.Trace.Fail($"{client.Endpoint.Address} ping Error");
964
                    }
965

    
966
                }
967
                ItemsUpdate(newitems);
968
                await System.Windows.Application.Current.Dispatcher.InvokeAsync(() => ItemsUpdate(newitems));
969
            }
970
            catch (Exception ex)
971
            {
972
                System.Diagnostics.Debug.WriteLine(ex.ToString());
973
            }
974
        }
975

    
976
        /// <summary>
977
        /// AliveDataSelect의 Data Update
978
        /// </summary>
979
        /// <param name="newitems"></param>
980
        private void ItemsUpdate(List<ConvertPDF> newitems)
981
        {
982

    
983
            foreach (var item in newitems)
984
            {
985
                item.OriginfilePath = HttpUtility.UrlDecode(item.OriginfilePath);
986
            }
987

    
988
            if (AliveItems == null)
989
            {
990
                AliveItems = new System.Collections.ObjectModel.ObservableCollection<ConvertPDF>();
991

    
992
                foreach (var item in newitems)
993
                {
994
                    AliveItems.Add(item);
995
                }
996
            }
997
            else
998
            {
999
                /// 데이터 업데이트
1000
                newitems.ForEach(newitem =>
1001
                {
1002
                    AliveItems.UpdateWhere(changeitem => ConvertItemEx.ChangeValues(changeitem, newitem), x => x.ProjectNumber == newitem.ProjectNumber && x.ConvertID == newitem.ConvertID);
1003
                });
1004

    
1005
                // 추가
1006
                foreach (var item in newitems)
1007
                {
1008
                    if (AliveItems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
1009
                    {
1010
                        AliveItems.Add(item);
1011
                    }
1012
                }
1013

    
1014
                /// 삭제
1015

    
1016
                for (int i = AliveItems.Count() - 1; i > -1; --i)
1017
                {
1018
                    var item = AliveItems[i];
1019

    
1020
                    if (newitems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
1021
                    {
1022
                        try
1023
                        {
1024
                            AliveItems.RemoveAt(i);
1025
                        }
1026
                        catch (Exception ex)
1027
                        {
1028
                            System.Diagnostics.Debug.WriteLine(ex.ToString());
1029
                        }
1030
                    }
1031
                }
1032
            }
1033
        }
1034

    
1035

    
1036
        public static async Task<bool> SimplePingAsync(string uri)
1037
        {
1038
            bool result = false;
1039

    
1040
            try
1041
            {
1042
                using (System.Net.Http.HttpClient Client = new System.Net.Http.HttpClient())
1043
                {
1044
                    Client.Timeout = new TimeSpan(0, 0, 60);
1045

    
1046
                    var message = await Client.GetAsync(uri);
1047

    
1048
                    System.Net.HttpStatusCode StatusCode = message.StatusCode;
1049

    
1050
                    switch (StatusCode)
1051
                    {
1052

    
1053
                        case System.Net.HttpStatusCode.Accepted:
1054
                        case System.Net.HttpStatusCode.OK:
1055
                            result = true;
1056
                            break;
1057
                    }
1058
                }
1059
            }
1060
            catch (Exception ex)
1061
            {
1062
                result = false;
1063
                System.Diagnostics.Debug.WriteLine(ex.ToString());
1064
            }
1065

    
1066
            return result;
1067
        }
1068

    
1069
        #endregion
1070

    
1071
        #region Data Convert
1072

    
1073
        private void DataConvert(object obj)
1074
        {
1075
            if (SelectFilterConvertList == null)
1076
            {
1077
                MessageBox.Show("왼쪽 버튼 클릭 후 Converter 해주세요!");
1078
            }
1079
            else
1080
            {
1081
                var resultRealConvert = 0;
1082
                var resultFiltertConvert = 0;
1083
                if (SelectRealConvert != null)
1084
                {
1085
                    resultRealConvert = SetCleanUpItem(SelectRealConvert);//ConvertDataBase
1086
                }
1087
                if (SelectFilterConvertList != null)
1088
                {
1089
                    foreach (var SelectFilterConvert in SelectFilterConvertList)
1090
                    {
1091
                        resultFiltertConvert = SetCleanUpItem(SelectFilterConvert);
1092
                    }
1093
                }
1094
                System.Diagnostics.Debug.WriteLine(resultRealConvert + "  " + resultFiltertConvert);
1095

    
1096
                using (markusEntities entities = new markusEntities(App.MarkusDataBaseConnecitonString))
1097
                {
1098
                    foreach (var SelectFilterConvert in SelectFilterConvertList)
1099
                    {
1100
                        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); //프로시저 이용
1101

    
1102

    
1103
                        foreach (var x in items)
1104
                        {
1105
                            var MarkusLink = "kcom://" + CreateMarkusParam(x.PROJECT_NO, x.DOCUMENT_ID, "doftech");
1106

    
1107
                            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
1108
                                 , x.DOCUMENT_URL, x.CONVERT_PATH, MarkusLink, x.RECONVERTER);
1109

    
1110
                            RealConvertSource.Add(AddItem);
1111

    
1112
                            if (RealConvertSource.Count() == 1)
1113
                            {
1114
                                ConvertShow = true;
1115
                            }
1116
                        }
1117
                    }
1118

    
1119
                }
1120

    
1121
            }
1122
        }
1123

    
1124

    
1125
        public int SetCleanUpItem(ConvertPDF _ConvertItem)
1126
        {
1127
            using (markusEntities entities = new markusEntities(App.MarkusDataBaseConnecitonString))
1128
            {
1129
                int result = 0;
1130

    
1131
                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();
1132

    
1133
                if (items.Count() > 0)
1134
                {
1135
                    var item = items.First();
1136

    
1137
                    var _RECONVERTER = item.RECONVERTER - _ConvertItem.ReConverter;
1138
                    var _CREATE_DATETIME = DateTime.Now;
1139
                    var _STATUS = (int)StatusCodeType.None;
1140

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

    
1143
                }
1144

    
1145
                return result;
1146
            }
1147
        }
1148

    
1149

    
1150
        public static string CreateMarkusParam(string projectNo, string documentID, string userID)
1151
        {
1152
            ViewInfo viewInfo = new ViewInfo();
1153

    
1154
            viewInfo.DocumentItemID = documentID;
1155
            viewInfo.ProjectNO = projectNo;
1156
            viewInfo.UserID = userID;
1157

    
1158
            return ParamEncoding(JsonConvert.SerializeObject(viewInfo));
1159

    
1160
        }
1161

    
1162
        public static string ParamEncoding(string EncodingText, System.Text.Encoding oEncoding = null)
1163
        {
1164

    
1165
            if (oEncoding == null)
1166
                oEncoding = System.Text.Encoding.UTF8;
1167

    
1168
            return Convert.ToBase64String(oEncoding.GetBytes(EncodingText));
1169

    
1170
        }
1171

    
1172

    
1173
        #endregion
1174

    
1175
        #region Validation
1176

    
1177
        private void DataValidate(object obj)
1178
        {
1179
            if (SelectFilterConvertList.Count() > 1)
1180
            {
1181
                MessageBox.Show("하나만 클릭해 주세요");
1182
            }
1183
            else
1184
            {
1185
                bool result = false;
1186
                WebRequest webRequest = WebRequest.Create(SelectFilterConvertList[0].OriginfilePath);
1187
                webRequest.Timeout = 1200; // miliseconds
1188
                webRequest.Method = "HEAD";
1189

    
1190
                HttpWebResponse response = null;
1191

    
1192
                try
1193
                {
1194
                    response = (HttpWebResponse)webRequest.GetResponse();
1195
                    result = true;
1196
                }
1197
                catch (WebException webException)
1198
                {
1199
                    MessageBox.Show(SelectFilterConvert.FileName + " doesn't exist: " + webException.Message);
1200
                    result = true;
1201
                }
1202
                finally
1203
                {
1204
                    if (response != null)
1205
                    {
1206
                        response.Close();
1207
                    }
1208
                }
1209
                if (result == true)
1210
                {
1211
                    MessageBox.Show("File exists");
1212
                }
1213
            }
1214

    
1215
        }
1216

    
1217
        #endregion
1218

    
1219
        #region DataFilter
1220

    
1221
        public void DataFilter(object obj)
1222
        {
1223
            dispatcherTimer.Tick -= new EventHandler(Timer_Tick);
1224
            dispatcherTimer.Tick += new EventHandler(SearchTimer_Tick);
1225
        }
1226

    
1227
        #endregion
1228

    
1229
        #region MarkusLink
1230

    
1231
        private void MarkusLink(object obj)
1232
        {
1233
            if (obj is ConvertPDF)
1234
            {
1235

    
1236
                if (obj != null)
1237
                {
1238
                    var convertitem = obj as ConvertPDF;
1239

    
1240
                    SelectFilterConvertList[0] = convertitem;
1241

    
1242
                    SelectRealConvert = convertitem;
1243

    
1244
                    ProcessStartInfo startInfo = null;
1245

    
1246
                    startInfo = new ProcessStartInfo("iexplore.exe", convertitem.MarkusLink);
1247

    
1248
                    Process.Start(startInfo);
1249
                }
1250

    
1251
            }
1252
        }
1253

    
1254
        #endregion
1255

    
1256
        #region Data Delete
1257

    
1258
        private void DataDelete(object obj)
1259
        {
1260
            RadWindow.Alert("Do you want to delete it??", this.OnClosed);
1261
        }
1262

    
1263
        private void OnClosed(object sender, WindowClosedEventArgs e)
1264
        {
1265
            using (markusEntities entities = new markusEntities(App.MarkusDataBaseConnecitonString))
1266
            {
1267
                var result = e.DialogResult;
1268
                if (result == true)
1269
                {
1270
                    if (SelectFilterConvertList.Count() > 1)
1271
                    {
1272
                        MessageBox.Show("하나만 클릭해 주세요!");
1273
                    }
1274
                    else
1275
                    {
1276
                        if (SelectRealConvert != null)
1277
                        {
1278
                            entities.SELECT_CONVERT_DELETE(SelectRealConvert.ConvertID);
1279
                        }
1280
                        if (SelectFilterConvertList != null)
1281
                        {
1282
                            entities.SELECT_CONVERT_DELETE(SelectFilterConvertList[0].ConvertID);
1283
                        }
1284
                    }
1285
                }
1286
            }
1287
        }
1288

    
1289

    
1290
        #endregion
1291

    
1292
        #region Data Export
1293

    
1294

    
1295
        /// <summary>
1296
        /// 필터된 상단 그리드 엑셀로 출력
1297
        /// </summary>
1298

    
1299
        public void DataExportData(object obj)
1300
        {
1301
            SaveFileDialog saveFileDialog = new SaveFileDialog();
1302

    
1303
            saveFileDialog.FileName = "Document"; // Default file name
1304
            saveFileDialog.DefaultExt = ".txt"; // Default file extension
1305
            saveFileDialog.Filter = "Csv documents (.Csv)|*.csv|Excel(2017~2019)Worksheets|*.xlsx"; // Filter files by extension
1306

    
1307

    
1308
            if (saveFileDialog.ShowDialog() == true)
1309
            {
1310

    
1311

    
1312
                if (!string.IsNullOrWhiteSpace(saveFileDialog.FileName))
1313
                {
1314

    
1315
                    var extension = new System.IO.FileInfo(saveFileDialog.FileName).Extension;
1316

    
1317
                    if (extension == ".xlsx" || extension == ".csv")
1318
                    {
1319

    
1320
                        var headers = new List<HeaderMember>
1321
                        {
1322
                            new HeaderMember{HeaderName = "ServiceID", Property = "ServiceID" },
1323
                            new HeaderMember{HeaderName = "ConvertID", Property = "ConvertID" },
1324
                            new HeaderMember{HeaderName = "ProjectNumber", Property = "ProjectNumber" },
1325
                            new HeaderMember{HeaderName = "ConvertState", Property = "ConvertState" },
1326
                            new HeaderMember{HeaderName = "CurrentPageNo", Property = "CurrentPageNo" },
1327
                            new HeaderMember{HeaderName = "TotalPage", Property = "TotalPage" },
1328
                            new HeaderMember{HeaderName = "OriginfilePath", Property = "OriginfilePath" },
1329
                            new HeaderMember{HeaderName = "ConvertPath", Property = "ConvertPath" },
1330
                            new HeaderMember{HeaderName = "CreateTime", Property = "CreateTime" },
1331
                            new HeaderMember{HeaderName = "Exception", Property = "Exception" },
1332
                            new HeaderMember{HeaderName = "ProcessorAffinity", Property = "ProcessorAffinity" },
1333
                            new HeaderMember{HeaderName = "ReConverter", Property = "ReConverter" },
1334
                            new HeaderMember{HeaderName = "UniqueKey", Property = "UniqueKey" }
1335
                        };
1336

    
1337

    
1338
                        DataExport dataExport = new DataExport();
1339
                        dataExport.DataExportExcel(saveFileDialog.FileName, "Hello world", FilterConvertSource, headers);
1340
                    }
1341
                }
1342
            }
1343
        }
1344

    
1345
        #endregion
1346

    
1347
        #region Data Search
1348

    
1349
        public void RemoveCreateTimeFilter(object obj)
1350
        {
1351
            DefaultCreateTime = DateTime.Now;
1352
            SelectedCreateTimeBegin = DefaultCreateTime;
1353
            SelectedCreateTimeEnd = DefaultCreateTime;
1354
        }
1355

    
1356
        #endregion
1357

    
1358
        #region Reset
1359

    
1360
        /// <summary>
1361
        /// 그리드 상단 원상복귀 버튼
1362
        /// 필터를 끝낸 후 다시 복귀
1363
        /// </summary>
1364

    
1365
        public void Reset(object obj)
1366
        {
1367
            ProjectNumberFilter = null;
1368
            UniqueKeyFilter = null;
1369
            Service_IDFilter = null;
1370
            Document_NameFilter = null;
1371
            Docuemnt_NOFilter = null;
1372
            ReconverterFilter = null;
1373
            RevisionFilter = null;
1374
            GroupNOFilter = null;
1375
            DOCUMENT_URLFilter = null;
1376
            DefaultCreateTime = DateTime.Now;
1377
            SelectedCreateTimeBegin = DefaultCreateTime;
1378
            SelectedCreateTimeEnd = DefaultCreateTime;
1379
            dispatcherTimer.Tick -= new EventHandler(SearchTimer_Tick);
1380
            dispatcherTimer.Tick += new EventHandler(Timer_Tick);
1381
        }
1382

    
1383
        #endregion
1384

    
1385
        #region ConvertAddDialog
1386

    
1387
        /// <summary>
1388
        /// 그리드 상단 Conver 추가 버튼
1389
        /// ProjectNo, DocumentURL, DocumentID, 입력해서 저장 프로시저에서 추가 
1390
        /// </summary>
1391

    
1392
        public void ConverAdd(object obj)
1393
        {
1394
            dispatcherTimer.Tick -= new EventHandler(Timer_Tick);
1395

    
1396
            Views.ConvertAddDialog convertAddDialog = new Views.ConvertAddDialog();
1397

    
1398
            convertAddDialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;
1399

    
1400
            convertAddDialog.ShowDialog();
1401

    
1402
            dispatcherTimer.Tick += new EventHandler(Timer_Tick);
1403
        }
1404

    
1405
        #endregion
1406

    
1407

    
1408
        #region ConvertPathFileSearch
1409

    
1410
        /// <summary>
1411
        ///  ConvertPath 파일 탐색기로 열리는 아이콘
1412
        /// </summary>
1413

    
1414
        public void ConvertPathFileSearch(object obj)
1415
        {
1416
            if (obj is ConvertPDF)
1417
            {
1418
                if (obj != null)
1419
                {
1420
                    var convertitem = obj as ConvertPDF;
1421

    
1422
                    string filePath = "@" + convertitem.ConvertPath;
1423

    
1424
                    System.Diagnostics.Process.Start("explorer.exe", filePath);
1425
                }
1426
            }
1427
        }
1428

    
1429
        #endregion
1430

    
1431
        #endregion
1432
    }
1433
}
1434

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