markus / ConvertService / ServiceBase / Markus.Service.StationController / ViewModel / FinalPDFViewModel.cs @ c68259ac
이력 | 보기 | 이력해설 | 다운로드 (52.8 KB)
1 |
using Markus.Service.Extensions; |
---|---|
2 |
using Markus.Service.StationController.Data; |
3 |
using Markus.Service.StationController.Behaviors; |
4 |
using Markus.Service.StationController.Extensions; |
5 |
using Markus.Service.StationController.Controls; |
6 |
using Microsoft.Win32; |
7 |
using System; |
8 |
using System.Collections.Generic; |
9 |
using System.ComponentModel; |
10 |
using System.Linq; |
11 |
using System.Threading.Tasks; |
12 |
using System.Web; |
13 |
using System.Windows; |
14 |
using Telerik.Windows.Controls; |
15 |
using Telerik.Windows.Data; |
16 |
using System.Net; |
17 |
using System.Windows.Threading; |
18 |
using System.Diagnostics; |
19 |
using System.Windows.Input; |
20 |
using Markus.Mvvm.ToolKit; |
21 |
using System.Windows.Data; |
22 |
using System.Windows.Controls; |
23 |
using System.IO; |
24 |
using Newtonsoft.Json; |
25 |
using static Markus.Service.StationController.Data.FinalPDF; |
26 |
using System.Collections.ObjectModel; |
27 |
|
28 |
namespace Markus.Service.StationController.ViewModel |
29 |
{ |
30 |
class FinalPDFViewModel : Mvvm.ToolKit.ViewModelBase |
31 |
{ |
32 |
#region Constructor |
33 |
|
34 |
/// <summary> |
35 |
/// 실행하면 처음 들어가는 부분 |
36 |
/// </summary> |
37 |
public FinalPDFViewModel() |
38 |
{ |
39 |
DataFilterCommand = new DelegateCommand(DataFilter); |
40 |
DataSaveFileGemBoxCommand = new DelegateCommand(DataExportData); |
41 |
ConvertCommand = new DelegateCommand(DataConvert); |
42 |
DeleteCommand = new DelegateCommand(DataDelete); |
43 |
ValidateCommand = new DelegateCommand(DataValidate); |
44 |
MarkusLinkCommand = new DelegateCommand(MarkusLink); |
45 |
RemoveCreateTimeFilterCommand = new DelegateCommand(RemoveCreateTimeFilter); |
46 |
ResetCommand = new DelegateCommand(Reset); |
47 |
ConverAddCommand = new DelegateCommand(ConverAdd); |
48 |
FinalPDFPathFileSearchCommand = new DelegateCommand(FinalPDFPathFileSearch); |
49 |
Stop_ProcessCommand = new DelegateCommand(Stop_Process); |
50 |
} |
51 |
|
52 |
#endregion |
53 |
|
54 |
#region Properties |
55 |
|
56 |
DataService.DataServiceClient WcfClient = new DataService.DataServiceClient(); |
57 |
|
58 |
|
59 |
private static System.Collections.ObjectModel.ObservableCollection<FinalPDF> _ConvertSource; |
60 |
public static System.Collections.ObjectModel.ObservableCollection<FinalPDF> ConvertSource |
61 |
{ |
62 |
get |
63 |
{ |
64 |
if (_ConvertSource == null) |
65 |
{ |
66 |
_ConvertSource = new System.Collections.ObjectModel.ObservableCollection<FinalPDF>(); |
67 |
} |
68 |
return _ConvertSource; |
69 |
} |
70 |
set |
71 |
{ |
72 |
_ConvertSource = value; |
73 |
} |
74 |
} |
75 |
|
76 |
public ObservableCollection<ProjectName> _ProjectNames; |
77 |
public ObservableCollection<ProjectName> ProjectNames |
78 |
{ |
79 |
get |
80 |
{ |
81 |
if (_ProjectNames == null) |
82 |
{ |
83 |
_ProjectNames = new System.Collections.ObjectModel.ObservableCollection<ProjectName>(); |
84 |
} |
85 |
|
86 |
return _ProjectNames; |
87 |
} |
88 |
set |
89 |
{ |
90 |
_ProjectNames = value; |
91 |
OnPropertyChanged(() => ProjectNames); |
92 |
} |
93 |
} |
94 |
|
95 |
private System.Collections.ObjectModel.ObservableCollection<FinalPDF> _FilterSearch; |
96 |
public System.Collections.ObjectModel.ObservableCollection<FinalPDF> FilterSearch |
97 |
{ |
98 |
get |
99 |
{ |
100 |
if (_FilterSearch == null) |
101 |
{ |
102 |
_FilterSearch = new System.Collections.ObjectModel.ObservableCollection<FinalPDF> |
103 |
{ |
104 |
new FinalPDF{ProjectNumber = "Filter Search"} |
105 |
}; |
106 |
} |
107 |
|
108 |
return _FilterSearch; |
109 |
} |
110 |
} |
111 |
|
112 |
private System.Collections.ObjectModel.ObservableCollection<FinalPDF> _AliveItems; |
113 |
public System.Collections.ObjectModel.ObservableCollection<FinalPDF> AliveItems |
114 |
{ |
115 |
get => _AliveItems; |
116 |
set |
117 |
{ |
118 |
_AliveItems = value; |
119 |
OnPropertyChanged(() => AliveItems); |
120 |
} |
121 |
} |
122 |
|
123 |
public ICollectionView FilterConvertSourceView |
124 |
{ |
125 |
get |
126 |
{ |
127 |
var view = CollectionViewSource.GetDefaultView(FilterConvertSource); |
128 |
return view; |
129 |
} |
130 |
} |
131 |
|
132 |
private System.Collections.ObjectModel.ObservableCollection<FinalPDF> _FilterConvertSource; |
133 |
public System.Collections.ObjectModel.ObservableCollection<FinalPDF> FilterConvertSource |
134 |
{ |
135 |
get |
136 |
{ |
137 |
if (_FilterConvertSource == null) |
138 |
{ |
139 |
_FilterConvertSource = new System.Collections.ObjectModel.ObservableCollection<FinalPDF>(); |
140 |
} |
141 |
return _FilterConvertSource; |
142 |
} |
143 |
set |
144 |
{ |
145 |
_FilterConvertSource = value; |
146 |
OnPropertyChanged(() => FilterConvertSource); |
147 |
} |
148 |
} |
149 |
|
150 |
|
151 |
private System.Collections.ObjectModel.ObservableCollection<FinalPDF> _RealConvertSource; |
152 |
public System.Collections.ObjectModel.ObservableCollection<FinalPDF> RealConvertSource |
153 |
{ |
154 |
get => _RealConvertSource; |
155 |
set |
156 |
{ |
157 |
_RealConvertSource = value; |
158 |
OnPropertyChanged(() => RealConvertSource); |
159 |
} |
160 |
} |
161 |
|
162 |
|
163 |
private System.Windows.Documents.FlowDocument connectionLog; |
164 |
public System.Windows.Documents.FlowDocument ConnectionLog |
165 |
{ |
166 |
get => connectionLog; |
167 |
set |
168 |
{ |
169 |
if (connectionLog != value) |
170 |
{ |
171 |
connectionLog = value; |
172 |
OnPropertyChanged(() => ConnectionLog); |
173 |
} |
174 |
} |
175 |
} |
176 |
|
177 |
|
178 |
private int _SelectedInt = 4; |
179 |
public int SelectedInt |
180 |
{ |
181 |
get => _SelectedInt; |
182 |
set |
183 |
{ |
184 |
_SelectedInt = value; |
185 |
OnPropertyChanged(() => SelectedInt); |
186 |
} |
187 |
} |
188 |
|
189 |
|
190 |
private Telerik.Windows.Data.EnumMemberViewModel _SelectedStatus; |
191 |
public Telerik.Windows.Data.EnumMemberViewModel SelectedStatus |
192 |
{ |
193 |
get => _SelectedStatus; |
194 |
set |
195 |
{ |
196 |
_SelectedStatus = value; |
197 |
OnPropertyChanged(() => SelectedStatus); |
198 |
} |
199 |
} |
200 |
|
201 |
|
202 |
private SelectedCountItem _SelectedCount; |
203 |
public SelectedCountItem SelectedCount |
204 |
{ |
205 |
get => _SelectedCount; |
206 |
set |
207 |
{ |
208 |
_SelectedCount = value; |
209 |
OnPropertyChanged(() => SelectedCount); |
210 |
} |
211 |
} |
212 |
|
213 |
List<SelectedCountItem> _SelectedCountList; |
214 |
public List<SelectedCountItem> SelectedCountList |
215 |
{ |
216 |
get |
217 |
{ |
218 |
if (_SelectedCountList == null) |
219 |
{ |
220 |
_SelectedCountList = new List<SelectedCountItem> |
221 |
{ |
222 |
new SelectedCountItem{DisplayMember = "50",ValueMember = 50}, |
223 |
new SelectedCountItem{DisplayMember = "100",ValueMember = 100}, |
224 |
new SelectedCountItem{DisplayMember = "150",ValueMember = 150}, |
225 |
new SelectedCountItem{DisplayMember = "200",ValueMember = 200} |
226 |
}; |
227 |
} |
228 |
|
229 |
return _SelectedCountList; |
230 |
} |
231 |
} |
232 |
|
233 |
private FinalPDF _SelectFilterConvert; |
234 |
public FinalPDF SelectFilterConvert |
235 |
{ |
236 |
get => _SelectFilterConvert; |
237 |
set |
238 |
{ |
239 |
_SelectFilterConvert = value; |
240 |
OnPropertyChanged(() => SelectFilterConvert); |
241 |
} |
242 |
} |
243 |
|
244 |
|
245 |
|
246 |
private ObservableCollection<FinalPDF> _SelectFilterConvertList; |
247 |
public ObservableCollection<FinalPDF> SelectFilterConvertList |
248 |
{ |
249 |
get |
250 |
{ |
251 |
if (_SelectFilterConvertList == null) |
252 |
{ |
253 |
_SelectFilterConvertList = new ObservableCollection<FinalPDF>(); |
254 |
} |
255 |
return _SelectFilterConvertList; |
256 |
} |
257 |
set |
258 |
{ |
259 |
_SelectFilterConvertList = value; |
260 |
OnPropertyChanged(() => SelectFilterConvertList); |
261 |
} |
262 |
} |
263 |
|
264 |
private FinalPDF _SelectRealConvert; |
265 |
public FinalPDF SelectRealConvert |
266 |
{ |
267 |
get => _SelectRealConvert; |
268 |
set |
269 |
{ |
270 |
_SelectRealConvert = value; |
271 |
OnPropertyChanged(() => SelectRealConvert); |
272 |
} |
273 |
} |
274 |
|
275 |
|
276 |
private FinalPDF _SelectAliveConvert; |
277 |
public FinalPDF SelectAliveConvert |
278 |
{ |
279 |
get => _SelectAliveConvert; |
280 |
set |
281 |
{ |
282 |
_SelectAliveConvert = value; |
283 |
OnPropertyChanged(() => SelectAliveConvert); |
284 |
} |
285 |
} |
286 |
|
287 |
|
288 |
private StatusTypeList _StatusType; |
289 |
public StatusTypeList StatusType |
290 |
{ |
291 |
get => _StatusType; |
292 |
set |
293 |
{ |
294 |
_StatusType = value; |
295 |
OnPropertyChanged(() => StatusType); |
296 |
} |
297 |
} |
298 |
|
299 |
private bool _IsLoading; |
300 |
public bool IsLoading |
301 |
{ |
302 |
get => _IsLoading; |
303 |
set |
304 |
{ |
305 |
if (_IsLoading != value) |
306 |
{ |
307 |
_IsLoading = value; |
308 |
OnPropertyChanged(() => IsLoading); |
309 |
} |
310 |
} |
311 |
} |
312 |
|
313 |
IEnumerable<Telerik.Windows.Data.EnumMemberViewModel> _StatusCodeList; |
314 |
public IEnumerable<Telerik.Windows.Data.EnumMemberViewModel> StatusCodeList |
315 |
{ |
316 |
get |
317 |
{ |
318 |
if (_StatusCodeList == null) |
319 |
{ |
320 |
_StatusCodeList = Telerik.Windows.Data.EnumDataSource.FromType<StatusCodeType>(); |
321 |
} |
322 |
|
323 |
return _StatusCodeList; |
324 |
} |
325 |
} |
326 |
|
327 |
public ProjectName _ProjectNumberFilter; |
328 |
public ProjectName ProjectNumberFilter |
329 |
{ |
330 |
get |
331 |
{ |
332 |
if (_ProjectNumberFilter == null) |
333 |
{ |
334 |
_ProjectNumberFilter = new ProjectName(); |
335 |
} |
336 |
return _ProjectNumberFilter; |
337 |
} |
338 |
set |
339 |
{ |
340 |
_ProjectNumberFilter = value; |
341 |
OnPropertyChanged(() => ProjectNumberFilter); |
342 |
} |
343 |
} |
344 |
|
345 |
public string _DocumentIDFilter; |
346 |
public string DocumentIDFilter |
347 |
{ |
348 |
get |
349 |
{ |
350 |
return _DocumentIDFilter; |
351 |
} |
352 |
set |
353 |
{ |
354 |
if (_DocumentIDFilter == "") |
355 |
{ |
356 |
_DocumentIDFilter = null; |
357 |
} |
358 |
else if (_DocumentIDFilter != value) |
359 |
{ |
360 |
_DocumentIDFilter = value; |
361 |
OnPropertyChanged(() => DocumentIDFilter); |
362 |
} |
363 |
} |
364 |
} |
365 |
|
366 |
public string _DOCINFO_IDFilter; |
367 |
public string DOCINFO_IDFilter |
368 |
{ |
369 |
get |
370 |
{ |
371 |
return _DOCINFO_IDFilter; |
372 |
} |
373 |
set |
374 |
{ |
375 |
if (_DOCINFO_IDFilter == "") |
376 |
{ |
377 |
_DOCINFO_IDFilter = null; |
378 |
} |
379 |
else if (_DOCINFO_IDFilter != value) |
380 |
{ |
381 |
_DOCINFO_IDFilter = value; |
382 |
OnPropertyChanged(() => DOCINFO_IDFilter); |
383 |
} |
384 |
} |
385 |
} |
386 |
|
387 |
public string _Document_URLFilter; |
388 |
public string Document_URLFilter |
389 |
{ |
390 |
get |
391 |
{ |
392 |
return _Document_URLFilter; |
393 |
} |
394 |
set |
395 |
{ |
396 |
if (_Document_URLFilter != value) |
397 |
{ |
398 |
_Document_URLFilter = value; |
399 |
OnPropertyChanged(() => Document_URLFilter); |
400 |
} |
401 |
} |
402 |
} |
403 |
|
404 |
public string _MarkupInfo_IDFilter; |
405 |
public string MarkupInfo_IDFilter |
406 |
{ |
407 |
get |
408 |
{ |
409 |
return _MarkupInfo_IDFilter; |
410 |
} |
411 |
set |
412 |
{ |
413 |
if (_MarkupInfo_IDFilter != value) |
414 |
{ |
415 |
_MarkupInfo_IDFilter = value; |
416 |
OnPropertyChanged(() => MarkupInfo_IDFilter); |
417 |
} |
418 |
} |
419 |
} |
420 |
|
421 |
public string _CreateUser_IDFilter; |
422 |
public string CreateUser_IDFilter |
423 |
{ |
424 |
get |
425 |
{ |
426 |
return _CreateUser_IDFilter; |
427 |
} |
428 |
set |
429 |
{ |
430 |
if (_CreateUser_IDFilter == "") |
431 |
{ |
432 |
_CreateUser_IDFilter = null; |
433 |
} |
434 |
else if (_CreateUser_IDFilter != value) |
435 |
{ |
436 |
_CreateUser_IDFilter = value; |
437 |
OnPropertyChanged(() => CreateUser_IDFilter); |
438 |
} |
439 |
} |
440 |
} |
441 |
|
442 |
public string _GROUP_NOFilter; |
443 |
public string GROUP_NOFilter |
444 |
{ |
445 |
get |
446 |
{ |
447 |
return _GROUP_NOFilter; |
448 |
} |
449 |
set |
450 |
{ |
451 |
if (_GROUP_NOFilter == "") |
452 |
{ |
453 |
_GROUP_NOFilter = null; |
454 |
} |
455 |
else if (_GROUP_NOFilter != value) |
456 |
{ |
457 |
_GROUP_NOFilter = value; |
458 |
OnPropertyChanged(() => GROUP_NOFilter); |
459 |
} |
460 |
} |
461 |
} |
462 |
|
463 |
public string _REVISIONFilter; |
464 |
public string REVISIONFilter |
465 |
{ |
466 |
get |
467 |
{ |
468 |
return _REVISIONFilter; |
469 |
} |
470 |
set |
471 |
{ |
472 |
if (_REVISIONFilter == "") |
473 |
{ |
474 |
_REVISIONFilter = null; |
475 |
} |
476 |
else if (_REVISIONFilter != value) |
477 |
{ |
478 |
_REVISIONFilter = value; |
479 |
OnPropertyChanged(() => REVISIONFilter); |
480 |
} |
481 |
} |
482 |
} |
483 |
|
484 |
public StatusCodeType _ConvertStateFilter; |
485 |
public StatusCodeType ConvertStateFilter |
486 |
{ |
487 |
get { return _ConvertStateFilter; } |
488 |
set |
489 |
{ |
490 |
if (_ConvertStateFilter != value) |
491 |
{ |
492 |
_ConvertStateFilter = value; |
493 |
OnPropertyChanged(() => ConvertStateFilter); |
494 |
} |
495 |
} |
496 |
} |
497 |
|
498 |
public string _Document_NOFilter; |
499 |
public string Document_NOFilter |
500 |
{ |
501 |
get { return _Document_NOFilter; } |
502 |
set |
503 |
{ |
504 |
if (_Document_NOFilter == "") |
505 |
{ |
506 |
_Document_NOFilter = null; |
507 |
} |
508 |
else if (_Document_NOFilter != value) |
509 |
{ |
510 |
_Document_NOFilter = value; |
511 |
OnPropertyChanged(() => Document_NOFilter); |
512 |
} |
513 |
} |
514 |
} |
515 |
|
516 |
public string _Exception; |
517 |
public string Exception |
518 |
{ |
519 |
get { return _Exception; } |
520 |
set |
521 |
{ |
522 |
if (_Exception == "") |
523 |
{ |
524 |
_Exception = null; |
525 |
} |
526 |
else if (_Exception != value) |
527 |
{ |
528 |
_Exception = value; |
529 |
OnPropertyChanged(() => Exception); |
530 |
} |
531 |
} |
532 |
} |
533 |
|
534 |
public string _Document_NameFilter; |
535 |
public string Document_NameFilter |
536 |
{ |
537 |
get { return _Document_NameFilter; } |
538 |
set |
539 |
{ |
540 |
if (_Document_NameFilter == "") |
541 |
{ |
542 |
_Document_NameFilter = null; |
543 |
} |
544 |
else if (_Document_NameFilter != value) |
545 |
{ |
546 |
_Document_NameFilter = value; |
547 |
OnPropertyChanged(() => Document_NameFilter); |
548 |
} |
549 |
} |
550 |
} |
551 |
|
552 |
|
553 |
static DateTime DefaultCreateTime = DateTime.Now.AddHours(-1); |
554 |
private DateTime _SelectedCreateTimeBegin = DefaultCreateTime; |
555 |
public DateTime SelectedCreateTimeBegin |
556 |
{ |
557 |
|
558 |
get { return _SelectedCreateTimeBegin; } |
559 |
set |
560 |
{ |
561 |
if (_SelectedCreateTimeBegin == value) |
562 |
return; |
563 |
_SelectedCreateTimeBegin = value; |
564 |
OnPropertyChanged(() => SelectedCreateTimeBegin); |
565 |
|
566 |
} |
567 |
} |
568 |
|
569 |
private DateTime _SelectedCreateTimeEnd = DefaultCreateTime; |
570 |
public DateTime SelectedCreateTimeEnd |
571 |
{ |
572 |
|
573 |
get { return _SelectedCreateTimeEnd; } |
574 |
set |
575 |
{ |
576 |
if (_SelectedCreateTimeEnd == value) |
577 |
return; |
578 |
_SelectedCreateTimeEnd = value; |
579 |
OnPropertyChanged(() => SelectedCreateTimeEnd); |
580 |
} |
581 |
} |
582 |
|
583 |
public int _DataBase_ItemsHeight = 800; |
584 |
public int DataBase_ItemsHeight |
585 |
{ |
586 |
get { return _DataBase_ItemsHeight; } |
587 |
set |
588 |
{ |
589 |
_DataBase_ItemsHeight = value; |
590 |
OnPropertyChanged(() => DataBase_ItemsHeight); |
591 |
} |
592 |
} |
593 |
|
594 |
|
595 |
public int _RealConvert_Height = 80; |
596 |
public int RealConvert_Height |
597 |
{ |
598 |
get { return _RealConvert_Height; } |
599 |
set |
600 |
{ |
601 |
_RealConvert_Height = value; |
602 |
OnPropertyChanged(() => RealConvert_Height); |
603 |
} |
604 |
} |
605 |
|
606 |
public int _Alive_Height = 80; |
607 |
public int Alive_Height |
608 |
{ |
609 |
get { return _Alive_Height; } |
610 |
set |
611 |
{ |
612 |
_Alive_Height = value; |
613 |
OnPropertyChanged(() => Alive_Height); |
614 |
} |
615 |
} |
616 |
|
617 |
public bool _ConvertShow; |
618 |
public bool ConvertShow |
619 |
{ |
620 |
get => _ConvertShow; |
621 |
set |
622 |
{ |
623 |
if (_ConvertShow = !value) |
624 |
{ |
625 |
_ConvertShow = false; |
626 |
} |
627 |
_ConvertShow = value; |
628 |
OnPropertyChanged(() => ConvertShow); |
629 |
} |
630 |
} |
631 |
|
632 |
public bool _AliveShow; |
633 |
public bool AliveShow |
634 |
{ |
635 |
get => _AliveShow; |
636 |
set |
637 |
{ |
638 |
if (_AliveShow = !value) |
639 |
{ |
640 |
_AliveShow = false; |
641 |
} |
642 |
_AliveShow = value; |
643 |
OnPropertyChanged(() => AliveShow); |
644 |
} |
645 |
} |
646 |
|
647 |
|
648 |
private bool _ExcptionCheck = false; |
649 |
public bool ExcptionCheck |
650 |
{ |
651 |
get |
652 |
{ |
653 |
return _ExcptionCheck; |
654 |
} |
655 |
set |
656 |
{ |
657 |
_ExcptionCheck = value; |
658 |
OnPropertyChanged(() => ExcptionCheck); |
659 |
} |
660 |
} |
661 |
|
662 |
public bool _SearchTimerOn = false; |
663 |
public bool SearchTimerOn |
664 |
{ |
665 |
get => _SearchTimerOn; |
666 |
set |
667 |
{ |
668 |
if (_SearchTimerOn = !value) |
669 |
{ |
670 |
_SearchTimerOn = false; |
671 |
} |
672 |
_SearchTimerOn = value; |
673 |
OnPropertyChanged(() => SearchTimerOn); |
674 |
} |
675 |
} |
676 |
|
677 |
#endregion |
678 |
|
679 |
#region Command |
680 |
|
681 |
public DelegateCommand ConvertCommand { get; private set; } |
682 |
public DelegateCommand DeleteCommand { get; private set; } |
683 |
public DelegateCommand ValidateCommand { get; private set; } |
684 |
public DelegateCommand DataSaveFileGemBoxCommand { get; private set; } |
685 |
public DelegateCommand MarkusLinkCommand { get; private set; } |
686 |
public DelegateCommand RemoveCreateTimeFilterCommand { get; private set; } |
687 |
|
688 |
public DelegateCommand DataFilterCommand { get; private set; } |
689 |
public DelegateCommand ResetCommand { get; private set; } |
690 |
public DelegateCommand ConverAddCommand { get; private set; } |
691 |
public DelegateCommand FinalPDFPathFileSearchCommand { get; private set; } |
692 |
public DelegateCommand Stop_ProcessCommand { get; private set; } |
693 |
|
694 |
#endregion |
695 |
|
696 |
#region Main Logic |
697 |
|
698 |
/// <summary> |
699 |
/// 각각의 Grid row 객체들 업데이트 |
700 |
/// </summary> |
701 |
|
702 |
private DispatcherTimer dispatcherTimer; |
703 |
public override void Loaded() |
704 |
{ |
705 |
base.Loaded(); |
706 |
|
707 |
if (!App.IsDesignMode) |
708 |
{ |
709 |
dispatcherTimer = new DispatcherTimer(); |
710 |
dispatcherTimer.Tick += new EventHandler(Timer_Tick); |
711 |
dispatcherTimer.Interval = new TimeSpan(0, 0, 1); |
712 |
dispatcherTimer.Start(); |
713 |
} |
714 |
} |
715 |
|
716 |
private async void Timer_Tick(object sender, EventArgs e) |
717 |
{ |
718 |
dispatcherTimer.Stop(); |
719 |
|
720 |
if (IsAcitve) |
721 |
{ |
722 |
await App.Current.Dispatcher.InvokeAsync(() => |
723 |
{ |
724 |
DataSelect(); |
725 |
|
726 |
AliveDataSelect(); |
727 |
}); |
728 |
} |
729 |
|
730 |
await Task.Delay(5000); |
731 |
|
732 |
System.Threading.Thread.Sleep(new TimeSpan(0, 0, 0, 0, 100)); |
733 |
|
734 |
dispatcherTimer.Start(); |
735 |
} |
736 |
|
737 |
private async void SearchTimer_Tick(object sender, EventArgs e) |
738 |
{ |
739 |
dispatcherTimer.Stop(); |
740 |
|
741 |
if (IsAcitve) |
742 |
{ |
743 |
await App.Current.Dispatcher.InvokeAsync(() => |
744 |
{ |
745 |
DataSearch(new[] { (StatusCodeType)(SelectedStatus.Value) }, FilterConvertSource); |
746 |
|
747 |
RealDataSelect(new[] { StatusCodeType.None, StatusCodeType.Wait, StatusCodeType.PageLoading, StatusCodeType.Saving }, RealConvertSource); |
748 |
|
749 |
AliveDataSelect(); |
750 |
}); |
751 |
} |
752 |
|
753 |
await Task.Delay(5000); |
754 |
|
755 |
dispatcherTimer.Start(); |
756 |
} |
757 |
|
758 |
|
759 |
public override void Closed() |
760 |
{ |
761 |
if (dispatcherTimer != null) |
762 |
{ |
763 |
dispatcherTimer.Stop(); |
764 |
} |
765 |
|
766 |
base.Closed(); |
767 |
} |
768 |
|
769 |
|
770 |
#endregion |
771 |
|
772 |
#region Function |
773 |
|
774 |
#region Return_FilterConvertSource |
775 |
|
776 |
public static void Return_FilterConvertSource(ObservableCollection<FinalPDF> convertPDFs) |
777 |
{ |
778 |
ConvertSource = new ObservableCollection<FinalPDF>(); |
779 |
ConvertSource = convertPDFs; |
780 |
} |
781 |
|
782 |
public static ObservableCollection<FinalPDF> Return_FilterConvertSource() |
783 |
{ |
784 |
return ConvertSource; |
785 |
} |
786 |
|
787 |
|
788 |
#endregion |
789 |
|
790 |
#region Data Select |
791 |
|
792 |
/// <summary> |
793 |
/// 상단 그리드 중앙 그리드 출력 데이터 |
794 |
/// </summary> |
795 |
private void DataSelect() |
796 |
{ |
797 |
|
798 |
if (FilterConvertSource == null) |
799 |
{ |
800 |
FilterConvertSource = new System.Collections.ObjectModel.ObservableCollection<FinalPDF>(); |
801 |
} |
802 |
|
803 |
if (RealConvertSource == null) |
804 |
{ |
805 |
RealConvertSource = new System.Collections.ObjectModel.ObservableCollection<FinalPDF>(); |
806 |
} |
807 |
|
808 |
/// combobox 에서 선택된 items |
809 |
if (SelectedStatus != null) |
810 |
{ |
811 |
DataSelect(new[] { (StatusCodeType)(SelectedStatus.Value) }, FilterConvertSource); |
812 |
} |
813 |
|
814 |
/// 컨버터중인 items |
815 |
RealDataSelect(new[] { StatusCodeType.None, StatusCodeType.Wait, StatusCodeType.PageLoading, StatusCodeType.Saving }, RealConvertSource); |
816 |
|
817 |
} |
818 |
|
819 |
private async void RealDataSelect(IEnumerable<StatusCodeType> statusCodeTypeList, System.Collections.ObjectModel.ObservableCollection<FinalPDF> collection) |
820 |
{ |
821 |
try |
822 |
{ |
823 |
IEnumerable<FinalPDF> Listitems = Enumerable.Empty<FinalPDF>(); |
824 |
|
825 |
foreach (var coll in collection) |
826 |
{ |
827 |
Listitems = from x in await WcfClient.GET_SELECT_FINAL_PDF_ITEMAsync(coll.ConvertID, coll.ProjectNumber, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null) |
828 |
let MarkusLink = "kcom://" + CreateMarkusParam(x.PROJECT_NO, x.DOCUMENT_ID, "doftech") |
829 |
select new FinalPDF(x.ID, x.PROJECT_NO, x.STATUS, x.DOCUMENT_ID, x.MARKUPINFO_ID, x.DOCINFO_ID, x.DOCUMENT_NAME, x.DOCUMENT_NO, x.CREATE_USER_ID, x.REVISION, x.CURRENT_PAGE, |
830 |
x.TOTAL_PAGE, x.EXCEPTION, x.GROUP_NO, x.CREATE_DATETIME, x.START_DATETIME, x.END_DATETIME, x.ORIGINAL_FILE, x.CONVERT_PATH, MarkusLink); |
831 |
|
832 |
} |
833 |
|
834 |
foreach (var Listitem in Listitems) |
835 |
{ |
836 |
collection.UpdateWhere(changeitem => |
837 |
ConvertItemEx.ChangeValues(changeitem, Listitem), x => x.ProjectNumber == Listitem.ProjectNumber && x.ConvertID == Listitem.ConvertID); |
838 |
} |
839 |
|
840 |
RealConvert_Height = 80 + (10 * collection.Count()); |
841 |
DataBase_ItemsHeight = 800 - (RealConvert_Height + Alive_Height); |
842 |
} |
843 |
catch (Exception ex) |
844 |
{ |
845 |
MessageBox.Show(ex.ToString()); |
846 |
} |
847 |
} |
848 |
|
849 |
private async void DataSelect(IEnumerable<StatusCodeType> statusCodeTypeList, System.Collections.ObjectModel.ObservableCollection<FinalPDF> collection) |
850 |
{ |
851 |
try |
852 |
{ |
853 |
int _status = 0; |
854 |
if (SelectedStatus != null) |
855 |
{ |
856 |
_status = (int)SelectedStatus.Value; |
857 |
} |
858 |
|
859 |
if (ProjectNames.Count() == 0) |
860 |
{ |
861 |
ProjectName Clear = new ProjectName("Clear", "Clear"); |
862 |
ProjectNames.Add(Clear); |
863 |
foreach (var x in await WcfClient.GET_SELECT_RUN_PROJECTSAsync(0)) |
864 |
{ |
865 |
ProjectName projectName = new ProjectName(x.PROJECT_NO, x.PROJECT_NAME); |
866 |
ProjectNames.Add(projectName); |
867 |
} |
868 |
} |
869 |
|
870 |
var Listitems = from x in await WcfClient.GET_SELECT_FINAL_PDF_ITEMAsync(null, null, null, null, null, null, null, null, _status, SelectedCount.ValueMember, null, null, null, null, null, null, null, null, null, null) |
871 |
let MarkusLink = "kcom://" + CreateMarkusParam(x.ID, x.DOCUMENT_ID, "doftech") |
872 |
select new FinalPDF(x.ID, x.PROJECT_NO, x.STATUS, x.DOCUMENT_ID, x.MARKUPINFO_ID, x.DOCINFO_ID, x.DOCUMENT_NAME, x.DOCUMENT_NO, x.CREATE_USER_ID, |
873 |
x.REVISION, x.CURRENT_PAGE, x.TOTAL_PAGE, x.EXCEPTION, x.GROUP_NO, x.CREATE_DATETIME, x.START_DATETIME, x.END_DATETIME |
874 |
, x.ORIGINAL_FILE, x.CONVERT_PATH, MarkusLink); |
875 |
|
876 |
if (collection.Count() == 0) |
877 |
{ |
878 |
if (statusCodeTypeList.Count() == 1) |
879 |
{ |
880 |
foreach (var x in Listitems) |
881 |
{ |
882 |
collection.Add(x); |
883 |
} |
884 |
} |
885 |
} |
886 |
else |
887 |
{ |
888 |
foreach (var newitem in Listitems) |
889 |
{ |
890 |
collection.UpdateWhere(changeitem => |
891 |
ConvertItemEx.ChangeValues(changeitem, newitem), x => x.ProjectNumber == newitem.ProjectNumber && x.ConvertID == newitem.ConvertID); |
892 |
} |
893 |
|
894 |
if (statusCodeTypeList.Count() == 1) |
895 |
{ |
896 |
for (int i = collection.Count() - 1; i >= 0; --i) |
897 |
{ |
898 |
var item = collection[i]; |
899 |
|
900 |
if (Listitems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0) |
901 |
{ |
902 |
collection.RemoveAt(i); |
903 |
} |
904 |
} |
905 |
} |
906 |
|
907 |
if (statusCodeTypeList.Count() == 1) |
908 |
{ |
909 |
foreach (var item in Listitems) |
910 |
{ |
911 |
if (collection.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0) |
912 |
{ |
913 |
for (int i = 0; i < 200; i++) |
914 |
{ |
915 |
if (i < collection.Count() - 1) |
916 |
{ |
917 |
if (DateTime.Compare(collection[i].CreateTime, item.CreateTime) < 0) |
918 |
{ |
919 |
collection.Insert(i, item); |
920 |
break; |
921 |
} |
922 |
} |
923 |
else |
924 |
{ |
925 |
collection.Add(item); |
926 |
break; |
927 |
} |
928 |
} |
929 |
|
930 |
} |
931 |
|
932 |
} |
933 |
} |
934 |
} |
935 |
} |
936 |
catch (Exception ex) |
937 |
{ |
938 |
MessageBox.Show(ex.ToString()); |
939 |
System.Diagnostics.Debug.WriteLine(ex.ToString()); |
940 |
} |
941 |
} |
942 |
|
943 |
private async void DataSearch(IEnumerable<StatusCodeType> statusCodeTypeList, System.Collections.ObjectModel.ObservableCollection<FinalPDF> collection) |
944 |
{ |
945 |
try |
946 |
{ |
947 |
int _status = 0; |
948 |
if (SelectedStatus != null) |
949 |
{ |
950 |
_status = (int)SelectedStatus.Value; |
951 |
} |
952 |
|
953 |
DateTime? Start_CreateTime = null; |
954 |
DateTime? Finish_CreateTime = null; |
955 |
if (SelectedCreateTimeBegin != DefaultCreateTime) |
956 |
{ |
957 |
Start_CreateTime = SelectedCreateTimeBegin; |
958 |
} |
959 |
if (SelectedCreateTimeEnd != DefaultCreateTime) |
960 |
{ |
961 |
Finish_CreateTime = SelectedCreateTimeEnd; |
962 |
} |
963 |
|
964 |
if (ProjectNames.Count() == 0) |
965 |
{ |
966 |
foreach (var x in await WcfClient.GET_SELECT_RUN_PROJECTSAsync(0)) |
967 |
{ |
968 |
ProjectName projectName = new ProjectName(x.PROJECT_NO, x.PROJECT_NAME); |
969 |
ProjectNames.Add(projectName); |
970 |
} |
971 |
} |
972 |
|
973 |
var Listitems = from x in await WcfClient.GET_SELECT_FINAL_PDF_ITEMAsync(null, ProjectNumberFilter.Project_NO, DocumentIDFilter, MarkupInfo_IDFilter, DOCINFO_IDFilter, Document_NameFilter, Document_NOFilter, |
974 |
CreateUser_IDFilter, _status, SelectedCount.ValueMember, GROUP_NOFilter, REVISIONFilter, Start_CreateTime, Finish_CreateTime, null, null, null, null, Document_URLFilter, ExcptionCheck) |
975 |
let MarkusLink = "kcom://" + CreateMarkusParam(x.ID, x.DOCUMENT_ID, "doftech") |
976 |
select new FinalPDF(x.ID, x.PROJECT_NO, x.STATUS, x.DOCUMENT_ID, x.MARKUPINFO_ID, x.DOCINFO_ID, x.DOCUMENT_NAME, x.DOCUMENT_NO, x.CREATE_USER_ID, |
977 |
x.REVISION, x.CURRENT_PAGE, x.TOTAL_PAGE, x.EXCEPTION, x.GROUP_NO, x.CREATE_DATETIME, x.START_DATETIME, x.END_DATETIME |
978 |
, x.ORIGINAL_FILE, x.CONVERT_PATH, MarkusLink); |
979 |
|
980 |
if (collection.Count() == 0) |
981 |
{ |
982 |
if (statusCodeTypeList.Count() == 1) |
983 |
{ |
984 |
foreach (var x in Listitems) |
985 |
{ |
986 |
collection.Add(x); |
987 |
} |
988 |
} |
989 |
} |
990 |
else |
991 |
{ |
992 |
foreach (var newitem in Listitems) |
993 |
{ |
994 |
collection.UpdateWhere(changeitem => |
995 |
ConvertItemEx.ChangeValues(changeitem, newitem), x => x.ProjectNumber == newitem.ProjectNumber && x.ConvertID == newitem.ConvertID); |
996 |
} |
997 |
|
998 |
if (statusCodeTypeList.Count() == 1) |
999 |
{ |
1000 |
|
1001 |
for (int i = collection.Count() - 1; i >= 0; --i) |
1002 |
{ |
1003 |
var item = collection[i]; |
1004 |
|
1005 |
if (Listitems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0) |
1006 |
{ |
1007 |
collection.RemoveAt(i); |
1008 |
} |
1009 |
} |
1010 |
} |
1011 |
|
1012 |
if (statusCodeTypeList.Count() == 1) |
1013 |
{ |
1014 |
foreach (var item in Listitems) |
1015 |
{ |
1016 |
if (collection.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0) |
1017 |
{ |
1018 |
for (int i = 0; i < 200; i++) |
1019 |
{ |
1020 |
if (i < collection.Count() - 1) |
1021 |
{ |
1022 |
if (DateTime.Compare(collection[i].CreateTime, item.CreateTime) < 0) |
1023 |
{ |
1024 |
collection.Insert(i, item); |
1025 |
break; |
1026 |
} |
1027 |
} |
1028 |
else |
1029 |
{ |
1030 |
collection.Add(item); |
1031 |
break; |
1032 |
} |
1033 |
} |
1034 |
|
1035 |
} |
1036 |
|
1037 |
} |
1038 |
} |
1039 |
|
1040 |
} |
1041 |
} |
1042 |
catch (Exception ex) |
1043 |
{ |
1044 |
MessageBox.Show(ex.ToString()); |
1045 |
System.Diagnostics.Debug.WriteLine(ex.ToString()); |
1046 |
} |
1047 |
} |
1048 |
/// <summary> |
1049 |
/// 서비스의 실시간 컨버터 Item |
1050 |
/// </summary> |
1051 |
private async void AliveDataSelect() |
1052 |
{ |
1053 |
try |
1054 |
{ |
1055 |
List<FinalPDF> newitems = new List<FinalPDF>(); |
1056 |
foreach (var client in App.StationClientList) |
1057 |
{ |
1058 |
if (await SimplePingAsync(client.Endpoint.Address.ToString())) |
1059 |
{ |
1060 |
try |
1061 |
{ |
1062 |
List<FinalPDF> itemsToList = new List<FinalPDF>(); |
1063 |
var items = await client.AliveConvertListAsync(); |
1064 |
string result = ""; |
1065 |
|
1066 |
foreach (var item in items) |
1067 |
{ |
1068 |
FinalPDF itemsToEach = new FinalPDF(); |
1069 |
itemsToEach.ConvertID = item.ConvertID; |
1070 |
itemsToEach.ProjectNumber = item.ProjectNumber; |
1071 |
|
1072 |
var MarkusLink = "kcom://" + CreateMarkusParam(item.ProjectNumber, item.DocumentID, "doftech"); |
1073 |
|
1074 |
if (item.ConvertState != null) |
1075 |
{ |
1076 |
itemsToEach.ConvertState = (StatusCodeType)Enum.Parse(typeof(StatusCodeType), item.ConvertState); |
1077 |
} |
1078 |
|
1079 |
if (item.OriginfilePath.Contains("/")) |
1080 |
{ |
1081 |
result = item.OriginfilePath.Substring(item.OriginfilePath.LastIndexOf("/") + 1); |
1082 |
} |
1083 |
else |
1084 |
{ |
1085 |
result = item.OriginfilePath.Substring(item.OriginfilePath.LastIndexOf("%") + 1); |
1086 |
} |
1087 |
itemsToEach.FileName = result; |
1088 |
|
1089 |
itemsToEach.CurrentPageNo = item.CurrentPageNo; |
1090 |
itemsToEach.TotalPage = item.TotalPage; |
1091 |
itemsToEach.OriginfilePath = item.OriginfilePath; |
1092 |
itemsToEach.ConvertPath = item.ConvertPath; |
1093 |
itemsToEach.MarkusLink = MarkusLink; |
1094 |
itemsToEach.DocumentID = item.DocumentID; |
1095 |
itemsToEach.GroupNo = item.GroupNo; |
1096 |
itemsToEach.DocumentName = item.DocumnetName; |
1097 |
itemsToEach.Revision = item.Revision; |
1098 |
itemsToEach.Exception = item.Exception; |
1099 |
itemsToEach.ConvertPath = item.ConvertPath; |
1100 |
itemsToEach.CreateTime = item.CreateTime; |
1101 |
itemsToEach.StartTime = item.StartTime; |
1102 |
itemsToEach.EndTime = item.EndTime; |
1103 |
|
1104 |
itemsToList.Add(itemsToEach); |
1105 |
} |
1106 |
newitems.AddRange(itemsToList); |
1107 |
System.Diagnostics.Trace.WriteLine($"{client.Endpoint.Address} ping"); |
1108 |
|
1109 |
if (items.Count() == 0) |
1110 |
{ |
1111 |
System.Diagnostics.Trace.WriteLine($"{client.Endpoint.Address} Alive Items is zero."); |
1112 |
} |
1113 |
} |
1114 |
catch (Exception ex) |
1115 |
{ |
1116 |
System.Diagnostics.Trace.Fail($"{client.Endpoint.Address} {ex.Message}"); |
1117 |
} |
1118 |
} |
1119 |
else |
1120 |
{ |
1121 |
System.Diagnostics.Trace.Fail($"{client.Endpoint.Address} ping Error"); |
1122 |
} |
1123 |
|
1124 |
} |
1125 |
ItemsUpdate(newitems); |
1126 |
await System.Windows.Application.Current.Dispatcher.InvokeAsync(() => ItemsUpdate(newitems)); |
1127 |
} |
1128 |
catch (Exception ex) |
1129 |
{ |
1130 |
System.Diagnostics.Debug.WriteLine(ex.ToString()); |
1131 |
} |
1132 |
} |
1133 |
|
1134 |
/// <summary> |
1135 |
/// AliveDataSelect의 Data Update |
1136 |
/// </summary> |
1137 |
/// <param name = "newitems" ></ param > |
1138 |
private void ItemsUpdate(List<FinalPDF> newitems) |
1139 |
{ |
1140 |
|
1141 |
foreach (var item in newitems) |
1142 |
{ |
1143 |
item.OriginfilePath = HttpUtility.UrlDecode(item.OriginfilePath); |
1144 |
} |
1145 |
|
1146 |
if (AliveItems == null) |
1147 |
{ |
1148 |
AliveItems = new System.Collections.ObjectModel.ObservableCollection<FinalPDF>(); |
1149 |
|
1150 |
foreach (var item in newitems) |
1151 |
{ |
1152 |
AliveItems.Add(item); |
1153 |
} |
1154 |
} |
1155 |
else |
1156 |
{ |
1157 |
newitems.ForEach(newitem => |
1158 |
{ |
1159 |
AliveItems.UpdateWhere(changeitem => ConvertItemEx.ChangeValues(changeitem, newitem), x => x.ProjectNumber == newitem.ProjectNumber && x.ConvertID == newitem.ConvertID); |
1160 |
}); |
1161 |
|
1162 |
foreach (var item in newitems) |
1163 |
{ |
1164 |
if (AliveItems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0) |
1165 |
{ |
1166 |
AliveItems.Add(item); |
1167 |
} |
1168 |
} |
1169 |
|
1170 |
for (int i = AliveItems.Count() - 1; i > -1; --i) |
1171 |
{ |
1172 |
var item = AliveItems[i]; |
1173 |
|
1174 |
if (newitems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0) |
1175 |
{ |
1176 |
try |
1177 |
{ |
1178 |
AliveItems.RemoveAt(i); |
1179 |
} |
1180 |
catch (Exception ex) |
1181 |
{ |
1182 |
System.Diagnostics.Debug.WriteLine(ex.ToString()); |
1183 |
} |
1184 |
} |
1185 |
} |
1186 |
} |
1187 |
|
1188 |
if (AliveItems.Count() > 1) |
1189 |
{ |
1190 |
AliveShow = true; |
1191 |
} |
1192 |
|
1193 |
Alive_Height = 80 + (newitems.Count() * 10); |
1194 |
DataBase_ItemsHeight = 800 - (RealConvert_Height + Alive_Height); |
1195 |
} |
1196 |
|
1197 |
|
1198 |
public static async Task<bool> SimplePingAsync(string uri) |
1199 |
{ |
1200 |
bool result = false; |
1201 |
|
1202 |
try |
1203 |
{ |
1204 |
using (System.Net.Http.HttpClient Client = new System.Net.Http.HttpClient()) |
1205 |
{ |
1206 |
Client.Timeout = new TimeSpan(0, 0, 60); |
1207 |
|
1208 |
var message = await Client.GetAsync(uri); |
1209 |
|
1210 |
System.Net.HttpStatusCode StatusCode = message.StatusCode; |
1211 |
|
1212 |
switch (StatusCode) |
1213 |
{ |
1214 |
|
1215 |
case System.Net.HttpStatusCode.Accepted: |
1216 |
case System.Net.HttpStatusCode.OK: |
1217 |
result = true; |
1218 |
break; |
1219 |
} |
1220 |
} |
1221 |
} |
1222 |
catch (Exception ex) |
1223 |
{ |
1224 |
result = false; |
1225 |
System.Diagnostics.Debug.WriteLine(ex.ToString()); |
1226 |
} |
1227 |
|
1228 |
return result; |
1229 |
} |
1230 |
|
1231 |
#endregion |
1232 |
|
1233 |
#region Data Convert |
1234 |
|
1235 |
private async void DataConvert(object obj) |
1236 |
{ |
1237 |
if (SelectFilterConvert == null && SelectRealConvert == null) |
1238 |
{ |
1239 |
MessageBox.Show("왼쪽 버튼 클릭 후 Converter 해주세요!"); |
1240 |
} |
1241 |
else |
1242 |
{ |
1243 |
var resultRealConvert = 0; |
1244 |
var resultFiltertConvert = 0; |
1245 |
|
1246 |
if (SelectRealConvert != null) |
1247 |
{ |
1248 |
resultRealConvert = SetCleanUpItem(SelectRealConvert).Result; |
1249 |
} |
1250 |
else if (SelectFilterConvert != null) |
1251 |
{ |
1252 |
resultFiltertConvert = SetCleanUpItem(SelectFilterConvert).Result; |
1253 |
} |
1254 |
System.Diagnostics.Debug.WriteLine(resultRealConvert + " " + resultFiltertConvert); |
1255 |
|
1256 |
var items = from x in await WcfClient.GET_SELECT_FINAL_PDF_ITEMAsync(SelectFilterConvert.ConvertID, null, null, null, null, null, null, null, null, 1, null, null, null, null, null, null, null, null, null, null) |
1257 |
let MarkusLink = "kcom://" + CreateMarkusParam(x.ID, x.DOCUMENT_ID, "doftech") |
1258 |
select new FinalPDF(x.ID, x.PROJECT_NO, x.STATUS, x.DOCUMENT_ID, x.MARKUPINFO_ID, x.DOCINFO_ID, x.DOCUMENT_NAME, x.DOCUMENT_NO, x.CREATE_USER_ID, |
1259 |
x.REVISION, x.CURRENT_PAGE, x.TOTAL_PAGE, x.EXCEPTION, x.GROUP_NO, x.CREATE_DATETIME, x.START_DATETIME, x.END_DATETIME |
1260 |
, x.ORIGINAL_FILE, x.CONVERT_PATH, MarkusLink); |
1261 |
|
1262 |
|
1263 |
foreach (var item in items) |
1264 |
{ |
1265 |
|
1266 |
RealConvertSource.Add(item); |
1267 |
|
1268 |
if (RealConvertSource.Count() == 1) |
1269 |
{ |
1270 |
ConvertShow = true; |
1271 |
} |
1272 |
} |
1273 |
} |
1274 |
} |
1275 |
|
1276 |
|
1277 |
public async Task<int> SetCleanUpItem(FinalPDF _ConvertItem) |
1278 |
{ |
1279 |
int result = 0; |
1280 |
|
1281 |
var items = await WcfClient.GET_SELECT_FINAL_PDF_ITEMAsync(_ConvertItem.ConvertID, null, null, null, null, null, null, null, null, 1, null, null, null, null, null, null, null, null, null, null); |
1282 |
|
1283 |
if (items.Count() > 0) |
1284 |
{ |
1285 |
var item = items.First(); |
1286 |
|
1287 |
var _CREATE_DATETIME = DateTime.Now.AddHours(-1); |
1288 |
var _STATUS = (int)StatusCodeType.None; |
1289 |
|
1290 |
await WcfClient.GET_SELECT_RERECONVERT_ITEMAsync(_ConvertItem.ConvertID, 0, _CREATE_DATETIME, _STATUS, null); |
1291 |
|
1292 |
} |
1293 |
|
1294 |
return result; |
1295 |
} |
1296 |
|
1297 |
public static string CreateMarkusParam(string projectNo, string documentID, string userID) |
1298 |
{ |
1299 |
ViewInfo viewInfo = new ViewInfo(); |
1300 |
|
1301 |
viewInfo.DocumentItemID = documentID; |
1302 |
viewInfo.ProjectNO = projectNo; |
1303 |
viewInfo.UserID = userID; |
1304 |
|
1305 |
return ParamEncoding(JsonConvert.SerializeObject(viewInfo)); |
1306 |
|
1307 |
} |
1308 |
|
1309 |
public static string ParamEncoding(string EncodingText, System.Text.Encoding oEncoding = null) |
1310 |
{ |
1311 |
|
1312 |
if (oEncoding == null) |
1313 |
oEncoding = System.Text.Encoding.UTF8; |
1314 |
|
1315 |
return Convert.ToBase64String(oEncoding.GetBytes(EncodingText)); |
1316 |
|
1317 |
} |
1318 |
|
1319 |
#endregion |
1320 |
|
1321 |
#region Validation |
1322 |
|
1323 |
private void DataValidate(object obj) |
1324 |
{ |
1325 |
|
1326 |
bool result = false; |
1327 |
|
1328 |
WebRequest webRequest = WebRequest.Create(SelectFilterConvert.OriginfilePath); |
1329 |
webRequest.Timeout = 1200; // miliseconds |
1330 |
webRequest.Method = "HEAD"; |
1331 |
|
1332 |
HttpWebResponse response = null; |
1333 |
|
1334 |
try |
1335 |
{ |
1336 |
response = (HttpWebResponse)webRequest.GetResponse(); |
1337 |
result = true; |
1338 |
} |
1339 |
catch (WebException webException) |
1340 |
{ |
1341 |
MessageBox.Show(SelectFilterConvert.FileName + " doesn't exist: " + webException.Message); |
1342 |
result = true; |
1343 |
} |
1344 |
finally |
1345 |
{ |
1346 |
if (response != null) |
1347 |
{ |
1348 |
response.Close(); |
1349 |
} |
1350 |
} |
1351 |
if (result == true) |
1352 |
{ |
1353 |
MessageBox.Show("File exists"); |
1354 |
} |
1355 |
} |
1356 |
|
1357 |
#endregion |
1358 |
|
1359 |
#region Data Delete |
1360 |
|
1361 |
private void DataDelete(object obj) |
1362 |
{ |
1363 |
RadWindow.Alert("do you want to delete it??", this.OnClosed); |
1364 |
} |
1365 |
|
1366 |
private async void OnClosed(object sender, WindowClosedEventArgs e) |
1367 |
{ |
1368 |
var result = e.DialogResult; |
1369 |
if (result == true) |
1370 |
{ |
1371 |
if (SelectFilterConvertList.Count() > 1) |
1372 |
{ |
1373 |
MessageBox.Show("하나만 클릭해 주세요!"); |
1374 |
} |
1375 |
else |
1376 |
{ |
1377 |
if (SelectRealConvert != null) |
1378 |
{ |
1379 |
await WcfClient.GET_SELECT_CONVERT_DELETEAsync(SelectRealConvert.ConvertID); |
1380 |
} |
1381 |
if (SelectFilterConvertList != null) |
1382 |
{ |
1383 |
await WcfClient.GET_SELECT_CONVERT_DELETEAsync(SelectFilterConvertList[0].ConvertID); |
1384 |
} |
1385 |
} |
1386 |
} |
1387 |
} |
1388 |
|
1389 |
|
1390 |
#endregion |
1391 |
|
1392 |
#region Stop Process |
1393 |
|
1394 |
private void Stop_Process(object obj) |
1395 |
{ |
1396 |
if (SelectFilterConvertList.Count() > 1) |
1397 |
{ |
1398 |
MessageBox.Show("하나만 클릭해 주세요"); |
1399 |
} |
1400 |
else |
1401 |
{ |
1402 |
RadWindow.Alert("프로세스 종료 할까요??", this.ON_Stop_Process); |
1403 |
|
1404 |
} |
1405 |
|
1406 |
} |
1407 |
|
1408 |
private void ON_Stop_Process(object sender, WindowClosedEventArgs e) |
1409 |
{ |
1410 |
var result = e.DialogResult; |
1411 |
if (result == true) |
1412 |
{ |
1413 |
var process = Process.GetProcessesByName("Markus.Service.ConvertProcess"); |
1414 |
|
1415 |
for (int i = process.Count() - 1; i >= 0; i--) |
1416 |
{ |
1417 |
try |
1418 |
{ |
1419 |
var commandLines = process[i].Arguments().CommandLine; |
1420 |
|
1421 |
if (commandLines.Count() > 0) |
1422 |
{ |
1423 |
if (commandLines[0] == "TEST" && commandLines[1] == "1") |
1424 |
{ |
1425 |
process[i].Kill(); |
1426 |
} |
1427 |
//if (AliveItems.Count(f => f.ConvertID == commandLines[0]) == 0) |
1428 |
//{ |
1429 |
// process[i].Kill(); |
1430 |
//} |
1431 |
} |
1432 |
} |
1433 |
catch (Exception ex) |
1434 |
{ |
1435 |
System.Diagnostics.Debug.WriteLine(ex.ToString()); |
1436 |
} |
1437 |
} |
1438 |
} |
1439 |
} |
1440 |
#endregion |
1441 |
|
1442 |
#region DataFilter |
1443 |
|
1444 |
public void DataFilter(object obj) |
1445 |
{ |
1446 |
SearchTimerOn = true; |
1447 |
dispatcherTimer.Tick -= new EventHandler(Timer_Tick); |
1448 |
dispatcherTimer.Tick += new EventHandler(SearchTimer_Tick); |
1449 |
} |
1450 |
|
1451 |
#endregion |
1452 |
|
1453 |
#region MarkusLink |
1454 |
|
1455 |
private void MarkusLink(object obj)///여기서 부터 |
1456 |
{ |
1457 |
if (obj is FinalPDF) |
1458 |
{ |
1459 |
if (obj != null) |
1460 |
{ |
1461 |
var convertitem = obj as FinalPDF; |
1462 |
|
1463 |
SelectFilterConvertList.Add(convertitem); |
1464 |
|
1465 |
SelectRealConvert = convertitem; |
1466 |
|
1467 |
ProcessStartInfo startInfo = null; |
1468 |
|
1469 |
startInfo = new ProcessStartInfo("iexplore.exe", convertitem.MarkusLink); |
1470 |
|
1471 |
Process.Start(startInfo); |
1472 |
} |
1473 |
} |
1474 |
} |
1475 |
|
1476 |
#endregion |
1477 |
|
1478 |
#region Data Export |
1479 |
|
1480 |
|
1481 |
/// <summary> |
1482 |
/// 필터된 상단 그리드 엑셀로 출력 |
1483 |
/// </summary> |
1484 |
|
1485 |
public void DataExportData(object obj) |
1486 |
{ |
1487 |
if (SearchTimerOn == true) |
1488 |
{ |
1489 |
dispatcherTimer.Tick -= new EventHandler(SearchTimer_Tick); |
1490 |
} |
1491 |
else |
1492 |
{ |
1493 |
dispatcherTimer.Tick -= new EventHandler(Timer_Tick); |
1494 |
} |
1495 |
|
1496 |
Return_FilterConvertSource(FilterConvertSource); |
1497 |
|
1498 |
Views.FinalPDFExcelDialog finalPDFExcelDialog = new Views.FinalPDFExcelDialog(); |
1499 |
|
1500 |
finalPDFExcelDialog.Owner = Application.Current.MainWindow; |
1501 |
finalPDFExcelDialog.WindowStartupLocation = WindowStartupLocation.CenterOwner; |
1502 |
|
1503 |
finalPDFExcelDialog.ShowDialog(); |
1504 |
|
1505 |
|
1506 |
if (SearchTimerOn == true) |
1507 |
{ |
1508 |
dispatcherTimer.Tick += new EventHandler(SearchTimer_Tick); |
1509 |
} |
1510 |
else |
1511 |
{ |
1512 |
dispatcherTimer.Tick += new EventHandler(Timer_Tick); |
1513 |
} |
1514 |
} |
1515 |
|
1516 |
#endregion |
1517 |
|
1518 |
#region Data Search |
1519 |
|
1520 |
public void RemoveCreateTimeFilter(object obj) |
1521 |
{ |
1522 |
DefaultCreateTime = DateTime.Now.AddHours(-1); ; |
1523 |
SelectedCreateTimeBegin = DefaultCreateTime; |
1524 |
SelectedCreateTimeEnd = DefaultCreateTime; |
1525 |
|
1526 |
} |
1527 |
|
1528 |
#endregion |
1529 |
|
1530 |
#region Reset |
1531 |
|
1532 |
/// <summary> |
1533 |
/// 그리드 상단 원상복귀 버튼 |
1534 |
/// 필터를 끝낸 후 다시 복귀 |
1535 |
/// </summary> |
1536 |
|
1537 |
public void Reset(object obj) |
1538 |
{ |
1539 |
SearchTimerOn = false; |
1540 |
ExcptionCheck = false; |
1541 |
SelectedInt = 10; |
1542 |
ProjectNumberFilter = ProjectNames[0]; |
1543 |
DocumentIDFilter = null; |
1544 |
MarkupInfo_IDFilter = null; |
1545 |
DOCINFO_IDFilter = null; |
1546 |
Document_NameFilter = null; |
1547 |
Document_NOFilter = null; |
1548 |
CreateUser_IDFilter = null; |
1549 |
GROUP_NOFilter = null; |
1550 |
REVISIONFilter = null; |
1551 |
|
1552 |
DefaultCreateTime = DateTime.Now.AddHours(-1); |
1553 |
SelectedCreateTimeBegin = DefaultCreateTime; |
1554 |
SelectedCreateTimeEnd = DefaultCreateTime; |
1555 |
|
1556 |
dispatcherTimer.Tick -= new EventHandler(SearchTimer_Tick); |
1557 |
dispatcherTimer.Tick += new EventHandler(Timer_Tick); |
1558 |
|
1559 |
} |
1560 |
|
1561 |
#endregion |
1562 |
|
1563 |
#region ConvertAddDialog |
1564 |
|
1565 |
/// <summary> |
1566 |
/// 그리드 상단 Conver 추가 버튼 |
1567 |
/// ProjectNo, DocumentURL, DocumentID, 입력해서 저장 프로시저에서 추가 |
1568 |
/// </summary> |
1569 |
|
1570 |
public void ConverAdd(object obj) |
1571 |
{ |
1572 |
if (SearchTimerOn == true) |
1573 |
{ |
1574 |
dispatcherTimer.Tick -= new EventHandler(SearchTimer_Tick); |
1575 |
} |
1576 |
else |
1577 |
{ |
1578 |
dispatcherTimer.Tick -= new EventHandler(Timer_Tick); |
1579 |
} |
1580 |
|
1581 |
Views.FinalPDFAddDialog convertAddDialog = new Views.FinalPDFAddDialog(); |
1582 |
|
1583 |
convertAddDialog.Owner = Application.Current.MainWindow; |
1584 |
convertAddDialog.WindowStartupLocation = WindowStartupLocation.CenterOwner; |
1585 |
|
1586 |
convertAddDialog.ShowDialog(); |
1587 |
|
1588 |
if (SearchTimerOn == true) |
1589 |
{ |
1590 |
dispatcherTimer.Tick += new EventHandler(SearchTimer_Tick); |
1591 |
} |
1592 |
else |
1593 |
{ |
1594 |
dispatcherTimer.Tick += new EventHandler(Timer_Tick); |
1595 |
} |
1596 |
} |
1597 |
|
1598 |
#endregion |
1599 |
|
1600 |
#region FinalPDFPathFileSearch |
1601 |
|
1602 |
/// <summary> |
1603 |
/// ConvertPath 파일 탐색기로 열리는 아이콘 |
1604 |
/// </summary> |
1605 |
|
1606 |
public void FinalPDFPathFileSearch(object obj) |
1607 |
{ |
1608 |
if (obj is FinalPDF) |
1609 |
{ |
1610 |
if (obj != null) |
1611 |
{ |
1612 |
var convertitem = obj as FinalPDF; |
1613 |
|
1614 |
SaveFileDialog saveFileDialog = new SaveFileDialog(); |
1615 |
|
1616 |
saveFileDialog.FileName = "Document"; // Default file name |
1617 |
saveFileDialog.DefaultExt = ".txt"; // Default file extension |
1618 |
saveFileDialog.Filter = "Csv documents (.Csv)|*.csv|Excel(2017~2019)Worksheets|*.xlsx"; // Filter files by extension |
1619 |
|
1620 |
|
1621 |
if (saveFileDialog.ShowDialog() == true) |
1622 |
{ |
1623 |
} |
1624 |
} |
1625 |
} |
1626 |
} |
1627 |
|
1628 |
#endregion |
1629 |
|
1630 |
#endregion |
1631 |
} |
1632 |
} |