개정판 2decfbdf
DataBaseItemsModel 수정
Change-Id: I96830cad0b3990bb84346f438ba04e20d55ec26c
ConvertService/ServiceBase/Markus.Service.DataBase/ConvertDatabase.cs | ||
---|---|---|
5 | 5 |
using System.Collections.Generic; |
6 | 6 |
using System.IO; |
7 | 7 |
using System.Linq; |
8 |
using static Markus.Service.DataBase.ConvertDatabase; |
|
9 |
using System.Windows; |
|
10 |
using System.Linq.Expressions; |
|
11 |
using Markus.Service.Interface; |
|
8 | 12 |
|
9 | 13 |
namespace Markus.Service.DataBase |
10 | 14 |
{ |
... | ... | |
104 | 108 |
RECONVERTER = 0 |
105 | 109 |
}; |
106 | 110 |
|
111 |
|
|
107 | 112 |
entities.CONVERTER_DOC.Add(convert_doc); |
108 | 113 |
|
109 | 114 |
if (entities.SaveChanges() == 1) |
... | ... | |
114 | 119 |
return result; |
115 | 120 |
} |
116 | 121 |
|
122 |
//public bool SetDocument_Item(string Revision, string Document_No, string Document_Name, string Group_No)//세미 |
|
123 |
//{ |
|
124 |
// bool result = false; |
|
125 |
|
|
126 |
// if (Revision.IsNullOrEmpty()) |
|
127 |
// { |
|
128 |
// throw new Exception("Revision is Null"); |
|
129 |
// } |
|
130 |
|
|
131 |
// if (Document_No.IsNullOrEmpty()) |
|
132 |
// { |
|
133 |
// throw new Exception("Document_No is Null"); |
|
134 |
// } |
|
135 |
|
|
136 |
// if (Document_Name.IsNullOrEmpty()) |
|
137 |
// { |
|
138 |
// throw new Exception("Document_Name is Null"); |
|
139 |
// } |
|
140 |
|
|
141 |
// DOCUMENT_ITEM document_item = new DOCUMENT_ITEM |
|
142 |
// { |
|
143 |
// REVISION = Revision, |
|
144 |
// DOCUMENT_NO = Document_No, |
|
145 |
// DOCUMENT_NAME = Document_Name, |
|
146 |
// GROUP_NO = Group_No |
|
147 |
// }; |
|
148 |
|
|
149 |
// entities.DOCUMENT_ITEM.Add(document_item); |
|
150 |
|
|
151 |
// if (entities.SaveChanges() == 1) |
|
152 |
// { |
|
153 |
// result = true; |
|
154 |
// } |
|
155 |
|
|
156 |
// return result; |
|
157 |
//} |
|
117 | 158 |
/// <summary> |
118 | 159 |
/// 컨버터서비스를 이용하는 문서 정보 저장 |
119 | 160 |
/// UniqueID |
... | ... | |
214 | 255 |
if (convertItem.STATUS == (int)StatusCodeType.Completed) |
215 | 256 |
{ |
216 | 257 |
result = new Interface.ConvertItem(convertItem.DOCUMENT_ID, convertItem.PROJECT_NO, convertItem.ID, convertItem.DOCUMENT_URL, convertPath, |
217 |
convertItem.STATUS.ToString(), convertItem.CURRENT_PAGE, convertItem.TOTAL_PAGE, convertItem.EXCEPTION);
|
|
258 |
(StatusCodeType)convertItem.STATUS, convertItem.CURRENT_PAGE, convertItem.TOTAL_PAGE, convertItem.EXCEPTION);
|
|
218 | 259 |
} |
219 | 260 |
else |
220 | 261 |
{ |
... | ... | |
277 | 318 |
/// <param name="convertID">StatusCodeType을 변경하고자 하는 ConvertItem의 ID</param> |
278 | 319 |
/// <param name="ReConvert">ReConvert가 2이면 다시 Convert를 시도 안하기 때문에 기존 값으로 유지 하고 계속 시도 할수 있도록 0을 주는 경우가 있다.</param> |
279 | 320 |
/// <returns></returns> |
280 |
public int SetCleanUpItem(string convertID,int ReConvert) |
|
321 |
/// |
|
322 |
public int SetCleanUpItem(ConvertItem _ConvertItem) |
|
281 | 323 |
{ |
282 | 324 |
int result = 0; |
283 | 325 |
|
284 |
var items = entities.CONVERTER_DOC.Where(x=> x.ID == convertID); |
|
326 |
//var items = entities.CONVERTER_DOC.Where(x => x.ID == _ConvertItem.ConvertID && x.DOCUMENT_ID == _ConvertItem.DocumentID); |
|
327 |
var items = entities.CONVERTER_DOC.Where(x => x.ID == _ConvertItem.ConvertID); |
|
285 | 328 |
|
286 | 329 |
result = items.Count(); |
287 | 330 |
|
... | ... | |
289 | 332 |
{ |
290 | 333 |
var item = items.First(); |
291 | 334 |
|
292 |
item.RECONVERTER = item.RECONVERTER - ReConvert;
|
|
293 |
item.CREATE_DATETIME = DateTime.Now; |
|
335 |
item.RECONVERTER = item.RECONVERTER - _ConvertItem.ReConverter;
|
|
336 |
item.CREATE_DATETIME = DateTime.Now;//여기서도 변경 되고 디비에서도 변경됨
|
|
294 | 337 |
//item.START_DATETIME = null; |
295 |
item.END_DATETIME = null; |
|
296 |
item.STATUS = (int)StatusCodeType.None; |
|
338 |
//item.END_DATETIME = null; |
|
339 |
item.STATUS = (int)StatusCodeType.None; //여기서는 값 변경 되는데 디비에서 변경 안됨 => 0 되었다가 파일수에 따라 점차 늘어나는것 |
|
340 |
|
|
297 | 341 |
|
298 | 342 |
result = entities.SaveChanges(); |
299 | 343 |
} |
300 | 344 |
|
301 | 345 |
return result; |
302 | 346 |
} |
347 |
//public int SetCleanUpItem(string convertID,int ReConvert) |
|
348 |
//{ |
|
349 |
// int result = 0; |
|
350 |
|
|
351 |
// var items = entities.CONVERTER_DOC.Where(x=> x.ID == convertID); |
|
352 |
|
|
353 |
// result = items.Count(); |
|
354 |
|
|
355 |
// if (items.Count() > 0) |
|
356 |
// { |
|
357 |
// var item = items.First(); |
|
358 |
|
|
359 |
// item.RECONVERTER = item.RECONVERTER - ReConvert; |
|
360 |
// item.CREATE_DATETIME = DateTime.Now;//여기서도 변경 되고 디비에서도 변경됨 |
|
361 |
// //item.START_DATETIME = null; |
|
362 |
// //item.END_DATETIME = null; |
|
363 |
// item.STATUS = (int)StatusCodeType.None; //여기서는 값 변경 되는데 디비에서 변경 안됨 => 0 되었다가 파일수에 따라 점차 늘어나는것 |
|
364 |
|
|
365 |
|
|
366 |
// result = entities.SaveChanges(); |
|
367 |
// } |
|
368 |
|
|
369 |
// return result; |
|
370 |
//} |
|
303 | 371 |
|
304 | 372 |
|
305 | 373 |
/// <summary> |
... | ... | |
341 | 409 |
{ |
342 | 410 |
ReConverter = item.RECONVERTER, |
343 | 411 |
ServiceID = item.SERVICE_ID, |
344 |
ConvertState = ((StatusCodeType)item.STATUS).ToString(),
|
|
412 |
ConvertState = ((StatusCodeType)item.STATUS), |
|
345 | 413 |
CreateTime = item.CREATE_DATETIME, |
346 | 414 |
TotalPage = item.TOTAL_PAGE, |
347 | 415 |
CurrentPageNo = item.CURRENT_PAGE, |
... | ... | |
375 | 443 |
{ |
376 | 444 |
ReConverter = item.RECONVERTER, |
377 | 445 |
ServiceID = item.SERVICE_ID, |
378 |
ConvertState = ((StatusCodeType)item.STATUS).ToString(), |
|
446 |
//ConvertState = ((StatusCodeType)item.STATUS).ToString(), |
|
447 |
ConvertState = ((StatusCodeType)item.STATUS), |
|
379 | 448 |
CreateTime = item.CREATE_DATETIME, |
380 | 449 |
TotalPage = item.TOTAL_PAGE, |
381 | 450 |
CurrentPageNo = item.CURRENT_PAGE, |
... | ... | |
390 | 459 |
return convertItems; |
391 | 460 |
} |
392 | 461 |
|
393 |
public IEnumerable<Interface.ConvertItem> GetConvertProjects(Func<CONVERTER_DOC, bool> @where) |
|
394 |
{ |
|
395 |
var items = entities.CONVERTER_DOC.Where(@where); |
|
462 |
//List<Interface.ConvertItem> StatusKeep = new List<Interface.ConvertItem>(); |
|
396 | 463 |
|
397 |
if (items.Count() > 0) |
|
464 |
public IEnumerable<Interface.ConvertItem> GetConvertProjects(Markus.Service.Interface.ConvertItem selectedConvert) |
|
465 |
{ |
|
466 |
List<Interface.ConvertItem> StatusKeep = new List<Interface.ConvertItem>(); |
|
467 |
System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch();///////////////디비 테스트 후 해보기 |
|
468 |
stopwatch.Start(); |
|
469 |
List<Interface.ConvertItem> convertItems = new List<Interface.ConvertItem>();//디비 다 조인 후 조건 비교 후 그리드 출력 |
|
470 |
var query = from items in entities.CONVERTER_DOC //세미 |
|
471 |
join documents in entities.DOCUMENT_ITEM on items.DOCUMENT_ID equals documents.DOCUMENT_ID into GroupItems |
|
472 |
from subpet in GroupItems.DefaultIfEmpty() |
|
473 |
where items.PROJECT_NO == selectedConvert.ProjectNumber && items.DOCUMENT_ID == selectedConvert.DocumentID |
|
474 |
orderby items.CREATE_DATETIME descending |
|
475 |
select new |
|
476 |
{ |
|
477 |
ID = items.ID, |
|
478 |
DOCUMENT_URL = items.DOCUMENT_URL, |
|
479 |
RECONVERTER = items.RECONVERTER, |
|
480 |
SERVICE_ID = items.SERVICE_ID, |
|
481 |
STATUS = items.STATUS, |
|
482 |
CREATE_DATETIME = items.CREATE_DATETIME, |
|
483 |
TOTAL_PAGE = items.TOTAL_PAGE, |
|
484 |
CURRENT_PAGE = items.CURRENT_PAGE, |
|
485 |
EXCEPTION = items.EXCEPTION, |
|
486 |
PROJECT_NO = items.PROJECT_NO, |
|
487 |
DOCUMENT_ID = items.DOCUMENT_ID, |
|
488 |
REVISION = subpet.REVISION, |
|
489 |
DOCUMENT_NO = subpet.DOCUMENT_NO, |
|
490 |
DOCUMENT_NAME = subpet.DOCUMENT_NAME, |
|
491 |
GROUP_NO = subpet.GROUP_NO |
|
492 |
}; |
|
493 |
|
|
494 |
if (query.Count() > 0)//세미 |
|
398 | 495 |
{ |
399 |
foreach (var item in items)
|
|
496 |
foreach (var item in query)
|
|
400 | 497 |
{ |
401 |
|
|
402 |
yield return new Interface.ConvertItem(item.DOCUMENT_ID, item.PROJECT_NO, item.ID, item.DOCUMENT_URL)
|
|
498 |
//var convertitem = new Interface.ConvertItem(item.DOCUMENT_ID, item.PROJECT_NO, item.ID, item.DOCUMENT_URL) |
|
499 |
Interface.ConvertItem convertitem = new Interface.ConvertItem(item.DOCUMENT_ID, item.PROJECT_NO, item.ID, item.DOCUMENT_URL)
|
|
403 | 500 |
{ |
501 |
|
|
404 | 502 |
ReConverter = item.RECONVERTER, |
405 | 503 |
ServiceID = item.SERVICE_ID, |
406 | 504 |
//ConvertState = ((StatusCodeType)item.STATUS).ToString(), |
407 |
ConvertState = (item.STATUS).ToString(), |
|
505 |
//ConvertState = (item.STATUS).ToString(), |
|
506 |
ConvertState = (StatusCodeType)item.STATUS, |
|
408 | 507 |
CreateTime = item.CREATE_DATETIME, |
409 | 508 |
TotalPage = item.TOTAL_PAGE, |
410 | 509 |
CurrentPageNo = item.CURRENT_PAGE, |
411 | 510 |
Exception = item.EXCEPTION, |
412 |
ConvertPath = GetConvertPath(item.PROJECT_NO, item.DOCUMENT_ID) |
|
511 |
ConvertPath = GetConvertPath(item.PROJECT_NO, item.DOCUMENT_ID), |
|
512 |
|
|
513 |
Revision = item.REVISION, |
|
514 |
DocumnetNo = item.DOCUMENT_NO, |
|
515 |
DocumnetName = item.DOCUMENT_NAME, |
|
516 |
GroupNo = item.GROUP_NO |
|
413 | 517 |
}; |
518 |
//if (@whereq(convertitem)) |
|
519 |
//{ |
|
520 |
////convertItems.Add(convertitem); |
|
521 |
StatusKeep.Add(convertitem); |
|
522 |
// } |
|
414 | 523 |
|
415 | 524 |
} |
416 | 525 |
} |
417 |
} |
|
526 |
System.Diagnostics.Debug.WriteLine(new TimeSpan(stopwatch.ElapsedTicks).ToString()); |
|
527 |
//return convertItems;//디비 다 조인 후 조건 비교 후 그리드 출력 |
|
528 |
return StatusKeep; |
|
529 |
|
|
418 | 530 |
|
419 |
public List<Interface.ConvertItem> GetConvertProjects(Func<CONVERTER_DOC, bool> @where, StatusCodeType status) |
|
531 |
} |
|
532 |
public IEnumerable<Interface.ConvertItem> GetConvertProjects(System.Collections.ObjectModel.ObservableCollection<Interface.ConvertItem> selectedConvert) |
|
420 | 533 |
{ |
421 |
List<Interface.ConvertItem> convertItems = new List<Interface.ConvertItem>(); |
|
534 |
List<Interface.ConvertItem> StatusKeep = new List<Interface.ConvertItem>(); |
|
535 |
//System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch();///////////////디비 테스트 후 해보기 |
|
536 |
//stopwatch.Start(); |
|
537 |
List<Interface.ConvertItem> convertItems = new List<Interface.ConvertItem>();//디비 다 조인 후 조건 비교 후 그리드 출력 |
|
422 | 538 |
|
539 |
foreach (var selectedConvertItem in selectedConvert) |
|
540 |
{ |
|
541 |
var query = from items in entities.CONVERTER_DOC //세미 |
|
542 |
join documents in entities.DOCUMENT_ITEM on items.DOCUMENT_ID equals documents.DOCUMENT_ID into GroupItems |
|
543 |
from subpet in GroupItems.DefaultIfEmpty() |
|
544 |
where items.PROJECT_NO == selectedConvertItem.ProjectNumber && items.ID == selectedConvertItem.ConvertID |
|
545 |
select new |
|
546 |
{ |
|
547 |
ID = items.ID, |
|
548 |
DOCUMENT_URL = items.DOCUMENT_URL, |
|
549 |
RECONVERTER = items.RECONVERTER, |
|
550 |
SERVICE_ID = items.SERVICE_ID, |
|
551 |
STATUS = items.STATUS, |
|
552 |
CREATE_DATETIME = items.CREATE_DATETIME, |
|
553 |
TOTAL_PAGE = items.TOTAL_PAGE, |
|
554 |
CURRENT_PAGE = items.CURRENT_PAGE, |
|
555 |
EXCEPTION = items.EXCEPTION, |
|
556 |
PROJECT_NO = items.PROJECT_NO, |
|
557 |
DOCUMENT_ID = items.DOCUMENT_ID, |
|
558 |
REVISION = subpet.REVISION, |
|
559 |
DOCUMENT_NO = subpet.DOCUMENT_NO, |
|
560 |
DOCUMENT_NAME = subpet.DOCUMENT_NAME, |
|
561 |
GROUP_NO = subpet.GROUP_NO |
|
562 |
}; |
|
563 |
|
|
564 |
|
|
565 |
if (query.Count() > 0)//세미 |
|
566 |
{ |
|
567 |
foreach (var item in query) |
|
568 |
{ |
|
569 |
//var convertitem = new Interface.ConvertItem(item.DOCUMENT_ID, item.PROJECT_NO, item.ID, item.DOCUMENT_URL) |
|
570 |
Interface.ConvertItem convertitem = new Interface.ConvertItem(item.DOCUMENT_ID, item.PROJECT_NO, item.ID, item.DOCUMENT_URL) |
|
571 |
{ |
|
423 | 572 |
|
424 |
//var items = entities.CONVERTER_DOC.Where(x => x.STATUS == (int)statusCodeType).Take(takeCount).ToList(); //.Where(x => x.PROJECT_NO == gProjectNo); |
|
425 |
var items = entities.CONVERTER_DOC.Where(x => x.STATUS == (int)status).ToList(); |
|
573 |
ReConverter = item.RECONVERTER, |
|
574 |
ServiceID = item.SERVICE_ID, |
|
575 |
//ConvertState = ((StatusCodeType)item.STATUS).ToString(), |
|
576 |
//ConvertState = (item.STATUS).ToString(), |
|
577 |
ConvertState = (StatusCodeType)item.STATUS, |
|
578 |
CreateTime = item.CREATE_DATETIME, |
|
579 |
TotalPage = item.TOTAL_PAGE, |
|
580 |
CurrentPageNo = item.CURRENT_PAGE, |
|
581 |
Exception = item.EXCEPTION, |
|
582 |
ConvertPath = GetConvertPath(item.PROJECT_NO, item.DOCUMENT_ID), |
|
583 |
|
|
584 |
Revision = item.REVISION, |
|
585 |
DocumnetNo = item.DOCUMENT_NO, |
|
586 |
DocumnetName = item.DOCUMENT_NAME, |
|
587 |
GroupNo = item.GROUP_NO |
|
588 |
}; |
|
589 |
//if (@whereq(convertitem)) |
|
590 |
//{ |
|
591 |
////convertItems.Add(convertitem); |
|
592 |
StatusKeep.Add(convertitem); |
|
593 |
// } |
|
426 | 594 |
|
427 |
if (items.Count() > 0) |
|
595 |
} |
|
596 |
} |
|
597 |
} |
|
598 |
//System.Diagnostics.Debug.WriteLine(new TimeSpan(stopwatch.ElapsedTicks).ToString()); |
|
599 |
//return convertItems;//디비 다 조인 후 조건 비교 후 그리드 출력 |
|
600 |
return StatusKeep; |
|
601 |
|
|
602 |
|
|
603 |
|
|
604 |
} |
|
605 |
//public IEnumerable<Interface.ConvertItem> GetConvertProjects(Func<Interface.ConvertItem, bool> @whereq, int status)//조인 후 조건 & 조건and조인 |
|
606 |
////public List<Interface.ConvertItem> GetConvertProjects(Expression<Func<CONVERTER_DOC, bool>> @where) //linq and entity and sql |
|
607 |
////public IEnumerable<Interface.ConvertItem> GetConvertProjects(Func<CONVERTER_DOC, bool> @where) //원본 |
|
608 |
//{ |
|
609 |
// System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch();///////////////디비 테스트 후 해보기 |
|
610 |
// stopwatch.Start(); |
|
611 |
// List<Interface.ConvertItem> convertItems = new List<Interface.ConvertItem>();//디비 다 조인 후 조건 비교 후 그리드 출력 |
|
612 |
// var query = from items in entities.CONVERTER_DOC //세미 |
|
613 |
// join documents in entities.DOCUMENT_ITEM on items.DOCUMENT_ID equals documents.DOCUMENT_ID |
|
614 |
// where items.PROJECT_NO == documents.PROJECT_NO && items.STATUS == status |
|
615 |
// orderby items.CREATE_DATETIME descending |
|
616 |
// select new |
|
617 |
// { |
|
618 |
// ID = items.ID, |
|
619 |
// DOCUMENT_URL = items.DOCUMENT_URL, |
|
620 |
// RECONVERTER = items.RECONVERTER, |
|
621 |
// SERVICE_ID = items.SERVICE_ID, |
|
622 |
// STATUS = items.STATUS, |
|
623 |
// CREATE_DATETIME = items.CREATE_DATETIME, |
|
624 |
// TOTAL_PAGE = items.TOTAL_PAGE, |
|
625 |
// CURRENT_PAGE = items.CURRENT_PAGE, |
|
626 |
// EXCEPTION = items.EXCEPTION, |
|
627 |
// PROJECT_NO = items.PROJECT_NO, |
|
628 |
// DOCUMENT_ID = items.DOCUMENT_ID, |
|
629 |
// REVISION = documents.REVISION, |
|
630 |
// DOCUMENT_NO = documents.DOCUMENT_NO, |
|
631 |
// DOCUMENT_NAME = documents.DOCUMENT_NAME, |
|
632 |
// GROUP_NO = documents.GROUP_NO |
|
633 |
// }; |
|
634 |
|
|
635 |
// if (query.Count() > 0)//세미 |
|
636 |
// { |
|
637 |
// foreach (var item in query) |
|
638 |
// { |
|
639 |
// //var convertitem = new Interface.ConvertItem(item.DOCUMENT_ID, item.PROJECT_NO, item.ID, item.DOCUMENT_URL) |
|
640 |
// Interface.ConvertItem convertitem = new Interface.ConvertItem(item.DOCUMENT_ID, item.PROJECT_NO, item.ID, item.DOCUMENT_URL) |
|
641 |
// { |
|
642 |
|
|
643 |
// ReConverter = item.RECONVERTER, |
|
644 |
// ServiceID = item.SERVICE_ID, |
|
645 |
// //ConvertState = ((StatusCodeType)item.STATUS).ToString(), |
|
646 |
// ConvertState = (item.STATUS).ToString(), |
|
647 |
// CreateTime = item.CREATE_DATETIME, |
|
648 |
// TotalPage = item.TOTAL_PAGE, |
|
649 |
// CurrentPageNo = item.CURRENT_PAGE, |
|
650 |
// Exception = item.EXCEPTION, |
|
651 |
// //ConvertPath = GetConvertPath(item.PROJECT_NO, item.DOCUMENT_ID), |
|
652 |
|
|
653 |
// Revision = item.REVISION, |
|
654 |
// DocumnetNo = item.DOCUMENT_NO, |
|
655 |
// DocumnetName = item.DOCUMENT_NAME, |
|
656 |
// GroupNo = item.GROUP_NO |
|
657 |
// }; |
|
658 |
// if (@whereq(convertitem)) |
|
659 |
// { |
|
660 |
// //convertItems.Add(convertitem); |
|
661 |
// StatusKeep.Add(convertitem); |
|
662 |
// } |
|
663 |
|
|
664 |
// } |
|
665 |
// } |
|
666 |
// System.Diagnostics.Debug.WriteLine(new TimeSpan(stopwatch.ElapsedTicks).ToString()); |
|
667 |
// //return convertItems;//디비 다 조인 후 조건 비교 후 그리드 출력 |
|
668 |
// return StatusKeep; |
|
669 |
|
|
670 |
|
|
671 |
//} |
|
672 |
|
|
673 |
//public IEnumerable<Interface.ConvertItem> GetConvertProjects(Func<CONVERTER_DOC, bool> @where) //@where는 입력값이 CONVERTER_DOC이고 출력값이 bool //부장님 |
|
674 |
//public List<Interface.ConvertItem> GetConvertProjects(Func<CONVERTER_DOC, bool> @where) //@where는 입력값이 CONVERTER_DOC이고 출력값이 bool |
|
675 |
//System.Linq.IQueryable |
|
676 |
public IEnumerable<Interface.ConvertItem> GetConvertProjects(int status)//조인 후 조건 & 조건and조인 |
|
677 |
//public List<Interface.ConvertItem> GetConvertProjects(Expression<Func<CONVERTER_DOC, bool>> @where) //linq and entity and sql |
|
678 |
//public IEnumerable<Interface.ConvertItem> GetConvertProjects(Func<CONVERTER_DOC, bool> @where) //원본 |
|
679 |
{ |
|
680 |
// System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch();///////////////디비 테스트 후 해보기 |
|
681 |
// stopwatch.Start(); |
|
682 |
|
|
683 |
// //@ 심벌 ex) string filename = "C:\\Temp\\1.txt"; -> filename = @"C:\Temp\1.txt"; and 여러 문자열 사용 가능 |
|
684 |
////var items = entities.CONVERTER_DOC.Where(@where);//부장님 |
|
685 |
// List<Interface.ConvertItem> convertItems = new List<Interface.ConvertItem>(); |
|
686 |
|
|
687 |
// var query = from items in entities.CONVERTER_DOC //세미 |
|
688 |
// join documents in entities.DOCUMENT_ITEM on items.DOCUMENT_ID equals documents.DOCUMENT_ID |
|
689 |
// //where @where(items) |
|
690 |
// select new//new 다음에 클래스 이름 넣으면 안됨 |
|
691 |
// { |
|
692 |
// ID = items.ID, |
|
693 |
// DOCUMENT_URL = items.DOCUMENT_URL, |
|
694 |
// RECONVERTER = items.RECONVERTER, |
|
695 |
// SERVICE_ID = items.SERVICE_ID, |
|
696 |
// STATUS = items.STATUS, |
|
697 |
// CREATE_DATETIME = items.CREATE_DATETIME, |
|
698 |
// TOTAL_PAGE = items.TOTAL_PAGE, |
|
699 |
// CURRENT_PAGE = items.CURRENT_PAGE, |
|
700 |
// EXCEPTION = items.EXCEPTION, |
|
701 |
// PROJECT_NO = items.PROJECT_NO, |
|
702 |
// DOCUMENT_ID = items.DOCUMENT_ID, |
|
703 |
// REVISION = documents.REVISION, |
|
704 |
// DOCUMENT_NO = documents.DOCUMENT_NO, |
|
705 |
// DOCUMENT_NAME = documents.DOCUMENT_NAME, |
|
706 |
// GROUP_NO = documents.GROUP_NO |
|
707 |
// }; |
|
708 |
|
|
709 |
|
|
710 |
// if (query.Count() > 0)//ConvertItem에 값들 넣어야 함 그래야 값이 바뀌면 propertychanged로 그리드 실시간 없데이트 가능 |
|
711 |
// { |
|
712 |
// foreach (var item in query) |
|
713 |
// { |
|
714 |
// var convertitem = new Interface.ConvertItem(item.DOCUMENT_ID, item.PROJECT_NO, item.ID, item.DOCUMENT_URL) |
|
715 |
// { |
|
716 |
// ReConverter = item.RECONVERTER, |
|
717 |
// ServiceID = item.SERVICE_ID, |
|
718 |
// //ConvertState = ((StatusCodeType)item.STATUS).ToString(), |
|
719 |
// ConvertState = (item.STATUS).ToString(), |
|
720 |
// CreateTime = item.CREATE_DATETIME, |
|
721 |
// TotalPage = item.TOTAL_PAGE, |
|
722 |
// CurrentPageNo = item.CURRENT_PAGE, |
|
723 |
// Exception = item.EXCEPTION, |
|
724 |
// ConvertPath = GetConvertPath(item.PROJECT_NO, item.DOCUMENT_ID), |
|
725 |
|
|
726 |
// Revision = item.REVISION, |
|
727 |
// DocumnetNo = item.DOCUMENT_NO, |
|
728 |
// DocumnetName = item.DOCUMENT_NAME, |
|
729 |
// GroupNo = item.GROUP_NO |
|
730 |
// }; |
|
731 |
|
|
732 |
|
|
733 |
// convertItems.Add(convertitem); |
|
734 |
// } |
|
735 |
// } |
|
736 |
//System.Diagnostics.Debug.WriteLine(new TimeSpan(stopwatch.ElapsedTicks).ToString()); |
|
737 |
//return convertItems;///////////////디비 테스트 후 해보기 |
|
738 |
|
|
739 |
//select new Interface.ConvertItem(ConvertDoc.DOCUMENT_ID, ConvertDoc.PROJECT_NO, ConvertDoc.ID, ConvertDoc.DOCUMENT_URL) |
|
740 |
//{ |
|
741 |
// ReConverter = ConvertDoc.RECONVERTER, |
|
742 |
// ServiceID = ConvertDoc.SERVICE_ID, |
|
743 |
// //ConvertState = ((StatusCodeType)item.STATUS).ToString(), |
|
744 |
// ConvertState = (ConvertDoc.STATUS).ToString(), |
|
745 |
// CreateTime = ConvertDoc.CREATE_DATETIME, |
|
746 |
// TotalPage = ConvertDoc.TOTAL_PAGE, |
|
747 |
// CurrentPageNo = ConvertDoc.CURRENT_PAGE, |
|
748 |
// Exception = ConvertDoc.EXCEPTION, |
|
749 |
// ConvertPath = GetConvertPath(ConvertDoc.PROJECT_NO, ConvertDoc.DOCUMENT_ID), |
|
750 |
|
|
751 |
// Revision = documents.REVISION, |
|
752 |
// DocumnetNo = documents.DOCUMENT_NO, |
|
753 |
// DocumnetName = documents.DOCUMENT_NAME, |
|
754 |
// GroupNo = documents.GROUP_NO |
|
755 |
//}; |
|
756 |
//System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch();///////////////디비 테스트 후 해보기 |
|
757 |
//stopwatch.Start(); |
|
758 |
List<Interface.ConvertItem> convertItems = new List<Interface.ConvertItem>();//디비 다 조인 후 조건 비교 후 그리드 출력 |
|
759 |
var query = from items in entities.CONVERTER_DOC //세미 |
|
760 |
join documents in entities.DOCUMENT_ITEM on items.DOCUMENT_ID equals documents.DOCUMENT_ID into GroupItems |
|
761 |
from subpet in GroupItems.DefaultIfEmpty() |
|
762 |
where items.STATUS == status |
|
763 |
orderby items.CREATE_DATETIME descending |
|
764 |
select new |
|
765 |
{ |
|
766 |
ID = items.ID, |
|
767 |
DOCUMENT_URL = items.DOCUMENT_URL, |
|
768 |
RECONVERTER = items.RECONVERTER, |
|
769 |
SERVICE_ID = items.SERVICE_ID, |
|
770 |
STATUS = items.STATUS, |
|
771 |
CREATE_DATETIME = items.CREATE_DATETIME, |
|
772 |
TOTAL_PAGE = items.TOTAL_PAGE, |
|
773 |
CURRENT_PAGE = items.CURRENT_PAGE, |
|
774 |
EXCEPTION = items.EXCEPTION, |
|
775 |
PROJECT_NO = items.PROJECT_NO, |
|
776 |
DOCUMENT_ID = items.DOCUMENT_ID, |
|
777 |
REVISION = subpet.REVISION, |
|
778 |
DOCUMENT_NO = subpet.DOCUMENT_NO, |
|
779 |
DOCUMENT_NAME = subpet.DOCUMENT_NAME, |
|
780 |
GROUP_NO = subpet.GROUP_NO |
|
781 |
//REVISION = documents.REVISION, |
|
782 |
//DOCUMENT_NO = documents.DOCUMENT_NO, |
|
783 |
//DOCUMENT_NAME = documents.DOCUMENT_NAME, |
|
784 |
//GROUP_NO = documents.GROUP_NO |
|
785 |
}; |
|
786 |
|
|
787 |
if (query.Count() > 0)//세미 |
|
428 | 788 |
{ |
429 |
foreach (var item in items)
|
|
789 |
foreach (var item in query)
|
|
430 | 790 |
{ |
431 |
|
|
432 |
var convertitem = new Interface.ConvertItem(item.DOCUMENT_ID, item.PROJECT_NO, item.ID, item.DOCUMENT_URL)
|
|
791 |
//var convertitem = new Interface.ConvertItem(item.DOCUMENT_ID, item.PROJECT_NO, item.ID, item.DOCUMENT_URL) |
|
792 |
Interface.ConvertItem convertitem = new Interface.ConvertItem(item.DOCUMENT_ID, item.PROJECT_NO, item.ID, item.DOCUMENT_URL)
|
|
433 | 793 |
{ |
794 |
|
|
434 | 795 |
ReConverter = item.RECONVERTER, |
435 | 796 |
ServiceID = item.SERVICE_ID, |
436 | 797 |
//ConvertState = ((StatusCodeType)item.STATUS).ToString(), |
437 |
ConvertState = (item.STATUS).ToString(), |
|
798 |
//ConvertState = (item.STATUS).ToString(), |
|
799 |
ConvertState = (StatusCodeType)item.STATUS, |
|
438 | 800 |
CreateTime = item.CREATE_DATETIME, |
439 | 801 |
TotalPage = item.TOTAL_PAGE, |
440 | 802 |
CurrentPageNo = item.CURRENT_PAGE, |
441 | 803 |
Exception = item.EXCEPTION, |
442 |
ConvertPath = GetConvertPath(item.PROJECT_NO, item.DOCUMENT_ID) |
|
443 |
}; |
|
444 |
|
|
804 |
//ConvertPath = GetConvertPath(item.PROJECT_NO, item.DOCUMENT_ID), |
|
445 | 805 |
|
806 |
Revision = item.REVISION, |
|
807 |
DocumnetNo = item.DOCUMENT_NO, |
|
808 |
DocumnetName = item.DOCUMENT_NAME, |
|
809 |
GroupNo = item.GROUP_NO, |
|
810 |
DocumentID = item.DOCUMENT_ID |
|
811 |
}; |
|
812 |
convertItems.Add(convertitem); |
|
446 | 813 |
} |
447 | 814 |
} |
815 |
//System.Diagnostics.Debug.WriteLine(new TimeSpan(stopwatch.ElapsedTicks).ToString()); |
|
816 |
return convertItems;//디비 다 조인 후 조건 비교 후 그리드 출력 |
|
817 |
|
|
818 |
//if (Wheredel(convertitem) == false) |
|
819 |
//if (@where(convertitem) == false) |
|
820 |
//{ |
|
821 |
// break; |
|
822 |
//} |
|
823 |
//if (@where(convertitem)) |
|
824 |
//{ |
|
825 |
// convertItems.Add(convertitem); |
|
826 |
//} |
|
827 |
|
|
828 |
//yield return new Interface.ConvertItem(item.DOCUMENT_ID, item.PROJECT_NO, item.ID, item.DOCUMENT_URL) |
|
829 |
//{ |
|
830 |
// ReConverter = item.RECONVERTER, |
|
831 |
// ServiceID = item.SERVICE_ID, |
|
832 |
// //ConvertState = ((StatusCodeType)item.STATUS).ToString(), |
|
833 |
// ConvertState = (item.STATUS).ToString(), |
|
834 |
// CreateTime = item.CREATE_DATETIME, |
|
835 |
// TotalPage = item.TOTAL_PAGE, |
|
836 |
// CurrentPageNo = item.CURRENT_PAGE, |
|
837 |
// Exception = item.EXCEPTION, |
|
838 |
// ConvertPath = GetConvertPath(item.PROJECT_NO, item.DOCUMENT_ID), |
|
839 |
|
|
840 |
// Revision = item.REVISION, |
|
841 |
// DocumnetNo = item.DOCUMENT_NO, |
|
842 |
// DocumnetName = item.DOCUMENT_NAME, |
|
843 |
// GroupNo = item.GROUP_NO |
|
844 |
//}; |
|
845 |
|
|
846 |
|
|
847 |
//var query = entities.CONVERTER_DOC.Where(@where);//이렇게 해서 두 테이블 조인하는 프로시저 만들어라 |
|
848 |
|
|
849 |
//if (query.Count() > 0) |
|
850 |
//{ |
|
851 |
// foreach (var item in query) |
|
852 |
// { |
|
853 |
// //var docitem = entities.DOCUMENT_ITEM.Where(x => x.DOCUMENT_ID == item.DOCUMENT_ID); |
|
854 |
// if (@where(item)) |
|
855 |
// { |
|
856 |
// //string rev = ""; |
|
857 |
// //string docNo = ""; |
|
858 |
// //string docName = ""; |
|
859 |
// //string grpNo = ""; |
|
860 |
|
|
861 |
// //if (item.Count() > 0) |
|
862 |
// //{ |
|
863 |
// // rev = docitem.First().REVISION; |
|
864 |
// // docNo = docitem.First().DOCUMENT_NO; |
|
865 |
// // docName = docitem.First().DOCUMENT_NAME; |
|
866 |
// // grpNo = docitem.First().GROUP_NO; |
|
867 |
// //} |
|
868 |
|
|
869 |
// yield return new Interface.ConvertItem(item.DOCUMENT_ID, item.projectNo, item.ID, item.DOCUMENT_URL) |
|
870 |
// { |
|
871 |
// ReConverter = item.RECONVERTER, |
|
872 |
// ServiceID = item.SERVICE_ID, |
|
873 |
// //ConvertState = ((StatusCodeType)item.STATUS).ToString(), |
|
874 |
// CreateTime = item.CREATE_DATETIME, |
|
875 |
// TotalPage = item.TOTAL_PAGE, |
|
876 |
// CurrentPageNo = item.CURRENT_PAGE, |
|
877 |
// Exception = item.EXCEPTION, |
|
878 |
// ConvertPath = GetConvertPath(item.projectNo, item.DOCUMENT_ID), |
|
879 |
|
|
880 |
// Revision = item.REVISION, |
|
881 |
// DocumnetNo = item.DOCUMENT_NO, |
|
882 |
// DocumnetName = item.DOCUMENT_NAME, |
|
883 |
// GroupNo = item.GROUP_NO |
|
884 |
// }; |
|
885 |
// } |
|
886 |
// } |
|
887 |
//}//프로시저 |
|
888 |
|
|
889 |
//var items = entities.CONVERTER_DOC.Where(@where);//부장님원본 |
|
890 |
//if (items.Count() > 0)//원본 |
|
891 |
//{ |
|
892 |
// foreach (var item in items) |
|
893 |
// { |
|
894 |
// yield return new Interface.ConvertItem(item.DOCUMENT_ID, item.PROJECT_NO, item.ID, item.DOCUMENT_URL) |
|
895 |
// { |
|
896 |
// ReConverter = item.RECONVERTER, |
|
897 |
// ServiceID = item.SERVICE_ID, |
|
898 |
// //ConvertState = ((StatusCodeType)item.STATUS).ToString(), |
|
899 |
// ConvertState = (item.STATUS).ToString(), |
|
900 |
// CreateTime = item.CREATE_DATETIME, |
|
901 |
// TotalPage = item.TOTAL_PAGE, |
|
902 |
// CurrentPageNo = item.CURRENT_PAGE, |
|
903 |
// Exception = item.EXCEPTION, |
|
904 |
// ConvertPath = GetConvertPath(item.PROJECT_NO, item.DOCUMENT_ID) |
|
905 |
// }; |
|
906 |
// } |
|
907 |
//}//원본 |
|
908 |
|
|
909 |
//LINQKit 하다 말음 |
|
910 |
//List<Interface.ConvertItem> convertItems = new List<Interface.ConvertItem>(); |
|
911 |
//var query = |
|
912 |
// from items in entities.CONVERTER_DOC //세미 |
|
913 |
// join documents in entities.DOCUMENT_ITEM on items.DOCUMENT_ID equals documents.DOCUMENT_ID |
|
914 |
// select new//new 다음에 클래스 이름 넣으면 안됨 |
|
915 |
// { |
|
916 |
// ID = items.ID, |
|
917 |
// DOCUMENT_URL = items.DOCUMENT_URL, |
|
918 |
// RECONVERTER = items.RECONVERTER, |
|
919 |
// SERVICE_ID = items.SERVICE_ID, |
|
920 |
// STATUS = items.STATUS, |
|
921 |
// CREATE_DATETIME = items.CREATE_DATETIME, |
|
922 |
// TOTAL_PAGE = items.TOTAL_PAGE, |
|
923 |
// CURRENT_PAGE = items.CURRENT_PAGE, |
|
924 |
// EXCEPTION = items.EXCEPTION, |
|
925 |
// PROJECT_NO = items.PROJECT_NO, |
|
926 |
// DOCUMENT_ID = items.DOCUMENT_ID, |
|
927 |
// REVISION = documents.REVISION, |
|
928 |
// DOCUMENT_NO = documents.DOCUMENT_NO, |
|
929 |
// DOCUMENT_NAME = documents.DOCUMENT_NAME, |
|
930 |
// GROUP_NO = documents.GROUP_NO |
|
931 |
// }; |
|
932 |
|
|
933 |
//if (query.Count() > 0)//ConvertItem에 값들 넣어야 함 그래야 값이 바뀌면 propertychanged로 그리드 실시간 없데이트 가능 |
|
934 |
//{ |
|
935 |
// foreach (var item in query) |
|
936 |
// { |
|
937 |
// var convertitem = new Interface.ConvertItem(item.DOCUMENT_ID, item.PROJECT_NO, item.ID, item.DOCUMENT_URL) |
|
938 |
// { |
|
939 |
// ReConverter = item.RECONVERTER, |
|
940 |
// ServiceID = item.SERVICE_ID, |
|
941 |
// //ConvertState = ((StatusCodeType)item.STATUS).ToString(), |
|
942 |
// ConvertState = (item.STATUS).ToString(), |
|
943 |
// CreateTime = item.CREATE_DATETIME, |
|
944 |
// TotalPage = item.TOTAL_PAGE, |
|
945 |
// CurrentPageNo = item.CURRENT_PAGE, |
|
946 |
// Exception = item.EXCEPTION, |
|
947 |
// ConvertPath = GetConvertPath(item.PROJECT_NO, item.DOCUMENT_ID), |
|
948 |
|
|
949 |
// Revision = item.REVISION, |
|
950 |
// DocumnetNo = item.DOCUMENT_NO, |
|
951 |
// DocumnetName = item.DOCUMENT_NAME, |
|
952 |
// GroupNo = item.GROUP_NO |
|
953 |
// }; |
|
954 |
|
|
955 |
|
|
956 |
// convertItems.Add(convertitem); |
|
957 |
|
|
958 |
// } |
|
959 |
//} |
|
960 |
//return convertItems; |
|
961 |
//LINQKit |
|
448 | 962 |
|
449 |
return convertItems; |
|
450 | 963 |
} |
451 | 964 |
|
452 | 965 |
public List<Interface.ConvertItem> GetConvertProjectsStatus(Func<CONVERTER_DOC, bool> @where) |
... | ... | |
466 | 979 |
ReConverter = item.RECONVERTER, |
467 | 980 |
ServiceID = item.SERVICE_ID, |
468 | 981 |
//ConvertState = ((StatusCodeType)item.STATUS).ToString(), |
469 |
ConvertState = (item.STATUS).ToString(), |
|
982 |
//ConvertState = (item.STATUS).ToString(), |
|
983 |
ConvertState = (StatusCodeType)item.STATUS, |
|
470 | 984 |
CreateTime = item.CREATE_DATETIME, |
471 | 985 |
TotalPage = item.TOTAL_PAGE, |
472 | 986 |
CurrentPageNo = item.CURRENT_PAGE, |
내보내기 Unified diff