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