hytos / ID2.Manager / ID2.Manager.Controller / Controllers / DocumentController.cs @ 296ffcbd
이력 | 보기 | 이력해설 | 다운로드 (6.73 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> GetAllDocuments(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.GetAllDocuments(projectCode, personIncharge, jobLevel, documentNo, isToIsDiscussion, isFrReviewStatus, isID2Work, id2Status, avevaStatus, prodIsResult, clientIsResult); |
24 |
} |
25 |
} |
26 |
|
27 |
public IEnumerable<Documents> GetAllDocuments(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.GetAllDocuments(projectCode, personIncharge, jobLevel, documentNo, isToIsDiscussion, isFrReviewStatus, isID2Work, id2Status, avevaStatus, prodIsResult, clientIsResult); |
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 |
ToCapturePath = doc.ToCapturePath, |
71 |
ToIsMarkup = doc.ToIsMarkup, |
72 |
FrReviewStatus = doc.FrReviewStatus, |
73 |
FrRemarks = doc.FrRemarks, |
74 |
FrCreator = doc.FrCreator, |
75 |
FrCapturePath = doc.FrCapturePath, |
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; |
105 |
|
106 |
} |
107 |
return docs; |
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 |
} |