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