프로젝트

일반

사용자정보

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

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

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

1 e6281033 alzkakdixm
using Markus.Message;
2 a6e5055d alzkakdixm
using Markus.Service.DataBase;
3
using Markus.Service.Extensions;
4 e6281033 alzkakdixm
using Markus.Service.StationController.Data;
5 a6e5055d alzkakdixm
using Markus.Service.StationController.Behaviors;
6
using Markus.Service.StationController.Extensions;
7 b63dcfbb semi
using Markus.Service.StationController.Controls;
8 a6e5055d alzkakdixm
using Microsoft.Win32;
9
using System;
10
using System.Collections.Generic;
11
using System.ComponentModel;
12
using System.Linq;
13 2decfbdf alzkakdixm
using System.Threading.Tasks;
14
using System.Web;
15 a6e5055d alzkakdixm
using System.Windows;
16
using Telerik.Windows.Controls;
17
using Telerik.Windows.Data;
18
using ConvertItem = Markus.Service.Interface.ConvertItem;
19 e6281033 alzkakdixm
using System.Net;
20
using System.Windows.Threading;
21 e78f0871 alzkakdixm
using System.Diagnostics;
22
using System.Windows.Input;
23
using Markus.Mvvm.ToolKit;
24 902f397c semi
using System.Windows.Data;
25 a6e5055d alzkakdixm
26
namespace Markus.Service.StationController.ViewModel
27
{
28
    //세미
29 dfc86b71 taeseongkim
    public class DataBaseItemsModel : Mvvm.ToolKit.ViewModelBase
30 a6e5055d alzkakdixm
    {
31 e6281033 alzkakdixm
        #region Constructor
32
33
        /// <summary>
34
        /// 실행하면 처음 들어가는 부분
35
        /// </summary>
36
        public DataBaseItemsModel()
37
        {
38 b63dcfbb semi
            DataFilterCommand = new DelegateCommand(DataFilter);
39 e6281033 alzkakdixm
            DataSaveFileGemBoxCommand = new DelegateCommand(DataExportData);
40
            ConvertCommand = new DelegateCommand(DataConvert);
41
            DeleteCommand = new DelegateCommand(DataDelete);
42
            ValidateCommand = new DelegateCommand(DataValidate);
43 e78f0871 alzkakdixm
            MarkusLinkCommand = new DelegateCommand(MarkusLink);
44 5a954acc semi
            RemoveCreateTimeFilterCommand = new DelegateCommand(RemoveCreateTimeFilter);
45
            FilterConvertSourceView.Filter = new Predicate<object>(o => DetailFilter(o as ConvertItem));
46 b63dcfbb semi
            ResetCommand = new DelegateCommand(Reset);
47 218e5002 semi
            ConverAddCommand = new DelegateCommand(ConverAdd);
48 e6281033 alzkakdixm
        }
49
50
        #endregion
51
52
        #region Properties
53
54 b63dcfbb semi
        private System.Collections.ObjectModel.ObservableCollection<ConvertItem> _FilterSearch;
55
        public System.Collections.ObjectModel.ObservableCollection<ConvertItem> FilterSearch
56
        {
57
            get
58
            {
59
                if (_FilterSearch == null)
60
                {
61
                    _FilterSearch = new System.Collections.ObjectModel.ObservableCollection<ConvertItem>
62
                    {
63
                        new ConvertItem{ProjectNumber = "Filter Search"}
64
                    };
65
                }
66
67
                return _FilterSearch;
68
            }
69
        }
70
71 2decfbdf alzkakdixm
        private System.Collections.ObjectModel.ObservableCollection<ConvertItem> _AliveItems;
72
        public System.Collections.ObjectModel.ObservableCollection<ConvertItem> AliveItems
73
        {
74 e6281033 alzkakdixm
            get => _AliveItems;
75
            set
76 2decfbdf alzkakdixm
            {
77 0cb12397 alzkakdixm
                _AliveItems = value;
78 2decfbdf alzkakdixm
                OnPropertyChanged(() => AliveItems);
79
            }
80
        }
81
82 5a954acc semi
        public ICollectionView FilterConvertSourceView
83
        {
84 b63dcfbb semi
            get
85
            {
86
                var view = CollectionViewSource.GetDefaultView(FilterConvertSource);
87
                //if (view.CanFilter)
88
                //{
89
                //    view.Filter = DetailFilter;
90
                //    view.Filter = o => String.IsNullOrEmpty(ProjectNumberFilter) ? true : ((string)o).Contains(ProjectNumberFilter);
91
                //    view.Filter = o => String.IsNullOrEmpty(UniqueKeyFilter) ? true : ((string)o).Contains(UniqueKeyFilter);
92
                //}
93
                return view;
94
            }
95 5a954acc semi
        }
96
97 dfc86b71 taeseongkim
        private System.Collections.ObjectModel.ObservableCollection<ConvertItem> _FilterConvertSource;
98
        public System.Collections.ObjectModel.ObservableCollection<ConvertItem> FilterConvertSource
99
        {
100 902f397c semi
            //get => _FilterConvertSource;
101
            get
102
            {
103 5a954acc semi
                if (_FilterConvertSource == null)
104
                {
105
                    _FilterConvertSource = new System.Collections.ObjectModel.ObservableCollection<ConvertItem>();
106
                }
107
                //if (_FilterConvertSource != null)
108 902f397c semi
                //{
109 5a954acc semi
                //    var view = CollectionViewSource.GetDefaultView(FilterConvertSource);
110
                //    if (view.CanFilter)
111
                //    {
112
                //        view.Filter = DetailFilter;
113
                //    }
114 902f397c semi
                //}
115
                return _FilterConvertSource;
116
            }
117 dfc86b71 taeseongkim
            set
118
            {
119
                _FilterConvertSource = value;
120
                OnPropertyChanged(() => FilterConvertSource);
121
            }
122
        }
123
124
125
        private System.Collections.ObjectModel.ObservableCollection<ConvertItem> _RealConvertSource;
126
        public System.Collections.ObjectModel.ObservableCollection<ConvertItem> RealConvertSource
127
        {
128
            get => _RealConvertSource;
129
            set
130
            {
131
                _RealConvertSource = value;
132
                OnPropertyChanged(() => RealConvertSource);
133
            }
134
        }
135
136 2decfbdf alzkakdixm
137 0cb12397 alzkakdixm
        private System.Windows.Documents.FlowDocument connectionLog;
138 2decfbdf alzkakdixm
        public System.Windows.Documents.FlowDocument ConnectionLog
139
        {
140
            get => connectionLog;
141
            set
142
            {
143
                if (connectionLog != value)
144
                {
145
                    connectionLog = value;
146
                    OnPropertyChanged(() => ConnectionLog);
147
                }
148
            }
149
        }
150
151 a6e5055d alzkakdixm
152
        private Telerik.Windows.Data.EnumMemberViewModel _SelectedStatus;
153
        public Telerik.Windows.Data.EnumMemberViewModel SelectedStatus
154
        {
155
            get => _SelectedStatus;
156
            set
157
            {
158
                _SelectedStatus = value;
159 0cb12397 alzkakdixm
                OnPropertyChanged(() => SelectedStatus);
160 a6e5055d alzkakdixm
            }
161
        }
162
163
164
        private SelectedCountItem _SelectedCount;
165
        public SelectedCountItem SelectedCount
166
        {
167
            get => _SelectedCount;
168
            set
169
            {
170
                _SelectedCount = value;
171 dfc86b71 taeseongkim
                OnPropertyChanged(() => SelectedCount);
172 a6e5055d alzkakdixm
            }
173
        }
174
175 e6281033 alzkakdixm
        List<SelectedCountItem> _SelectedCountList;
176
        public List<SelectedCountItem> SelectedCountList
177 a6e5055d alzkakdixm
        {
178 e6281033 alzkakdixm
            get
179 2decfbdf alzkakdixm
            {
180 e6281033 alzkakdixm
                if (_SelectedCountList == null)
181 2decfbdf alzkakdixm
                {
182 e6281033 alzkakdixm
                    _SelectedCountList = new List<SelectedCountItem>
183 2decfbdf alzkakdixm
                    {
184 e6281033 alzkakdixm
                        new SelectedCountItem{DisplayMember = "50",ValueMember = 50},
185
                        new SelectedCountItem{DisplayMember = "100",ValueMember = 100},
186
                        new SelectedCountItem{DisplayMember = "150",ValueMember = 150},
187
                        new SelectedCountItem{DisplayMember = "200",ValueMember = 200}
188
                    };
189 2decfbdf alzkakdixm
                }
190 a6e5055d alzkakdixm
191 e6281033 alzkakdixm
                return _SelectedCountList;
192 2decfbdf alzkakdixm
            }
193
        }
194 a6e5055d alzkakdixm
195 0cb12397 alzkakdixm
        private ConvertItem _SelectFilterConvert;
196 a6e5055d alzkakdixm
        public ConvertItem SelectFilterConvert
197
        {
198
            get => _SelectFilterConvert;
199
            set
200
            {
201
                _SelectFilterConvert = value;
202 dfc86b71 taeseongkim
                OnPropertyChanged(() => SelectFilterConvert);
203 a6e5055d alzkakdixm
            }
204
        }
205 0cb12397 alzkakdixm
206
        private ConvertItem _SelectRealConvert;
207 a6e5055d alzkakdixm
        public ConvertItem SelectRealConvert
208
        {
209
            get => _SelectRealConvert;
210
            set
211
            {
212
                _SelectRealConvert = value;
213 dfc86b71 taeseongkim
                OnPropertyChanged(() => SelectRealConvert);
214 a6e5055d alzkakdixm
            }
215
        }
216
217 0cb12397 alzkakdixm
218
        private StatusTypeList _StatusType;
219 a6e5055d alzkakdixm
        public StatusTypeList StatusType
220
        {
221
            get => _StatusType;
222
            set
223
            {
224
                _StatusType = value;
225 dfc86b71 taeseongkim
                OnPropertyChanged(() => StatusType);
226 a6e5055d alzkakdixm
            }
227
        }
228
229 0cb12397 alzkakdixm
        private bool _IsLoading;
230 a6e5055d alzkakdixm
        public bool IsLoading
231
        {
232
            get => _IsLoading;
233
            set
234
            {
235
                if (_IsLoading != value)
236
                {
237
                    _IsLoading = value;
238 dfc86b71 taeseongkim
                    OnPropertyChanged(() => IsLoading);
239 a6e5055d alzkakdixm
                }
240
            }
241
        }
242
243 e6281033 alzkakdixm
        IEnumerable<Telerik.Windows.Data.EnumMemberViewModel> _StatusCodeList;
244
        public IEnumerable<Telerik.Windows.Data.EnumMemberViewModel> StatusCodeList
245 a6e5055d alzkakdixm
        {
246
            get
247
            {
248 e6281033 alzkakdixm
                if (_StatusCodeList == null)
249 a6e5055d alzkakdixm
                {
250 e6281033 alzkakdixm
                    _StatusCodeList = Telerik.Windows.Data.EnumDataSource.FromType<StatusCodeType>();
251 a6e5055d alzkakdixm
                }
252
253 e6281033 alzkakdixm
                return _StatusCodeList;
254 a6e5055d alzkakdixm
            }
255
        }
256 8c7d1ea1 alzkakdixm
257
        public bool _ConvertShow;
258
        public bool ConvertShow
259
        {
260
            get => _ConvertShow;
261
            set
262
            {
263 b63dcfbb semi
                if (_ConvertShow = !value)
264 8c7d1ea1 alzkakdixm
                {
265
                    _ConvertShow = false;
266
                }
267
                _ConvertShow = value;
268
                OnPropertyChanged(() => ConvertShow);
269
            }
270
        }
271 902f397c semi
272
        public string _ProjectNumberFilter;
273
        public string ProjectNumberFilter
274
        {
275
            get { return _ProjectNumberFilter; }
276
            set
277
            {
278 b63dcfbb semi
                if(_ProjectNumberFilter == "")
279
                {
280
                    _ProjectNumberFilter = null;
281
                }
282
                else if (_ProjectNumberFilter != value)
283 902f397c semi
                {
284
                    _ProjectNumberFilter = value;
285 5a954acc semi
                    OnPropertyChanged(() => ProjectNumberFilter);
286
                    //CollectionViewSource.GetDefaultView(FilterConvertSource).Refresh();
287 218e5002 semi
                    //FilterConvertSourceView.Refresh();
288 902f397c semi
                }
289
            }
290
        }
291
292
        public string _UniqueKeyFilter;
293
        public string UniqueKeyFilter
294
        {
295 b63dcfbb semi
            get
296
            {
297
                return _UniqueKeyFilter;
298
            }
299 902f397c semi
            set
300
            {
301 b63dcfbb semi
                if (_UniqueKeyFilter == "")
302
                {
303
                    _UniqueKeyFilter = null;
304
                }
305
                else if (_UniqueKeyFilter != value)
306 902f397c semi
                {
307
                    _UniqueKeyFilter = value;
308
                    OnPropertyChanged(() => UniqueKeyFilter);
309 5a954acc semi
                    //CollectionViewSource.GetDefaultView(FilterConvertSource).Refresh();
310 218e5002 semi
                    //FilterConvertSourceView.Refresh();
311 902f397c semi
                }
312
            }
313
        }
314
315 5a954acc semi
        public StatusCodeType _ConvertStateFilter;
316
        public StatusCodeType ConvertStateFilter
317 902f397c semi
        {
318
            get { return _ConvertStateFilter; }
319
            set
320
            {
321
                if (_ConvertStateFilter != value)
322
                {
323
                    _ConvertStateFilter = value;
324
                    OnPropertyChanged(() => ConvertStateFilter);
325 5a954acc semi
                    //CollectionViewSource.GetDefaultView(FilterConvertSource).Refresh();
326 218e5002 semi
                    //FilterConvertSourceView.Refresh();
327 902f397c semi
                }
328
            }
329
        }
330
331
        public string _Docuemnt_NOFilter;
332
        public string Docuemnt_NOFilter
333
        {
334
            get { return _Docuemnt_NOFilter; }
335
            set
336
            {
337 b63dcfbb semi
                if (_Docuemnt_NOFilter == "")
338
                {
339
                    _Docuemnt_NOFilter = null;
340
                }
341
                else if (_Docuemnt_NOFilter != value)
342 902f397c semi
                {
343
                    _Docuemnt_NOFilter = value;
344
                    OnPropertyChanged(() => Docuemnt_NOFilter);
345 5a954acc semi
                    //CollectionViewSource.GetDefaultView(FilterConvertSource).Refresh();
346 218e5002 semi
                    //FilterConvertSourceView.Refresh();
347 902f397c semi
                }
348
            }
349
        }
350
351
        public string _Docuemnt_NameFilter;
352
        public string Docuemnt_NameFilter
353
        {
354
            get { return _Docuemnt_NameFilter; }
355
            set
356
            {
357 b63dcfbb semi
                if (_Docuemnt_NameFilter == "")
358
                {
359
                    _Docuemnt_NameFilter = null;
360
                }
361
                else if (_Docuemnt_NameFilter != value)
362 902f397c semi
                {
363
                    _Docuemnt_NameFilter = value;
364
                    OnPropertyChanged(() => Docuemnt_NameFilter);
365 5a954acc semi
                    //CollectionViewSource.GetDefaultView(FilterConvertSource).Refresh();
366 218e5002 semi
                    //FilterConvertSourceView.Refresh();
367 902f397c semi
                }
368
            }
369
        }
370
371 b63dcfbb semi
        public int? _ReconverterFilter = 0;
372 5a954acc semi
        public int? ReconverterFilter
373 902f397c semi
        {
374
            get { return _ReconverterFilter; }
375
            set
376
            {
377 b63dcfbb semi
                if (_ReconverterFilter ==  null)
378
                {
379
                    _ReconverterFilter = 0;
380
                }
381
                else if (_ReconverterFilter != value)
382 902f397c semi
                {
383
                    _ReconverterFilter = value;
384
                    OnPropertyChanged(() => ReconverterFilter);
385 5a954acc semi
                    //CollectionViewSource.GetDefaultView(FilterConvertSource).Refresh();
386 218e5002 semi
                    //FilterConvertSourceView.Refresh();
387 5a954acc semi
388 902f397c semi
                }
389
            }
390
        }
391
392
        public string _Service_IDFilter;
393
        public string Service_IDFilter
394
        {
395
            get { return _Service_IDFilter; }
396
            set
397
            {
398 b63dcfbb semi
                if (_Service_IDFilter == "")
399
                {
400
                    _Service_IDFilter = null;
401
                }
402
                else  if (_Service_IDFilter != value)
403 902f397c semi
                {
404
                    _Service_IDFilter = value;
405
                    OnPropertyChanged(() => Service_IDFilter);
406 5a954acc semi
                    //CollectionViewSource.GetDefaultView(FilterConvertSource).Refresh();
407 218e5002 semi
                    //FilterConvertSourceView.Refresh();
408 902f397c semi
                }
409
            }
410
        }
411
412
        public string _RevisionFilter;
413
        public string RevisionFilter
414
        {
415
            get { return _RevisionFilter; }
416
            set
417
            {
418 b63dcfbb semi
                if (_RevisionFilter == "")
419
                {
420
                    _RevisionFilter = null ;
421
                }
422
                else if (_RevisionFilter != value)
423 902f397c semi
                {
424
                    _RevisionFilter = value;
425
                    OnPropertyChanged(() => RevisionFilter);
426 5a954acc semi
                    //CollectionViewSource.GetDefaultView(FilterConvertSource).Refresh();
427 218e5002 semi
                    //FilterConvertSourceView.Refresh();
428
                }
429
            }
430
        }
431
432
        public string _GroupNOFilter;
433
        public string GroupNOFilter
434
        {
435
            get { return _GroupNOFilter; }
436
            set
437
            {
438
                if (_GroupNOFilter == "")
439
                {
440
                    _GroupNOFilter = null;
441
                }
442
                else if (_GroupNOFilter != value)
443
                {
444
                    _GroupNOFilter = value;
445
                    OnPropertyChanged(() => GroupNOFilter);
446
                    //CollectionViewSource.GetDefaultView(FilterConvertSource).Refresh();
447
                    //FilterConvertSourceView.Refresh();
448 902f397c semi
                }
449
            }
450
        }
451 5a954acc semi
452 b63dcfbb semi
        static DateTime DefaultCreateTime = DateTime.Now;
453
        private DateTime _SelectedCreateTimeBegin = DefaultCreateTime;
454 5a954acc semi
        public DateTime SelectedCreateTimeBegin
455
        {
456
457
            get { return _SelectedCreateTimeBegin; }
458
            set
459
            {
460
                if (_SelectedCreateTimeBegin == value)
461
                    return;
462
                _SelectedCreateTimeBegin = value;
463
                OnPropertyChanged(() => SelectedCreateTimeBegin);
464
                //CollectionViewSource.GetDefaultView(FilterConvertSource).Refresh();
465 218e5002 semi
                //FilterConvertSourceView.Refresh();
466 5a954acc semi
                //AddGeneratorBeginFilter();
467
468
            }
469
        }
470
471 b63dcfbb semi
        private DateTime _SelectedCreateTimeEnd = DefaultCreateTime;
472 5a954acc semi
        public DateTime SelectedCreateTimeEnd
473
        {
474
475
            get { return _SelectedCreateTimeEnd; }
476
            set
477
            {
478
                if (_SelectedCreateTimeEnd == value)
479
                    return;
480
                _SelectedCreateTimeEnd = value;
481
                OnPropertyChanged(() => SelectedCreateTimeEnd);
482
                //CollectionViewSource.GetDefaultView(FilterConvertSource).Refresh();
483 218e5002 semi
                //FilterConvertSourceView.Refresh();
484 5a954acc semi
                //AddGeneratorBeginFilter();
485
486
            }
487
        }
488
489 218e5002 semi
        public int _DocpanelHeigh = 800;
490
        public int DocpanelHeight //나중에 다시 해야함
491
        {
492
            get { return _DocpanelHeigh; }
493
            set
494
            {
495
                _DocpanelHeigh = value;
496
                OnPropertyChanged(() => DocpanelHeight);
497
            }
498
        }
499
500 b63dcfbb semi
        private string _Click = "Click";
501
        public string Click
502
        {
503
504
            get { return _Click; }
505
        }
506 e6281033 alzkakdixm
        #endregion
507
508
        #region Command
509 a6e5055d alzkakdixm
510 0cb12397 alzkakdixm
        public DelegateCommand ConvertCommand { get; private set; }
511
        public DelegateCommand DeleteCommand { get; private set; }
512
        public DelegateCommand ValidateCommand { get; private set; }
513 e6281033 alzkakdixm
        public DelegateCommand DataSaveFileGemBoxCommand { get; private set; }
514 e78f0871 alzkakdixm
        public DelegateCommand MarkusLinkCommand { get; private set; }
515 b63dcfbb semi
        public DelegateCommand RemoveCreateTimeFilterCommand { get; private set; }
516
517
        public DelegateCommand DataFilterCommand { get; private set; }
518
        public DelegateCommand ResetCommand { get; private set; }
519 218e5002 semi
        public DelegateCommand ConverAddCommand { get; private set; }
520 5a954acc semi
521 e6281033 alzkakdixm
        #endregion
522 a6e5055d alzkakdixm
523 e6281033 alzkakdixm
        #region Main Logic
524 a6e5055d alzkakdixm
525 e6281033 alzkakdixm
        /// <summary>
526
        /// 각각의 Grid row 객체들 업데이트
527
        /// </summary>
528
529
        private DispatcherTimer dispatcherTimer;
530 43b2e236 semi
        //public override void Loaded()
531
        //{
532
        //    base.Loaded();
533
534
        //    if (!App.IsDesignMode)
535
        //    {
536
        //        dispatcherTimer = new DispatcherTimer();
537
        //        dispatcherTimer.Tick += new EventHandler(Timer_Tick);
538
        //        dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
539
        //        dispatcherTimer.Start();
540
        //    }
541
        //}
542 a6e5055d alzkakdixm
543 b119eeaa taeseongkim
        private async void Timer_Tick(object sender, EventArgs e)
544 a6e5055d alzkakdixm
        {
545 e6281033 alzkakdixm
            dispatcherTimer.Stop();
546
547
            if (IsAcitve)
548 a6e5055d alzkakdixm
            {
549 b119eeaa taeseongkim
                await App.Current.Dispatcher.InvokeAsync(() =>
550 a6e5055d alzkakdixm
                {
551 e6281033 alzkakdixm
                    DataSelect();
552
553
                    AliveDataSelect();
554
                });
555
            }
556
557 b119eeaa taeseongkim
            await Task.Delay(5000);
558
559
            //System.Threading.Thread.Sleep(new TimeSpan(0,0,0,0,100));
560 e6281033 alzkakdixm
561
            dispatcherTimer.Start();
562
        }
563 a6e5055d alzkakdixm
564 e6281033 alzkakdixm
        public override void Closed()
565
        {
566
            if (dispatcherTimer != null)
567
            {
568
                dispatcherTimer.Stop();
569 a6e5055d alzkakdixm
            }
570 e6281033 alzkakdixm
571
            base.Closed();
572 a6e5055d alzkakdixm
        }
573 0cb12397 alzkakdixm
574 2decfbdf alzkakdixm
575 e6281033 alzkakdixm
        #endregion
576 a6e5055d alzkakdixm
577 e6281033 alzkakdixm
        #region Function
578 a6e5055d alzkakdixm
579 e6281033 alzkakdixm
        #region Data Select
580
581
        /// <summary>
582
        /// 상단 그리드 중앙 그리드 출력 데이터
583
        /// </summary>
584
        private void DataSelect()
585
        {
586 a6e5055d alzkakdixm
587 e6281033 alzkakdixm
            if (FilterConvertSource == null)
588
            {
589
                FilterConvertSource = new System.Collections.ObjectModel.ObservableCollection<ConvertItem>();
590
            }
591
592
            if (RealConvertSource == null)
593
            {
594
                RealConvertSource = new System.Collections.ObjectModel.ObservableCollection<ConvertItem>();
595
            }
596
597
            /// combobox 에서 선택된 items
598
            if (SelectedStatus != null)
599
            {
600
                DataSelect(new[] { (StatusCodeType)(SelectedStatus.Value) }, FilterConvertSource);
601 a6e5055d alzkakdixm
            }
602
603 e6281033 alzkakdixm
            /// 컨버터중인 items
604
            RealDataSelect(new[] { StatusCodeType.None, StatusCodeType.Wait, StatusCodeType.PageLoading, StatusCodeType.Saving }, RealConvertSource);
605 2decfbdf alzkakdixm
606 e6281033 alzkakdixm
        }
607 2decfbdf alzkakdixm
608
        private void RealDataSelect(IEnumerable<StatusCodeType> statusCodeTypeList, System.Collections.ObjectModel.ObservableCollection<ConvertItem> collection)
609
        {
610
            try
611
            {
612
                using (Markus.Service.DataBase.ConvertDatabase database = new Markus.Service.DataBase.ConvertDatabase(App.MarkusDataBaseConnecitonString))
613
                {
614
                    var items = database.GetConvertProjects(collection)//x:database객체 y:statusCodeTypeList의값  Count()안에 predicator 조건 만족하면 count개수안에 넣음
615
                                          .Take(SelectedCount.ValueMember).ToList();//
616
617
                    items.ForEach(newitem =>
618
                    {
619
                        collection.UpdateWhere(changeitem =>
620
                        ConvertItemEx.ChangeValues(changeitem, newitem), x => x.ConvertID == newitem.ConvertID && x.ProjectNumber == newitem.ProjectNumber);
621
                    });
622
                }
623
            }
624
            catch (Exception ex)
625
            {
626
                MessageBox.Show(ex.ToString());
627
            }
628
        }
629
630 a6e5055d alzkakdixm
        private void DataSelect(IEnumerable<StatusCodeType> statusCodeTypeList, System.Collections.ObjectModel.ObservableCollection<ConvertItem> collection)
631
        {
632
            try
633
            {
634
                using (Markus.Service.DataBase.ConvertDatabase database = new Markus.Service.DataBase.ConvertDatabase(App.MarkusDataBaseConnecitonString))
635
                {
636
637 2decfbdf alzkakdixm
                    int _status = 0;
638
                    if (SelectedStatus != null)
639
                    {
640
                        _status = (int)SelectedStatus.Value;
641
                    }
642
643 218e5002 semi
644 b63dcfbb semi
                    var items = database.GetConvertProjects(_status, ProjectNumberFilter, UniqueKeyFilter, Docuemnt_NameFilter, Service_IDFilter, Docuemnt_NOFilter
645
                        , ReconverterFilter, RevisionFilter)//x:database객체 y:statusCodeTypeList의값  Count()안에 predicator 조건 만족하면 count개수안에 넣음
646
                                          .Take(SelectedCount.ValueMember).ToList();
647 2decfbdf alzkakdixm
648 a6e5055d alzkakdixm
                    if (collection.Count() == 0)
649
                    {
650 2decfbdf alzkakdixm
                        if (statusCodeTypeList.Count() == 1)
651
                        {
652
                            items.ForEach(x => collection.Add(x));
653
                        }
654 a6e5055d alzkakdixm
                    }
655
                    else
656
                    {
657 2decfbdf alzkakdixm
658
                        ////세미 업데이트
659
                        items.ForEach(newitem =>
660 a6e5055d alzkakdixm
                        {
661
                            collection.UpdateWhere(changeitem =>
662 2decfbdf alzkakdixm
                            ConvertItemEx.ChangeValues(changeitem, newitem), x => x.ProjectNumber == newitem.ProjectNumber && x.ConvertID == newitem.ConvertID);
663 a6e5055d alzkakdixm
                        });
664
665 2decfbdf alzkakdixm
                        if (statusCodeTypeList.Count() == 1)
666 a6e5055d alzkakdixm
                        {
667 2decfbdf alzkakdixm
                            //삭제
668
                            for (int i = collection.Count() - 1; i >= 0; --i)
669 a6e5055d alzkakdixm
                            {
670 2decfbdf alzkakdixm
                                var item = collection[i];
671 a6e5055d alzkakdixm
672 2decfbdf alzkakdixm
                                if (items.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)//디비에서 가져온 값과 마지막값부터 차례대로 비교
673
                                {//참=> 0제외한 모든 수
674
                                    collection.RemoveAt(i);
675
                                }
676
                            }
677 a6e5055d alzkakdixm
                        }
678
679 2decfbdf alzkakdixm
                        if (statusCodeTypeList.Count() == 1)
680 a6e5055d alzkakdixm
                        {
681 2decfbdf alzkakdixm
                            //추가 convert 후 추가됨
682
                            foreach (var item in items)
683
                            {
684
                                if (collection.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)//그리드와 디비 변동 없으면 안들어감
685
                                {
686
                                    /*for (int i = 0; i < collection.Count()+1; i++)//위 그리드에서 카운드 개수 변함 없고 컨버터 끝난 후 추가할때 createtime 비교 하며 order by 순으로 추가*/
687
                                    for (int i = 0; i < 200; i++)
688
                                    {
689
                                        if (i < collection.Count() - 1)
690
                                        {
691
                                            if (DateTime.Compare(collection[i].CreateTime, item.CreateTime) < 0)
692
                                            {
693
                                                collection.Insert(i, item);
694
                                                break;
695
                                            }
696
                                        }
697
                                        else
698
                                        {
699
                                            collection.Add(item);
700
                                            break;
701
                                        }
702
                                    }
703
704
                                }
705 a6e5055d alzkakdixm
706
                            }
707
                        }
708 2decfbdf alzkakdixm
709 a6e5055d alzkakdixm
                    }
710
                }
711 2decfbdf alzkakdixm
712 a6e5055d alzkakdixm
            }
713
            catch (Exception ex)
714
            {
715 b63dcfbb semi
                //MessageBox.Show(ex.ToString());
716
                System.Diagnostics.Debug.WriteLine(ex.ToString());
717 a6e5055d alzkakdixm
            }
718
        }
719
720 b63dcfbb semi
        private void DataSearch(IEnumerable<StatusCodeType> statusCodeTypeList, System.Collections.ObjectModel.ObservableCollection<ConvertItem> collection)
721
        {
722
            try
723
            {
724 218e5002 semi
                using (Markus.Service.DataBase.ConvertDatabase database = new Markus.Service.DataBase.ConvertDatabase(App.MarkusDataBaseConnecitonString))
725 b63dcfbb semi
                {
726 218e5002 semi
                    using (markusEntities entities = new markusEntities())
727
                    {
728 b63dcfbb semi
729
730 218e5002 semi
                        int _status = 0;
731
                        if (SelectedStatus != null)
732
                        {
733
                            _status = (int)SelectedStatus.Value;
734
                        }
735 b63dcfbb semi
736 218e5002 semi
                        //DocumentID = unikey
737 b63dcfbb semi
738 218e5002 semi
                        //null 왼쪽에서 부터 p_BEGIN_START_DATETIE, p_Finish_START_DATETIE, BEGIN_END_DATETIME, Finish_END_DATETIME (전에 없애라고 하셔서..)
739
                        //오류떠서  [Model].Context.tt File에서  288줄  Function.Name to edmFunction.FullName바꿨더니 오류 안남
740
                        var items = entities.SELECT_CONVERT_ITEM(ProjectNumberFilter, UniqueKeyFilter, _status, SelectedCount.ValueMember, SelectedCreateTimeBegin, SelectedCreateTimeEnd, null, null, null, null, GroupNOFilter,
741
                            Docuemnt_NameFilter, Docuemnt_NOFilter, RevisionFilter).ToList();//이대로 그냥 쓰면 쿼리 -> 쿼리 결과는 두 번 이상 열거할 수 없습니다 뜸
742 b63dcfbb semi
743 218e5002 semi
                        //SEARCH 할때 최소한 프로젝트 넘버랑 유니크키(다큐먼트 넘버) 크레이트타임 시작 줘야함
744 b63dcfbb semi
745 218e5002 semi
                        List<ConvertItem> Listitems = new List<ConvertItem>();
746 b63dcfbb semi
747 218e5002 semi
                        foreach (var x in items)
748
                        {
749
                            var convertpath = database.GetSearchConvertPathAndMarkus(x.PROJECT_NO, x.DOCUMENT_ID);
750 b63dcfbb semi
751 218e5002 semi
                            ConvertItem AddItem = new ConvertItem(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
752
                             , x.DOCUMENT_URL, convertpath[0], convertpath[1]);
753
                            Listitems.Add(AddItem);
754
                            //이거 없으면 collection.Insert(i, item); 할때 문제 생김
755
                        }
756
757
                        if (collection.Count() == 0)
758 b63dcfbb semi
                        {
759 218e5002 semi
                            if (statusCodeTypeList.Count() == 1)
760 b63dcfbb semi
                            {
761 218e5002 semi
                                foreach (var x in Listitems)
762
                                {
763
                                    collection.Add(x);
764
                                }
765 b63dcfbb semi
                            }
766
                        }
767 218e5002 semi
                        else
768 b63dcfbb semi
                        {
769
770 218e5002 semi
                            ////세미 업데이트
771
                            foreach (var newitem in Listitems)
772
                            {
773
                                collection.UpdateWhere(changeitem =>
774
                                ConvertItemEx.ChangeValues(changeitem, newitem), x => x.ProjectNumber == newitem.ProjectNumber && x.ConvertID == newitem.ConvertID);
775
                            }
776 b63dcfbb semi
777
778 218e5002 semi
                            if (statusCodeTypeList.Count() == 1)
779 b63dcfbb semi
                            {
780
781 218e5002 semi
                                //삭제
782
                                for (int i = collection.Count() - 1; i >= 0; --i)
783 b63dcfbb semi
                                {
784 218e5002 semi
                                    var item = collection[i];
785
786
                                    if (Listitems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
787
                                    {
788
                                        collection.RemoveAt(i);
789
                                    }
790 b63dcfbb semi
                                }
791
                            }
792
793 218e5002 semi
                            if (statusCodeTypeList.Count() == 1)
794 b63dcfbb semi
                            {
795 218e5002 semi
                                //추가 convert 후 추가됨
796
                                foreach (var item in Listitems)
797 b63dcfbb semi
                                {
798 218e5002 semi
                                    if (collection.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
799 b63dcfbb semi
                                    {
800 218e5002 semi
                                        for (int i = 0; i < 200; i++)
801 b63dcfbb semi
                                        {
802 218e5002 semi
                                            if (i < collection.Count() - 1)
803 b63dcfbb semi
                                            {
804 218e5002 semi
                                                if (DateTime.Compare(collection[i].CreateTime, item.CreateTime) < 0)
805
                                                {
806
                                                    collection.Insert(i, item);
807
                                                    break;
808
                                                }
809
                                            }
810
                                            else
811
                                            {
812
                                                collection.Add(item);
813 b63dcfbb semi
                                                break;
814
                                            }
815
                                        }
816 218e5002 semi
817 b63dcfbb semi
                                    }
818
819
                                }
820
                            }
821
822 218e5002 semi
                        }
823 b63dcfbb semi
                    }
824
                }
825
826
            }
827
            catch (Exception ex)
828
            {
829
                //MessageBox.Show(ex.ToString());
830
                System.Diagnostics.Debug.WriteLine(ex.ToString());
831
            }
832
        }
833 e6281033 alzkakdixm
        /// <summary>
834
        /// 서비스의 실시간 컨버터 Item
835
        /// </summary>
836
        private async void AliveDataSelect()
837 a6e5055d alzkakdixm
        {
838 e6281033 alzkakdixm
            try
839 a6e5055d alzkakdixm
            {
840 e6281033 alzkakdixm
                List<ConvertItem> newitems = new List<ConvertItem>();
841 a6e5055d alzkakdixm
842 e6281033 alzkakdixm
                foreach (var client in App.StationClientList)
843
                {
844
                    if (await SimplePingAsync(client.Endpoint.Address.ToString()))
845
                    {
846
                        try
847
                        {
848
                            List<ConvertItem> itemsToList = new List<ConvertItem>();
849
                            var items = await client.AliveConvertListAsync();
850
                            foreach (var item in items)
851
                            {
852
                                ConvertItem itemsToEach = new ConvertItem();
853
                                itemsToEach.ServiceID = item.ServiceID;
854
                                itemsToEach.ConvertID = item.ConvertID;
855
                                itemsToEach.ProjectNumber = item.ProjectNumber;
856 29000595 alzkakdixm
857
                                if (item.ConvertState != null)
858 e6281033 alzkakdixm
                                {
859
                                    itemsToEach.ConvertState = (StatusCodeType)Enum.Parse(typeof(StatusCodeType), item.ConvertState);
860
                                }
861
862
                                itemsToEach.CurrentPageNo = item.CurrentPageNo;
863
                                itemsToEach.TotalPage = item.TotalPage;
864
                                itemsToEach.OriginfilePath = item.OriginfilePath;
865
                                itemsToEach.ConvertPath = item.ConvertPath;
866 344ac7ed alzkakdixm
                                itemsToEach.MarkusLink = item.MarkusLink;
867
                                itemsToEach.UniqueKey = item.UniqueKey;
868
                                itemsToEach.FileName = item.FileName;
869
                                itemsToEach.ConvertPath = item.ConvertPath;
870
                                itemsToEach.CreateTime = item.CreateTime;
871
                                itemsToEach.Exception = item.Exception;
872
                                itemsToEach.ProcessorAffinity = item.ProcessorAffinity;
873
                                itemsToEach.ReConverter = item.ReConverter;
874
                                itemsToEach.DocumentID = item.DocumentID;
875
                                itemsToEach.DocumnetName = item.DocumnetName;
876
                                itemsToEach.GroupNo = item.GroupNo;
877
                                itemsToEach.Revision = item.Revision;
878
                                itemsToEach.StartTime = item.StartTime;
879
                                itemsToEach.EndTime = item.EndTime;
880
881 e6281033 alzkakdixm
882
                                itemsToList.Add(itemsToEach);
883
                            }
884
                            newitems.AddRange(itemsToList);
885
                            System.Diagnostics.Trace.WriteLine($"{client.Endpoint.Address} ping");
886 2decfbdf alzkakdixm
887 e6281033 alzkakdixm
                            if (items.Count() == 0)
888
                            {
889
                                System.Diagnostics.Trace.WriteLine($"{client.Endpoint.Address} Alive Items is zero.");
890
                            }
891
                        }
892
                        catch (Exception ex)
893
                        {
894
                            System.Diagnostics.Trace.Fail($"{client.Endpoint.Address} {ex.Message}");
895
                        }
896
                    }
897
                    else
898
                    {
899
                        System.Diagnostics.Trace.Fail($"{client.Endpoint.Address} ping Error");
900
                    }
901
                }
902 2decfbdf alzkakdixm
903 e6281033 alzkakdixm
                ItemsUpdate(newitems);
904
                await System.Windows.Application.Current.Dispatcher.InvokeAsync(() => ItemsUpdate(newitems));
905
            }
906
            catch (Exception ex)
907
            {
908
                System.Diagnostics.Debug.WriteLine(ex.ToString());
909 a6e5055d alzkakdixm
            }
910
        }
911
912 e6281033 alzkakdixm
        /// <summary>
913
        /// AliveDataSelect의 Data Update
914
        /// </summary>
915
        /// <param name="newitems"></param>
916
        private void ItemsUpdate(List<ConvertItem> newitems)
917 a6e5055d alzkakdixm
        {
918
919 e6281033 alzkakdixm
            foreach (var item in newitems)
920
            {
921
                item.OriginfilePath = HttpUtility.UrlDecode(item.OriginfilePath);
922
            }
923
924
            if (AliveItems == null)
925
            {
926
                AliveItems = new System.Collections.ObjectModel.ObservableCollection<ConvertItem>();
927
928
                foreach (var item in newitems)
929
                {
930
                    AliveItems.Add(item);
931
                }
932
            }
933
            else
934 a6e5055d alzkakdixm
            {
935 e6281033 alzkakdixm
                /// 데이터 업데이트
936
                newitems.ForEach(newitem =>
937
                {
938
                    AliveItems.UpdateWhere(changeitem => ConvertItemEx.ChangeValues(changeitem, newitem), x => x.ProjectNumber == newitem.ProjectNumber && x.ConvertID == newitem.ConvertID);
939
                });
940
941
                // 추가
942
                foreach (var item in newitems)
943
                {
944
                    if (AliveItems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
945
                    {
946
                        AliveItems.Add(item);
947
                    }
948
                }
949 a6e5055d alzkakdixm
950 e6281033 alzkakdixm
                /// 삭제
951 2decfbdf alzkakdixm
952 e6281033 alzkakdixm
                for (int i = AliveItems.Count() - 1; i > -1; --i)
953
                {
954
                    var item = AliveItems[i];
955 a6e5055d alzkakdixm
956 e6281033 alzkakdixm
                    if (newitems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
957
                    {
958
                        try
959
                        {
960
                            AliveItems.RemoveAt(i);
961
                        }
962
                        catch (Exception ex)
963
                        {
964
                            System.Diagnostics.Debug.WriteLine(ex.ToString());
965
                        }
966
                    }
967
                }
968 2decfbdf alzkakdixm
            }
969 a6e5055d alzkakdixm
        }
970
971
972 e6281033 alzkakdixm
        public static async Task<bool> SimplePingAsync(string uri)
973 a6e5055d alzkakdixm
        {
974 e6281033 alzkakdixm
            bool result = false;
975
976
            try
977
            {
978
                using (System.Net.Http.HttpClient Client = new System.Net.Http.HttpClient())
979
                {
980
                    Client.Timeout = new TimeSpan(0, 0, 60);
981
982
                    var message = await Client.GetAsync(uri);
983
984
                    System.Net.HttpStatusCode StatusCode = message.StatusCode;
985
986
                    switch (StatusCode)
987
                    {
988
989
                        case System.Net.HttpStatusCode.Accepted:
990
                        case System.Net.HttpStatusCode.OK:
991
                            result = true;
992
                            break;
993
                    }
994
                }
995
            }
996
            catch (Exception ex)
997
            {
998
                result = false;
999
                System.Diagnostics.Debug.WriteLine(ex.ToString());
1000
            }
1001
1002
            return result;
1003 a6e5055d alzkakdixm
        }
1004
1005 e6281033 alzkakdixm
        #endregion
1006
1007
        #region Data Convert
1008 a6e5055d alzkakdixm
1009 e6281033 alzkakdixm
        private void DataConvert(object obj)
1010
        {
1011
            if (SelectFilterConvert == null && SelectRealConvert == null)
1012
            {
1013
                MessageBox.Show("왼쪽 버튼 클릭 후 Converter 해주세요!");
1014
            }
1015
            else
1016 a6e5055d alzkakdixm
            {
1017 e6281033 alzkakdixm
                ConvertDatabase _DataConvert = new ConvertDatabase(App.MarkusDataBaseConnecitonString);
1018
                var resultRealConvert = 0;
1019
                var resultFiltertConvert = 0;
1020
1021
                if (SelectRealConvert != null)
1022
                {
1023
                    resultRealConvert = _DataConvert.SetCleanUpItem(SelectRealConvert);
1024
                }
1025
                else if (SelectFilterConvert != null)
1026 a6e5055d alzkakdixm
                {
1027 e6281033 alzkakdixm
                    resultFiltertConvert = _DataConvert.SetCleanUpItem(SelectFilterConvert);
1028
                }
1029
                System.Diagnostics.Debug.WriteLine(resultRealConvert + "  " + resultFiltertConvert);
1030
1031
                using (Markus.Service.DataBase.ConvertDatabase database = new Markus.Service.DataBase.ConvertDatabase(App.MarkusDataBaseConnecitonString))
1032
                {
1033
                    var items = database.GetConvertProjects(SelectFilterConvert);
1034
1035
                    foreach (var item in items)
1036
                    {
1037
                        RealConvertSource.Add(item);
1038
                    }
1039 8c7d1ea1 alzkakdixm
                    if (RealConvertSource.Count() == 1)
1040
                    {
1041
                        ConvertShow = true;
1042
                    }
1043 a6e5055d alzkakdixm
                }
1044
            }
1045 e6281033 alzkakdixm
        }
1046
1047
        #endregion
1048
1049
        #region Validation
1050 a6e5055d alzkakdixm
1051 e6281033 alzkakdixm
        private void DataValidate(object obj)
1052
        {
1053
1054
            bool result = false;
1055 a6e5055d alzkakdixm
1056 e6281033 alzkakdixm
            WebRequest webRequest = WebRequest.Create(SelectFilterConvert.OriginfilePath);
1057
            webRequest.Timeout = 1200; // miliseconds
1058
            webRequest.Method = "HEAD";
1059
1060
            HttpWebResponse response = null;
1061
1062
            try
1063
            {
1064
                response = (HttpWebResponse)webRequest.GetResponse();
1065
                result = true;
1066
            }
1067
            catch (WebException webException)
1068
            {
1069
                MessageBox.Show(SelectFilterConvert.FileName + " doesn't exist: " + webException.Message);
1070
                result = true;
1071
            }
1072
            finally
1073 a6e5055d alzkakdixm
            {
1074 e6281033 alzkakdixm
                if (response != null)
1075 a6e5055d alzkakdixm
                {
1076 e6281033 alzkakdixm
                    response.Close();
1077 a6e5055d alzkakdixm
                }
1078 2decfbdf alzkakdixm
            }
1079 e6281033 alzkakdixm
            if (result == true)
1080
            {
1081
                MessageBox.Show("File exists");
1082
            }
1083
        }
1084
1085
        #endregion
1086
1087 b63dcfbb semi
        #region DataFilter
1088
1089
        public void DataFilter(object obj)
1090
        {
1091
            dispatcherTimer.Tick -= new EventHandler(Timer_Tick);
1092
            DataSearch(new[] { (StatusCodeType)(SelectedStatus.Value) }, FilterConvertSource);
1093
            //dispatcherTimer.Start();
1094
        }
1095
1096
        #endregion
1097
1098 e78f0871 alzkakdixm
        #region MarkusLink
1099
1100
        private void MarkusLink(object obj)///여기서 부터 
1101
        {
1102
            if (obj is ConvertItem)
1103
            {
1104
                if (obj != null)
1105
                {
1106
                    var convertitem = obj as ConvertItem;
1107
1108
                    SelectFilterConvert = convertitem;
1109
1110
                    SelectRealConvert = convertitem;
1111
1112
                    ProcessStartInfo startInfo = null;
1113
1114
                    startInfo = new ProcessStartInfo("iexplore.exe", convertitem.MarkusLink);
1115
1116
                    Process.Start(startInfo);
1117
                }
1118
            }
1119
        }
1120
1121
        #endregion
1122
1123 e6281033 alzkakdixm
        #region Data Delete
1124
1125
        private void DataDelete(object obj)
1126
        {
1127 8c7d1ea1 alzkakdixm
            RadWindow.Alert("do you want to delete it??", this.OnClosed);
1128 e6281033 alzkakdixm
        }
1129
1130
        private void OnClosed(object sender, WindowClosedEventArgs e)
1131
        {
1132
            var result = e.DialogResult;
1133
            if (result == true)
1134
            {
1135
                ConvertDatabase _DataConvert = new ConvertDatabase(App.MarkusDataBaseConnecitonString);
1136
                var resultRealConvert = _DataConvert.RemoveItem(SelectRealConvert.ConvertID);
1137
                var resultFiltertConvert = _DataConvert.RemoveItem(SelectFilterConvert.ConvertID);
1138
                System.Diagnostics.Debug.WriteLine(resultRealConvert + "  " + resultFiltertConvert);
1139
            }
1140
        }
1141
1142
1143
        #endregion
1144
1145
        #region Data Export
1146
1147
1148
        /// <summary>
1149
        /// 필터된 상단 그리드 엑셀로 출력
1150
        /// </summary>
1151
1152
        public void DataExportData(object obj)
1153
        {
1154
            SaveFileDialog saveFileDialog = new SaveFileDialog();
1155
1156
            saveFileDialog.FileName = "Document"; // Default file name
1157
            saveFileDialog.DefaultExt = ".txt"; // Default file extension
1158
            saveFileDialog.Filter = "Csv documents (.Csv)|*.csv|Excel(2017~2019)Worksheets|*.xlsx"; // Filter files by extension
1159
1160
1161
            if (saveFileDialog.ShowDialog() == true)
1162 2decfbdf alzkakdixm
            {
1163 e6281033 alzkakdixm
1164
1165
                if (!string.IsNullOrWhiteSpace(saveFileDialog.FileName))
1166 0cb12397 alzkakdixm
                {
1167 e6281033 alzkakdixm
1168
                    var extension = new System.IO.FileInfo(saveFileDialog.FileName).Extension;
1169
1170
                    if (extension == ".xlsx" || extension == ".csv")
1171
                    {
1172
1173
                        var headers = new List<HeaderMember>
1174
                        {
1175
                            new HeaderMember{HeaderName = "ServiceID", Property = "ServiceID" },
1176
                            new HeaderMember{HeaderName = "ConvertID", Property = "ConvertID" },
1177
                            new HeaderMember{HeaderName = "ProjectNumber", Property = "ProjectNumber" },
1178
                            new HeaderMember{HeaderName = "ConvertState", Property = "ConvertState" },
1179
                            new HeaderMember{HeaderName = "CurrentPageNo", Property = "CurrentPageNo" },
1180
                            new HeaderMember{HeaderName = "TotalPage", Property = "TotalPage" },
1181
                            new HeaderMember{HeaderName = "OriginfilePath", Property = "OriginfilePath" },
1182
                            new HeaderMember{HeaderName = "ConvertPath", Property = "ConvertPath" },
1183
                            new HeaderMember{HeaderName = "CreateTime", Property = "CreateTime" },
1184
                            new HeaderMember{HeaderName = "Exception", Property = "Exception" },
1185
                            new HeaderMember{HeaderName = "ProcessorAffinity", Property = "ProcessorAffinity" },
1186
                            new HeaderMember{HeaderName = "ReConverter", Property = "ReConverter" },
1187
                            new HeaderMember{HeaderName = "UniqueKey", Property = "UniqueKey" }
1188
                        };
1189
1190
1191
                        DataExport dataExport = new DataExport();
1192
                        dataExport.DataExportExcel(saveFileDialog.FileName, "Hello world", FilterConvertSource, headers);
1193
                        //_dataExport.DataExportExcel(saveFileDialog.FileName, saveFileDialog.FileName.ToString(),  Projectsource, headers);
1194
                        //GemBoxFileSave(obj);
1195
                    }
1196 0cb12397 alzkakdixm
                }
1197 2decfbdf alzkakdixm
            }
1198
        }
1199 e6281033 alzkakdixm
1200
        #endregion
1201
1202 b63dcfbb semi
        #region Data Search
1203 902f397c semi
1204
1205
        /// <summary>
1206
        /// Grid Filter
1207
        /// </summary>
1208
1209 5a954acc semi
        private bool DetailFilter(object item)
1210 902f397c semi
        {
1211
            var Item = item as ConvertItem;
1212
            if (ProjectNumberFilter == null) return true;
1213
            if (ProjectNumberFilter == Item.ProjectNumber) return true;
1214 5a954acc semi
            //if (ConvertStateFilter == null) return true;
1215
            //if (ConvertStateFilter == (StatusCodeType)Item.ConvertState) return true;
1216
            if (Docuemnt_NameFilter == null) return true;
1217
            if (Docuemnt_NameFilter == Item.DocumnetName) return true;
1218
            if (Service_IDFilter == null) return true;
1219
            if (Service_IDFilter == Item.ServiceID) return true;
1220
            if (UniqueKeyFilter == null) return true;
1221
            if (UniqueKeyFilter == Item.UniqueKey) return true;
1222
            if (Docuemnt_NOFilter == null) return true;
1223
            if (Docuemnt_NOFilter == Item.DocumnetNo) return true;
1224
            if (ReconverterFilter == null) return true;
1225
            if (ReconverterFilter == Item.ReConverter) return true;
1226
            if (RevisionFilter == null) return true;
1227
            if (RevisionFilter == Item.Revision) return true;
1228
1229 902f397c semi
            return false;
1230
        }
1231
1232 b63dcfbb semi
        public void RemoveCreateTimeFilter(object obj)
1233
        {
1234
            DefaultCreateTime = DateTime.Now;
1235
            SelectedCreateTimeBegin = DefaultCreateTime;
1236
            SelectedCreateTimeEnd = DefaultCreateTime;
1237
1238
        }
1239
1240
        #endregion
1241
1242
        #region Reset
1243
1244
        /// <summary>
1245
        /// 그리드 상단 원상복귀 버튼
1246
        /// 필터를 끝낸 후 다시 복귀
1247
        /// </summary>
1248
1249
        public void Reset(object obj)
1250 5a954acc semi
        {
1251 b63dcfbb semi
            dispatcherTimer.Tick += new EventHandler(Timer_Tick);
1252 5a954acc semi
        }
1253
1254 902f397c semi
        #endregion
1255
1256 218e5002 semi
1257
        #region
1258
1259
        /// <summary>
1260
        /// 그리드 상단 Conver 추가 버튼
1261
        /// ProjectNo, DocumentURL, DocumentID, 입력해서 저장 프로시저에서 추가 
1262
        /// </summary>
1263
1264
        public void ConverAdd(object obj)
1265
        {
1266 43b2e236 semi
            //줄 530줄 load부분 주석 처리하면 잘됨 
1267
            //dispatcherTimer.Stop();
1268
1269
            Views.ConvertAddDialog convertAddDialog = new Views.ConvertAddDialog();
1270
            convertAddDialog.ShowDialog();
1271 218e5002 semi
1272 43b2e236 semi
            //dispatcherTimer.Start();
1273 218e5002 semi
        }
1274
1275
        #endregion
1276
1277 e6281033 alzkakdixm
        #endregion
1278 a6e5055d alzkakdixm
    }
1279
}
클립보드 이미지 추가 (최대 크기: 500 MB)