프로젝트

일반

사용자정보

통계
| 개정판:

hytos / ID2.Manager / ID2.Manager.Controller / Controllers / DocumentController.cs @ 7066b8a9

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

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

    
7
using ID2.Manager.Dapper;
8
using ID2.Manager.Data.Models;
9
using ID2.Manager.Dapper.Repository;
10

    
11
namespace ID2.Manager.Controller.Controllers
12
{
13
    public class DocumentController : BaseController
14
    {
15
        public DocumentController() : base() { }
16

    
17
        public DocumentController(ID2ProjectInfo id2Info) : base(id2Info) { }
18

    
19
        public (IEnumerable<Documents> dwgs, int totalCnt) GetDocuments(string projectCode, string personIncharge, string jobLevel, string documentNo, string isToIsDiscussion, string isFrReviewStatus, string isID2Work, string id2Status, string avevaStatus, string prodIsResult, string clientIsResult)
20
        {
21
            using (DocumentRepository rep = new DocumentRepository(this._MSSQLCONNSTR))
22
            {
23
                return rep.GetDocuments(projectCode, personIncharge, jobLevel, documentNo, isToIsDiscussion, isFrReviewStatus, isID2Work, id2Status, avevaStatus, prodIsResult, clientIsResult);
24
            }
25
        }
26

    
27
        public (IEnumerable<Documents> dwgs, int totalCnt) GetDocuments(List<ID2ProjectInfo> id2Infos, string projectCode, string personIncharge, string jobLevel, string documentNo, string isToIsDiscussion, string isFrReviewStatus, string isID2Work, string id2Status, string avevaStatus, string prodIsResult, string clientIsResult)
28
        {
29
            IEnumerable<Documents> docs = this.GetDocuments(projectCode, personIncharge, jobLevel, documentNo, isToIsDiscussion, isFrReviewStatus, isID2Work, id2Status, avevaStatus, prodIsResult, clientIsResult).dwgs;
30
            List<ID2Drawings> id2docs = null;
31

    
32
            if (id2Infos.Any())
33
            {
34
                id2docs = new List<ID2Drawings>();
35
                id2Infos.ForEach(x =>
36
                {
37
                    id2docs.AddRange(new DocumentController(x).GetID2DrawingsByProject(x));
38
                });
39
            }
40

    
41
            if (docs != null && id2docs != null && docs.Any() && id2docs.Any())
42
            {
43
                var result = from doc in docs
44
                             join id2 in id2docs on new { projCd = doc.RefProjectCode, DocNo = doc.DocumentNo } equals new { projCd = id2.PROJECTNAME, DocNo = id2.DOCNAME } into gj
45
                             from dw in gj.DefaultIfEmpty()
46
                             select new Documents()
47
                             {
48
                                 Seq = doc.Seq,
49
                                 DocID = doc.DocID,
50
                                 DocumentNo = doc.DocumentNo,
51
                                 RevisonNo = doc.RevisonNo,
52
                                 RefProjectCode = doc.RefProjectCode,
53
                                 IsLatest = doc.IsLatest,
54
                                 AutoCADFilie = doc.AutoCADFilie,
55
                                 PDFFile = doc.PDFFile,
56
                                 MarkupLink = doc.MarkupLink,
57
                                 AVEVALink = doc.AVEVALink,
58
                                 DocFilePath = doc.DocFilePath,
59
                                 DocFileName = doc.DocFileName,
60
                                 JobLevel = doc.JobLevel,
61
                                 IsTypical = doc.IsTypical,
62
                                 PersonInCharge = doc.PersonInCharge,
63
                                 IsDeleted = doc.IsDeleted,
64
                                 RegisteredDate = doc.RegisteredDate,
65
                                 ModifiedDate = doc.ModifiedDate,
66
                                 DeletedDate = doc.DeletedDate,
67
                                 ToIsDiscussion = doc.ToIsDiscussion,
68
                                 ToRemarks = doc.ToRemarks,
69
                                 ToCreator = doc.ToCreator,
70
                                 ToCapture = doc.ToCapture,
71
                                 ToIsMarkup = doc.ToIsMarkup,
72
                                 FrReviewStatus = doc.FrReviewStatus,
73
                                 FrRemarks = doc.FrRemarks,
74
                                 FrCreator = doc.FrCreator,
75
                                 FrCapture = doc.FrCapture,
76
                                 FrIsMarkup = doc.FrIsMarkup,
77
                                 IsID2Work = doc.IsID2Work,
78
                                 ID2Connection = doc.ID2Connection,
79
                                 ID2StartDate = doc.ID2StartDate,
80
                                 ID2EndDate = dw?.DATETIME == null ? (DateTime?)null : Convert.ToDateTime(dw?.DATETIME),
81
                                 ID2JobTime = doc.ID2JobTime,
82
                                 ID2Status = doc.ID2Status,
83
                                 ID2Issues = doc.ID2Issues,
84
                                 AVEVAConnection = doc.AVEVAConnection,
85
                                 AVEVAConvertDate = doc.AVEVAConvertDate,
86
                                 AVEVAReviewDate = doc.AVEVAReviewDate,
87
                                 AVEVAStatus = doc.AVEVAStatus,
88
                                 AVEVAIssues = doc.AVEVAIssues,
89
                                 ReviewFilePath = doc.ReviewFilePath,
90
                                 ReviewFileName = doc.ReviewFileName,
91
                                 ProdReviewer = doc.ProdReviewer,
92
                                 ProdIsResult = doc.ProdIsResult,
93
                                 ProdRemarks = doc.ProdRemarks,
94
                                 ClientReviewer = doc.ClientReviewer,
95
                                 ClientIsResult = doc.ClientIsResult,
96
                                 ClientRemarks = doc.ClientRemarks,
97
                                 DTIsGateWay = doc.DTIsGateWay,
98
                                 DTIsImport = doc.DTIsImport,
99
                                 DTIsRegSystem = doc.DTIsRegSystem,
100
                                 DTRemarks = doc.DTRemarks,
101
                                 MarkupText = doc.MarkupText
102
                             };
103

    
104
                return (result, 0);
105

    
106
            }
107
            return (docs, 0);
108
        }
109

    
110
        public bool SetDocumentData(List<Documents> docList, List<Documents> delDocList)
111
        {
112
            using (DocumentRepository rep = new DocumentRepository(this._MSSQLCONNSTR))
113
            {
114
                return rep.SetDocumentData(docList, delDocList);
115
            }
116
        }
117

    
118
        public Documents SetDocumentDataField(Documents doc, string userId)
119
        {
120
            using (DocumentRepository rep = new DocumentRepository(this._MSSQLCONNSTR))
121
            {
122
                return rep.SetDocumentDataField(doc, userId);
123
            }
124
        }
125

    
126

    
127
        //ID2
128
        public IEnumerable<ID2Drawings> GetID2DrawingsByProject(ID2ProjectInfo id2Info)
129
        {
130
            using (DocumentRepository rep = new DocumentRepository(this._ID2CONNSTR))
131
            {
132
                return rep.GetID2DrawingsByProject(id2Info);
133
            }
134
        }
135
    }
136
}
클립보드 이미지 추가 (최대 크기: 500 MB)