개정판 037ab674
WCF 변경
Change-Id: Iac482667ce5ff20c3acee80186ef2356928bc6da
ConvertService/ServiceBase/Markus.Service.StationController/ViewModel/DashBoardViewModel.cs | ||
---|---|---|
31 | 31 | |
32 | 32 |
#region Properties |
33 | 33 | |
34 |
DataService.DataServiceClient WcfClient = new DataService.DataServiceClient(); |
|
35 | ||
34 | 36 |
static DateTime DefaultCreateTime = DateTime.Now; |
35 | 37 |
private DateTime _SelectedCreateTimeBegin = DefaultCreateTime; |
36 | 38 |
public DateTime SelectedCreateTimeBegin |
... | ... | |
257 | 259 |
} |
258 | 260 |
} |
259 | 261 | |
260 |
private void ConvertDataSelect(IEnumerable<ConvertPDF.StatusCodeType> statusCodeTypeList, ObservableCollection<ConvertCOUNT> collection) |
|
262 |
private async void ConvertDataSelect(IEnumerable<ConvertPDF.StatusCodeType> statusCodeTypeList, ObservableCollection<ConvertCOUNT> collection)
|
|
261 | 263 |
{ |
262 | 264 |
try |
263 | 265 |
{ |
264 |
using (markusEntities entities = new markusEntities(App.MarkusDataBaseConnecitonString)) |
|
266 |
int _status = 0; |
|
267 |
if (SelectedStatus != null) |
|
265 | 268 |
{ |
266 |
int _status = 0; |
|
267 |
if (SelectedStatus != null) |
|
268 |
{ |
|
269 |
_status = (int)SelectedStatus.Value; |
|
270 |
} |
|
271 | ||
272 |
//DocumentID = unikey |
|
273 |
DateTime? Start_CreateTime = null; |
|
274 |
DateTime? Finish_CreateTime = null; |
|
275 |
if (SelectedCreateTimeBegin != DefaultCreateTime) |
|
276 |
{ |
|
277 |
Start_CreateTime = SelectedCreateTimeBegin; |
|
278 |
} |
|
279 |
if (SelectedCreateTimeEnd != DefaultCreateTime) |
|
280 |
{ |
|
281 |
Finish_CreateTime = SelectedCreateTimeEnd; |
|
282 |
} |
|
283 | ||
284 |
var items = entities.SELECT_CONVERT_COUNT(_status, Start_CreateTime, Finish_CreateTime).ToList(); |
|
269 |
_status = (int)SelectedStatus.Value; |
|
270 |
} |
|
285 | 271 | |
286 |
List<ConvertCOUNT> Listitems = new List<ConvertCOUNT>(); |
|
272 |
//DocumentID = unikey |
|
273 |
DateTime? Start_CreateTime = null; |
|
274 |
DateTime? Finish_CreateTime = null; |
|
275 |
if (SelectedCreateTimeBegin != DefaultCreateTime) |
|
276 |
{ |
|
277 |
Start_CreateTime = SelectedCreateTimeBegin; |
|
278 |
} |
|
279 |
if (SelectedCreateTimeEnd != DefaultCreateTime) |
|
280 |
{ |
|
281 |
Finish_CreateTime = SelectedCreateTimeEnd; |
|
282 |
} |
|
287 | 283 | |
288 |
for (int i = 0; i < items.Count; i++) |
|
289 |
{ |
|
290 |
ConvertCOUNT AddItem = new ConvertCOUNT(items[i].PROJECT_NO, items[i].COUNT, items[i].EXCEPTION_COUNT); |
|
291 |
Listitems.Add(AddItem); |
|
292 |
} |
|
284 |
var Listitems = from num in await WcfClient.GET_CONVERT_COUNTAsync(_status, Start_CreateTime, Finish_CreateTime) |
|
285 |
select new ConvertCOUNT(num.PROJECT_NO, num.COUNT.Value, num.EXCEPTION_COUNT.Value); |
|
293 | 286 | |
294 |
if (collection.Count() == 0) |
|
287 |
if (collection.Count() == 0) |
|
288 |
{ |
|
289 |
if (statusCodeTypeList.Count() == 1) |
|
295 | 290 |
{ |
296 |
if (statusCodeTypeList.Count() == 1)
|
|
291 |
foreach (var x in Listitems)
|
|
297 | 292 |
{ |
298 |
foreach (var x in Listitems) |
|
299 |
{ |
|
300 |
collection.Add(x); |
|
301 |
} |
|
293 |
collection.Add(x); |
|
302 | 294 |
} |
303 | 295 |
} |
304 |
else |
|
296 |
} |
|
297 |
else |
|
298 |
{ |
|
299 | ||
300 |
//세미 업데이트 |
|
301 |
foreach (var newitem in Listitems) |
|
305 | 302 |
{ |
303 |
collection.UpdateWhere(changeitem => |
|
304 |
ConvertItemEx.ChangeValues(changeitem, newitem), x => x.Project_NO == newitem.Project_NO && x.Count == newitem.Count); |
|
305 |
} |
|
306 | 306 | |
307 |
//세미 업데이트 |
|
308 |
foreach (var newitem in Listitems) |
|
309 |
{ |
|
310 |
collection.UpdateWhere(changeitem => |
|
311 |
ConvertItemEx.ChangeValues(changeitem, newitem), x => x.Project_NO == newitem.Project_NO && x.Count == newitem.Count); |
|
312 |
} |
|
313 | 307 | |
308 |
if (statusCodeTypeList.Count() == 1) |
|
309 |
{ |
|
314 | 310 | |
315 |
if (statusCodeTypeList.Count() == 1) |
|
311 |
//삭제 |
|
312 |
for (int i = collection.Count() - 1; i >= 0; --i) |
|
316 | 313 |
{ |
314 |
var item = collection[i]; |
|
317 | 315 | |
318 |
//삭제 |
|
319 |
for (int i = collection.Count() - 1; i >= 0; --i) |
|
316 |
if (Listitems.Count(x => x.Project_NO == item.Project_NO && x.Count == item.Count) == 0) |
|
320 | 317 |
{ |
321 |
var item = collection[i]; |
|
322 | ||
323 |
if (Listitems.Count(x => x.Project_NO == item.Project_NO && x.Count == item.Count) == 0) |
|
324 |
{ |
|
325 |
collection.RemoveAt(i); |
|
326 |
} |
|
318 |
collection.RemoveAt(i); |
|
327 | 319 |
} |
328 | 320 |
} |
321 |
} |
|
329 | 322 | |
330 |
if (statusCodeTypeList.Count() == 1) |
|
323 |
if (statusCodeTypeList.Count() == 1) |
|
324 |
{ |
|
325 |
//추가 convert 후 추가됨 |
|
326 |
foreach (var item in Listitems) |
|
331 | 327 |
{ |
332 |
//추가 convert 후 추가됨 |
|
333 |
foreach (var item in Listitems) |
|
328 |
if (collection.Count(x => x.Project_NO == item.Project_NO && x.Count == item.Count) == 0) |
|
334 | 329 |
{ |
335 |
if (collection.Count(x => x.Project_NO == item.Project_NO && x.Count == item.Count) == 0)
|
|
330 |
for (int i = 0; i < 200; i++)
|
|
336 | 331 |
{ |
337 |
for (int i = 0; i < 200; i++) |
|
338 |
{ |
|
339 |
collection.Add(item); |
|
340 |
break; |
|
341 |
} |
|
332 |
collection.Add(item); |
|
333 |
break; |
|
342 | 334 |
} |
343 | 335 |
} |
344 | 336 |
} |
345 | 337 |
} |
346 | 338 |
} |
339 | ||
347 | 340 |
} |
348 | 341 |
catch (Exception ex) |
349 | 342 |
{ |
... | ... | |
351 | 344 |
} |
352 | 345 |
} |
353 | 346 | |
354 |
private void FinalPDFDataSelect(IEnumerable<ConvertPDF.StatusCodeType> statusCodeTypeList, ObservableCollection<FinalPDFCOUNT> collection) |
|
347 |
private async void FinalPDFDataSelect(IEnumerable<ConvertPDF.StatusCodeType> statusCodeTypeList, ObservableCollection<FinalPDFCOUNT> collection)
|
|
355 | 348 |
{ |
356 | 349 |
try |
357 | 350 |
{ |
358 |
using (markusEntities entities = new markusEntities(App.MarkusDataBaseConnecitonString)) |
|
359 |
{ |
|
360 |
int _status = 0; |
|
361 |
if (SelectedStatus != null) |
|
362 |
{ |
|
363 |
_status = (int)SelectedStatus.Value; |
|
364 |
} |
|
365 | ||
366 |
//DocumentID = unikey |
|
367 |
DateTime? Start_CreateTime = null; |
|
368 |
DateTime? Finish_CreateTime = null; |
|
369 |
if (SelectedCreateTimeBegin != DefaultCreateTime) |
|
370 |
{ |
|
371 |
Start_CreateTime = SelectedCreateTimeBegin; |
|
372 |
} |
|
373 |
if (SelectedCreateTimeEnd != DefaultCreateTime) |
|
374 |
{ |
|
375 |
Finish_CreateTime = SelectedCreateTimeEnd; |
|
376 |
} |
|
377 | 351 | |
378 |
var items = entities.SELECT_FINALPDF_COUNT(_status, Start_CreateTime, Finish_CreateTime).ToList(); |
|
352 |
int _status = 0; |
|
353 |
if (SelectedStatus != null) |
|
354 |
{ |
|
355 |
_status = (int)SelectedStatus.Value; |
|
356 |
} |
|
379 | 357 | |
380 |
List<FinalPDFCOUNT> Listitems = new List<FinalPDFCOUNT>(); |
|
358 |
//DocumentID = unikey |
|
359 |
DateTime? Start_CreateTime = null; |
|
360 |
DateTime? Finish_CreateTime = null; |
|
361 |
if (SelectedCreateTimeBegin != DefaultCreateTime) |
|
362 |
{ |
|
363 |
Start_CreateTime = SelectedCreateTimeBegin; |
|
364 |
} |
|
365 |
if (SelectedCreateTimeEnd != DefaultCreateTime) |
|
366 |
{ |
|
367 |
Finish_CreateTime = SelectedCreateTimeEnd; |
|
368 |
} |
|
381 | 369 | |
382 |
for (int i = 0; i < items.Count; i++) |
|
383 |
{ |
|
384 |
FinalPDFCOUNT AddItem = new FinalPDFCOUNT(items[i].PROJECT_NO, items[i].COUNT, items[i].EXCEPTION_COUNT); |
|
385 |
Listitems.Add(AddItem); |
|
386 |
} |
|
370 |
var Listitems = from num in await WcfClient.GET_FINALPDF_COUNTAsync(_status, Start_CreateTime, Finish_CreateTime) |
|
371 |
select new FinalPDFCOUNT(num.PROJECT_NO, num.COUNT.Value, num.EXCEPTION_COUNT.Value); |
|
387 | 372 | |
388 |
if (collection.Count() == 0) |
|
373 |
if (collection.Count() == 0) |
|
374 |
{ |
|
375 |
if (statusCodeTypeList.Count() == 1) |
|
389 | 376 |
{ |
390 |
if (statusCodeTypeList.Count() == 1)
|
|
377 |
foreach (var x in Listitems)
|
|
391 | 378 |
{ |
392 |
foreach (var x in Listitems) |
|
393 |
{ |
|
394 |
collection.Add(x); |
|
395 |
} |
|
379 |
collection.Add(x); |
|
396 | 380 |
} |
397 | 381 |
} |
398 |
else |
|
382 |
} |
|
383 |
else |
|
384 |
{ |
|
385 | ||
386 |
//세미 업데이트 |
|
387 |
foreach (var newitem in Listitems) |
|
399 | 388 |
{ |
389 |
collection.UpdateWhere(changeitem => |
|
390 |
ConvertItemEx.ChangeValues(changeitem, newitem), x => x.Project_NO == newitem.Project_NO && x.Count == newitem.Count); |
|
391 |
} |
|
400 | 392 | |
401 |
//세미 업데이트 |
|
402 |
foreach (var newitem in Listitems) |
|
403 |
{ |
|
404 |
collection.UpdateWhere(changeitem => |
|
405 |
ConvertItemEx.ChangeValues(changeitem, newitem), x => x.Project_NO == newitem.Project_NO && x.Count == newitem.Count); |
|
406 |
} |
|
407 | 393 | |
394 |
if (statusCodeTypeList.Count() == 1) |
|
395 |
{ |
|
408 | 396 | |
409 |
if (statusCodeTypeList.Count() == 1) |
|
397 |
//삭제 |
|
398 |
for (int i = collection.Count() - 1; i >= 0; --i) |
|
410 | 399 |
{ |
400 |
var item = collection[i]; |
|
411 | 401 | |
412 |
//삭제 |
|
413 |
for (int i = collection.Count() - 1; i >= 0; --i) |
|
402 |
if (Listitems.Count(x => x.Project_NO == item.Project_NO && x.Count == item.Count) == 0) |
|
414 | 403 |
{ |
415 |
var item = collection[i]; |
|
416 | ||
417 |
if (Listitems.Count(x => x.Project_NO == item.Project_NO && x.Count == item.Count) == 0) |
|
418 |
{ |
|
419 |
collection.RemoveAt(i); |
|
420 |
} |
|
404 |
collection.RemoveAt(i); |
|
421 | 405 |
} |
422 | 406 |
} |
407 |
} |
|
423 | 408 | |
424 |
if (statusCodeTypeList.Count() == 1) |
|
409 |
if (statusCodeTypeList.Count() == 1) |
|
410 |
{ |
|
411 |
//추가 convert 후 추가됨 |
|
412 |
foreach (var item in Listitems) |
|
425 | 413 |
{ |
426 |
//추가 convert 후 추가됨 |
|
427 |
foreach (var item in Listitems) |
|
414 |
if (collection.Count(x => x.Project_NO == item.Project_NO && x.Count == item.Count) == 0) |
|
428 | 415 |
{ |
429 |
if (collection.Count(x => x.Project_NO == item.Project_NO && x.Count == item.Count) == 0)
|
|
416 |
for (int i = 0; i < 200; i++)
|
|
430 | 417 |
{ |
431 |
for (int i = 0; i < 200; i++) |
|
432 |
{ |
|
433 |
collection.Add(item); |
|
434 |
break; |
|
435 |
} |
|
418 |
collection.Add(item); |
|
419 |
break; |
|
436 | 420 |
} |
437 | 421 |
} |
438 | 422 |
} |
439 | 423 |
} |
424 | ||
440 | 425 |
} |
441 | 426 |
} |
442 | 427 |
catch (Exception ex) |
내보내기 Unified diff