프로젝트

일반

사용자정보

통계
| 브랜치(Branch): | 개정판:

markus / FinalService / KCOM_FinalService / DatabaseLoadTest / Program.cs @ a02231f2

이력 | 보기 | 이력해설 | 다운로드 (4.27 KB)

1
using KCOMDataModel.DataModel;
2
using System;
3
using System.Collections.Generic;
4
using System.Linq;
5
using System.Text;
6
using System.Threading.Tasks;
7

    
8
namespace DatabaseLoadTest
9
{
10
    class Program
11
    {
12
        static void Main(string[] args)
13
        {
14
            try
15
            {
16

    
17
                using (KCOMEntities _entity = new KCOMEntities(KCOMDataModel.Common.ConnectStringBuilder.KCOMConnectionString().ToString()))
18
                {
19
                    var items = _entity.FINAL_PDF;
20

    
21
                    Console.WriteLine("FinalPDF Count : " + items.Count());
22

    
23
                    foreach (var item in items)
24
                    {
25
                        List<MARKUP_DATA> MarkupDataSet = null;
26
                        DOCINFO DocInfoItem = null;
27

    
28
                        using (CIEntities _ciEntity = new CIEntities(KCOMDataModel.Common.ConnectStringBuilder.ProjectCIConnectString("000000").ToString()))
29
                        {
30
                            DocInfoItem = _ciEntity.DOCINFO.Where(x => x.DOCUMENT_ID == item.DOCUMENT_ID).FirstOrDefault();
31

    
32
                            var markupinfoItem = DocInfoItem.MARKUP_INFO.Where(x => x.DOCINFO_ID == DocInfoItem.ID && x.CONSOLIDATE == 1 && x.AVOID_CONSOLIDATE == 0 && x.PART_CONSOLIDATE == 0).FirstOrDefault();
33

    
34
                            if (markupinfoItem.MARKUP_INFO_VERSION.Count > 0)
35
                            {
36
                                MarkupDataSet = markupinfoItem.MARKUP_INFO_VERSION.OrderBy(x => x.CREATE_DATE).LastOrDefault().MARKUP_DATA.ToList().OrderBy(x => x.PAGENUMBER).ToList();
37
                            }
38
                        }
39

    
40
                        List<MARKUP_DATA> MarkupDataSet2 = null;
41
                        DOCINFO DocInfoItem2 = null;
42
                        MARKUP_INFO MarkupInfoItem = null;
43

    
44
                        using (CIEntities _ciEntity = new CIEntities(KCOMDataModel.Common.ConnectStringBuilder.ProjectCIConnectString("000000").ToString()))
45
                        {
46
                            var _DOCINFO = _ciEntity.DOCINFO.Where(x => x.DOCUMENT_ID == item.DOCUMENT_ID);
47

    
48
                            if (_DOCINFO.Count() > 0)
49
                            {
50
                                DocInfoItem2 = _DOCINFO.First();
51

    
52
                                var infoItems = _ciEntity.MARKUP_INFO.Where(x => x.DOCINFO_ID == DocInfoItem.ID && x.CONSOLIDATE == 1 && x.AVOID_CONSOLIDATE == 0 && x.PART_CONSOLIDATE == 0);
53

    
54
                                if (infoItems.Count() == 0)
55
                                {
56
                                    throw new Exception("콘솔리데잇이 작업 요청 후에 수정 / 삭제 되었습니다");
57
                                }
58
                                else
59
                                {
60
                                    MarkupInfoItem = infoItems.First();
61

    
62
                                    var markupInfoVerItems = _ciEntity.MARKUP_INFO_VERSION.Where(x => x.MARKUPINFO_ID == MarkupInfoItem.ID).ToList();
63

    
64
                                    if (markupInfoVerItems.Count() > 0)
65
                                    {
66
                                        var markupInfoVerItem = markupInfoVerItems.OrderByDescending(x => x.CREATE_DATE).First();
67

    
68
                                        MarkupDataSet2 = _ciEntity.MARKUP_DATA.Where(x => x.MARKUPINFO_VERSION_ID == markupInfoVerItem.ID).OrderBy(d => d.PAGENUMBER).ToList();
69
                                    }
70
                                    else
71
                                    {
72
                                        throw new Exception("MARKUP_INFO_VERSION 이 존재 하지 않습니다");
73
                                    }
74
                                }
75
                            }
76
                        }
77

    
78

    
79
                        if (MarkupDataSet?.Count() != MarkupDataSet?.Count())
80
                        {
81
                            Console.WriteLine($"Document ID : {item.DOCUMENT_ID} Error");
82
                        }
83

    
84
                        System.Threading.Thread.Sleep(100);
85
                    }
86

    
87
                }
88
            }
89
            catch (Exception ex)
90
            {
91
                Console.WriteLine(ex.ToString());
92
            }
93
            Console.WriteLine("완료");
94
            Console.ReadLine();
95
        }
96

    
97
        static void Write(string Log)
98
        {
99

    
100
        }
101
    }
102
}
클립보드 이미지 추가 (최대 크기: 500 MB)