hytos / ID2.Manager / ID2.Manager.Dapper / Repository / DocumentRepository.cs @ dfb9a03c
이력 | 보기 | 이력해설 | 다운로드 (34.4 KB)
1 | 5898479a | yoush97 | using System; |
---|---|---|---|
2 | using System.Collections.Generic; |
||
3 | using System.Linq; |
||
4 | using System.Text; |
||
5 | using System.Threading.Tasks; |
||
6 | |||
7 | 54977253 | yoush97 | using System.Data; |
8 | 39938acd | yoush97 | using System.ComponentModel; |
9 | using System.Reflection; |
||
10 | 54977253 | yoush97 | |
11 | 5898479a | yoush97 | using ID2.Manager.Data.Models; |
12 | |||
13 | 8e373ccf | yoush97 | using Dapper; |
14 | 39938acd | yoush97 | |
15 | using Newtonsoft.Json; |
||
16 | 8e373ccf | yoush97 | |
17 | 5898479a | yoush97 | namespace ID2.Manager.Dapper.Repository |
18 | { |
||
19 | public class DocumentRepository : BaseRepository |
||
20 | { |
||
21 | public DocumentRepository(string connectionStr) : base(connectionStr) { } |
||
22 | |||
23 | d65eb9b2 | yoush97 | public IEnumerable<Documents> GetAllDocuments(List<string> projectGroupIDs) |
24 | 5898479a | yoush97 | { |
25 | a4a166e2 | yoush97 | var dynamicParameters = new DynamicParameters(); |
26 | StringBuilder sbWhere = new StringBuilder(); |
||
27 | var parameters = new Dictionary<string, object>(); |
||
28 | d65eb9b2 | yoush97 | if (projectGroupIDs.Count > 0) |
29 | a4a166e2 | yoush97 | { |
30 | d65eb9b2 | yoush97 | sbWhere.Append(" and doc.RefProjectCode in (select Code from dbo.Projects where ParentID in @RefGroupIDs) "); |
31 | parameters.Add("RefGroupIDs", projectGroupIDs); |
||
32 | a4a166e2 | yoush97 | } |
33 | |||
34 | 82705273 | yoush97 | try |
35 | { |
||
36 | string query = $@" |
||
37 | 54977253 | yoush97 | select doc.* |
38 | 7066b8a9 | yoush97 | from dbo.Documents doc |
39 | a4a166e2 | yoush97 | where doc.IsDeleted=0 {sbWhere} |
40 | 7066b8a9 | yoush97 | order by doc.Seq;"; |
41 | a4a166e2 | yoush97 | |
42 | if (parameters.Count > 0) |
||
43 | { |
||
44 | dynamicParameters.AddDynamicParams(parameters); |
||
45 | } |
||
46 | |||
47 | return Query<Documents>(query, dynamicParameters); |
||
48 | 82705273 | yoush97 | } |
49 | catch (Exception ex) |
||
50 | { |
||
51 | throw ex; |
||
52 | } |
||
53 | 7066b8a9 | yoush97 | } |
54 | 08499f5f | taeseongkim | static string GetDescriptionFromAttribute(MemberInfo member) |
55 | { |
||
56 | if (member == null) return null; |
||
57 | |||
58 | var attrib = (DescriptionAttribute)Attribute.GetCustomAttribute(member, typeof(DescriptionAttribute), false); |
||
59 | return (attrib?.Description ?? member.Name).ToLower(); |
||
60 | } |
||
61 | |||
62 | 7066b8a9 | yoush97 | |
63 | d65eb9b2 | yoush97 | public (IEnumerable<Documents> dwgs, int totalCnt) GetDocuments(List<string> projectGroupIDs, List<string> dateTypes, DateTime? frDate, DateTime? toDate, string team, string projectCode, string personIncharge, string jobLevel, string documentNo, string isToIsDiscussion, string isFrReviewStatus, string id2Status, string id2Issues, string avevaStatus, string avevaIssues, string prodIsResult, string clientIsResult, string isGateWay, string isRegSystem) |
64 | 7066b8a9 | yoush97 | { |
65 | 08499f5f | taeseongkim | var map = new CustomPropertyTypeMap(typeof(AttFileInfo), (type, columnName) |
66 | => type.GetProperties().FirstOrDefault(prop => GetDescriptionFromAttribute(prop) == columnName.ToLower())); |
||
67 | SqlMapper.SetTypeMap(typeof(AttFileInfo), map); |
||
68 | |||
69 | |||
70 | 7066b8a9 | yoush97 | var dynamicParameters = new DynamicParameters(); |
71 | 54977253 | yoush97 | dynamicParameters.Add("Total", dbType: DbType.Int32, direction: ParameterDirection.Output); |
72 | 7066b8a9 | yoush97 | |
73 | 8e373ccf | yoush97 | StringBuilder sbWhere = new StringBuilder(); |
74 | bf7d1c08 | yoush97 | StringBuilder sbTotalWhere = new StringBuilder(); |
75 | 8e373ccf | yoush97 | var parameters = new Dictionary<string, object>(); |
76 | b2ff5ff4 | yoush97 | if (dateTypes.Count > 0 && (frDate != null || toDate != null)) |
77 | { |
||
78 | List<string> subWheres = new List<string>(); |
||
79 | foreach (string dateType in dateTypes) |
||
80 | { |
||
81 | StringBuilder sbSubWhere = new StringBuilder(); |
||
82 | if (frDate != null) |
||
83 | { |
||
84 | sbSubWhere.Insert(0, $@"convert(datetime, '{Convert.ToDateTime(frDate).AddDays(-1):yyyy-MM-dd 23:59:59.997}') < doc.{dateType}"); |
||
85 | } |
||
86 | if (toDate != null) |
||
87 | { |
||
88 | if (frDate != null) |
||
89 | sbSubWhere.Append($@" and "); |
||
90 | sbSubWhere.Append($@"doc.{dateType} < convert(datetime, '{Convert.ToDateTime(toDate).AddDays(1):yyyy-MM-dd 00:00:00.000}')"); |
||
91 | } |
||
92 | |||
93 | if (sbSubWhere.Length > 0) |
||
94 | { |
||
95 | subWheres.Add("(" + sbSubWhere.ToString() + ")"); |
||
96 | } |
||
97 | } |
||
98 | |||
99 | if (subWheres.Count > 0) |
||
100 | { |
||
101 | sbWhere.Append(" and (" + string.Join(" or ", subWheres) + ") "); |
||
102 | } |
||
103 | } |
||
104 | a8981c30 | yoush97 | if (!string.IsNullOrEmpty(team)) |
105 | { |
||
106 | sbWhere.Append(" and prj.Team=@Team "); |
||
107 | parameters.Add("Team", team); |
||
108 | } |
||
109 | 416979ec | yoush97 | if (projectCode == null) |
110 | ea97eee6 | yoush97 | { |
111 | 416979ec | yoush97 | sbWhere.Append(" and prj.Code is null "); |
112 | d65eb9b2 | yoush97 | sbTotalWhere.Append(" and doc.RefProjectCode in (select Code from dbo.Projects where ParentID in @RefGroupIDs) "); |
113 | parameters.Add("RefGroupIDs", projectGroupIDs); |
||
114 | 416979ec | yoush97 | } |
115 | else if (projectCode.Equals(string.Empty)) |
||
116 | { |
||
117 | d65eb9b2 | yoush97 | sbWhere.Append(" and doc.RefProjectCode in (select Code from dbo.Projects where ParentID in @RefGroupIDs) "); |
118 | sbTotalWhere.Append(" and doc.RefProjectCode in (select Code from dbo.Projects where ParentID in @RefGroupIDs) "); |
||
119 | parameters.Add("RefGroupIDs", projectGroupIDs); |
||
120 | ea97eee6 | yoush97 | } |
121 | else |
||
122 | 8e373ccf | yoush97 | { |
123 | d65eb9b2 | yoush97 | sbTotalWhere.Append(" and doc.RefProjectCode in (select Code from dbo.Projects where ParentID in @RefGroupIDs) "); |
124 | parameters.Add("RefGroupIDs", projectGroupIDs); |
||
125 | e8a86b9b | yoush97 | |
126 | 36a31d25 | yoush97 | sbWhere.Append(" and doc.RefProjectCode=@RefProjectCode "); |
127 | parameters.Add("RefProjectCode", projectCode); |
||
128 | 8e373ccf | yoush97 | } |
129 | if (!string.IsNullOrEmpty(personIncharge)) |
||
130 | { |
||
131 | 6290fc92 | yoush97 | sbWhere.Append(" and (doc.PersonInCharge=@PersonInCharge or doc.AVEVAPersonInCharge=@PersonInCharge) "); |
132 | 8e373ccf | yoush97 | parameters.Add("PersonInCharge", personIncharge); |
133 | 6290fc92 | yoush97 | parameters.Add("AVEVAPersonInCharge", personIncharge); |
134 | 8e373ccf | yoush97 | } |
135 | 08ea0584 | yoush97 | if (!string.IsNullOrEmpty(jobLevel)) |
136 | { |
||
137 | sbWhere.Append(" and doc.JobLevel=@JobLevel "); |
||
138 | parameters.Add("JobLevel", jobLevel); |
||
139 | } |
||
140 | 8e373ccf | yoush97 | if (!string.IsNullOrEmpty(documentNo)) |
141 | { |
||
142 | sbWhere.Append(" and doc.DocumentNo like '%' + @DocumentNo +'%' "); |
||
143 | parameters.Add("DocumentNo", documentNo); |
||
144 | } |
||
145 | |||
146 | 296ffcbd | yoush97 | if (!string.IsNullOrEmpty(isToIsDiscussion)) |
147 | { |
||
148 | sbWhere.Append(" and doc.ToIsDiscussion=@ToIsDiscussion "); |
||
149 | parameters.Add("ToIsDiscussion", isToIsDiscussion); |
||
150 | } |
||
151 | |||
152 | if (!string.IsNullOrEmpty(isFrReviewStatus)) |
||
153 | { |
||
154 | sbWhere.Append(" and doc.FrReviewStatus=@FrReviewStatus "); |
||
155 | parameters.Add("FrReviewStatus", isFrReviewStatus); |
||
156 | } |
||
157 | |||
158 | 08ea0584 | yoush97 | if (!string.IsNullOrEmpty(id2Status)) |
159 | { |
||
160 | sbWhere.Append(" and doc.ID2Status=@ID2Status "); |
||
161 | parameters.Add("ID2Status", id2Status); |
||
162 | } |
||
163 | 3cc84cb6 | yoush97 | |
164 | if (!string.IsNullOrEmpty(id2Issues)) |
||
165 | { |
||
166 | sbWhere.Append(" and (case when isnull(ltrim(rtrim(doc.ID2Issues)),'') = '' then 'No' else 'Yes' end)=@ID2Issues "); |
||
167 | parameters.Add("ID2Issues", id2Issues); |
||
168 | } |
||
169 | |||
170 | 08ea0584 | yoush97 | if (!string.IsNullOrEmpty(avevaStatus)) |
171 | { |
||
172 | sbWhere.Append(" and doc.AVEVAStatus=@AVEVAStatus "); |
||
173 | parameters.Add("AVEVAStatus", avevaStatus); |
||
174 | } |
||
175 | |||
176 | 3cc84cb6 | yoush97 | if (!string.IsNullOrEmpty(avevaIssues)) |
177 | { |
||
178 | sbWhere.Append(" and (case when isnull(ltrim(rtrim(doc.AVEVAIssues)),'') = '' then 'No' else 'Yes' end)=@AVEVAIssues "); |
||
179 | parameters.Add("AVEVAIssues", avevaIssues); |
||
180 | } |
||
181 | |||
182 | 08ea0584 | yoush97 | if (!string.IsNullOrEmpty(prodIsResult)) |
183 | { |
||
184 | sbWhere.Append(" and doc.ProdIsResult=@ProdIsResult "); |
||
185 | parameters.Add("ProdIsResult", prodIsResult); |
||
186 | } |
||
187 | if (!string.IsNullOrEmpty(clientIsResult)) |
||
188 | { |
||
189 | sbWhere.Append(" and doc.ClientIsResult=@ClientIsResult "); |
||
190 | parameters.Add("ClientIsResult", clientIsResult); |
||
191 | } |
||
192 | ee82162b | yoush97 | if (!string.IsNullOrEmpty(isGateWay)) |
193 | { |
||
194 | sbWhere.Append(" and doc.DTIsGateWay=@DTIsGateWay "); |
||
195 | parameters.Add("DTIsGateWay", isGateWay); |
||
196 | } |
||
197 | if (!string.IsNullOrEmpty(isRegSystem)) |
||
198 | { |
||
199 | sbWhere.Append(" and doc.DTIsRegSystem=@DTIsRegSystem "); |
||
200 | parameters.Add("DTIsRegSystem", isRegSystem); |
||
201 | } |
||
202 | 08ea0584 | yoush97 | |
203 | 82705273 | yoush97 | try |
204 | { |
||
205 | bc01d8d5 | yoush97 | if (parameters.Count > 0) |
206 | { |
||
207 | dynamicParameters.AddDynamicParams(parameters); |
||
208 | } |
||
209 | |||
210 | string query = $@" |
||
211 | select doc.* |
||
212 | ,prj.Team |
||
213 | from dbo.Documents doc |
||
214 | left outer join dbo.Projects prj on doc.RefProjectCode=prj.Code |
||
215 | where doc.IsDeleted=0 {sbWhere} |
||
216 | order by doc.Seq; |
||
217 | |||
218 | select files.* |
||
219 | from dbo.AttachFIles files |
||
220 | inner join |
||
221 | ( |
||
222 | 8b4923fe | yoush97 | select doc.DocID |
223 | bc01d8d5 | yoush97 | from dbo.Documents doc |
224 | left outer join dbo.Projects prj on doc.RefProjectCode=prj.Code |
||
225 | where doc.IsDeleted=0 {sbWhere} |
||
226 | 8b4923fe | yoush97 | ) doc on files.RefID=doc.DocID; |
227 | bc01d8d5 | yoush97 | |
228 | select PROJECT_NO |
||
229 | ,DOCUMENT_ID |
||
230 | ,PAGENUMBER |
||
231 | ,[Text] as [TEXT] |
||
232 | ,CREATE_DATE |
||
233 | ,[NAME] as CREATE_USER |
||
234 | 8b4923fe | yoush97 | from ViewMarkupData; |
235 | |||
236 | select @Total=count(*) from dbo.Documents doc where doc.IsDeleted=0 {sbTotalWhere};"; |
||
237 | var results = QueryMultiple(query, dynamicParameters); |
||
238 | |||
239 | var docs = results.Read<Documents>(); |
||
240 | var docFiles = results.Read<AttFileInfo>(); |
||
241 | var markupData = results.Read<MarkupText>(); |
||
242 | int totalCount = dynamicParameters.Get<int>("Total"); |
||
243 | bc01d8d5 | yoush97 | |
244 | var docFileGroups = docFiles.GroupBy(g => g.RefID) |
||
245 | .Select(x => new |
||
246 | { |
||
247 | RefDocID = x.Key, |
||
248 | List = x.AsEnumerable<AttFileInfo>().ToList(), |
||
249 | ToCaptureCount = x.Where(y => y.Category.Equals("toreview")).Count(), |
||
250 | FrCaptureCount = x.Where(y => y.Category.Equals("frreview")).Count(), |
||
251 | ID2CaptureCount = x.Where(y => y.Category.Equals("id2work")).Count() |
||
252 | }); |
||
253 | var markupGroups = markupData.GroupBy(g => new { g.PROJECT_NO, g.DOCUMENT_ID }) |
||
254 | .Select(x => new |
||
255 | { |
||
256 | x.Key.PROJECT_NO, |
||
257 | x.Key.DOCUMENT_ID, |
||
258 | List = x.Where(y => y.TEXT != null && y.CREATE_DATE != null && y.CREATE_USER != null).OrderByDescending(o => o.CREATE_DATE).ToList() //x.AsEnumerable<MarkupText>().ToList() |
||
259 | }); |
||
260 | |||
261 | var ret = (from d in docs |
||
262 | join fg in docFileGroups on d.DocID equals fg.RefDocID into dfg |
||
263 | from fdata in dfg.DefaultIfEmpty() |
||
264 | join mg in markupGroups on new { pj = d.RefProjectCode, dn = d.DocumentNo } equals new { pj = mg.PROJECT_NO, dn = mg.DOCUMENT_ID } into dmg |
||
265 | from mdata in dmg.DefaultIfEmpty() |
||
266 | 8b4923fe | yoush97 | select new { d, fdata, mdata }).Select(x => |
267 | bc01d8d5 | yoush97 | { |
268 | 8b4923fe | yoush97 | x.d.ToCapture = x.fdata?.ToCaptureCount ?? x.d.ToCapture; |
269 | x.d.FrCapture = x.fdata?.FrCaptureCount ?? x.d.FrCapture; |
||
270 | x.d.ID2Capture = x.fdata?.ID2CaptureCount ?? x.d.ID2Capture; |
||
271 | x.d.Markups = x.mdata?.List.Count > 0 ? x.mdata.List : x.d.Markups; |
||
272 | x.d.AttFiles = x.fdata?.List ?? new List<AttFileInfo>(); |
||
273 | x.d.ConvertStatus = (x.mdata == null ? x.d.ConvertStatus : 4); |
||
274 | return x.d; |
||
275 | bc01d8d5 | yoush97 | }); |
276 | |||
277 | return (ret, totalCount); |
||
278 | 82705273 | yoush97 | } |
279 | catch (Exception ex) |
||
280 | { |
||
281 | throw ex; |
||
282 | } |
||
283 | 5898479a | yoush97 | } |
284 | 482f6326 | yoush97 | |
285 | ff990784 | yoush97 | public int ExistsDocument(string projectGroupID, List<string> newDwgNos) |
286 | { |
||
287 | 9107c43b | yoush97 | int existCount = 0; |
288 | ff990784 | yoush97 | |
289 | 9107c43b | yoush97 | int paramMaxCount = 2000; |
290 | int execCount = (newDwgNos.Count / paramMaxCount) + 1; |
||
291 | ff990784 | yoush97 | |
292 | 9107c43b | yoush97 | for (int i = 0; i < execCount; i++) |
293 | { |
||
294 | var dynamicParameters = new DynamicParameters(); |
||
295 | StringBuilder sbWhere = new StringBuilder(); |
||
296 | var parameters = new Dictionary<string, object>(); |
||
297 | if (!string.IsNullOrEmpty(projectGroupID)) |
||
298 | ff990784 | yoush97 | { |
299 | 9107c43b | yoush97 | sbWhere.Append(" and doc.RefProjectCode in (select Code from dbo.Projects where ParentID=@RefGroupID) "); |
300 | parameters.Add("RefGroupID", projectGroupID); |
||
301 | ff990784 | yoush97 | } |
302 | |||
303 | 9107c43b | yoush97 | var limitDwgNos = newDwgNos.Skip(paramMaxCount * i).Take(paramMaxCount).ToList(); |
304 | sbWhere.Append($@" and doc.DocumentNo in @limitDwgNos "); |
||
305 | parameters.Add("limitDwgNos", limitDwgNos); |
||
306 | |||
307 | try |
||
308 | { |
||
309 | string query = $@" |
||
310 | ff990784 | yoush97 | select count(*) cnt |
311 | from dbo.Documents doc |
||
312 | where doc.IsDeleted=0 {sbWhere}"; |
||
313 | |||
314 | 9107c43b | yoush97 | if (parameters.Count > 0) |
315 | { |
||
316 | dynamicParameters.AddDynamicParams(parameters); |
||
317 | } |
||
318 | |||
319 | existCount += ExecuteScalar<int>(query, dynamicParameters); |
||
320 | } |
||
321 | catch (Exception ex) |
||
322 | ff990784 | yoush97 | { |
323 | 9107c43b | yoush97 | throw ex; |
324 | ff990784 | yoush97 | } |
325 | } |
||
326 | 9107c43b | yoush97 | |
327 | return existCount; |
||
328 | ff990784 | yoush97 | } |
329 | |||
330 | 416979ec | yoush97 | // public bool ExistsNotRegID2ProjectDocuments() |
331 | // { |
||
332 | // try |
||
333 | // { |
||
334 | // string query = $@" |
||
335 | //select top 1 * |
||
336 | //from dbo.Documents doc |
||
337 | //where doc.IsDeleted=0 |
||
338 | // and doc.RefProjectCode not in (select Code from dbo.Projects prj);"; |
||
339 | |||
340 | // bool isRet = ExecuteScalar<int>(query, null) > 0; |
||
341 | |||
342 | // return isRet; |
||
343 | // } |
||
344 | // catch (Exception ex) |
||
345 | // { |
||
346 | // throw ex; |
||
347 | // } |
||
348 | // } |
||
349 | |||
350 | d65eb9b2 | yoush97 | public bool SetDocumentData(List<string> projectGroupIDs, List<Documents> docList, List<string> delDocList, string userId) |
351 | 482f6326 | yoush97 | { |
352 | bool isSuccess = false; |
||
353 | |||
354 | try |
||
355 | { |
||
356 | d2d4f84b | yoush97 | using (var transaction = base.BeginTransaction()) |
357 | 482f6326 | yoush97 | { |
358 | 709c1971 | yoush97 | string query = string.Empty; |
359 | |||
360 | if (delDocList.Count > 0) |
||
361 | 482f6326 | yoush97 | { |
362 | 993feace | yoush97 | int paramMaxCount = 2000; |
363 | int execCount = (delDocList.Count / paramMaxCount) + 1; |
||
364 | 709c1971 | yoush97 | |
365 | 993feace | yoush97 | for (int i = 0; i < execCount; i++) |
366 | 709c1971 | yoush97 | { |
367 | 993feace | yoush97 | var dynamicParameters = new DynamicParameters(); |
368 | StringBuilder sbWhere = new StringBuilder(); |
||
369 | var parameters = new Dictionary<string, object>(); |
||
370 | |||
371 | parameters.Add("DeletedUser", userId); |
||
372 | |||
373 | f074a104 | yoush97 | var limitDwgNos = delDocList.Skip(paramMaxCount * i).Take(paramMaxCount).ToList(); |
374 | 39938acd | yoush97 | sbWhere.Append($@" and DocID in @limitDwgNos "); |
375 | 993feace | yoush97 | parameters.Add("limitDwgNos", limitDwgNos); |
376 | |||
377 | 53fde692 | yoush97 | query = $@" |
378 | 74aa670a | yoush97 | update dbo.Documents |
379 | set IsDeleted=1 |
||
380 | 993feace | yoush97 | ,DeletedDate=getdate() |
381 | 54977253 | yoush97 | ,DeletedUser=@DeletedUser |
382 | 39938acd | yoush97 | where IsDeleted=0 {sbWhere}"; |
383 | 993feace | yoush97 | if (parameters.Count > 0) |
384 | { |
||
385 | dynamicParameters.AddDynamicParams(parameters); |
||
386 | } |
||
387 | |||
388 | base.Execute(query, dynamicParameters, transaction); |
||
389 | 709c1971 | yoush97 | } |
390 | } |
||
391 | 482f6326 | yoush97 | |
392 | foreach (Documents doc in docList) |
||
393 | { |
||
394 | if (string.IsNullOrEmpty(doc.DocID)) |
||
395 | { |
||
396 | 54977253 | yoush97 | doc.RegisteredUser = userId; |
397 | 993feace | yoush97 | doc.ModifiedUser = userId; |
398 | |||
399 | query = $@" |
||
400 | 39938acd | yoush97 | if exists(select * from dbo.Documents where RefProjectCode=@RefProjectCode and DocumentNo=@DocumentNo and IsDeleted=0) |
401 | 993feace | yoush97 | begin |
402 | --update |
||
403 | update dbo.Documents |
||
404 | set RevisonNo=case when isnull(@RevisonNo,'')='' then '0' else @RevisonNo end |
||
405 | ,System=@System |
||
406 | ,SubSystemCode=@SubSystemCode |
||
407 | ,JobLevel=@JobLevel |
||
408 | b2c03c2e | yoush97 | ,Simularity=@Simularity |
409 | 993feace | yoush97 | ,PersonInCharge=@PersonInCharge |
410 | 62e3647c | yoush97 | ,Worker=@Worker |
411 | 993feace | yoush97 | ,ModifiedDate=getdate() |
412 | ,ModifiedUser=@ModifiedUser |
||
413 | ,ToIsDiscussion=@ToIsDiscussion |
||
414 | ,ToRemarks=@ToRemarks |
||
415 | ,ToCreator=@ToCreator |
||
416 | ,FrReviewStatus=@FrReviewStatus |
||
417 | ,FrRemarks=@FrRemarks |
||
418 | ,FrCreator=@FrCreator |
||
419 | ,ID2StartDate=@ID2StartDate |
||
420 | ,ID2EndDate=@ID2EndDate |
||
421 | ,ID2Status=@ID2Status |
||
422 | ,ID2Issues=@ID2Issues |
||
423 | ,ReplyModifications=@ReplyModifications |
||
424 | ,ReplyRequester=@ReplyRequester |
||
425 | ,IsConvert=@IsConvert |
||
426 | ,AVEVAPersonInCharge=@AVEVAPersonInCharge |
||
427 | ,AVEVAWorker=@AVEVAWorker |
||
428 | ,AVEVAConvertDate=@AVEVAConvertDate |
||
429 | ,AVEVAReviewDate=@AVEVAReviewDate |
||
430 | ,AVEVAWorkDate=@AVEVAWorkDate |
||
431 | ,AVEVAStatus=@AVEVAStatus |
||
432 | ,AVEVAIssues=@AVEVAIssues |
||
433 | ,ProdReviewer=@ProdReviewer |
||
434 | ,ProdIsResult=@ProdIsResult |
||
435 | ,ProdRemarks=@ProdRemarks |
||
436 | ,ClientReviewer=@ClientReviewer |
||
437 | ,ClientIsResult=@ClientIsResult |
||
438 | ,ClientRemarks=@ClientRemarks |
||
439 | ,DTIsGateWay=@DTIsGateWay |
||
440 | ,DTIsImport=@DTIsImport |
||
441 | ,DTIsRegSystem=@DTIsRegSystem |
||
442 | ,DTRemarks=@DTRemarks |
||
443 | 39938acd | yoush97 | where RefProjectCode=@RefProjectCode and DocumentNo=@DocumentNo and IsDeleted=0 |
444 | 993feace | yoush97 | |
445 | if @@rowcount > 0 |
||
446 | begin |
||
447 | 39938acd | yoush97 | select @DocID |
448 | 993feace | yoush97 | end |
449 | else |
||
450 | begin |
||
451 | select '' |
||
452 | end |
||
453 | end |
||
454 | else |
||
455 | begin |
||
456 | --insert |
||
457 | declare @tbdoc table(docid varchar(36)) |
||
458 | insert into dbo.Documents |
||
459 | ( |
||
460 | DocID |
||
461 | ,DocumentNo |
||
462 | ,RevisonNo |
||
463 | ,System |
||
464 | ,SubSystemCode |
||
465 | ,RefProjectCode |
||
466 | ,JobLevel |
||
467 | b2c03c2e | yoush97 | ,Simularity |
468 | 993feace | yoush97 | ,PersonInCharge |
469 | 62e3647c | yoush97 | ,Worker |
470 | 993feace | yoush97 | ,RegisteredDate |
471 | ,RegisteredUser |
||
472 | ,ToIsDiscussion |
||
473 | ,ToRemarks |
||
474 | ,ToCreator |
||
475 | ,FrReviewStatus |
||
476 | ,FrRemarks |
||
477 | ,FrCreator |
||
478 | ,ID2StartDate |
||
479 | ,ID2EndDate |
||
480 | ,ID2Status |
||
481 | ,ID2Issues |
||
482 | ,ReplyModifications |
||
483 | ,ReplyRequester |
||
484 | ,IsConvert |
||
485 | ,AVEVAPersonInCharge |
||
486 | ,AVEVAWorker |
||
487 | ,AVEVAConvertDate |
||
488 | ,AVEVAReviewDate |
||
489 | ,AVEVAWorkDate |
||
490 | ,AVEVAStatus |
||
491 | ,AVEVAIssues |
||
492 | ,ProdReviewer |
||
493 | ,ProdIsResult |
||
494 | ,ProdRemarks |
||
495 | ,ClientReviewer |
||
496 | ,ClientIsResult |
||
497 | ,ClientRemarks |
||
498 | ,DTIsGateWay |
||
499 | ,DTIsImport |
||
500 | ,DTIsRegSystem |
||
501 | ,DTRemarks |
||
502 | ) |
||
503 | output inserted.DocID into @tbdoc |
||
504 | values |
||
505 | ( |
||
506 | lower(newid()) |
||
507 | ,@DocumentNo |
||
508 | ,case when isnull(@RevisonNo,'')='' then '0' else @RevisonNo end |
||
509 | ,@System |
||
510 | ,@SubSystemCode |
||
511 | ,@RefProjectCode |
||
512 | ,@JobLevel |
||
513 | b2c03c2e | yoush97 | ,@Simularity |
514 | 993feace | yoush97 | ,@PersonInCharge |
515 | 62e3647c | yoush97 | ,@Worker |
516 | 993feace | yoush97 | ,getdate() |
517 | ,@RegisteredUser |
||
518 | ,@ToIsDiscussion |
||
519 | ,@ToRemarks |
||
520 | ,@ToCreator |
||
521 | ,@FrReviewStatus |
||
522 | ,@FrRemarks |
||
523 | ,@FrCreator |
||
524 | ,@ID2StartDate |
||
525 | ,@ID2EndDate |
||
526 | ,@ID2Status |
||
527 | ,@ID2Issues |
||
528 | ,@ReplyModifications |
||
529 | ,@ReplyRequester |
||
530 | ,@IsConvert |
||
531 | ,@AVEVAPersonInCharge |
||
532 | ,@AVEVAWorker |
||
533 | ,@AVEVAConvertDate |
||
534 | ,@AVEVAReviewDate |
||
535 | ,@AVEVAWorkDate |
||
536 | ,@AVEVAStatus |
||
537 | ,@AVEVAIssues |
||
538 | ,@ProdReviewer |
||
539 | ,@ProdIsResult |
||
540 | ,@ProdRemarks |
||
541 | ,@ClientReviewer |
||
542 | ,@ClientIsResult |
||
543 | ,@ClientRemarks |
||
544 | ,@DTIsGateWay |
||
545 | ,@DTIsImport |
||
546 | ,@DTIsRegSystem |
||
547 | ,@DTRemarks |
||
548 | ) |
||
549 | |||
550 | if @@rowcount > 0 |
||
551 | begin |
||
552 | select docid from @tbdoc |
||
553 | end |
||
554 | else |
||
555 | begin |
||
556 | select '' |
||
557 | end |
||
558 | end"; |
||
559 | 482f6326 | yoush97 | } |
560 | else |
||
561 | { |
||
562 | 54977253 | yoush97 | doc.ModifiedUser = userId; |
563 | 482f6326 | yoush97 | query = $@" |
564 | update dbo.Documents |
||
565 | 0a6036cb | yoush97 | set RevisonNo=case when isnull(@RevisonNo,'')='' then '0' else @RevisonNo end |
566 | 79d7836e | yoush97 | ,System=@System |
567 | ,SubSystemCode=@SubSystemCode |
||
568 | a8981c30 | yoush97 | ,RefProjectCode=@RefProjectCode |
569 | 54977253 | yoush97 | ,JobLevel=@JobLevel |
570 | b2c03c2e | yoush97 | ,Simularity=@Simularity |
571 | 54977253 | yoush97 | ,PersonInCharge=@PersonInCharge |
572 | 62e3647c | yoush97 | ,Worker=@Worker |
573 | 54977253 | yoush97 | ,ModifiedDate=getdate() |
574 | ,ModifiedUser=@ModifiedUser |
||
575 | ,ToIsDiscussion=@ToIsDiscussion |
||
576 | ,ToRemarks=@ToRemarks |
||
577 | ,ToCreator=@ToCreator |
||
578 | ,FrReviewStatus=@FrReviewStatus |
||
579 | ,FrRemarks=@FrRemarks |
||
580 | ,FrCreator=@FrCreator |
||
581 | ,ID2StartDate=@ID2StartDate |
||
582 | ,ID2EndDate=@ID2EndDate |
||
583 | ,ID2Status=@ID2Status |
||
584 | ,ID2Issues=@ID2Issues |
||
585 | cb2e1138 | yoush97 | ,ReplyModifications=@ReplyModifications |
586 | ,ReplyRequester=@ReplyRequester |
||
587 | ,IsConvert=@IsConvert |
||
588 | ,AVEVAPersonInCharge=@AVEVAPersonInCharge |
||
589 | ,AVEVAWorker=@AVEVAWorker |
||
590 | 54977253 | yoush97 | ,AVEVAConvertDate=@AVEVAConvertDate |
591 | ,AVEVAReviewDate=@AVEVAReviewDate |
||
592 | ab3c1c74 | yoush97 | ,AVEVAWorkDate=@AVEVAWorkDate |
593 | 54977253 | yoush97 | ,AVEVAStatus=@AVEVAStatus |
594 | ,AVEVAIssues=@AVEVAIssues |
||
595 | ,ProdReviewer=@ProdReviewer |
||
596 | ,ProdIsResult=@ProdIsResult |
||
597 | ,ProdRemarks=@ProdRemarks |
||
598 | ,ClientReviewer=@ClientReviewer |
||
599 | ,ClientIsResult=@ClientIsResult |
||
600 | ,ClientRemarks=@ClientRemarks |
||
601 | ,DTIsGateWay=@DTIsGateWay |
||
602 | ,DTIsImport=@DTIsImport |
||
603 | ,DTIsRegSystem=@DTIsRegSystem |
||
604 | ,DTRemarks=@DTRemarks |
||
605 | b1591ae6 | yoush97 | where DocID=@DocID |
606 | |||
607 | if @@rowcount > 0 |
||
608 | begin |
||
609 | select @DocID |
||
610 | end |
||
611 | else |
||
612 | begin |
||
613 | select '' |
||
614 | end;"; |
||
615 | } |
||
616 | string refID = base.QueryFirstOrDefault<string>(query, doc, transaction); |
||
617 | |||
618 | if (doc.AttFiles != null && doc.AttFiles.Count > 0) |
||
619 | { |
||
620 | string attDelIDList = string.Join("','", doc.AttFiles.Where(x => !string.IsNullOrEmpty(x.FileID)).Select(x => x.FileID).ToList()); |
||
621 | |||
622 | if (!string.IsNullOrEmpty(refID) && attDelIDList.Length > 0) |
||
623 | { |
||
624 | query = $@" |
||
625 | delete from dbo.AttachFIles |
||
626 | where RefID=@RefID and FileID in ('{attDelIDList}');"; |
||
627 | base.Execute(query, new { RefID = refID }, transaction); |
||
628 | } |
||
629 | |||
630 | foreach (AttFileInfo attFile in doc.AttFiles) |
||
631 | { |
||
632 | e5ade387 | yoush97 | if (string.IsNullOrEmpty(attFile.RefID)) |
633 | { |
||
634 | attFile.RefID = refID; |
||
635 | attFile.Creator = userId; |
||
636 | b1591ae6 | yoush97 | |
637 | e5ade387 | yoush97 | query = $@" |
638 | b1591ae6 | yoush97 | insert into dbo.AttachFIles (FileID,RefID,Category,FileType,FileName,FilePath,FileExtension,FileData,Creator) |
639 | values |
||
640 | ( |
||
641 | lower(newid()) |
||
642 | ,@RefID |
||
643 | ,@Category |
||
644 | ,@FileType |
||
645 | ,@FileName |
||
646 | ,@FilePath |
||
647 | ,@FileExtension |
||
648 | ,@FileData |
||
649 | ,@Creator |
||
650 | )"; |
||
651 | |||
652 | e5ade387 | yoush97 | base.Execute(query, attFile, transaction); |
653 | } |
||
654 | b1591ae6 | yoush97 | } |
655 | 482f6326 | yoush97 | } |
656 | } |
||
657 | |||
658 | transaction.Commit(); |
||
659 | isSuccess = true; |
||
660 | } |
||
661 | } |
||
662 | catch (Exception ex) |
||
663 | { |
||
664 | throw ex; |
||
665 | } |
||
666 | |||
667 | return isSuccess; |
||
668 | } |
||
669 | 978488b0 | yoush97 | |
670 | public Documents SetDocumentDataField(Documents doc, string userId) |
||
671 | { |
||
672 | Documents resultData = null; |
||
673 | |||
674 | try |
||
675 | { |
||
676 | using (var transaction = base.BeginTransaction()) |
||
677 | { |
||
678 | string query = string.Empty; |
||
679 | |||
680 | if (!string.IsNullOrEmpty(doc.DocID)) |
||
681 | { |
||
682 | StringBuilder sbSet = new StringBuilder(); |
||
683 | var parameters = new Dictionary<string, object>(); |
||
684 | |||
685 | #region Update 할 목록 |
||
686 | if (doc.ID2StartDate != null) |
||
687 | { |
||
688 | 4b8d9ad9 | yoush97 | sbSet.Append(" ,ID2StartDate=(case when ID2StartDate is null then @DateTimeNow else ID2StartDate end) "); |
689 | 978488b0 | yoush97 | parameters.Add("ID2StartDate", doc.ID2StartDate); |
690 | } |
||
691 | 4b8d9ad9 | yoush97 | |
692 | 62e3647c | yoush97 | if (!string.IsNullOrEmpty(doc.Worker)) |
693 | 4b8d9ad9 | yoush97 | { |
694 | sbSet.Append(" ,Worker=@Worker "); |
||
695 | parameters.Add("Worker", doc.Worker); |
||
696 | } |
||
697 | 978488b0 | yoush97 | #endregion |
698 | |||
699 | if (parameters.Count > 0) |
||
700 | { |
||
701 | sbSet.Append(" ,ModifiedUser=@ModifiedUser "); |
||
702 | parameters.Add("ModifiedUser", userId); |
||
703 | |||
704 | 54977253 | yoush97 | parameters.Add("DocID", doc.DocID); |
705 | |||
706 | 978488b0 | yoush97 | query = $@" |
707 | declare @DateTimeNow datetime |
||
708 | set @DateTimeNow = getdate() |
||
709 | |||
710 | update dbo.Documents |
||
711 | set ModifiedDate=@DateTimeNow {sbSet} |
||
712 | where [DocID]=@DocID |
||
713 | |||
714 | if @@rowcount > 0 |
||
715 | begin |
||
716 | fe310cac | yoush97 | select * from dbo.Documents where DocID=@DocID |
717 | 978488b0 | yoush97 | end |
718 | else |
||
719 | begin |
||
720 | fe310cac | yoush97 | select * from dbo.Documents where 1=2 |
721 | 978488b0 | yoush97 | end;"; |
722 | resultData = base.QueryFirstOrDefault<Documents>(query, parameters, transaction); |
||
723 | } |
||
724 | } |
||
725 | |||
726 | transaction.Commit(); |
||
727 | } |
||
728 | } |
||
729 | catch (Exception ex) |
||
730 | { |
||
731 | throw ex; |
||
732 | } |
||
733 | |||
734 | return resultData; |
||
735 | } |
||
736 | fe57f64a | yoush97 | |
737 | 54977253 | yoush97 | public bool SetDocumentDatasField(List<Documents> docs, string userId) |
738 | { |
||
739 | bool isSuccess = false; |
||
740 | |||
741 | try |
||
742 | { |
||
743 | using (var transaction = base.BeginTransaction()) |
||
744 | { |
||
745 | foreach (Documents doc in docs) |
||
746 | { |
||
747 | string query = string.Empty; |
||
748 | |||
749 | if (!string.IsNullOrEmpty(doc.DocID)) |
||
750 | { |
||
751 | StringBuilder sbSet = new StringBuilder(); |
||
752 | var parameters = new Dictionary<string, object>(); |
||
753 | |||
754 | #region Update 할 목록 |
||
755 | if (doc.ID2EndDate != null) |
||
756 | { |
||
757 | sbSet.Append(" ,ID2EndDate=@ID2EndDate "); |
||
758 | parameters.Add("ID2EndDate", doc.ID2EndDate); |
||
759 | } |
||
760 | #endregion |
||
761 | |||
762 | if (parameters.Count > 0) |
||
763 | { |
||
764 | sbSet.Append(" ,ModifiedUser=@ModifiedUser "); |
||
765 | parameters.Add("ModifiedUser", userId); |
||
766 | |||
767 | parameters.Add("DocID", doc.DocID); |
||
768 | |||
769 | query = $@" |
||
770 | update dbo.Documents |
||
771 | set ModifiedDate=getdate() {sbSet} |
||
772 | where [DocID]=@DocID;"; |
||
773 | e458a996 | taeseongkim | base.Execute(query, parameters, transaction); |
774 | 54977253 | yoush97 | } |
775 | } |
||
776 | } |
||
777 | transaction.Commit(); |
||
778 | isSuccess = true; |
||
779 | } |
||
780 | } |
||
781 | catch (Exception ex) |
||
782 | { |
||
783 | throw ex; |
||
784 | } |
||
785 | |||
786 | return isSuccess; |
||
787 | } |
||
788 | |||
789 | fe57f64a | yoush97 | |
790 | //ID2 |
||
791 | public IEnumerable<ID2Drawings> GetID2DrawingsByProject(ID2ProjectInfo id2Info) |
||
792 | { |
||
793 | 82705273 | yoush97 | try |
794 | { |
||
795 | string query = $@" |
||
796 | fe57f64a | yoush97 | select @Name PROJECTNAME |
797 | ,dw.[UID], dw.[NAME], left(dw.[NAME], len(dw.[NAME]) - dw.lastidx) DOCNAME |
||
798 | ,case when rtrim(ltrim(isnull(convert(varchar, dw.[DATETIME]),''))) = '' then null else convert(datetime, convert(varchar, dw.[DATETIME])) end [DATETIME] |
||
799 | ,dw.OCCUPIED, dw.[Image] |
||
800 | from |
||
801 | ( |
||
802 | select [UID], [NAME], [DATETIME], OCCUPIED, [Image], charindex('.', reverse([NAME])) lastidx |
||
803 | from dbo.Drawings |
||
804 | ) dw;"; |
||
805 | 82705273 | yoush97 | return Query<ID2Drawings>(query, id2Info); |
806 | } |
||
807 | catch (Exception ex) |
||
808 | { |
||
809 | throw ex; |
||
810 | } |
||
811 | fe57f64a | yoush97 | } |
812 | 39938acd | yoush97 | |
813 | aa3deda4 | humkyung | /// <summary> |
814 | /// 주어진 이름을 가진 심볼을 조회한다. |
||
815 | /// </summary> |
||
816 | /// <param name="id2Info"></param> |
||
817 | /// <param name="Name"></param> |
||
818 | /// <returns></returns> |
||
819 | public IEnumerable<ID2Symbol> FindID2Symbols(string Name) |
||
820 | { |
||
821 | 72676337 | humkyung | string query = $@"select Name, T.[Type], OriginalPoint, ConnectionPoint, Width, Height |
822 | aa3deda4 | humkyung | from Symbol A join SymbolType T on A.SymbolType_UID=T.UID where A.Name like @Name"; |
823 | return Query<ID2Symbol>(query, new { Name = $"%{Name}%" }); |
||
824 | } |
||
825 | |||
826 | 39938acd | yoush97 | |
827 | //Transactions |
||
828 | d65eb9b2 | yoush97 | public int GetTranKey(string userId, string projectIDs) |
829 | 39938acd | yoush97 | { |
830 | int result = -1; |
||
831 | |||
832 | try |
||
833 | { |
||
834 | var dynamicParameters = new DynamicParameters(); |
||
835 | |||
836 | var parameters = new Dictionary<string, object>() |
||
837 | { |
||
838 | { "UserId", userId }, |
||
839 | d65eb9b2 | yoush97 | { "ProjectIDs", projectIDs } |
840 | 39938acd | yoush97 | }; |
841 | |||
842 | dynamicParameters.AddDynamicParams(parameters); |
||
843 | |||
844 | using (var transaction = base.BeginTransaction()) |
||
845 | { |
||
846 | string query = $@" |
||
847 | --log master 입력 |
||
848 | insert into dbo.Transactions (UserId, ProjectID) |
||
849 | d65eb9b2 | yoush97 | values (@UserId, @ProjectIDs); |
850 | 39938acd | yoush97 | select scope_identity();"; |
851 | |||
852 | result = base.ExecuteScalar<int>(query, dynamicParameters, transaction); |
||
853 | |||
854 | transaction.Commit(); |
||
855 | } |
||
856 | } |
||
857 | catch (Exception ex) |
||
858 | { |
||
859 | throw ex; |
||
860 | } |
||
861 | |||
862 | return result; |
||
863 | } |
||
864 | |||
865 | public bool SetTran(int seq, bool isMgt, bool isStart, int itemCount, int markusItemCount) |
||
866 | { |
||
867 | bool result = false; |
||
868 | |||
869 | try |
||
870 | { |
||
871 | var dynamicParameters = new DynamicParameters(); |
||
872 | var parameters = new Dictionary<string, object>() |
||
873 | { |
||
874 | { "Seq", seq }, |
||
875 | { "ItemCount", itemCount }, |
||
876 | { "MarkusItemCount", markusItemCount } |
||
877 | }; |
||
878 | dynamicParameters.AddDynamicParams(parameters); |
||
879 | StringBuilder sbWhere = new StringBuilder(); |
||
880 | if (isMgt) |
||
881 | { |
||
882 | if (isStart) |
||
883 | { |
||
884 | sbWhere.Append("StartDate=getdate(), ItemCount=@ItemCount"); |
||
885 | } |
||
886 | else |
||
887 | { |
||
888 | sbWhere.Append("EndDate=getdate()"); |
||
889 | } |
||
890 | |||
891 | } |
||
892 | else |
||
893 | { |
||
894 | if (isStart) |
||
895 | { |
||
896 | sbWhere.Append("MarkusStartDate=getdate(), MarkusItemCount=@MarkusItemCount"); |
||
897 | } |
||
898 | else |
||
899 | { |
||
900 | sbWhere.Append("MarkusEndDate=getdate()"); |
||
901 | } |
||
902 | } |
||
903 | |||
904 | using (var transaction = base.BeginTransaction()) |
||
905 | { |
||
906 | string query = $@" |
||
907 | update dbo.Transactions |
||
908 | set {sbWhere} |
||
909 | where Seq=@Seq;"; |
||
910 | base.Execute(query, dynamicParameters, transaction); |
||
911 | |||
912 | transaction.Commit(); |
||
913 | |||
914 | result = true; |
||
915 | } |
||
916 | } |
||
917 | catch (Exception ex) |
||
918 | { |
||
919 | throw ex; |
||
920 | } |
||
921 | |||
922 | return result; |
||
923 | } |
||
924 | |||
925 | public string GetTranData(int seq) |
||
926 | { |
||
927 | try |
||
928 | { |
||
929 | var dynamicParameters = new DynamicParameters(); |
||
930 | var parameters = new Dictionary<string, object>() |
||
931 | { |
||
932 | { "Seq", seq } |
||
933 | }; |
||
934 | dynamicParameters.AddDynamicParams(parameters); |
||
935 | |||
936 | string query = $@" |
||
937 | select * |
||
938 | from dbo.Transactions |
||
939 | where Seq=@Seq"; |
||
940 | |||
941 | IEnumerable<dynamic> rows = base.Query<dynamic>(query, dynamicParameters); |
||
942 | |||
943 | return this.ToSerializeData(rows); |
||
944 | } |
||
945 | catch (Exception ex) |
||
946 | { |
||
947 | throw ex; |
||
948 | } |
||
949 | } |
||
950 | |||
951 | public string ToSerializeData(IEnumerable<dynamic> items) |
||
952 | { |
||
953 | List<Dictionary<string, object>> list = new List<Dictionary<string, object>>(); |
||
954 | |||
955 | if (items == null) return string.Empty; |
||
956 | var datas = items.ToArray(); |
||
957 | if (datas.Length == 0) return string.Empty; |
||
958 | |||
959 | foreach (var data in datas) |
||
960 | { |
||
961 | var dicItem = new Dictionary<string, object>(); |
||
962 | foreach (var pair in ((IDictionary<string, object>)data)) |
||
963 | { |
||
964 | dicItem.Add(pair.Key, pair.Value); |
||
965 | } |
||
966 | list.Add(dicItem); |
||
967 | } |
||
968 | |||
969 | return JsonConvert.SerializeObject(list); |
||
970 | } |
||
971 | |||
972 | public IEnumerable<Documents> GetTrDocuments(int seq) |
||
973 | { |
||
974 | var dynamicParameters = new DynamicParameters(); |
||
975 | StringBuilder sbWhere = new StringBuilder(); |
||
976 | var parameters = new Dictionary<string, object>() |
||
977 | { |
||
978 | { "Seq", seq } |
||
979 | }; |
||
980 | dynamicParameters.AddDynamicParams(parameters); |
||
981 | |||
982 | try |
||
983 | { |
||
984 | string query = $@" |
||
985 | declare @CreatedDate datetime |
||
986 | declare @EndDate datetime |
||
987 | d65eb9b2 | yoush97 | declare @ProjectGroupID varchar(4000) |
988 | 39938acd | yoush97 | |
989 | select top 1 @CreatedDate=CreatedDate, @EndDate=EndDate, @ProjectGroupID=ProjectID |
||
990 | from dbo.Transactions |
||
991 | where Seq=@Seq |
||
992 | |||
993 | 9d611a63 | yoush97 | --select RefProjectCode, DocumentNo |
994 | --from dbo.Documents |
||
995 | --where RefProjectCode in (select Code from dbo.Projects where ParentID=@ProjectGroupID) |
||
996 | -- and RegisteredDate between @CreatedDate and @EndDate |
||
997 | |||
998 | 39938acd | yoush97 | select RefProjectCode, DocumentNo |
999 | from dbo.Documents |
||
1000 | 416979ec | yoush97 | where RefProjectCode is not null and ((RegisteredDate between @CreatedDate and @EndDate) or (ModifiedDate between @CreatedDate and @EndDate))"; |
1001 | 39938acd | yoush97 | |
1002 | if (parameters.Count > 0) |
||
1003 | { |
||
1004 | dynamicParameters.AddDynamicParams(parameters); |
||
1005 | } |
||
1006 | |||
1007 | return Query<Documents>(query, dynamicParameters); |
||
1008 | } |
||
1009 | catch (Exception ex) |
||
1010 | { |
||
1011 | throw ex; |
||
1012 | } |
||
1013 | } |
||
1014 | 9096bc6d | taeseongkim | |
1015 | public class MarkusConvert |
||
1016 | { |
||
1017 | public string PROJECT_NO { get; set; } |
||
1018 | public string DOCUMENT_ID { get; set; } |
||
1019 | public int STATUS { get; set; } |
||
1020 | } |
||
1021 | |||
1022 | 5898479a | yoush97 | } |
1023 | d2d4f84b | yoush97 | } |