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