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