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