markus / KCOM_API / ServiceDeepView.svc.cs @ 195f079d
이력 | 보기 | 이력해설 | 다운로드 (139 KB)
1 | 787a4489 | KangIngu | using IFinalPDF; |
---|---|---|---|
2 | using IKCOM; |
||
3 | using KCOMDataModel.Common; |
||
4 | using KCOMDataModel.DataModel; |
||
5 | using System; |
||
6 | using System.Collections.Generic; |
||
7 | 2ab012e8 | djkim | using System.Collections.ObjectModel; |
8 | ff01c725 | humkyung | using System.Configuration; |
9 | 787a4489 | KangIngu | using System.Linq; |
10 | dfb95d0f | djkim | using System.Net; |
11 | 787a4489 | KangIngu | using System.Runtime.Remoting.Channels.Tcp; |
12 | using System.Runtime.Serialization; |
||
13 | using System.ServiceModel; |
||
14 | using System.ServiceModel.Activation; |
||
15 | using System.Text; |
||
16 | ff01c725 | humkyung | using System.Web.Services; |
17 | 787a4489 | KangIngu | using System.Windows; |
18 | dfb95d0f | djkim | using System.Xml; |
19 | 315ae55e | taeseongkim | using ColorSelector; |
20 | 6a19b48d | taeseongkim | using Newtonsoft.Json.Linq; |
21 | 787a4489 | KangIngu | |
22 | namespace KCOM_API |
||
23 | { |
||
24 | // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "ServiceDeepView" in code, svc and config file together. |
||
25 | // NOTE: In order to launch WCF Test Client for testing this service, please select ServiceDeepView.svc or ServiceDeepView.svc.cs at the Solution Explorer and start debugging. |
||
26 | [ServiceContract(Namespace = "")] |
||
27 | [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] |
||
28 | public partial class ServiceDeepView : System.Web.Services.WebService |
||
29 | { |
||
30 | 0585d5cc | taeseongkim | public ServiceDeepView() |
31 | { |
||
32 | 5c64268e | taeseongkim | //System.Diagnostics.Trace.WriteLine(OperationContext.Current.RequestContext.RequestMessage.Headers.Action.ToString()); |
33 | 0585d5cc | taeseongkim | } |
34 | |||
35 | ffddbe4e | djkim | /// <summary> |
36 | /// Client Version 과 Server Version 을 비교하여 Server Version 이 최신이면 다운로드 url 리턴. |
||
37 | /// </summary> |
||
38 | /// <param name="is64BitProcess">64bit = true, 32bit = false</param> |
||
39 | /// <param name="markusVer">client version</param> |
||
40 | /// <returns></returns> |
||
41 | 264c9309 | ljiyeon | [OperationContract] |
42 | public string GetVersionData(bool is64BitProcess, string markusVer) |
||
43 | { |
||
44 | string url = null; |
||
45 | d71b4688 | ljiyeon | |
46 | 264c9309 | ljiyeon | try |
47 | { |
||
48 | ffddbe4e | djkim | Version client_version = new Version(markusVer); |
49 | |||
50 | //DB에서 version 정보와 다운로드 url 을 Select |
||
51 | PROPERTIES dbvalue = null; |
||
52 | ff01c725 | humkyung | string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; |
53 | using (KCOMEntities uc = new KCOMEntities(sConnString)) |
||
54 | ffddbe4e | djkim | { |
55 | string wherestr = string.Empty; |
||
56 | if (is64BitProcess) |
||
57 | 264c9309 | ljiyeon | { |
58 | ffddbe4e | djkim | wherestr = "Update_x64"; |
59 | 264c9309 | ljiyeon | } |
60 | else |
||
61 | { |
||
62 | 075cbfcf | taeseongkim | wherestr = "Update_x86"; |
63 | ffddbe4e | djkim | } |
64 | dbvalue = uc.PROPERTIES.Where(data => data.TYPE == wherestr).FirstOrDefault(); |
||
65 | } |
||
66 | |||
67 | //서버 버전이 최신이면 0보다 큰값 리턴 |
||
68 | Version server_version = new Version(dbvalue.PROPERTY); |
||
69 | int result = server_version.CompareTo(client_version); |
||
70 | if (result > 0) |
||
71 | { |
||
72 | url = dbvalue.VALUE; |
||
73 | 264c9309 | ljiyeon | } |
74 | } |
||
75 | 0585d5cc | taeseongkim | catch (Exception ex) |
76 | 264c9309 | ljiyeon | { |
77 | 5c64268e | taeseongkim | System.Diagnostics.Trace.WriteLine("KCOM_API - GetVersionData : " + ex.ToString()); |
78 | 0585d5cc | taeseongkim | |
79 | 264c9309 | ljiyeon | url = null; |
80 | } |
||
81 | return url; |
||
82 | } |
||
83 | ff01c725 | humkyung | |
84 | 787a4489 | KangIngu | |
85 | [OperationContract] |
||
86 | public KCOM_SystemInfo GetSystemData() |
||
87 | { |
||
88 | try |
||
89 | { |
||
90 | ff01c725 | humkyung | string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; |
91 | using (KCOMEntities uc = new KCOMEntities(sConnString)) |
||
92 | 787a4489 | KangIngu | { |
93 | var SystemInfoSet = uc.PROPERTIES.Where(data => data.TYPE == "SystemInfo").ToList(); |
||
94 | |||
95 | KCOM_SystemInfo sysInfo = new KCOM_SystemInfo(); |
||
96 | |||
97 | var url = SystemInfoSet.Where(data => data.PROPERTY == "Url").FirstOrDefault(); |
||
98 | if (url != null) |
||
99 | { |
||
100 | sysInfo.HostName = url.VALUE; |
||
101 | } |
||
102 | |||
103 | 43e1d368 | taeseongkim | var port = SystemInfoSet.Where(data => data.PROPERTY == "Port").FirstOrDefault(); |
104 | if (port != null) |
||
105 | 787a4489 | KangIngu | { |
106 | 43e1d368 | taeseongkim | sysInfo.HostPort = port.VALUE; |
107 | 787a4489 | KangIngu | } |
108 | 9a1ce1db | KangIngu | |
109 | 43e1d368 | taeseongkim | var stamp = uc.PROPERTIES.Where(data => data.TYPE == "STAMP").FirstOrDefault(); |
110 | if(stamp != null) |
||
111 | 9a1ce1db | KangIngu | { |
112 | 43e1d368 | taeseongkim | sysInfo.STAMP = stamp.VALUE; |
113 | |||
114 | 9a1ce1db | KangIngu | } |
115 | 43e1d368 | taeseongkim | |
116 | var stampContents = uc.PROPERTIES.Where(data => data.TYPE == "STAMP_CONTENTS"); |
||
117 | |||
118 | if (stampContents?.Count() > 0) |
||
119 | { |
||
120 | sysInfo.STAMP_CONTENTS = stampContents.ToDictionary(x => x.PROPERTY, x => x.VALUE); |
||
121 | } |
||
122 | |||
123 | 787a4489 | KangIngu | return sysInfo; |
124 | } |
||
125 | } |
||
126 | catch (Exception ex) |
||
127 | { |
||
128 | 5c64268e | taeseongkim | System.Diagnostics.Trace.WriteLine("KCOM_API - GetSystemData : " + ex.ToString()); |
129 | 0585d5cc | taeseongkim | |
130 | 787a4489 | KangIngu | } |
131 | return null; |
||
132 | 24c5e56c | taeseongkim | //GC.Collect(2); |
133 | 787a4489 | KangIngu | } |
134 | |||
135 | private static string shortGuid() |
||
136 | e1c892f7 | taeseongkim | { |
137 | 787a4489 | KangIngu | byte[] bytes = new byte[16]; |
138 | using (var provider = System.Security.Cryptography.RandomNumberGenerator.Create()) |
||
139 | { |
||
140 | provider.GetBytes(bytes); |
||
141 | } |
||
142 | |||
143 | var guid = new Guid(bytes); |
||
144 | |||
145 | return Convert.ToBase64String(guid.ToByteArray()) |
||
146 | .Substring(0, 10) |
||
147 | .Replace("/", "") |
||
148 | .Replace("+", "") + DateTime.UtcNow.Ticks.ToString("x"); |
||
149 | } |
||
150 | |||
151 | |||
152 | [OperationContract] |
||
153 | 992a98b4 | KangIngu | public List<FAVORITE_DOC> GetFavoriteVP(string PrjNo, string userID, string sharepointItemID) |
154 | { |
||
155 | ff01c725 | humkyung | string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; |
156 | using (KCOMEntities dc = new KCOMEntities(sConnString)) |
||
157 | 992a98b4 | KangIngu | { |
158 | |||
159 | int flagString = Convert.ToInt32(FAVORITE_FLAG.Personal); |
||
160 | List<FAVORITE_DOC> favoriteListSet = new List<FAVORITE_DOC>(); |
||
161 | //dc.FAVORITE_DOC.Where(data => data.PROJECT_NO == PrjNo && data.DOCUMENT_ID == sharepointItemID && data.FLAG != |
||
162 | // flagString).ToList().ForEach(data => favoriteListSet.Add(data)); |
||
163 | |||
164 | |||
165 | //dc.FAVORITE_DOC.Where(data => data.PROJECT_NO == PrjNo && data.MEMBER_USER_ID == userID).ToList().ForEach(data => favoriteListSet.Add(data)); |
||
166 | |||
167 | favoriteListSet = dc.FAVORITE_DOC.Where(data => data.PROJECT_NO == PrjNo && data.MEMBER_USER_ID == userID && data.DOCUMENT_ID == sharepointItemID).ToList(); |
||
168 | |||
169 | //favoriteListSet = favoriteListSet.Distinct().ToList(); |
||
170 | return favoriteListSet; |
||
171 | } |
||
172 | } |
||
173 | 0585d5cc | taeseongkim | |
174 | 992a98b4 | KangIngu | [OperationContract] |
175 | public bool EditFavoriteVP(string prjNo, string userID, string docID, int state, string description) |
||
176 | { |
||
177 | ff01c725 | humkyung | string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; |
178 | using (KCOMEntities dc = new KCOMEntities(sConnString)) |
||
179 | 992a98b4 | KangIngu | { |
180 | //List<FAVORITE_DOC> favoriteSet = dc.FAVORITE_DOC.Where(data => data.PROJECT_NO == prjNo && data.MEMBER_USER_ID == userID |
||
181 | // && data.PAGE_NO == SavePageNo && data.CREATE_TIME == createTime).ToList(); |
||
182 | List<FAVORITE_DOC> favoriteSet = dc.FAVORITE_DOC.Where(data => data.PROJECT_NO == prjNo && data.MEMBER_USER_ID == userID |
||
183 | && data.ID == docID).ToList(); |
||
184 | try |
||
185 | { |
||
186 | |||
187 | if (favoriteSet.Count > 0) |
||
188 | { |
||
189 | var FavoriteVP_Instance = favoriteSet.First(); |
||
190 | |||
191 | FavoriteVP_Instance.DESCRIPTION = description; |
||
192 | FavoriteVP_Instance.FLAG = state; |
||
193 | |||
194 | dc.SaveChanges(); |
||
195 | |||
196 | return true; |
||
197 | } |
||
198 | else |
||
199 | { |
||
200 | return false; |
||
201 | } |
||
202 | } |
||
203 | 0585d5cc | taeseongkim | catch (Exception ex) |
204 | 992a98b4 | KangIngu | { |
205 | 5c64268e | taeseongkim | System.Diagnostics.Trace.WriteLine("KCOM_API - EditFavoriteVP : " + ex.ToString()); |
206 | 0585d5cc | taeseongkim | |
207 | 992a98b4 | KangIngu | return false; |
208 | } |
||
209 | } |
||
210 | } |
||
211 | |||
212 | [OperationContract] |
||
213 | public bool DelFavoriteVP(string prjNo, string userID, int SavePageNo, string docID) |
||
214 | { |
||
215 | ff01c725 | humkyung | string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; |
216 | using (KCOMEntities dc = new KCOMEntities(sConnString)) |
||
217 | 992a98b4 | KangIngu | { |
218 | |||
219 | List<FAVORITE_DOC> favoriteSet = dc.FAVORITE_DOC.Where(data => data.PROJECT_NO == prjNo && data.MEMBER_USER_ID == userID |
||
220 | && data.ID == docID).ToList(); |
||
221 | |||
222 | try |
||
223 | { |
||
224 | if (favoriteSet.Count > 0) |
||
225 | { |
||
226 | favoriteSet.ForEach(data => dc.FAVORITE_DOC.DeleteObject(data)); |
||
227 | dc.SaveChanges(); |
||
228 | return true; |
||
229 | } |
||
230 | else |
||
231 | { |
||
232 | return false; |
||
233 | } |
||
234 | } |
||
235 | 0585d5cc | taeseongkim | catch (Exception ex) |
236 | 992a98b4 | KangIngu | { |
237 | 5c64268e | taeseongkim | System.Diagnostics.Trace.WriteLine("KCOM_API - DelFavoriteVP : " + ex.ToString()); |
238 | 0585d5cc | taeseongkim | |
239 | 992a98b4 | KangIngu | return false; |
240 | } |
||
241 | } |
||
242 | } |
||
243 | |||
244 | 9294fed6 | humkyung | /// <summary> |
245 | /// 두 페이지를 비교하여 결과를 리턴한다 |
||
246 | /// </summary> |
||
247 | /// <param name="projectNo"></param> |
||
248 | /// <param name="originDocItem_ID"></param> |
||
249 | /// <param name="targetDocItem_ID"></param> |
||
250 | /// <param name="originPageNo"></param> |
||
251 | /// <param name="targetPageNo"></param> |
||
252 | /// <param name="isInternalAddress"></param> |
||
253 | /// <returns></returns> |
||
254 | 992a98b4 | KangIngu | [OperationContract] |
255 | d9cf7d6e | djkim | public List<Rect> GetCompareRect(string projectNo, string originDocItem_ID, string targetDocItem_ID, string originPageNo, string targetPageNo, string isInternalAddress) |
256 | 787a4489 | KangIngu | { |
257 | 6b6e937c | taeseongkim | List<Rect> result = new List<Rect>(); |
258 | |||
259 | 72424099 | taeseongkim | try |
260 | { |
||
261 | string originFile = ""; |
||
262 | string targetFile = ""; |
||
263 | a874198d | humkyung | |
264 | 72424099 | taeseongkim | string sOriginFolder = originDocItem_ID.All(char.IsDigit) ? (Convert.ToUInt32(originDocItem_ID) / 100).ToString() : (originDocItem_ID.Length >= 5 ? originDocItem_ID.Substring(0, 5) : originDocItem_ID); |
265 | string sTagetFolder = targetDocItem_ID.All(char.IsDigit) ? (Convert.ToUInt32(targetDocItem_ID) / 100).ToString() : (targetDocItem_ID.Length >= 5 ? targetDocItem_ID.Substring(0, 5) : targetDocItem_ID); |
||
266 | a1142a6b | taeseongkim | |
267 | 72424099 | taeseongkim | if (Boolean.Parse(isInternalAddress)) |
268 | { |
||
269 | originFile = String.Format(KCOM_API.Properties.Settings.Default.TileSoucePath, projectNo, sOriginFolder, originDocItem_ID, originPageNo); |
||
270 | targetFile = String.Format(KCOM_API.Properties.Settings.Default.TileSoucePath, projectNo, sTagetFolder, targetDocItem_ID, targetPageNo); |
||
271 | } |
||
272 | else |
||
273 | { |
||
274 | originFile = String.Format(KCOM_API.Properties.Settings.Default.TileSoucePath_SUB, projectNo, originDocItem_ID, originPageNo); |
||
275 | targetFile = String.Format(KCOM_API.Properties.Settings.Default.TileSoucePath_SUB, projectNo, targetDocItem_ID, targetPageNo); |
||
276 | } |
||
277 | 787a4489 | KangIngu | |
278 | 5b5d9b1f | taeseongkim | using (Markus.Image.ImageCompare compareLib = new Markus.Image.ImageCompare()) |
279 | 72424099 | taeseongkim | { |
280 | result = compareLib.CompareReturnRects(originFile, targetFile, new System.Drawing.Size(20, 20)); |
||
281 | } |
||
282 | } |
||
283 | catch (Exception ex) |
||
284 | 6b6e937c | taeseongkim | { |
285 | 5c64268e | taeseongkim | System.Diagnostics.Trace.WriteLine("KCOM_API - GetCompareRect : " + ex.ToString()); |
286 | 72424099 | taeseongkim | //throw new FaultException(ex.ToString() + " Inner Exception : " + ex.InnerException?.ToString()); |
287 | 6b6e937c | taeseongkim | } |
288 | 0585d5cc | taeseongkim | |
289 | 787a4489 | KangIngu | |
290 | return result; |
||
291 | } |
||
292 | |||
293 | 3212270d | taeseongkim | /// <summary> |
294 | /// 두 페이지를 비교하여 결과를 리턴한다 |
||
295 | /// </summary> |
||
296 | /// <param name="projectNo"></param> |
||
297 | /// <param name="originDocItem_ID"></param> |
||
298 | /// <param name="targetDocItem_ID"></param> |
||
299 | /// <param name="originPageNo"></param> |
||
300 | /// <param name="targetPageNo"></param> |
||
301 | /// <param name="isInternalAddress"></param> |
||
302 | /// <returns></returns> |
||
303 | [OperationContract] |
||
304 | public List<Rect> GetComparefixSize(string projectNo, string originDocItem_ID, string targetDocItem_ID, string originPageNo, string targetPageNo,Size FixSize, string isInternalAddress) |
||
305 | { |
||
306 | List<Rect> result = new List<Rect>(); |
||
307 | |||
308 | try |
||
309 | { |
||
310 | string originFile = ""; |
||
311 | string targetFile = ""; |
||
312 | |||
313 | string sOriginFolder = originDocItem_ID.All(char.IsDigit) ? (Convert.ToUInt32(originDocItem_ID) / 100).ToString() : (originDocItem_ID.Length >= 5 ? originDocItem_ID.Substring(0, 5) : originDocItem_ID); |
||
314 | string sTagetFolder = targetDocItem_ID.All(char.IsDigit) ? (Convert.ToUInt32(targetDocItem_ID) / 100).ToString() : (targetDocItem_ID.Length >= 5 ? targetDocItem_ID.Substring(0, 5) : targetDocItem_ID); |
||
315 | |||
316 | if (Boolean.Parse(isInternalAddress)) |
||
317 | { |
||
318 | originFile = String.Format(KCOM_API.Properties.Settings.Default.TileSoucePath, projectNo, sOriginFolder, originDocItem_ID, originPageNo); |
||
319 | targetFile = String.Format(KCOM_API.Properties.Settings.Default.TileSoucePath, projectNo, sTagetFolder, targetDocItem_ID, targetPageNo); |
||
320 | } |
||
321 | else |
||
322 | { |
||
323 | originFile = String.Format(KCOM_API.Properties.Settings.Default.TileSoucePath_SUB, projectNo, originDocItem_ID, originPageNo); |
||
324 | targetFile = String.Format(KCOM_API.Properties.Settings.Default.TileSoucePath_SUB, projectNo, targetDocItem_ID, targetPageNo); |
||
325 | } |
||
326 | |||
327 | using (Markus.Image.ImageCompare compareLib = new Markus.Image.ImageCompare()) |
||
328 | { |
||
329 | |||
330 | result = compareLib.CompareReturnRects(originFile, targetFile, new System.Drawing.Size(20, 20)); |
||
331 | } |
||
332 | } |
||
333 | catch (Exception ex) |
||
334 | { |
||
335 | 5c64268e | taeseongkim | System.Diagnostics.Trace.WriteLine("KCOM_API - GetCompareRect : " + ex.ToString()); |
336 | 3212270d | taeseongkim | //throw new FaultException(ex.ToString() + " Inner Exception : " + ex.InnerException?.ToString()); |
337 | } |
||
338 | |||
339 | |||
340 | return result; |
||
341 | } |
||
342 | |||
343 | 6b6e937c | taeseongkim | //[OperationContract] |
344 | //public List<Rect> GetCompareRect_old(string projectNo, string originDocItem_ID, string targetDocItem_ID, string originPageNo, string targetPageNo, string isInternalAddress) |
||
345 | //{ |
||
346 | // System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch(); |
||
347 | |||
348 | // stopwatch.Start(); |
||
349 | |||
350 | // string originFile = ""; |
||
351 | // string targetFile = ""; |
||
352 | |||
353 | // string sFolder = originDocItem_ID.All(char.IsDigit) ? (Convert.ToUInt32(originDocItem_ID) / 100).ToString() : (originDocItem_ID.Length >= 5 ? originDocItem_ID.Substring(0, 5) : originDocItem_ID); |
||
354 | // if (Boolean.Parse(isInternalAddress)) |
||
355 | // { |
||
356 | // originFile = String.Format(KCOM_API.Properties.Settings.Default.TileSoucePath, projectNo, sFolder, originDocItem_ID, originPageNo); |
||
357 | // targetFile = String.Format(KCOM_API.Properties.Settings.Default.TileSoucePath, projectNo, sFolder, targetDocItem_ID, targetPageNo); |
||
358 | // } |
||
359 | // else |
||
360 | // { |
||
361 | // originFile = String.Format(KCOM_API.Properties.Settings.Default.TileSoucePath_SUB, projectNo, originDocItem_ID, originPageNo); |
||
362 | // targetFile = String.Format(KCOM_API.Properties.Settings.Default.TileSoucePath_SUB, projectNo, targetDocItem_ID, targetPageNo); |
||
363 | // } |
||
364 | |||
365 | // CompareLib compareLib = new CompareLib(); |
||
366 | |||
367 | // var resultOrigin = compareLib.ChangeCmpUrlToPng_File(originFile); |
||
368 | // var resultTarget = compareLib.ChangeCmpUrlToPng_File(targetFile); |
||
369 | |||
370 | // string outPutFile = compareLib.ImageCompare_File(resultOrigin, resultTarget); |
||
371 | // var result = compareLib.GetBoundBoxInImage(outPutFile); |
||
372 | |||
373 | 5c64268e | taeseongkim | // System.Diagnostics.Trace.WriteLine(new TimeSpan(stopwatch.ElapsedTicks)); |
374 | 6b6e937c | taeseongkim | |
375 | // return result; |
||
376 | //} |
||
377 | |||
378 | 787a4489 | KangIngu | |
379 | #region Final PDF |
||
380 | private string _ChanID = null; |
||
381 | TcpChannel chan = null; |
||
382 | [OperationContract] |
||
383 | public FinalPDFResult SetFinalPDF(string ProjectNo, string DocInfoID, string MarkupInfoID, string CreateUserID) |
||
384 | { |
||
385 | #region 임시보관 |
||
386 | #endregion |
||
387 | FinalPDFResult _result = new FinalPDFResult(); |
||
388 | RemFinalPDFObject remObj = null; |
||
389 | try |
||
390 | { |
||
391 | string _finalID = shortGuid(); |
||
392 | int _DocTotalPages = -1; |
||
393 | string docItemId; |
||
394 | |||
395 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
396 | using (CIEntities _ci = new CIEntities(sCIConnString)) |
||
397 | 787a4489 | KangIngu | { |
398 | var _doc = _ci.DOCINFO.Where(info => info.ID == DocInfoID); |
||
399 | |||
400 | if (_doc.Count() > 0) |
||
401 | { |
||
402 | _DocTotalPages = _doc.First().PAGE_COUNT; |
||
403 | docItemId = _doc.First().DOCUMENT_ID; |
||
404 | } |
||
405 | else |
||
406 | { |
||
407 | _result.Status = FinalStatus.Error; |
||
408 | _result.Exception = "페이지 정보를 가져올 수 없습니다."; |
||
409 | return _result; |
||
410 | } |
||
411 | } |
||
412 | if (_DocTotalPages > 0) |
||
413 | { |
||
414 | FINAL_PDF fm = new FINAL_PDF() |
||
415 | { |
||
416 | ID = _finalID, |
||
417 | PROJECT_NO = ProjectNo, |
||
418 | DOCINFO_ID = DocInfoID, |
||
419 | DOCUMENT_ID = docItemId, |
||
420 | MARKUPINFO_ID = MarkupInfoID, |
||
421 | CREATE_USER_ID = CreateUserID, |
||
422 | TOTAL_PAGE = _DocTotalPages, |
||
423 | CREATE_DATETIME = DateTime.Now, |
||
424 | STATUS = (int)IFinalPDF.FinalStatus.Insert |
||
425 | }; |
||
426 | ff01c725 | humkyung | |
427 | string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; |
||
428 | using (KCOMEntities _entity = new KCOMEntities(sConnString)) |
||
429 | 787a4489 | KangIngu | { |
430 | _entity.AddToFINAL_PDF(fm); |
||
431 | _entity.SaveChanges(System.Data.Objects.SaveOptions.AcceptAllChangesAfterSave); |
||
432 | }; |
||
433 | |||
434 | 6a19b48d | taeseongkim | if(KCOM_API.Properties.Settings.Default.FinalService.StartsWith("tcp")) |
435 | 787a4489 | KangIngu | { |
436 | 6a19b48d | taeseongkim | System.Runtime.Remoting.Channels.IChannel _ch = System.Runtime.Remoting.Channels.ChannelServices.GetChannel("tcp"); |
437 | if (_ch == null) |
||
438 | 787a4489 | KangIngu | { |
439 | 6a19b48d | taeseongkim | chan = new TcpChannel(); |
440 | _ChanID = chan.ChannelName; |
||
441 | System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(chan, false); |
||
442 | // Create an instance of the remote object |
||
443 | 787a4489 | KangIngu | |
444 | 6a19b48d | taeseongkim | using (KCOMEntities ec = new KCOMEntities(sConnString)) |
445 | { |
||
446 | |||
447 | //remObj = (RemFinalPDFObject)Activator.GetObject(typeof(RemFinalPDFObject), |
||
448 | // "tcp://localhost:9092/remFinalPDF"); |
||
449 | remObj = (RemFinalPDFObject)Activator.GetObject(typeof(RemFinalPDFObject), |
||
450 | //"tcp://192.168.0.67:9092/remFinalPDF"); |
||
451 | KCOM_API.Properties.Settings.Default.FinalService); |
||
452 | } |
||
453 | 787a4489 | KangIngu | |
454 | 6a19b48d | taeseongkim | //"tcp://localhost:8080/remFinalPDF"); |
455 | 787a4489 | KangIngu | |
456 | 6a19b48d | taeseongkim | _result = remObj.SetFinalPDF(ProjectNo, _finalID); |
457 | _result.FinalID = _finalID; |
||
458 | _result.Status = FinalStatus.Success; |
||
459 | 787a4489 | KangIngu | |
460 | 6a19b48d | taeseongkim | //MarkupToPDF.MarkupToPDF fa = new MarkupToPDF.MarkupToPDF(); |
461 | //fa.MakeFinalPDF(fm); |
||
462 | } |
||
463 | else |
||
464 | { |
||
465 | _ChanID = _ch.ChannelName; |
||
466 | } |
||
467 | 787a4489 | KangIngu | } |
468 | else |
||
469 | { |
||
470 | 6a19b48d | taeseongkim | System.Net.WebClient client = new System.Net.WebClient(); |
471 | var convertResult = client.DownloadString($"{KCOM_API.Properties.Settings.Default.FinalService}/Rest/FinalAdd?ProjectNo={ProjectNo}&FinalID={_finalID}"); |
||
472 | |||
473 | JObject jObject = JObject.Parse(convertResult, new JsonLoadSettings()); |
||
474 | |||
475 | if(jObject["FinalAddResult"].ToString() == true.ToString()) |
||
476 | { |
||
477 | _result.FinalID = _finalID; |
||
478 | _result.Status = FinalStatus.Success; |
||
479 | } |
||
480 | 787a4489 | KangIngu | } |
481 | 6a19b48d | taeseongkim | |
482 | 787a4489 | KangIngu | } |
483 | } |
||
484 | catch (Exception ex) |
||
485 | { |
||
486 | 5c64268e | taeseongkim | System.Diagnostics.Trace.WriteLine("KCOM_API - SetFinalPDF : " + ex.ToString()); |
487 | 0585d5cc | taeseongkim | |
488 | 787a4489 | KangIngu | _result.Status = FinalStatus.Error; |
489 | |||
490 | if (ex.GetType() == typeof(System.Net.Sockets.SocketException)) |
||
491 | _result.Exception = "Final Server Not Connection"; |
||
492 | b734b65d | djkim | else _result.Exception = ex.ToString(); |
493 | 787a4489 | KangIngu | } |
494 | finally |
||
495 | { |
||
496 | remObj = null; |
||
497 | if (System.Runtime.Remoting.Channels.ChannelServices.GetChannel("tcp") != null) |
||
498 | System.Runtime.Remoting.Channels.ChannelServices.UnregisterChannel(chan); |
||
499 | |||
500 | GC.Collect(2); |
||
501 | } |
||
502 | return _result; |
||
503 | } |
||
504 | #endregion |
||
505 | |||
506 | |||
507 | [OperationContract] |
||
508 | public bool GetConversionState(KCOM_BasicParam param) |
||
509 | { |
||
510 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
511 | using (CIEntities entity = new CIEntities(sCIConnString)) |
||
512 | 787a4489 | KangIngu | { |
513 | var doc = entity.DOCINFO.Where(data => data.DOCUMENT_ID == param.documentID).FirstOrDefault(); |
||
514 | if (doc != null) |
||
515 | { |
||
516 | var count = doc.DOCPAGE.Where(data => data.DOCINFO_ID == doc.ID).Count(); |
||
517 | if (doc.PAGE_COUNT == count) //페이지 수가 일치하는지 |
||
518 | { |
||
519 | return true; |
||
520 | } |
||
521 | else //페이지 수가 일치하지 않는 경우 |
||
522 | { |
||
523 | ff01c725 | humkyung | string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; |
524 | KCOMEntities entity_kcom = new KCOMEntities(sConnString); |
||
525 | 787a4489 | KangIngu | var lst = entity_kcom.CONVERTER_DOC.Where(data => data.PROJECT_NO == param.projectNo && data.DOCUMENT_ID == param.documentID && data.TOTAL_PAGE != doc.PAGE_COUNT).ToList(); |
526 | |||
527 | if (lst != null || lst.Count >= 1) |
||
528 | { |
||
529 | //Common.Helper.SystemErrorNotify(SERVICE_NAME.API, LEVEL.MEDIUM, ERROR_TYPE.CONVERT, Resources.ResourceManager.GetString("MSG_ERROR_PAGECOUNT"), param.documentID, param.projectNo); |
||
530 | //이메일 클라이언트를 구현해야함 |
||
531 | } |
||
532 | return false; |
||
533 | } |
||
534 | } |
||
535 | else |
||
536 | { |
||
537 | //Common.Helper.SystemErrorNotify(SERVICE_NAME.API, LEVEL.MEDIUM, ERROR_TYPE.CONVERT, Resources.ResourceManager.GetString("MSG_ERROR_CONVERTFAILED"), param.documentID, param.projectNo); |
||
538 | //이메일 클라이언트를 구현해야함 |
||
539 | return false; |
||
540 | } |
||
541 | } |
||
542 | } |
||
543 | |||
544 | [OperationContract] |
||
545 | public List<VPRevision> GetVPRevisionHistory(string ProjectNo, string vpNo, string DocumentId) |
||
546 | { |
||
547 | List<VPRevision> _result = new List<VPRevision>(); |
||
548 | try |
||
549 | { |
||
550 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
551 | using (CIEntities entity = new CIEntities(sCIConnString)) |
||
552 | 787a4489 | KangIngu | { |
553 | var _vpList = (from docitem in entity.DOCUMENT_ITEM |
||
554 | 0585d5cc | taeseongkim | where docitem.PROJECT_NO == ProjectNo && docitem.DOCUMENT_NO == vpNo |
555 | 787a4489 | KangIngu | select new VPRevision |
556 | { |
||
557 | RevNo = docitem.REVISION, |
||
558 | GroupNo = docitem.GROUP_NO, |
||
559 | FROM_VENDOR = docitem.ORIGINAL_FILE, |
||
560 | DOCUMENT_ID = docitem.DOCUMENT_ID, |
||
561 | TO_VENDOR = docitem.RESULT_FILE, |
||
562 | RESULT = docitem.RESULT, |
||
563 | c91f45f3 | djkim | DocNo = docitem.DOCUMENT_NO, |
564 | ab5aa762 | taeseongkim | //EnsembleLink = docitem.ENSEMBLEINFO_URL, |
565 | c0977e97 | djkim | //IsSyncPossible = docitem.DOCUMENT_ID == DocumentId ? false : entity.DOCINFO.Where(d => d.DOCUMENT_ID == docitem.DOCUMENT_ID).ToList().Count > 0 ? true : false |
566 | 787a4489 | KangIngu | }); |
567 | _result = _vpList.ToList(); |
||
568 | c0977e97 | djkim | foreach (var vp in _result) |
569 | { |
||
570 | if (entity.DOCINFO.Where(d => d.DOCUMENT_ID == vp.DOCUMENT_ID).ToList().Count > 0) |
||
571 | vp.IsSyncPossible = true; |
||
572 | else |
||
573 | vp.IsSyncPossible = false; |
||
574 | } |
||
575 | ff01c725 | humkyung | |
576 | //_result = _result.OrderByDescending(r => UInt64.Parse(System.Text.RegularExpressions.Regex.Replace(r.GroupNo, @"\D", ""))).ToList(); |
||
577 | f65e6c02 | taeseongkim | _result = _result.OrderByDescending(r => r.GroupNo).ToList(); |
578 | 787a4489 | KangIngu | } |
579 | } |
||
580 | ff01c725 | humkyung | catch (Exception ex) |
581 | 787a4489 | KangIngu | { |
582 | 5c64268e | taeseongkim | System.Diagnostics.Trace.WriteLine("KCOM_API - GetVPRevisionHistory : " + ex.ToString()); |
583 | 787a4489 | KangIngu | } |
584 | finally |
||
585 | { |
||
586 | 24c5e56c | taeseongkim | //GC.Collect(2); |
587 | 787a4489 | KangIngu | } |
588 | 0585d5cc | taeseongkim | |
589 | 787a4489 | KangIngu | return _result; |
590 | } |
||
591 | |||
592 | [OperationContract] |
||
593 | 2ab012e8 | djkim | public VPRevision GetVPRevisionFirstOrDefault(string ProjectNo, string DocumentId) |
594 | { |
||
595 | VPRevision _result = null; |
||
596 | try |
||
597 | { |
||
598 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
599 | using (CIEntities entity = new CIEntities(sCIConnString)) |
||
600 | 2ab012e8 | djkim | { |
601 | _result = (from docitem in entity.DOCUMENT_ITEM |
||
602 | 0585d5cc | taeseongkim | where docitem.PROJECT_NO == ProjectNo && docitem.DOCUMENT_ID == DocumentId |
603 | 2ab012e8 | djkim | select new VPRevision |
604 | { |
||
605 | RevNo = docitem.REVISION, |
||
606 | GroupNo = docitem.GROUP_NO, |
||
607 | FROM_VENDOR = docitem.ORIGINAL_FILE, |
||
608 | DOCUMENT_ID = docitem.DOCUMENT_ID, |
||
609 | TO_VENDOR = docitem.RESULT_FILE, |
||
610 | RESULT = docitem.RESULT |
||
611 | }).FirstOrDefault(); |
||
612 | } |
||
613 | } |
||
614 | 0585d5cc | taeseongkim | catch (Exception ex) |
615 | 2ab012e8 | djkim | { |
616 | 5c64268e | taeseongkim | System.Diagnostics.Trace.WriteLine("KCOM_API - GetVPRevisionFirstOrDefault : " + ex.ToString()); |
617 | 2ab012e8 | djkim | } |
618 | finally |
||
619 | { |
||
620 | 24c5e56c | taeseongkim | //GC.Collect(2); |
621 | 2ab012e8 | djkim | } |
622 | return _result; |
||
623 | } |
||
624 | |||
625 | [OperationContract] |
||
626 | 787a4489 | KangIngu | public DOCINFO GetDocInfo(KCOM_BasicParam param) |
627 | { |
||
628 | DOCINFO _result = null; |
||
629 | try |
||
630 | { |
||
631 | // 차후 아래의 코드로 변경 |
||
632 | //using (CI_Entities ModelDeeview = new CI_Entities(DaelimCiConnectionString.ToString())) |
||
633 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
634 | CIEntities ModelDeeview = new CIEntities(sCIConnString); |
||
635 | 787a4489 | KangIngu | |
636 | 683a4a8f | djkim | var docinfo = ModelDeeview.DOCINFO.Where(doc => doc.DOCUMENT_ID == param.documentID && doc.PROJECT_NO == param.projectNo); |
637 | 787a4489 | KangIngu | if (docinfo.Count() > 0) |
638 | { |
||
639 | _result = docinfo.First(); |
||
640 | _result.MARKUP_INFO.Clear(); |
||
641 | |||
642 | } |
||
643 | return _result; |
||
644 | |||
645 | } |
||
646 | catch (Exception ex) |
||
647 | { |
||
648 | 5c64268e | taeseongkim | System.Diagnostics.Trace.WriteLine("KCOM_API - GetDocInfo : " + ex.ToString()); |
649 | 787a4489 | KangIngu | } |
650 | finally |
||
651 | { |
||
652 | 24c5e56c | taeseongkim | //GC.Collect(2); |
653 | 787a4489 | KangIngu | } |
654 | return null; |
||
655 | } |
||
656 | |||
657 | [OperationContract] |
||
658 | public bool GetCheckSystemAdmin(string UserID) |
||
659 | { |
||
660 | ff01c725 | humkyung | string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; |
661 | using (KCOMEntities uc = new KCOMEntities(sConnString)) |
||
662 | 787a4489 | KangIngu | { |
663 | var user = uc.PROPERTIES.Where(data => data.TYPE == "Administrator" && data.PROPERTY.Contains(UserID)).FirstOrDefault(); |
||
664 | if (user != null) |
||
665 | { |
||
666 | return true; |
||
667 | } |
||
668 | else |
||
669 | { |
||
670 | return false; |
||
671 | } |
||
672 | } |
||
673 | 24c5e56c | taeseongkim | //GC.Collect(2); |
674 | 787a4489 | KangIngu | } |
675 | |||
676 | [OperationContract] |
||
677 | public DOCUMENT_ITEM GetDocumentItemInfo(KCOM_BasicParam param) |
||
678 | { |
||
679 | ///param : prjNo, documentId, userId |
||
680 | DOCUMENT_ITEM _result = null; |
||
681 | |||
682 | try |
||
683 | { |
||
684 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
685 | CIEntities entity = new CIEntities(sCIConnString); |
||
686 | ac91e747 | taeseongkim | |
687 | 0585d5cc | taeseongkim | var _items = entity.DOCUMENT_ITEM.Where(data => data.PROJECT_NO == param.projectNo && data.DOCUMENT_ID == param.documentID); |
688 | 787a4489 | KangIngu | |
689 | if (_items.Count() > 0) |
||
690 | { |
||
691 | _result = _items.First(); |
||
692 | |||
693 | return _result; |
||
694 | } |
||
695 | //else |
||
696 | //{ |
||
697 | // Common.Helper.SystemErrorNotify(SERVICE_NAME.API, LEVEL.MEDIUM, ERROR_TYPE.CONVERT, Resources.ResourceManager.GetString("MSG_ERROR_DOCUMENTNOTFOUND"), param.documentID, param.projectNo); |
||
698 | //} |
||
699 | } |
||
700 | catch (Exception ex) |
||
701 | { |
||
702 | 5c64268e | taeseongkim | System.Diagnostics.Trace.WriteLine("KCOM_API - GetDocumentItemInfo : " + ex.ToString()); |
703 | ac91e747 | taeseongkim | |
704 | new FaultException("GetDocumentItemInfo Error - " + ex.ToString()); |
||
705 | ff01c725 | humkyung | //throw new FaultException(ex.ToString()); |
706 | 787a4489 | KangIngu | //Common.Helper.SystemErrorNotify(SERVICE_NAME.API, LEVEL.MEDIUM, ERROR_TYPE.CONVERT, "GetDocumentItemInfo / " + ex.Message, param.documentID, param.projectNo); |
707 | } |
||
708 | |||
709 | return _result; |
||
710 | } |
||
711 | 35afe17c | djkim | /// <summary> |
712 | /// DOCUMENT_ITEM Table 의 ID 로 Item 을 Select |
||
713 | /// </summary> |
||
714 | 5ded1e5a | djkim | /// 대림의 경우 Interface ID(Document 의 ID) 를 parameter 로 전달 |
715 | /// 넘어온 ID를 통해 document id 를 확인하는 과정이 필요 |
||
716 | 35afe17c | djkim | /// <param name="ensemble_id"></param> |
717 | /// <returns></returns> |
||
718 | c0977e97 | djkim | [OperationContract] |
719 | public string GetDocItemID(string ensemble_id) |
||
720 | { |
||
721 | ///param : prjNo, documentId, userId |
||
722 | string _result = string.Empty; |
||
723 | |||
724 | try |
||
725 | { |
||
726 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
727 | CIEntities entity = new CIEntities(sCIConnString); |
||
728 | 787a4489 | KangIngu | |
729 | c0977e97 | djkim | var _items = entity.DOCUMENT_ITEM.Where(data => data.ID == ensemble_id).FirstOrDefault(); |
730 | 35afe17c | djkim | if(_items != null) |
731 | _result = _items.DOCUMENT_ID; |
||
732 | c0977e97 | djkim | } |
733 | catch (Exception ex) |
||
734 | { |
||
735 | 5c64268e | taeseongkim | System.Diagnostics.Trace.WriteLine("KCOM_API - GetDocItemID : " + ex.ToString()); |
736 | c0977e97 | djkim | //System.Diagnostics.Trace.WriteLine("GetVendorItemInfo Error : " + ex); |
737 | //Common.Helper.SystemErrorNotify(SERVICE_NAME.API, LEVEL.MEDIUM, ERROR_TYPE.CONVERT, "GetDocumentItemInfo / " + ex.Message, param.documentID, param.projectNo); |
||
738 | } |
||
739 | |||
740 | return _result; |
||
741 | } |
||
742 | 787a4489 | KangIngu | public string UserGO(MARKUP_INFO item) |
743 | { |
||
744 | if (item != null) |
||
745 | { |
||
746 | return item.MARKUP_INFO_VERSION.OrderByDescending(data => data.CREATE_DATE).FirstOrDefault().ID; |
||
747 | } |
||
748 | return null; |
||
749 | } |
||
750 | 53880c83 | ljiyeon | |
751 | [OperationContract] |
||
752 | public List<MarkupInfoItem> GetMarkupInfoItems(string ProjectNo, string DocInfoId) |
||
753 | { |
||
754 | List<MarkupInfoItem> _result = new List<MarkupInfoItem>(); |
||
755 | try |
||
756 | { |
||
757 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
758 | using (CIEntities entity = new CIEntities(sCIConnString)) |
||
759 | 53880c83 | ljiyeon | { |
760 | var markupListData = entity.MARKUP_INFO.Where(data => data.DOCINFO_ID == DocInfoId).ToList(); |
||
761 | |||
762 | var markupList = from markup in markupListData |
||
763 | orderby markup.CREATE_TIME descending |
||
764 | select new MarkupInfoItem |
||
765 | { |
||
766 | MarkupInfoID = markup.ID, |
||
767 | UserID = markup.USER_ID, |
||
768 | MarkupVersionID = markup.MARKUP_INFO_VERSION.Count() == 0 ? null : markup.MARKUP_INFO_VERSION.OrderByDescending(data => data.CREATE_DATE).FirstOrDefault().ID, |
||
769 | CreateTime = markup.CREATE_TIME, |
||
770 | Consolidate = markup.CONSOLIDATE, |
||
771 | Description = markup.DESCRIPTION, |
||
772 | AvoidConsolidate = markup.AVOID_CONSOLIDATE, |
||
773 | PartConsolidate = markup.PART_CONSOLIDATE, |
||
774 | UpdateTime = DateTime.Parse(markup.UPDATE_TIME.ToString()), |
||
775 | }; |
||
776 | |||
777 | if (markupList.Count() > 0) |
||
778 | { |
||
779 | _result = markupList.ToList(); |
||
780 | } |
||
781 | |||
782 | _result.ForEach(r => |
||
783 | { |
||
784 | |||
785 | r.MarkupList = (from markupData in entity.MARKUP_DATA |
||
786 | where markupData.MARKUPINFO_VERSION_ID == r.MarkupVersionID |
||
787 | orderby markupData.PAGENUMBER |
||
788 | c0977e97 | djkim | select new MarkupItem { ID = markupData.ID, PageNumber = markupData.PAGENUMBER, Data = markupData.DATA, Data_Type = markupData.DATA_TYPE, Symbol_ID = markupData.SYMBOL_ID}).ToList(); |
789 | 53880c83 | ljiyeon | }); |
790 | |||
791 | c0977e97 | djkim | List<PROPERTIES> _ColorsProperties = new List<PROPERTIES>(); |
792 | 53880c83 | ljiyeon | Random random = new Random(); |
793 | ff01c725 | humkyung | |
794 | string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; |
||
795 | using (KCOMEntities kcomEntity = new KCOMEntities(sConnString)) |
||
796 | c0977e97 | djkim | { |
797 | _ColorsProperties = (from property in kcomEntity.PROPERTIES |
||
798 | where property.TYPE == "DisplayColor" |
||
799 | select property).ToList(); |
||
800 | 315ae55e | taeseongkim | |
801 | } |
||
802 | |||
803 | 4fcb686a | taeseongkim | if (_ColorsProperties.Count() != _result.GroupBy(x=>x.UserID).Count()) |
804 | 315ae55e | taeseongkim | { |
805 | ColorGenerator uniqueColorGenerator = new ColorGenerator(System.Drawing.Color.Red); // 2303 = (int)Color.Red |
||
806 | |||
807 | uniqueColorGenerator.GetEnumerator(_result.Count()); |
||
808 | |||
809 | for (int i = 0; i < _result.Count(); i++) |
||
810 | { |
||
811 | var c = uniqueColorGenerator.GetNext(); |
||
812 | _ColorsProperties.Add(new PROPERTIES { VALUE = String.Format("{0:X2}{1:X2}{2:X2}",c.R, c.G,c.B) }); |
||
813 | } |
||
814 | a1142a6b | taeseongkim | } |
815 | |||
816 | bool IsProjectNoPass = Properties.Settings.Default.IsProjectNoPass; |
||
817 | 53880c83 | ljiyeon | |
818 | 4fcb686a | taeseongkim | foreach (var item in _result.GroupBy(x=>x.UserID)) |
819 | 53880c83 | ljiyeon | { |
820 | a1142a6b | taeseongkim | string query = "SELECT members.ID,members.NAME,members.DEPARTMENT FROM CIEntities.MEMBER as members where members.ID = @userId"; |
821 | |||
822 | System.Data.Objects.ObjectQuery<System.Data.Common.DbDataRecord> memberQuery |
||
823 | 4fcb686a | taeseongkim | = entity.CreateQuery<System.Data.Common.DbDataRecord>(query,new System.Data.Objects.ObjectParameter("userId",item.Key)); |
824 | |||
825 | a1142a6b | taeseongkim | if (memberQuery.Count() > 0) |
826 | 53880c83 | ljiyeon | { |
827 | a1142a6b | taeseongkim | string userName = memberQuery.First()["NAME"]?.ToString().Trim(); |
828 | string depatment = memberQuery.First()["DEPARTMENT"]?.ToString().Trim(); |
||
829 | |||
830 | 4fcb686a | taeseongkim | PROPERTIES deptColor = _ColorsProperties[0]; |
831 | |||
832 | _ColorsProperties.RemoveAt(0); |
||
833 | //PROPERTIES deptColor = _ColorsProperties.Find(c => c.PROPERTY == depatment); |
||
834 | |||
835 | //if (_ColorsProperties.Count > 0) |
||
836 | //{ |
||
837 | // if (deptColor == null) |
||
838 | // { |
||
839 | // item.DisplayColor = "#FF" + _ColorsProperties[0].VALUE; |
||
840 | // _ColorsProperties.RemoveAt(0); |
||
841 | // } |
||
842 | // else |
||
843 | // { |
||
844 | // item.DisplayColor = "#FF" + deptColor.VALUE; |
||
845 | // _ColorsProperties.Remove(deptColor); |
||
846 | // } |
||
847 | //} |
||
848 | |||
849 | foreach (var markupInfo in item) |
||
850 | { |
||
851 | markupInfo.DisplayColor = "#FF" + deptColor.VALUE; |
||
852 | markupInfo.UserName = userName; |
||
853 | markupInfo.Depatment = depatment; |
||
854 | } |
||
855 | c0977e97 | djkim | } |
856 | 53880c83 | ljiyeon | } |
857 | 4fcb686a | taeseongkim | |
858 | |||
859 | //else |
||
860 | //{ |
||
861 | // item.DisplayColor = String.Format("#FF{0:X6}", random.Next(0x1000000)); |
||
862 | //} |
||
863 | 53880c83 | ljiyeon | } |
864 | } |
||
865 | 0585d5cc | taeseongkim | catch (Exception ex) |
866 | 53880c83 | ljiyeon | { |
867 | 5c64268e | taeseongkim | System.Diagnostics.Trace.WriteLine("KCOM_API - GetMarkupInfoItems : " + ex.ToString()); |
868 | 0585d5cc | taeseongkim | |
869 | 53880c83 | ljiyeon | return _result; |
870 | } |
||
871 | finally |
||
872 | { |
||
873 | 24c5e56c | taeseongkim | //GC.Collect(2); |
874 | 53880c83 | ljiyeon | } |
875 | |||
876 | return _result; |
||
877 | } |
||
878 | |||
879 | 787a4489 | KangIngu | [OperationContract] |
880 | public List<MarkupInfoItem> GetSyncMarkupInfoItems(string ProjectNo, string DocInfoId, string currentUser) |
||
881 | { |
||
882 | List<MarkupInfoItem> _result = new List<MarkupInfoItem>(); |
||
883 | try |
||
884 | { |
||
885 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
886 | using (CIEntities entity = new CIEntities(sCIConnString)) |
||
887 | 787a4489 | KangIngu | { |
888 | var docItem = entity.DOCINFO.Where(data => data.DOCUMENT_ID == DocInfoId).FirstOrDefault(); |
||
889 | if (docItem == null) |
||
890 | { |
||
891 | return null; |
||
892 | } |
||
893 | var markupListData = entity.MARKUP_INFO.Where(data => data.DOCINFO_ID == docItem.ID).ToList(); |
||
894 | |||
895 | var markupList = from markup in markupListData |
||
896 | where markup.USER_ID == currentUser || markup.CONSOLIDATE == 1 |
||
897 | orderby markup.CREATE_TIME descending |
||
898 | select new MarkupInfoItem |
||
899 | { |
||
900 | MarkupInfoID = markup.ID, |
||
901 | UserID = markup.USER_ID, |
||
902 | MarkupVersionID = markup.MARKUP_INFO_VERSION.Count() == 0 ? null : markup.MARKUP_INFO_VERSION.OrderByDescending(data => data.CREATE_DATE).FirstOrDefault().ID, |
||
903 | CreateTime = markup.CREATE_TIME, |
||
904 | Consolidate = markup.CONSOLIDATE, |
||
905 | Description = markup.DESCRIPTION, |
||
906 | AvoidConsolidate = markup.AVOID_CONSOLIDATE, |
||
907 | PartConsolidate = markup.PART_CONSOLIDATE, |
||
908 | }; |
||
909 | |||
910 | |||
911 | |||
912 | if (markupList.Count() > 0) |
||
913 | { |
||
914 | _result = markupList.ToList(); |
||
915 | } |
||
916 | |||
917 | |||
918 | |||
919 | _result.ForEach(r => |
||
920 | { |
||
921 | |||
922 | r.MarkupList = (from markupData in entity.MARKUP_DATA |
||
923 | where markupData.MARKUPINFO_VERSION_ID == r.MarkupVersionID |
||
924 | orderby markupData.PAGENUMBER |
||
925 | ab5aa762 | taeseongkim | select new MarkupItem |
926 | { |
||
927 | ID = markupData.ID, |
||
928 | PageNumber = markupData.PAGENUMBER, |
||
929 | Data = markupData.DATA, |
||
930 | Data_Type = markupData.DATA_TYPE, |
||
931 | Symbol_ID = markupData.SYMBOL_ID |
||
932 | }).ToList(); |
||
933 | 787a4489 | KangIngu | }); |
934 | |||
935 | List<PROPERTIES> _ColorsProperties = new List<PROPERTIES>(); |
||
936 | Random random = new Random(); |
||
937 | |||
938 | ff01c725 | humkyung | string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; |
939 | using (KCOMEntities kcomEntity = new KCOMEntities(sConnString)) |
||
940 | 787a4489 | KangIngu | { |
941 | _ColorsProperties = (from property in kcomEntity.PROPERTIES |
||
942 | where property.TYPE == "DisplayColor" |
||
943 | select property).ToList(); |
||
944 | } |
||
945 | |||
946 | foreach (var item in _result) |
||
947 | { |
||
948 | a1142a6b | taeseongkim | string query = "SELECT members.ID,members.NAME,members.DEPARTMENT FROM CIEntities.MEMBER as members where members.ID = @userId"; |
949 | |||
950 | System.Data.Objects.ObjectQuery<System.Data.Common.DbDataRecord> memberQuery |
||
951 | = entity.CreateQuery<System.Data.Common.DbDataRecord>(query, new System.Data.Objects.ObjectParameter("userId", item.UserID)); |
||
952 | 787a4489 | KangIngu | |
953 | a1142a6b | taeseongkim | if (memberQuery.Count() > 0) |
954 | 787a4489 | KangIngu | { |
955 | a1142a6b | taeseongkim | |
956 | string userName = memberQuery.First()["NAME"]?.ToString().Trim(); |
||
957 | string depatment = memberQuery.First()["DEPARTMENT"]?.ToString().Trim(); |
||
958 | |||
959 | item.UserName = userName; |
||
960 | item.Depatment = depatment; |
||
961 | 787a4489 | KangIngu | } |
962 | |||
963 | if (_ColorsProperties.Count > 0) |
||
964 | { |
||
965 | int colorIdx = random.Next(1, _ColorsProperties.Count()); |
||
966 | #region 부서별로 색상을 지정하고자 할때 |
||
967 | /// 일단 의견을 들어보자구! |
||
968 | #endregion |
||
969 | item.DisplayColor = "#FF" + _ColorsProperties[colorIdx].VALUE; |
||
970 | _ColorsProperties.Remove(_ColorsProperties[colorIdx]); |
||
971 | //item.DisplayColor = "#FF" + _Colors.First(); |
||
972 | //_Colors.Remove(_Colors.First()); |
||
973 | } |
||
974 | else |
||
975 | { |
||
976 | item.DisplayColor = String.Format("#FF{0:X6}", random.Next(0x1000000)); |
||
977 | } |
||
978 | } |
||
979 | } |
||
980 | } |
||
981 | 0585d5cc | taeseongkim | catch (Exception ex) |
982 | 787a4489 | KangIngu | { |
983 | 5c64268e | taeseongkim | System.Diagnostics.Trace.WriteLine("KCOM_API - GetSyncMarkupInfoItems : " + ex.ToString()); |
984 | 787a4489 | KangIngu | return _result; |
985 | } |
||
986 | finally |
||
987 | { |
||
988 | 24c5e56c | taeseongkim | //GC.Collect(2); |
989 | 787a4489 | KangIngu | } |
990 | |||
991 | return _result; |
||
992 | } |
||
993 | |||
994 | |||
995 | //[OperationContract] |
||
996 | //[ServiceKnownType(typeof(MEMBER))] |
||
997 | //public List<MEMBER> GetUserData(string ProjectNo, string UserID) |
||
998 | //{ |
||
999 | // List<MEMBER> _result = new List<MEMBER>(); |
||
1000 | |||
1001 | // using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString())) |
||
1002 | // { |
||
1003 | // var _UserList = from member in entity.MEMBER |
||
1004 | // where member.ID == UserID |
||
1005 | // select member; |
||
1006 | // _result = _UserList.ToList(); |
||
1007 | // } |
||
1008 | // //GC.Collect(2); |
||
1009 | // return _result; |
||
1010 | //} |
||
1011 | |||
1012 | 2ab012e8 | djkim | [OperationContract] |
1013 | [ServiceKnownType(typeof(MEMBER))] |
||
1014 | public List<MEMBER> GetUserData(string ProjectNo, string UserID) |
||
1015 | { |
||
1016 | List<MEMBER> _result = new List<MEMBER>(); |
||
1017 | 787a4489 | KangIngu | |
1018 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
1019 | 285635d3 | taeseongkim | |
1020 | ff01c725 | humkyung | using (CIEntities entity = new CIEntities(sCIConnString)) |
1021 | 2ab012e8 | djkim | { |
1022 | 285635d3 | taeseongkim | _result = GetMemberQuery(entity, UserID); |
1023 | 2ab012e8 | djkim | } |
1024 | //GC.Collect(2); |
||
1025 | return _result; |
||
1026 | } |
||
1027 | 787a4489 | KangIngu | |
1028 | |||
1029 | [OperationContract] |
||
1030 | public List<string> GetDeptData(string UserDept) //그룹 추가 옵션 부여 예정 |
||
1031 | { |
||
1032 | List<string> _result = new List<string>(); |
||
1033 | |||
1034 | try |
||
1035 | { |
||
1036 | ff01c725 | humkyung | string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; |
1037 | KCOMEntities entity = new KCOMEntities(sConnString); |
||
1038 | 787a4489 | KangIngu | var YourEnginner = (from dept in entity.PROPERTIES |
1039 | where dept.TYPE == "DeptName" && UserDept.Contains(dept.VALUE) |
||
1040 | select dept).FirstOrDefault(); |
||
1041 | |||
1042 | if (YourEnginner != null) |
||
1043 | { |
||
1044 | _result = (from dept in entity.PROPERTIES |
||
1045 | where dept.PROPERTY == YourEnginner.PROPERTY |
||
1046 | select dept.VALUE).ToList(); |
||
1047 | return _result; |
||
1048 | } |
||
1049 | else |
||
1050 | { |
||
1051 | return null; |
||
1052 | } |
||
1053 | } |
||
1054 | catch (Exception ex) |
||
1055 | { |
||
1056 | 5c64268e | taeseongkim | System.Diagnostics.Trace.WriteLine("KCOM_API - GetDeptData : " + ex.ToString()); |
1057 | 787a4489 | KangIngu | } |
1058 | finally |
||
1059 | { |
||
1060 | 24c5e56c | taeseongkim | //GC.Collect(2); |
1061 | 787a4489 | KangIngu | } |
1062 | return _result; |
||
1063 | } |
||
1064 | |||
1065 | [OperationContract] |
||
1066 | public bool DeleteMarkup(string ProjectNo, string MarkupInfoID) |
||
1067 | { |
||
1068 | bool _result = false; |
||
1069 | try |
||
1070 | { |
||
1071 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
1072 | using (KCOMDataModel.DataModel.CIEntities Entity = new KCOMDataModel.DataModel.CIEntities(sCIConnString)) |
||
1073 | 787a4489 | KangIngu | { |
1074 | |||
1075 | MARKUP_INFO instance = Entity.MARKUP_INFO.Where(root => root.ID == MarkupInfoID).FirstOrDefault(); |
||
1076 | |||
1077 | if (instance == null) |
||
1078 | { |
||
1079 | return false; |
||
1080 | } |
||
1081 | MARKUP_INFO_VERSION version = instance.MARKUP_INFO_VERSION.FirstOrDefault(); |
||
1082 | |||
1083 | |||
1084 | version.MARKUP_DATA.ToList().ForEach(data => |
||
1085 | { |
||
1086 | Entity.MARKUP_DATA.DeleteObject(data); |
||
1087 | Entity.SaveChanges(); |
||
1088 | }); |
||
1089 | |||
1090 | Entity.MARKUP_INFO_VERSION.DeleteObject(version); |
||
1091 | Entity.SaveChanges(); |
||
1092 | |||
1093 | Entity.MARKUP_INFO.DeleteObject(instance); |
||
1094 | Entity.SaveChanges(); |
||
1095 | |||
1096 | } |
||
1097 | _result = true; |
||
1098 | } |
||
1099 | catch (Exception ex) |
||
1100 | { |
||
1101 | 5c64268e | taeseongkim | System.Diagnostics.Trace.WriteLine("KCOM_API - DeleteMarkup : " + ex.ToString()); |
1102 | 787a4489 | KangIngu | } |
1103 | finally |
||
1104 | { |
||
1105 | 24c5e56c | taeseongkim | //GC.Collect(2); |
1106 | 787a4489 | KangIngu | } |
1107 | return _result; |
||
1108 | } |
||
1109 | 992a98b4 | KangIngu | |
1110 | #region Favorite |
||
1111 | [OperationContract] |
||
1112 | public bool SetFavoriteVP(string prjNo, string userID, string groupNo, string docNo, string rev, int SavePageNo, string documentItemID, string VPDescription, IKCOM.FAVORITE_FLAG flag) |
||
1113 | { |
||
1114 | ff01c725 | humkyung | string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; |
1115 | using (KCOMEntities entity = new KCOMEntities(sConnString)) |
||
1116 | 992a98b4 | KangIngu | { |
1117 | try |
||
1118 | { |
||
1119 | entity.FAVORITE_DOC.AddObject(new FAVORITE_DOC |
||
1120 | { |
||
1121 | ID = shortGuid(), |
||
1122 | PROJECT_NO = prjNo, |
||
1123 | DOCUMENT_ID = documentItemID, |
||
1124 | GROUP_NO = groupNo, |
||
1125 | DOCUMENT_NO = docNo, |
||
1126 | MEMBER_USER_ID = userID, |
||
1127 | DESCRIPTION = VPDescription, |
||
1128 | CREATE_TIME = DateTime.Now, |
||
1129 | REVISION = rev, |
||
1130 | FLAG = (int)flag, |
||
1131 | PAGE_NO = SavePageNo, |
||
1132 | }); |
||
1133 | entity.SaveChanges(); |
||
1134 | } |
||
1135 | 0585d5cc | taeseongkim | catch (Exception ex) |
1136 | 992a98b4 | KangIngu | { |
1137 | 5c64268e | taeseongkim | System.Diagnostics.Trace.WriteLine("KCOM_API - SetFavoriteVP : " + ex.ToString()); |
1138 | 992a98b4 | KangIngu | return false; |
1139 | } |
||
1140 | |||
1141 | return true; |
||
1142 | } |
||
1143 | } |
||
1144 | |||
1145 | //[OperationContract] |
||
1146 | //public List<FAVORITE_DOC> GetFavoriteVP(string PrjNo, string userID, string sharepointItemID) |
||
1147 | //{ |
||
1148 | // using (KCOMEntities entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
||
1149 | // { |
||
1150 | |||
1151 | // int flagString = Convert.ToInt32(IKCOM.FAVORITE_FLAG.Personal); |
||
1152 | // List<FAVORITE_DOC> favoriteListSet = new List<FAVORITE_DOC>(); |
||
1153 | // entity.FAVORITE_DOC.Where(data => data.PROJECT_NO == PrjNo && data.DOCUMENT_ID == sharepointItemID && data.FLAG != |
||
1154 | // flagString).ToList().ForEach(data => favoriteListSet.Add(data)); |
||
1155 | // entity.FAVORITE_DOC.Where(data => data.PROJECT_NO == PrjNo && data.MEMBER_USER_ID == userID).ToList().ForEach(data => favoriteListSet.Add(data)); |
||
1156 | // favoriteListSet = favoriteListSet.Distinct().ToList(); |
||
1157 | // return favoriteListSet; |
||
1158 | // } |
||
1159 | //} |
||
1160 | //[OperationContract] |
||
1161 | //public bool EditFavoriteVP(string prjNo, string userID, int SavePageNo, string sharepointItemID, DateTime createTime, int state, string description) |
||
1162 | //{ |
||
1163 | // using (DeepViewEntities dc = new DeepViewEntities(ConnectStringBuilder.DeepViewConnectionString().ToString())) |
||
1164 | // { |
||
1165 | // List<FavoriteVP> favoriteSet = dc.FavoriteVP.Where(data => data.ProjectNo == prjNo && data.CreateUserID == userID |
||
1166 | // && data.PageNo == SavePageNo && data.CreateTime == createTime).ToList(); |
||
1167 | |||
1168 | // try |
||
1169 | // { |
||
1170 | |||
1171 | |||
1172 | // if (favoriteSet.Count > 0) |
||
1173 | // { |
||
1174 | // var FavoriteVP_Instance = favoriteSet.First(); |
||
1175 | |||
1176 | // FavoriteVP_Instance.Description = description; |
||
1177 | // FavoriteVP_Instance.Flag = state; |
||
1178 | |||
1179 | // dc.SaveChanges(); |
||
1180 | |||
1181 | // return true; |
||
1182 | // } |
||
1183 | // else |
||
1184 | // { |
||
1185 | // return false; |
||
1186 | // } |
||
1187 | // } |
||
1188 | 5c64268e | taeseongkim | // catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex); |
1189 | 992a98b4 | KangIngu | // { |
1190 | // return false; |
||
1191 | // } |
||
1192 | // } |
||
1193 | //} |
||
1194 | //[OperationContract] |
||
1195 | //public bool DelFavoriteVP(string prjNo, string userID, int SavePageNo, string sharepointItemID, DateTime createTime) |
||
1196 | //{ |
||
1197 | |||
1198 | // using (DeepViewEntities dc = new DeepViewEntities(ConnectStringBuilder.DeepViewConnectionString().ToString())) |
||
1199 | // { |
||
1200 | // List<FavoriteVP> favoriteSet = dc.FavoriteVP.Where(data => data.ProjectNo == prjNo && data.CreateUserID == userID |
||
1201 | // && data.PageNo == SavePageNo && data.CreateTime == createTime).ToList(); |
||
1202 | |||
1203 | // try |
||
1204 | // { |
||
1205 | |||
1206 | |||
1207 | // if (favoriteSet.Count > 0) |
||
1208 | // { |
||
1209 | // favoriteSet.ForEach(data => dc.FavoriteVP.DeleteObject(data)); |
||
1210 | // dc.SaveChanges(); |
||
1211 | // return true; |
||
1212 | // } |
||
1213 | // else |
||
1214 | // { |
||
1215 | // return false; |
||
1216 | // } |
||
1217 | // } |
||
1218 | 5c64268e | taeseongkim | // catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex); |
1219 | 992a98b4 | KangIngu | // { |
1220 | // return false; |
||
1221 | // } |
||
1222 | // } |
||
1223 | //} |
||
1224 | #endregion |
||
1225 | 2ab012e8 | djkim | |
1226 | [OperationContract] |
||
1227 | public bool SaveMarkupData(MarkupInfoItem UserState,string project_no,string doc_id, string user_id, List<MARKUP_DATA> mlmarkup_data) |
||
1228 | { |
||
1229 | 6b6e937c | taeseongkim | |
1230 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
1231 | using (CIEntities Entity = new CIEntities(sCIConnString)) |
||
1232 | 2ab012e8 | djkim | { |
1233 | #region Docinfo 정보 가져오기 |
||
1234 | |||
1235 | string docinfoid_ = (from info in Entity.DOCINFO |
||
1236 | where info.DOCUMENT_ID == doc_id |
||
1237 | && info.PROJECT_NO == project_no |
||
1238 | select info.ID |
||
1239 | ).First().ToString(); |
||
1240 | #endregion |
||
1241 | |||
1242 | #region Markup_Info 저장 |
||
1243 | |||
1244 | MARKUP_INFO markup_info = new MARKUP_INFO(); |
||
1245 | try |
||
1246 | { |
||
1247 | markup_info = (from info in Entity.MARKUP_INFO |
||
1248 | where info.ID == UserState.MarkupInfoID && info.USER_ID == user_id |
||
1249 | select info).FirstOrDefault(); |
||
1250 | } |
||
1251 | 0585d5cc | taeseongkim | catch (Exception ex) |
1252 | 2ab012e8 | djkim | { |
1253 | 5c64268e | taeseongkim | System.Diagnostics.Trace.WriteLine("KCOM_API - SaveMarkupData Get markup_info: " + ex.ToString()); |
1254 | 2ab012e8 | djkim | markup_info = null; |
1255 | } |
||
1256 | |||
1257 | //markup_info가 없을 경우 생성 |
||
1258 | if (markup_info == null) |
||
1259 | { |
||
1260 | //MarkupInfo 저장 |
||
1261 | markup_info = new MARKUP_INFO |
||
1262 | { |
||
1263 | ID = UserState.MarkupInfoID, |
||
1264 | DOCINFO_ID = docinfoid_, |
||
1265 | USER_ID = user_id, |
||
1266 | CREATE_TIME = DateTime.Now, |
||
1267 | CONSOLIDATE = UserState.Consolidate, |
||
1268 | AVOID_CONSOLIDATE = UserState.AvoidConsolidate, |
||
1269 | PART_CONSOLIDATE = UserState.PartConsolidate, |
||
1270 | DESCRIPTION = UserState.Description, |
||
1271 | UPDATE_TIME = DateTime.Now |
||
1272 | }; |
||
1273 | Entity.MARKUP_INFO.AddObject(markup_info); |
||
1274 | } |
||
1275 | //markup_info가 있을 경우 업데이트 |
||
1276 | else |
||
1277 | { |
||
1278 | markup_info.UPDATE_TIME = DateTime.Now; |
||
1279 | } |
||
1280 | Entity.SaveChanges(); |
||
1281 | #endregion |
||
1282 | |||
1283 | #region Markup_Info_Version 저장 |
||
1284 | |||
1285 | MARKUP_INFO_VERSION markup_info_version = new MARKUP_INFO_VERSION(); |
||
1286 | |||
1287 | try |
||
1288 | { |
||
1289 | markup_info_version = (from info in Entity.MARKUP_INFO_VERSION |
||
1290 | where info.MARKUPINFO_ID == markup_info.ID |
||
1291 | select info).FirstOrDefault(); |
||
1292 | } |
||
1293 | 0585d5cc | taeseongkim | catch (Exception ex) |
1294 | 2ab012e8 | djkim | { |
1295 | 5c64268e | taeseongkim | System.Diagnostics.Trace.WriteLine("KCOM_API - SaveMarkupData Get markup_info_version : " + ex.ToString()); |
1296 | 2ab012e8 | djkim | markup_info_version = null; |
1297 | } |
||
1298 | |||
1299 | //markup_info_version 없을 경우 생성 |
||
1300 | if (markup_info_version == null) |
||
1301 | { |
||
1302 | //MarkupInfo_version 저장 |
||
1303 | markup_info_version = new MARKUP_INFO_VERSION() |
||
1304 | { |
||
1305 | ID = UserState.MarkupVersionID, |
||
1306 | MARKUPINFO_ID = markup_info.ID, |
||
1307 | CREATE_DATE = DateTime.Now |
||
1308 | }; |
||
1309 | Entity.MARKUP_INFO_VERSION.AddObject(markup_info_version); |
||
1310 | Entity.SaveChanges(); |
||
1311 | } |
||
1312 | #endregion |
||
1313 | |||
1314 | |||
1315 | Entity.MARKUP_DATA.Where(data => data.MARKUPINFO_VERSION_ID == markup_info_version.ID).ToList().ForEach(item => |
||
1316 | { |
||
1317 | Entity.MARKUP_DATA.DeleteObject(item); |
||
1318 | }); |
||
1319 | 77cdac33 | taeseongkim | |
1320 | 2ab012e8 | djkim | Entity.SaveChanges(); |
1321 | 6b6e937c | taeseongkim | |
1322 | try |
||
1323 | { |
||
1324 | mlmarkup_data.ForEach(value => |
||
1325 | { |
||
1326 | Entity.MARKUP_DATA.AddObject(new MARKUP_DATA |
||
1327 | { |
||
1328 | ID = value.ID, |
||
1329 | DATA = value.DATA, |
||
1330 | DATA_TYPE = value.DATA_TYPE, |
||
1331 | PAGENUMBER = value.PAGENUMBER, |
||
1332 | MARKUPINFO_VERSION_ID = markup_info_version.ID, |
||
1333 | SYMBOL_ID = value.SYMBOL_ID, |
||
1334 | //GROUP_ID = value.GROUP_ID |
||
1335 | }); |
||
1336 | b42dd24d | taeseongkim | |
1337 | |||
1338 | 6b6e937c | taeseongkim | }); |
1339 | Entity.SaveChanges(); |
||
1340 | b42dd24d | taeseongkim | |
1341 | if (Properties.Settings.Default.Properties["CLIENT_VERSION"] != null) |
||
1342 | { |
||
1343 | string sql = $"UPDATE MARKUP_DATA SET REMARK = '{Properties.Settings.Default.CLIENT_VERSION} {DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }' WHERE ID = @ID"; |
||
1344 | |||
1345 | mlmarkup_data.ForEach(value => |
||
1346 | { |
||
1347 | var param = new System.Data.Common.DbParameter[] { new System.Data.SqlClient.SqlParameter { ParameterName = "ID", Value = value.ID } }; |
||
1348 | var result = Entity.ExecuteStoreCommand(sql, param); |
||
1349 | }); |
||
1350 | |||
1351 | Entity.SaveChanges(); |
||
1352 | } |
||
1353 | 6b6e937c | taeseongkim | } |
1354 | 0585d5cc | taeseongkim | catch (Exception ex) |
1355 | 6b6e937c | taeseongkim | { |
1356 | 5c64268e | taeseongkim | System.Diagnostics.Trace.WriteLine("KCOM_API - SaveMarkupData set mlmarkup_data : " + ex.ToString()); |
1357 | 6b6e937c | taeseongkim | return false; |
1358 | } |
||
1359 | } |
||
1360 | return true; |
||
1361 | } |
||
1362 | |||
1363 | [OperationContract] |
||
1364 | public bool SavePageMarkupData(MarkupInfoItem UserState,int PageNo, string project_no, string doc_id, string user_id, List<MARKUP_DATA> mlmarkup_data) |
||
1365 | { |
||
1366 | |||
1367 | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
||
1368 | using (CIEntities Entity = new CIEntities(sCIConnString)) |
||
1369 | { |
||
1370 | #region Docinfo 정보 가져오기 |
||
1371 | |||
1372 | string docinfoid_ = (from info in Entity.DOCINFO |
||
1373 | where info.DOCUMENT_ID == doc_id |
||
1374 | && info.PROJECT_NO == project_no |
||
1375 | select info.ID |
||
1376 | ).First().ToString(); |
||
1377 | #endregion |
||
1378 | |||
1379 | #region Markup_Info 저장 |
||
1380 | |||
1381 | MARKUP_INFO markup_info = new MARKUP_INFO(); |
||
1382 | try |
||
1383 | { |
||
1384 | markup_info = (from info in Entity.MARKUP_INFO |
||
1385 | where info.ID == UserState.MarkupInfoID && info.USER_ID == user_id |
||
1386 | select info).FirstOrDefault(); |
||
1387 | } |
||
1388 | 0585d5cc | taeseongkim | catch (Exception ex) |
1389 | 6b6e937c | taeseongkim | { |
1390 | 5c64268e | taeseongkim | System.Diagnostics.Trace.WriteLine("KCOM_API - SavePageMarkupData : " + ex.ToString()); |
1391 | 0585d5cc | taeseongkim | |
1392 | 6b6e937c | taeseongkim | markup_info = null; |
1393 | } |
||
1394 | |||
1395 | //markup_info가 없을 경우 생성 |
||
1396 | if (markup_info == null) |
||
1397 | { |
||
1398 | //MarkupInfo 저장 |
||
1399 | markup_info = new MARKUP_INFO |
||
1400 | { |
||
1401 | ID = UserState.MarkupInfoID, |
||
1402 | DOCINFO_ID = docinfoid_, |
||
1403 | USER_ID = user_id, |
||
1404 | CREATE_TIME = DateTime.Now, |
||
1405 | CONSOLIDATE = UserState.Consolidate, |
||
1406 | AVOID_CONSOLIDATE = UserState.AvoidConsolidate, |
||
1407 | PART_CONSOLIDATE = UserState.PartConsolidate, |
||
1408 | DESCRIPTION = UserState.Description, |
||
1409 | UPDATE_TIME = DateTime.Now |
||
1410 | }; |
||
1411 | Entity.MARKUP_INFO.AddObject(markup_info); |
||
1412 | } |
||
1413 | //markup_info가 있을 경우 업데이트 |
||
1414 | else |
||
1415 | { |
||
1416 | markup_info.UPDATE_TIME = DateTime.Now; |
||
1417 | } |
||
1418 | Entity.SaveChanges(); |
||
1419 | #endregion |
||
1420 | |||
1421 | #region Markup_Info_Version 저장 |
||
1422 | |||
1423 | MARKUP_INFO_VERSION markup_info_version = new MARKUP_INFO_VERSION(); |
||
1424 | |||
1425 | try |
||
1426 | { |
||
1427 | markup_info_version = (from info in Entity.MARKUP_INFO_VERSION |
||
1428 | where info.MARKUPINFO_ID == markup_info.ID |
||
1429 | select info).FirstOrDefault(); |
||
1430 | } |
||
1431 | 0585d5cc | taeseongkim | catch (Exception ex) |
1432 | 6b6e937c | taeseongkim | { |
1433 | 5c64268e | taeseongkim | System.Diagnostics.Trace.WriteLine("KCOM_API - SavePageMarkupData get markup_info_version : " + ex.ToString()); |
1434 | 6b6e937c | taeseongkim | markup_info_version = null; |
1435 | } |
||
1436 | |||
1437 | //markup_info_version 없을 경우 생성 |
||
1438 | if (markup_info_version == null) |
||
1439 | { |
||
1440 | //MarkupInfo_version 저장 |
||
1441 | markup_info_version = new MARKUP_INFO_VERSION() |
||
1442 | { |
||
1443 | ID = UserState.MarkupVersionID, |
||
1444 | MARKUPINFO_ID = markup_info.ID, |
||
1445 | CREATE_DATE = DateTime.Now |
||
1446 | }; |
||
1447 | Entity.MARKUP_INFO_VERSION.AddObject(markup_info_version); |
||
1448 | Entity.SaveChanges(); |
||
1449 | } |
||
1450 | #endregion |
||
1451 | |||
1452 | |||
1453 | Entity.MARKUP_DATA.Where(data => data.PAGENUMBER == PageNo && data.MARKUPINFO_VERSION_ID == markup_info_version.ID).ToList().ForEach(item => |
||
1454 | { |
||
1455 | Entity.MARKUP_DATA.DeleteObject(item); |
||
1456 | }); |
||
1457 | Entity.SaveChanges(); |
||
1458 | 2ab012e8 | djkim | |
1459 | try |
||
1460 | { |
||
1461 | mlmarkup_data.ForEach(value => |
||
1462 | { |
||
1463 | Entity.MARKUP_DATA.AddObject(new MARKUP_DATA |
||
1464 | { |
||
1465 | ID = value.ID, |
||
1466 | DATA = value.DATA, |
||
1467 | DATA_TYPE = value.DATA_TYPE, |
||
1468 | PAGENUMBER = value.PAGENUMBER, |
||
1469 | c8e9b3e4 | ljiyeon | MARKUPINFO_VERSION_ID = markup_info_version.ID, |
1470 | 53880c83 | ljiyeon | SYMBOL_ID = value.SYMBOL_ID, |
1471 | c0977e97 | djkim | //GROUP_ID = value.GROUP_ID |
1472 | 2ab012e8 | djkim | }); |
1473 | }); |
||
1474 | Entity.SaveChanges(); |
||
1475 | } |
||
1476 | 0585d5cc | taeseongkim | catch (Exception ex) |
1477 | 2ab012e8 | djkim | { |
1478 | 5c64268e | taeseongkim | System.Diagnostics.Trace.WriteLine("KCOM_API - SavePageMarkupData set mlmarkup_data : " + ex.ToString()); |
1479 | 2ab012e8 | djkim | return false; |
1480 | } |
||
1481 | } |
||
1482 | return true; |
||
1483 | } |
||
1484 | |||
1485 | c0977e97 | djkim | //[OperationContract] |
1486 | //public long AddMarkupDataGroup(MARKUP_DATA_GROUP mARKUP_DATA_GROUP, string ProjectNo) |
||
1487 | //{ |
||
1488 | // try |
||
1489 | // { |
||
1490 | // using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString())) |
||
1491 | // { |
||
1492 | // Entity.AddToMARKUP_DATA_GROUP(mARKUP_DATA_GROUP); |
||
1493 | // //MARKUP_DATA_GROUP tt = Entity.MARKUP_DATA_GROUP.Where(info => info.ID == id).FirstOrDefault(); |
||
1494 | // Entity.SaveChanges(); |
||
1495 | 53880c83 | ljiyeon | |
1496 | c0977e97 | djkim | // return Entity.MARKUP_DATA_GROUP.ToList().LastOrDefault().ID; |
1497 | // } |
||
1498 | // } |
||
1499 | 5c64268e | taeseongkim | // catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex); |
1500 | c0977e97 | djkim | // { |
1501 | // return 0; |
||
1502 | // } |
||
1503 | //} |
||
1504 | //[OperationContract] |
||
1505 | //public bool UpdateMarkupDataGroup(long Group_ID, string ProjectNo) |
||
1506 | //{ |
||
1507 | // try |
||
1508 | // { |
||
1509 | // using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString())) |
||
1510 | // { |
||
1511 | // var UpdateItem = Entity.MARKUP_DATA_GROUP.Where(info => info.ID == Group_ID).FirstOrDefault(); |
||
1512 | // UpdateItem.STATE = 1; |
||
1513 | // Entity.SaveChanges(); |
||
1514 | // } |
||
1515 | // } |
||
1516 | 5c64268e | taeseongkim | // catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex); |
1517 | c0977e97 | djkim | // { |
1518 | // return false; |
||
1519 | // } |
||
1520 | // return true; |
||
1521 | //} |
||
1522 | 53880c83 | ljiyeon | [OperationContract] |
1523 | public bool UpdateMarkupData(string CommentID, long Group_ID, string ProjectNo) |
||
1524 | { |
||
1525 | try |
||
1526 | { |
||
1527 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
1528 | using (CIEntities Entity = new CIEntities(sCIConnString)) |
||
1529 | 53880c83 | ljiyeon | { |
1530 | var UpdateItem = Entity.MARKUP_DATA.Where(info => info.ID == CommentID).FirstOrDefault(); |
||
1531 | c0977e97 | djkim | //UpdateItem.GROUP_ID = Group_ID; |
1532 | 53880c83 | ljiyeon | Entity.SaveChanges(); |
1533 | } |
||
1534 | } |
||
1535 | 0585d5cc | taeseongkim | catch (Exception ex) |
1536 | 53880c83 | ljiyeon | { |
1537 | 5c64268e | taeseongkim | System.Diagnostics.Trace.WriteLine("KCOM_API - UpdateMarkupData: " + ex.ToString()); |
1538 | 53880c83 | ljiyeon | return false; |
1539 | } |
||
1540 | return true; |
||
1541 | } |
||
1542 | 2ab012e8 | djkim | |
1543 | [OperationContract] |
||
1544 | public bool SaveSymbol(SYMBOL_PRIVATE symbol_private) |
||
1545 | { |
||
1546 | try |
||
1547 | { |
||
1548 | ff01c725 | humkyung | string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; |
1549 | using (KCOMDataModel.DataModel.KCOMEntities uc = new KCOMDataModel.DataModel.KCOMEntities(sConnString)) |
||
1550 | 2ab012e8 | djkim | { |
1551 | uc.AddToSYMBOL_PRIVATE(symbol_private); |
||
1552 | uc.SaveChanges(); |
||
1553 | } |
||
1554 | } |
||
1555 | 0585d5cc | taeseongkim | catch (Exception ex) |
1556 | 2ab012e8 | djkim | { |
1557 | 5c64268e | taeseongkim | System.Diagnostics.Trace.WriteLine("KCOM_API - SaveSymbol: " + ex.ToString()); |
1558 | 2ab012e8 | djkim | return false; |
1559 | } |
||
1560 | return true; |
||
1561 | } |
||
1562 | [OperationContract] |
||
1563 | 498f0fc9 | ljiyeon | public bool AddPublicSymbol(SYMBOL_PUBLIC symbol) |
1564 | { |
||
1565 | try |
||
1566 | { |
||
1567 | ff01c725 | humkyung | string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; |
1568 | using (KCOMDataModel.DataModel.KCOMEntities uc = new KCOMDataModel.DataModel.KCOMEntities(sConnString)) |
||
1569 | 498f0fc9 | ljiyeon | { |
1570 | uc.AddToSYMBOL_PUBLIC(symbol); |
||
1571 | uc.SaveChanges(); |
||
1572 | } |
||
1573 | } |
||
1574 | 0585d5cc | taeseongkim | catch (Exception ex) |
1575 | 498f0fc9 | ljiyeon | { |
1576 | 5c64268e | taeseongkim | System.Diagnostics.Trace.WriteLine("KCOM_API - AddPublicSymbol: " + ex.ToString()); |
1577 | 498f0fc9 | ljiyeon | return false; |
1578 | } |
||
1579 | return true; |
||
1580 | } |
||
1581 | [OperationContract] |
||
1582 | public bool DeleteSymbol(string symbol_id, int type) |
||
1583 | 2ab012e8 | djkim | { |
1584 | try |
||
1585 | { |
||
1586 | ff01c725 | humkyung | string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; |
1587 | using (KCOMEntities Entity = new KCOMEntities(sConnString)) |
||
1588 | 2ab012e8 | djkim | { |
1589 | 498f0fc9 | ljiyeon | if (type == 0) |
1590 | { |
||
1591 | string delItem_ID = symbol_id; |
||
1592 | var delitem = Entity.SYMBOL_PRIVATE.Where(data => data.ID == delItem_ID).FirstOrDefault(); |
||
1593 | Entity.SYMBOL_PRIVATE.DeleteObject(delitem); |
||
1594 | Entity.SaveChanges(); |
||
1595 | } |
||
1596 | else |
||
1597 | { |
||
1598 | string delItem_ID = symbol_id; |
||
1599 | var delitem = Entity.SYMBOL_PUBLIC.Where(data => data.ID == delItem_ID).FirstOrDefault(); |
||
1600 | Entity.SYMBOL_PUBLIC.DeleteObject(delitem); |
||
1601 | Entity.SaveChanges(); |
||
1602 | } |
||
1603 | 2ab012e8 | djkim | } |
1604 | } |
||
1605 | 0585d5cc | taeseongkim | catch (Exception ex) |
1606 | 2ab012e8 | djkim | { |
1607 | 5c64268e | taeseongkim | System.Diagnostics.Trace.WriteLine("KCOM_API - DeleteSymbol : " + ex.ToString()); |
1608 | 0585d5cc | taeseongkim | |
1609 | 2ab012e8 | djkim | return false; |
1610 | } |
||
1611 | return true; |
||
1612 | } |
||
1613 | |||
1614 | [OperationContract] |
||
1615 | 498f0fc9 | ljiyeon | public bool RenameSymbol(string symbol_id, string name, int type) |
1616 | 2ab012e8 | djkim | { |
1617 | try |
||
1618 | { |
||
1619 | ff01c725 | humkyung | string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; |
1620 | using (KCOMEntities Entity = new KCOMEntities(sConnString)) |
||
1621 | 2ab012e8 | djkim | { |
1622 | 498f0fc9 | ljiyeon | if (type == 0) |
1623 | { |
||
1624 | var UpdateItem = Entity.SYMBOL_PRIVATE.Where(info => info.ID == symbol_id).FirstOrDefault(); |
||
1625 | UpdateItem.NAME = name; |
||
1626 | Entity.SaveChanges(); |
||
1627 | } |
||
1628 | else |
||
1629 | { |
||
1630 | var UpdateItem = Entity.SYMBOL_PUBLIC.Where(info => info.ID == symbol_id).FirstOrDefault(); |
||
1631 | UpdateItem.NAME = name; |
||
1632 | Entity.SaveChanges(); |
||
1633 | } |
||
1634 | 2ab012e8 | djkim | } |
1635 | } |
||
1636 | 0585d5cc | taeseongkim | catch (Exception ex) |
1637 | 2ab012e8 | djkim | { |
1638 | 5c64268e | taeseongkim | System.Diagnostics.Trace.WriteLine("KCOM_API - RenameSymbol: " + ex.ToString()); |
1639 | 2ab012e8 | djkim | return false; |
1640 | } |
||
1641 | return true; |
||
1642 | } |
||
1643 | |||
1644 | [OperationContract] |
||
1645 | public bool AddCheckListHistory(string project_no, CHECK_LIST_HISTORY Check_History) |
||
1646 | { |
||
1647 | try |
||
1648 | ff01c725 | humkyung | { |
1649 | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
||
1650 | using (CIEntities Entity = new CIEntities(sCIConnString)) |
||
1651 | 2ab012e8 | djkim | { |
1652 | Entity.CHECK_LIST_HISTORY.AddObject(Check_History); |
||
1653 | Entity.SaveChanges(); |
||
1654 | } |
||
1655 | } |
||
1656 | 0585d5cc | taeseongkim | catch (Exception ex) |
1657 | 2ab012e8 | djkim | { |
1658 | 5c64268e | taeseongkim | System.Diagnostics.Trace.WriteLine("KCOM_API - AddCheckListHistory: " + ex.ToString()); |
1659 | 2ab012e8 | djkim | return false; |
1660 | } |
||
1661 | return true; |
||
1662 | } |
||
1663 | [OperationContract] |
||
1664 | public bool SaveCheckListHistory(string project_no, string rev, CHECK_LIST_HISTORY Check_History) |
||
1665 | { |
||
1666 | try |
||
1667 | { |
||
1668 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
1669 | using (CIEntities Entity = new CIEntities(sCIConnString)) |
||
1670 | 2ab012e8 | djkim | { |
1671 | var item = Entity.CHECK_LIST_HISTORY.Where(info => info.REVISION == rev).FirstOrDefault(); |
||
1672 | item = Check_History; |
||
1673 | Entity.SaveChanges(); |
||
1674 | } |
||
1675 | } |
||
1676 | 0585d5cc | taeseongkim | catch (Exception ex) |
1677 | 2ab012e8 | djkim | { |
1678 | 5c64268e | taeseongkim | System.Diagnostics.Trace.WriteLine("KCOM_API - SaveCheckListHistory: " + ex.ToString()); |
1679 | 2ab012e8 | djkim | return false; |
1680 | } |
||
1681 | return true; |
||
1682 | } |
||
1683 | [OperationContract] |
||
1684 | public bool SaveCheckList(string project_no, string _id, CHECK_LIST Check_value) |
||
1685 | { |
||
1686 | try |
||
1687 | { |
||
1688 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
1689 | using (CIEntities Entity = new CIEntities(sCIConnString)) |
||
1690 | 2ab012e8 | djkim | { |
1691 | var item = Entity.CHECK_LIST.Where(info => info.ID == _id).FirstOrDefault(); |
||
1692 | item.TODOLIST = Check_value.TODOLIST; |
||
1693 | item.REMARK = Check_value.REMARK; |
||
1694 | item.STATUS = Check_value.STATUS; |
||
1695 | item.VENDOR = Check_value.VENDOR; |
||
1696 | item.REPLY = Check_value.REPLY; |
||
1697 | item.IMAGE_URL = Check_value.IMAGE_URL; |
||
1698 | item.IMAGE_ANCHOR = Check_value.IMAGE_ANCHOR; |
||
1699 | item.UPDATE_TIME = Check_value.UPDATE_TIME; |
||
1700 | 5de0c110 | ljiyeon | if(Check_value.STATUS == "False") |
1701 | { |
||
1702 | item.STATUS_DESC_OPEN = Check_value.STATUS_DESC_OPEN; |
||
1703 | } |
||
1704 | else |
||
1705 | { |
||
1706 | item.STATUS_DESC_CLOSE = Check_value.STATUS_DESC_CLOSE; |
||
1707 | } |
||
1708 | 2ab012e8 | djkim | Entity.SaveChanges(); |
1709 | } |
||
1710 | } |
||
1711 | 5c64268e | taeseongkim | catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex); |
1712 | 2ab012e8 | djkim | return false; |
1713 | } |
||
1714 | return true; |
||
1715 | } |
||
1716 | [OperationContract] |
||
1717 | public bool AddCheckList(string project_no, CHECK_LIST Check_value) |
||
1718 | { |
||
1719 | try |
||
1720 | { |
||
1721 | 24c5e56c | taeseongkim | |
1722 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
1723 | using (CIEntities Entity = new CIEntities(sCIConnString)) |
||
1724 | 2ab012e8 | djkim | { |
1725 | Entity.CHECK_LIST.AddObject(Check_value); |
||
1726 | Entity.SaveChanges(); |
||
1727 | } |
||
1728 | } |
||
1729 | 5c64268e | taeseongkim | catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex); |
1730 | 2ab012e8 | djkim | return false; |
1731 | } |
||
1732 | return true; |
||
1733 | } |
||
1734 | |||
1735 | [OperationContract] |
||
1736 | public CHECK_LIST GetCheckList(string project_no, string _id) |
||
1737 | { |
||
1738 | CHECK_LIST Check_value = new CHECK_LIST(); |
||
1739 | try |
||
1740 | { |
||
1741 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
1742 | using (CIEntities Entity = new CIEntities(sCIConnString)) |
||
1743 | 2ab012e8 | djkim | { |
1744 | Check_value = Entity.CHECK_LIST.Where(info => info.ID == _id).FirstOrDefault(); |
||
1745 | } |
||
1746 | } |
||
1747 | 5c64268e | taeseongkim | catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex); |
1748 | 2ab012e8 | djkim | return null; |
1749 | } |
||
1750 | return Check_value; |
||
1751 | } |
||
1752 | [OperationContract] |
||
1753 | public List<CHECK_LIST> GetUserCheckList(string project_no, string user_id, string doc_no) |
||
1754 | { |
||
1755 | List<CHECK_LIST> list = new List<CHECK_LIST>(); |
||
1756 | try |
||
1757 | { |
||
1758 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
1759 | using (CIEntities Entity = new CIEntities(sCIConnString)) |
||
1760 | 2ab012e8 | djkim | { |
1761 | list = Entity.CHECK_LIST.Where(i => i.PROJECT_NO == project_no && i.DOCUMENT_NO == doc_no && i.USER_ID == user_id).OrderBy(p => p.CREATE_TIME).ToList(); |
||
1762 | } |
||
1763 | } |
||
1764 | 5c64268e | taeseongkim | catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex); |
1765 | 2ab012e8 | djkim | return null; |
1766 | } |
||
1767 | return list; |
||
1768 | } |
||
1769 | [OperationContract] |
||
1770 | public List<CHECK_LIST_HISTORY> GetCheckListHistory(string project_no, string _id) |
||
1771 | { |
||
1772 | List<CHECK_LIST_HISTORY> history = new List<CHECK_LIST_HISTORY>(); |
||
1773 | try |
||
1774 | { |
||
1775 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
1776 | using (CIEntities Entity = new CIEntities(sCIConnString)) |
||
1777 | 2ab012e8 | djkim | { |
1778 | history = Entity.CHECK_LIST_HISTORY.Where(data => data.CHECKLIST_ID == _id).ToList(); |
||
1779 | } |
||
1780 | } |
||
1781 | 5c64268e | taeseongkim | catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex); |
1782 | 2ab012e8 | djkim | return null; |
1783 | } |
||
1784 | return history; |
||
1785 | } |
||
1786 | [OperationContract] |
||
1787 | public CHECK_LIST_HISTORY GetCheckListHistoryFirstOrDefault(string project_no, string checklist_id, string rev) |
||
1788 | { |
||
1789 | CHECK_LIST_HISTORY Check_Item = new CHECK_LIST_HISTORY(); |
||
1790 | try |
||
1791 | { |
||
1792 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
1793 | using (CIEntities Entity = new CIEntities(sCIConnString)) |
||
1794 | 2ab012e8 | djkim | { |
1795 | Check_Item = Entity.CHECK_LIST_HISTORY.Where(info => info.CHECKLIST_ID == checklist_id && info.REVISION == rev).FirstOrDefault(); |
||
1796 | } |
||
1797 | } |
||
1798 | 5c64268e | taeseongkim | catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex); |
1799 | 2ab012e8 | djkim | return null; |
1800 | } |
||
1801 | return Check_Item; |
||
1802 | } |
||
1803 | [OperationContract] |
||
1804 | public bool SavePageAngle(string project_no, List<DOCPAGE> _mldocpage) |
||
1805 | { |
||
1806 | try |
||
1807 | { |
||
1808 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
1809 | using (CIEntities Entity = new CIEntities(sCIConnString)) |
||
1810 | 2ab012e8 | djkim | { |
1811 | KCOMDataModel.DataModel.DOCPAGE _docpage = new KCOMDataModel.DataModel.DOCPAGE(); |
||
1812 | _mldocpage.ForEach(data => |
||
1813 | { |
||
1814 | _docpage = (from info in Entity.DOCPAGE |
||
1815 | where info.ID == data.ID |
||
1816 | select info).FirstOrDefault(); |
||
1817 | |||
1818 | if (_docpage.PAGE_ANGLE != data.PAGE_ANGLE) |
||
1819 | { |
||
1820 | _docpage.PAGE_ANGLE = data.PAGE_ANGLE; |
||
1821 | } |
||
1822 | }); |
||
1823 | |||
1824 | Entity.SaveChanges(); |
||
1825 | } |
||
1826 | } |
||
1827 | 5c64268e | taeseongkim | catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex); |
1828 | 2ab012e8 | djkim | return false; |
1829 | } |
||
1830 | return true; |
||
1831 | } |
||
1832 | |||
1833 | [OperationContract] |
||
1834 | public MARKUP_INFO GetMarkupInfo(string project_no, string _id) |
||
1835 | { |
||
1836 | MARKUP_INFO markupInfo = new MARKUP_INFO(); |
||
1837 | |||
1838 | try |
||
1839 | { |
||
1840 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
1841 | using (CIEntities Entity = new CIEntities(sCIConnString)) |
||
1842 | 2ab012e8 | djkim | { |
1843 | markupInfo = Entity.MARKUP_INFO.Where(entity => entity.DOCINFO_ID == _id).OrderByDescending(i => i.CONSOLIDATE).OrderByDescending(j => j.CREATE_TIME).FirstOrDefault(); |
||
1844 | } |
||
1845 | } |
||
1846 | 5c64268e | taeseongkim | catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex); |
1847 | 2ab012e8 | djkim | return null; |
1848 | } |
||
1849 | return markupInfo; |
||
1850 | } |
||
1851 | |||
1852 | [OperationContract] |
||
1853 | public List<string> GetMarkupDataListperPage(string project_no, string _markupinfoid, int _pageNo) |
||
1854 | { |
||
1855 | List<string> markupdata = new List<string>(); |
||
1856 | MARKUP_INFO_VERSION markup_info_version = new MARKUP_INFO_VERSION(); |
||
1857 | try |
||
1858 | { |
||
1859 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
1860 | using (CIEntities Entity = new CIEntities(sCIConnString)) |
||
1861 | 2ab012e8 | djkim | { |
1862 | markup_info_version = (from version in Entity.MARKUP_INFO_VERSION |
||
1863 | where version.MARKUPINFO_ID == _markupinfoid |
||
1864 | orderby version.CREATE_DATE descending |
||
1865 | select version).First(); |
||
1866 | markupdata = (from data in Entity.MARKUP_DATA |
||
1867 | where data.MARKUPINFO_VERSION_ID == markup_info_version.ID && data.PAGENUMBER == _pageNo |
||
1868 | select data.DATA).ToList(); |
||
1869 | } |
||
1870 | } |
||
1871 | 5c64268e | taeseongkim | catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex); |
1872 | 2ab012e8 | djkim | return null; |
1873 | } |
||
1874 | return markupdata; |
||
1875 | } |
||
1876 | |||
1877 | [OperationContract] |
||
1878 | public bool AddMarkupInfo(string project_no, MARKUP_INFO value) |
||
1879 | { |
||
1880 | try |
||
1881 | { |
||
1882 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
1883 | using (CIEntities Entity = new CIEntities(sCIConnString)) |
||
1884 | 2ab012e8 | djkim | { |
1885 | Entity.MARKUP_INFO.AddObject(value); |
||
1886 | Entity.SaveChanges(); |
||
1887 | } |
||
1888 | } |
||
1889 | 5c64268e | taeseongkim | catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex); |
1890 | 2ab012e8 | djkim | return false; |
1891 | } |
||
1892 | return true; |
||
1893 | } |
||
1894 | |||
1895 | [OperationContract] |
||
1896 | public bool AddMarkupInfoVersion(string project_no, MARKUP_INFO_VERSION value) |
||
1897 | { |
||
1898 | try |
||
1899 | { |
||
1900 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
1901 | using (CIEntities Entity = new CIEntities(sCIConnString)) |
||
1902 | 2ab012e8 | djkim | { |
1903 | Entity.MARKUP_INFO_VERSION.AddObject(value); |
||
1904 | Entity.SaveChanges(); |
||
1905 | } |
||
1906 | } |
||
1907 | 5c64268e | taeseongkim | catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex); |
1908 | 2ab012e8 | djkim | return false; |
1909 | } |
||
1910 | return true; |
||
1911 | } |
||
1912 | |||
1913 | [OperationContract] |
||
1914 | public bool AddMarkupData(string project_no, MARKUP_DATA value) |
||
1915 | { |
||
1916 | try |
||
1917 | { |
||
1918 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
1919 | using (CIEntities Entity = new CIEntities(sCIConnString)) |
||
1920 | 2ab012e8 | djkim | { |
1921 | Entity.MARKUP_DATA.AddObject(value); |
||
1922 | Entity.SaveChanges(); |
||
1923 | } |
||
1924 | } |
||
1925 | 5c64268e | taeseongkim | catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex); |
1926 | 2ab012e8 | djkim | return false; |
1927 | } |
||
1928 | return true; |
||
1929 | } |
||
1930 | |||
1931 | [OperationContract] |
||
1932 | public bool AvoidMarkupInfo(string project_no, string _doc_id) |
||
1933 | { |
||
1934 | try |
||
1935 | { |
||
1936 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
1937 | using (CIEntities Entity = new CIEntities(sCIConnString)) |
||
1938 | 2ab012e8 | djkim | { |
1939 | var item = Entity.MARKUP_INFO.Where(entity => entity.DOCINFO_ID == _doc_id).OrderByDescending(i => i.CONSOLIDATE).OrderByDescending(j => j.CREATE_TIME).FirstOrDefault(); |
||
1940 | item.AVOID_CONSOLIDATE = 1; |
||
1941 | Entity.SaveChanges(); |
||
1942 | } |
||
1943 | } |
||
1944 | 5c64268e | taeseongkim | catch (Exception ex) { |
1945 | System.Diagnostics.Trace.WriteLine(ex); |
||
1946 | 2ab012e8 | djkim | return false; |
1947 | } |
||
1948 | return true; |
||
1949 | } |
||
1950 | |||
1951 | [OperationContract] |
||
1952 | public bool SaveMarkupInfo(string project_no, string _id, MARKUP_INFO value) |
||
1953 | { |
||
1954 | try |
||
1955 | { |
||
1956 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
1957 | using (CIEntities Entity = new CIEntities(sCIConnString)) |
||
1958 | 2ab012e8 | djkim | { |
1959 | var item = Entity.MARKUP_INFO.Where(info => info.ID == _id).FirstOrDefault(); |
||
1960 | item = value; |
||
1961 | Entity.SaveChanges(); |
||
1962 | } |
||
1963 | } |
||
1964 | 5c64268e | taeseongkim | catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex); |
1965 | 2ab012e8 | djkim | return false; |
1966 | } |
||
1967 | return true; |
||
1968 | } |
||
1969 | [OperationContract] |
||
1970 | public List<MARKUP_DATA> GetMarkupDataList(string project_no, string _versionid) |
||
1971 | { |
||
1972 | List<MARKUP_DATA> mlresult = new List<MARKUP_DATA>(); |
||
1973 | |||
1974 | try |
||
1975 | { |
||
1976 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
1977 | using (CIEntities Entity = new CIEntities(sCIConnString)) |
||
1978 | 2ab012e8 | djkim | { |
1979 | mlresult = Entity.MARKUP_DATA.Where(data => data.MARKUPINFO_VERSION_ID == _versionid).ToList(); |
||
1980 | } |
||
1981 | } |
||
1982 | 5c64268e | taeseongkim | catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex); |
1983 | 2ab012e8 | djkim | return null; |
1984 | } |
||
1985 | return mlresult; |
||
1986 | } |
||
1987 | |||
1988 | [OperationContract] |
||
1989 | public bool Consolidate(string project_no, string _user_id, string _doc_id, List<MarkupInfoItem> markupInfoItems) |
||
1990 | { |
||
1991 | try |
||
1992 | { |
||
1993 | List<KCOMDataModel.DataModel.MARKUP_DATA> instanceDataSet = new List<KCOMDataModel.DataModel.MARKUP_DATA>(); |
||
1994 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
1995 | using (CIEntities Entity = new CIEntities(sCIConnString)) |
||
1996 | 2ab012e8 | djkim | { |
1997 | 0c624340 | djkim | var markupInfo = Entity.MARKUP_INFO.Where(entity => entity.DOCINFO_ID == _doc_id && entity.CONSOLIDATE == 1).OrderByDescending(j => j.CREATE_TIME).FirstOrDefault(); |
1998 | if (markupInfo != null) |
||
1999 | 2ab012e8 | djkim | { |
2000 | markupInfo.AVOID_CONSOLIDATE = 1; |
||
2001 | } |
||
2002 | |||
2003 | foreach (MarkupInfoItem item in markupInfoItems) |
||
2004 | { |
||
2005 | Entity.MARKUP_DATA.Where(data => data.MARKUPINFO_VERSION_ID == item.MarkupVersionID).ToList().ForEach(d => |
||
2006 | { |
||
2007 | instanceDataSet.Add(d); |
||
2008 | }); |
||
2009 | } |
||
2010 | |||
2011 | KCOMDataModel.DataModel.MARKUP_INFO info = new KCOMDataModel.DataModel.MARKUP_INFO(); |
||
2012 | info.ID = shortGuid(); |
||
2013 | info.CONSOLIDATE = 1; |
||
2014 | info.CREATE_TIME = DateTime.Now; |
||
2015 | info.DOCINFO_ID = _doc_id; |
||
2016 | info.UPDATE_TIME = DateTime.Now; |
||
2017 | info.USER_ID = _user_id; |
||
2018 | info.AVOID_CONSOLIDATE = 0; |
||
2019 | |||
2020 | Entity.MARKUP_INFO.AddObject(info); |
||
2021 | 6a19b48d | taeseongkim | |
2022 | 2ab012e8 | djkim | |
2023 | KCOMDataModel.DataModel.MARKUP_INFO_VERSION info2 = new KCOMDataModel.DataModel.MARKUP_INFO_VERSION |
||
2024 | { |
||
2025 | ID = shortGuid(), |
||
2026 | CREATE_DATE = DateTime.Now, |
||
2027 | MARKUP_INFO = info, |
||
2028 | }; |
||
2029 | |||
2030 | foreach (var item in instanceDataSet) |
||
2031 | { |
||
2032 | Entity.MARKUP_DATA.AddObject(new KCOMDataModel.DataModel.MARKUP_DATA |
||
2033 | { |
||
2034 | ID = shortGuid(), |
||
2035 | DATA = item.DATA, |
||
2036 | DATA_TYPE = item.DATA_TYPE, |
||
2037 | PAGENUMBER = item.PAGENUMBER, |
||
2038 | c8e9b3e4 | ljiyeon | MARKUP_INFO_VERSION = info2, |
2039 | 53880c83 | ljiyeon | SYMBOL_ID = item.SYMBOL_ID, |
2040 | c0977e97 | djkim | //GROUP_ID = item.GROUP_ID |
2041 | 2ab012e8 | djkim | }); |
2042 | } |
||
2043 | |||
2044 | 6a19b48d | taeseongkim | Entity.SaveChanges(); |
2045 | 2ab012e8 | djkim | } |
2046 | } |
||
2047 | 5c64268e | taeseongkim | catch (Exception ex) { |
2048 | System.Diagnostics.Trace.WriteLine(ex); |
||
2049 | 2ab012e8 | djkim | return false; |
2050 | } |
||
2051 | return true; |
||
2052 | } |
||
2053 | |||
2054 | 49d444ef | ljiyeon | |
2055 | [OperationContract] |
||
2056 | public FinalPDFResult ConsolidateMergedPDF(string project_no, string _user_id, string _doc_id, List<MarkupInfoItem> markupInfoItems, string ProjectNo, string DocInfoID, string CreateUserID) |
||
2057 | { |
||
2058 | bool consolidate = false; |
||
2059 | try |
||
2060 | { |
||
2061 | List<KCOMDataModel.DataModel.MARKUP_DATA> instanceDataSet = new List<KCOMDataModel.DataModel.MARKUP_DATA>(); |
||
2062 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
2063 | using (CIEntities Entity = new CIEntities(sCIConnString)) |
||
2064 | 49d444ef | ljiyeon | { |
2065 | var markupInfo = Entity.MARKUP_INFO.Where(entity => entity.DOCINFO_ID == _doc_id).OrderByDescending(i => i.CONSOLIDATE).OrderByDescending(j => j.CREATE_TIME).FirstOrDefault(); |
||
2066 | if (markupInfo.CONSOLIDATE == 1) |
||
2067 | { |
||
2068 | markupInfo.AVOID_CONSOLIDATE = 1; |
||
2069 | } |
||
2070 | |||
2071 | foreach (MarkupInfoItem item in markupInfoItems) |
||
2072 | { |
||
2073 | Entity.MARKUP_DATA.Where(data => data.MARKUPINFO_VERSION_ID == item.MarkupVersionID).ToList().ForEach(d => |
||
2074 | { |
||
2075 | instanceDataSet.Add(d); |
||
2076 | }); |
||
2077 | } |
||
2078 | |||
2079 | KCOMDataModel.DataModel.MARKUP_INFO info = new KCOMDataModel.DataModel.MARKUP_INFO(); |
||
2080 | info.ID = shortGuid(); |
||
2081 | info.CONSOLIDATE = 1; |
||
2082 | info.CREATE_TIME = DateTime.Now; |
||
2083 | info.DOCINFO_ID = _doc_id; |
||
2084 | info.UPDATE_TIME = DateTime.Now; |
||
2085 | info.USER_ID = _user_id; |
||
2086 | info.AVOID_CONSOLIDATE = 0; |
||
2087 | |||
2088 | Entity.MARKUP_INFO.AddObject(info); |
||
2089 | Entity.SaveChanges(); |
||
2090 | |||
2091 | |||
2092 | KCOMDataModel.DataModel.MARKUP_INFO_VERSION info2 = new KCOMDataModel.DataModel.MARKUP_INFO_VERSION |
||
2093 | { |
||
2094 | ID = shortGuid(), |
||
2095 | CREATE_DATE = DateTime.Now, |
||
2096 | MARKUP_INFO = info, |
||
2097 | }; |
||
2098 | Entity.SaveChanges(); |
||
2099 | |||
2100 | foreach (var item in instanceDataSet) |
||
2101 | { |
||
2102 | Entity.MARKUP_DATA.AddObject(new KCOMDataModel.DataModel.MARKUP_DATA |
||
2103 | { |
||
2104 | ID = shortGuid(), |
||
2105 | DATA = item.DATA, |
||
2106 | DATA_TYPE = item.DATA_TYPE, |
||
2107 | PAGENUMBER = item.PAGENUMBER, |
||
2108 | MARKUP_INFO_VERSION = info2, |
||
2109 | 53880c83 | ljiyeon | SYMBOL_ID = item.SYMBOL_ID, |
2110 | c0977e97 | djkim | //GROUP_ID = item.GROUP_ID |
2111 | 49d444ef | ljiyeon | }); |
2112 | } |
||
2113 | Entity.SaveChanges(); |
||
2114 | |||
2115 | |||
2116 | } |
||
2117 | consolidate = true; |
||
2118 | } |
||
2119 | 24c5e56c | taeseongkim | catch (Exception ex) |
2120 | 49d444ef | ljiyeon | { |
2121 | 5c64268e | taeseongkim | System.Diagnostics.Trace.WriteLine(ex); |
2122 | 49d444ef | ljiyeon | consolidate = false; |
2123 | } |
||
2124 | 24c5e56c | taeseongkim | |
2125 | 49d444ef | ljiyeon | FinalPDFResult _result = new FinalPDFResult(); |
2126 | if (consolidate == true) |
||
2127 | { |
||
2128 | RemFinalPDFObject remObj = null; |
||
2129 | try |
||
2130 | { |
||
2131 | string _finalID = shortGuid(); |
||
2132 | int _DocTotalPages = -1; |
||
2133 | string docItemId; |
||
2134 | |||
2135 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
2136 | using (CIEntities _ci = new CIEntities(sCIConnString)) |
||
2137 | 49d444ef | ljiyeon | { |
2138 | var _doc = _ci.DOCINFO.Where(info => info.ID == DocInfoID); |
||
2139 | |||
2140 | if (_doc.Count() > 0) |
||
2141 | { |
||
2142 | _DocTotalPages = _doc.First().PAGE_COUNT; |
||
2143 | docItemId = _doc.First().DOCUMENT_ID; |
||
2144 | } |
||
2145 | else |
||
2146 | { |
||
2147 | _result.Status = FinalStatus.Error; |
||
2148 | _result.Exception = "페이지 정보를 가져올 수 없습니다."; |
||
2149 | return _result; |
||
2150 | } |
||
2151 | } |
||
2152 | |||
2153 | var Items = GetMarkupInfoItems(ProjectNo, DocInfoID); |
||
2154 | if (_DocTotalPages > 0) |
||
2155 | { |
||
2156 | var item2 = Items.Cast<MarkupInfoItem>().Where(d => d.Consolidate == 1 && d.AvoidConsolidate == 0).FirstOrDefault(); |
||
2157 | FINAL_PDF fm = new FINAL_PDF() |
||
2158 | { |
||
2159 | ID = _finalID, |
||
2160 | PROJECT_NO = ProjectNo, |
||
2161 | DOCINFO_ID = DocInfoID, |
||
2162 | DOCUMENT_ID = docItemId, |
||
2163 | MARKUPINFO_ID = item2.MarkupInfoID, |
||
2164 | CREATE_USER_ID = CreateUserID, |
||
2165 | TOTAL_PAGE = _DocTotalPages, |
||
2166 | CREATE_DATETIME = DateTime.Now, |
||
2167 | STATUS = (int)IFinalPDF.FinalStatus.Insert |
||
2168 | }; |
||
2169 | ff01c725 | humkyung | |
2170 | string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; |
||
2171 | using (KCOMEntities _entity = new KCOMEntities(sConnString)) |
||
2172 | 49d444ef | ljiyeon | { |
2173 | _entity.AddToFINAL_PDF(fm); |
||
2174 | _entity.SaveChanges(System.Data.Objects.SaveOptions.AcceptAllChangesAfterSave); |
||
2175 | }; |
||
2176 | |||
2177 | System.Runtime.Remoting.Channels.IChannel _ch = System.Runtime.Remoting.Channels.ChannelServices.GetChannel("tcp"); |
||
2178 | if (_ch == null) |
||
2179 | { |
||
2180 | chan = new TcpChannel(); |
||
2181 | _ChanID = chan.ChannelName; |
||
2182 | System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(chan, false); |
||
2183 | // Create an instance of the remote object |
||
2184 | |||
2185 | ff01c725 | humkyung | using (KCOMEntities ec = new KCOMEntities(sConnString)) |
2186 | 49d444ef | ljiyeon | { |
2187 | |||
2188 | //remObj = (RemFinalPDFObject)Activator.GetObject(typeof(RemFinalPDFObject), |
||
2189 | // "tcp://localhost:9092/remFinalPDF"); |
||
2190 | remObj = (RemFinalPDFObject)Activator.GetObject(typeof(RemFinalPDFObject), |
||
2191 | //"tcp://192.168.0.67:9092/remFinalPDF"); |
||
2192 | "tcp://192.168.0.67:9092/remFinalPDF"); |
||
2193 | } |
||
2194 | |||
2195 | //"tcp://localhost:8080/remFinalPDF"); |
||
2196 | |||
2197 | _result = remObj.SetFinalPDF(ProjectNo, _finalID); |
||
2198 | _result.FinalID = _finalID; |
||
2199 | _result.Status = FinalStatus.Success; |
||
2200 | |||
2201 | //MarkupToPDF.MarkupToPDF fa = new MarkupToPDF.MarkupToPDF(); |
||
2202 | //fa.MakeFinalPDF(fm); |
||
2203 | } |
||
2204 | else |
||
2205 | { |
||
2206 | _ChanID = _ch.ChannelName; |
||
2207 | } |
||
2208 | } |
||
2209 | } |
||
2210 | catch (Exception ex) |
||
2211 | { |
||
2212 | _result.Status = FinalStatus.Error; |
||
2213 | |||
2214 | if (ex.GetType() == typeof(System.Net.Sockets.SocketException)) |
||
2215 | _result.Exception = "Final Server Not Connection"; |
||
2216 | } |
||
2217 | finally |
||
2218 | { |
||
2219 | remObj = null; |
||
2220 | if (System.Runtime.Remoting.Channels.ChannelServices.GetChannel("tcp") != null) |
||
2221 | System.Runtime.Remoting.Channels.ChannelServices.UnregisterChannel(chan); |
||
2222 | |||
2223 | GC.Collect(2); |
||
2224 | } |
||
2225 | } |
||
2226 | return _result; |
||
2227 | } |
||
2228 | 2ab012e8 | djkim | [OperationContract] |
2229 | 04a7385a | djkim | public bool TeamConsolidate(string project_no, string _user_id, string _doc_id, List<MarkupInfoItem> markupInfoItems) |
2230 | { |
||
2231 | try |
||
2232 | { |
||
2233 | List<KCOMDataModel.DataModel.MARKUP_DATA> instanceDataSet = new List<KCOMDataModel.DataModel.MARKUP_DATA>(); |
||
2234 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
2235 | using (CIEntities Entity = new CIEntities(sCIConnString)) |
||
2236 | 04a7385a | djkim | { |
2237 | 285635d3 | taeseongkim | var members = GetMemberQuery(Entity, _user_id); |
2238 | |||
2239 | string user_dept = ""; |
||
2240 | |||
2241 | if(members.Count() > 0) |
||
2242 | { |
||
2243 | user_dept = members.First().DEPARTMENT; |
||
2244 | } |
||
2245 | |||
2246 | var markupInfos = Entity.MARKUP_INFO.Where(entity => entity.DOCINFO_ID == _doc_id && entity.PART_CONSOLIDATE == 1) |
||
2247 | .OrderByDescending(j => j.CREATE_TIME).ToList(); |
||
2248 | |||
2249 | 0c624340 | djkim | foreach (var markupinfo in markupInfos) |
2250 | 04a7385a | djkim | { |
2251 | 285635d3 | taeseongkim | string markupdept = ""; |
2252 | |||
2253 | var markupMembers = GetMemberQuery(Entity, markupinfo.USER_ID); |
||
2254 | |||
2255 | if (markupMembers.Count() > 0) |
||
2256 | { |
||
2257 | markupdept = markupMembers.First().DEPARTMENT; |
||
2258 | } |
||
2259 | |||
2260 | 0c624340 | djkim | if (user_dept == markupdept) |
2261 | { |
||
2262 | markupinfo.AVOID_CONSOLIDATE = 1; |
||
2263 | } |
||
2264 | 04a7385a | djkim | } |
2265 | |||
2266 | foreach (MarkupInfoItem item in markupInfoItems) |
||
2267 | { |
||
2268 | Entity.MARKUP_DATA.Where(data => data.MARKUPINFO_VERSION_ID == item.MarkupVersionID).ToList().ForEach(d => |
||
2269 | { |
||
2270 | instanceDataSet.Add(d); |
||
2271 | }); |
||
2272 | } |
||
2273 | |||
2274 | KCOMDataModel.DataModel.MARKUP_INFO info = new KCOMDataModel.DataModel.MARKUP_INFO(); |
||
2275 | info.ID = shortGuid(); |
||
2276 | info.PART_CONSOLIDATE = 1; |
||
2277 | info.CREATE_TIME = DateTime.Now; |
||
2278 | info.DOCINFO_ID = _doc_id; |
||
2279 | info.UPDATE_TIME = DateTime.Now; |
||
2280 | info.USER_ID = _user_id; |
||
2281 | info.AVOID_CONSOLIDATE = 0; |
||
2282 | |||
2283 | Entity.MARKUP_INFO.AddObject(info); |
||
2284 | Entity.SaveChanges(); |
||
2285 | |||
2286 | |||
2287 | KCOMDataModel.DataModel.MARKUP_INFO_VERSION info2 = new KCOMDataModel.DataModel.MARKUP_INFO_VERSION |
||
2288 | { |
||
2289 | ID = shortGuid(), |
||
2290 | CREATE_DATE = DateTime.Now, |
||
2291 | MARKUP_INFO = info, |
||
2292 | }; |
||
2293 | Entity.SaveChanges(); |
||
2294 | |||
2295 | foreach (var item in instanceDataSet) |
||
2296 | { |
||
2297 | Entity.MARKUP_DATA.AddObject(new KCOMDataModel.DataModel.MARKUP_DATA |
||
2298 | { |
||
2299 | ID = shortGuid(), |
||
2300 | DATA = item.DATA, |
||
2301 | DATA_TYPE = item.DATA_TYPE, |
||
2302 | PAGENUMBER = item.PAGENUMBER, |
||
2303 | c8e9b3e4 | ljiyeon | MARKUP_INFO_VERSION = info2, |
2304 | 53880c83 | ljiyeon | SYMBOL_ID = item.SYMBOL_ID, |
2305 | c0977e97 | djkim | //GROUP_ID = item.GROUP_ID |
2306 | 04a7385a | djkim | }); |
2307 | } |
||
2308 | Entity.SaveChanges(); |
||
2309 | |||
2310 | |||
2311 | } |
||
2312 | } |
||
2313 | 5c64268e | taeseongkim | catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex); |
2314 | 04a7385a | djkim | return false; |
2315 | } |
||
2316 | return true; |
||
2317 | } |
||
2318 | |||
2319 | [OperationContract] |
||
2320 | 2ab012e8 | djkim | [ServiceKnownType(typeof(MEMBER))] |
2321 | public MEMBER GetMember(string project_no, string user_id) |
||
2322 | { |
||
2323 | 503cb09e | taeseongkim | MEMBER rstmember = null; |
2324 | 2ab012e8 | djkim | try |
2325 | { |
||
2326 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
2327 | using (CIEntities Entity = new CIEntities(sCIConnString)) |
||
2328 | 2ab012e8 | djkim | { |
2329 | 285635d3 | taeseongkim | var members = GetMemberQuery(Entity, user_id); |
2330 | 503cb09e | taeseongkim | |
2331 | 285635d3 | taeseongkim | if(members.Count() > 0) |
2332 | { |
||
2333 | rstmember = members.First(); |
||
2334 | } |
||
2335 | } |
||
2336 | } |
||
2337 | catch (Exception ex) |
||
2338 | { |
||
2339 | return null; |
||
2340 | } |
||
2341 | return rstmember; |
||
2342 | } |
||
2343 | 503cb09e | taeseongkim | |
2344 | 285635d3 | taeseongkim | private List<MEMBER> GetMemberQuery(System.Data.Objects.ObjectContext context, string UserID) |
2345 | { |
||
2346 | List<MEMBER> result = new List<MEMBER>(); |
||
2347 | 503cb09e | taeseongkim | |
2348 | 285635d3 | taeseongkim | try |
2349 | { |
||
2350 | string query = "SELECT members.ID,members.NAME,members.DEPARTMENT FROM CIEntities.MEMBER as members where members.ID = @userId"; |
||
2351 | |||
2352 | var param = new[] { new System.Data.Objects.ObjectParameter("userId", UserID) }; |
||
2353 | |||
2354 | System.Data.Objects.ObjectQuery<System.Data.Common.DbDataRecord> memberQuery |
||
2355 | = context.CreateQuery<System.Data.Common.DbDataRecord>(query, param); |
||
2356 | |||
2357 | if (memberQuery.Count() > 0) |
||
2358 | { |
||
2359 | foreach (var dataRecord in memberQuery) |
||
2360 | 503cb09e | taeseongkim | { |
2361 | 285635d3 | taeseongkim | MEMBER member = new MEMBER(); |
2362 | |||
2363 | string userName = dataRecord["NAME"]?.ToString().Trim(); |
||
2364 | string ID = dataRecord["ID"]?.ToString().Trim(); |
||
2365 | string depatment = dataRecord["DEPARTMENT"]?.ToString().Trim(); |
||
2366 | a7372e37 | taeseongkim | |
2367 | 285635d3 | taeseongkim | member.NAME = userName; |
2368 | member.ID = ID; |
||
2369 | member.DEPARTMENT = depatment; |
||
2370 | 503cb09e | taeseongkim | |
2371 | 285635d3 | taeseongkim | result.Add(member); |
2372 | 503cb09e | taeseongkim | } |
2373 | 2ab012e8 | djkim | } |
2374 | } |
||
2375 | ff01c725 | humkyung | catch (Exception ex) |
2376 | 2ab012e8 | djkim | { |
2377 | 285635d3 | taeseongkim | throw new Exception("GetMember(System.Data.Objects.ObjectContext context, string UserID) " , ex); |
2378 | 2ab012e8 | djkim | } |
2379 | 285635d3 | taeseongkim | |
2380 | return result; |
||
2381 | 2ab012e8 | djkim | } |
2382 | |||
2383 | ff01c725 | humkyung | [WebMethod] |
2384 | 2ab012e8 | djkim | [OperationContract] |
2385 | public List<SYMBOL_PRIVATE> GetSymbolList(string user_id) |
||
2386 | { |
||
2387 | List<SYMBOL_PRIVATE> Custom_List = new List<SYMBOL_PRIVATE>(); |
||
2388 | try |
||
2389 | { |
||
2390 | ff01c725 | humkyung | string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; |
2391 | using (KCOMEntities Entity = new KCOMEntities(sConnString)) |
||
2392 | 2ab012e8 | djkim | { |
2393 | Custom_List = Entity.SYMBOL_PRIVATE.Where(data => data.MEMBER_USER_ID == user_id).ToList(); |
||
2394 | } |
||
2395 | } |
||
2396 | ff01c725 | humkyung | catch (Exception ex) |
2397 | 2ab012e8 | djkim | { |
2398 | return null; |
||
2399 | } |
||
2400 | return Custom_List; |
||
2401 | } |
||
2402 | [OperationContract] |
||
2403 | public List<string> GetPublicSymbolDeptList() |
||
2404 | { |
||
2405 | List<string> Custom_List = new List<string>(); |
||
2406 | try |
||
2407 | { |
||
2408 | ff01c725 | humkyung | string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; |
2409 | using (KCOMEntities Entity = new KCOMEntities(sConnString)) |
||
2410 | 2ab012e8 | djkim | { |
2411 | b3251eea | ljiyeon | Custom_List = Entity.SYMBOL_PUBLIC.Select(data => data.DEPARTMENT).Distinct().ToList(); |
2412 | 2ab012e8 | djkim | } |
2413 | } |
||
2414 | 5c64268e | taeseongkim | catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex); |
2415 | 2ab012e8 | djkim | return null; |
2416 | } |
||
2417 | return Custom_List; |
||
2418 | } |
||
2419 | [OperationContract] |
||
2420 | public List<SYMBOL_PUBLIC> GetPublicSymbolList(string dept) |
||
2421 | { |
||
2422 | List<SYMBOL_PUBLIC> Custom_List = new List<SYMBOL_PUBLIC>(); |
||
2423 | try |
||
2424 | { |
||
2425 | ff01c725 | humkyung | string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; |
2426 | using (KCOMEntities Entity = new KCOMEntities(sConnString)) |
||
2427 | 2ab012e8 | djkim | { |
2428 | if(!string.IsNullOrEmpty(dept)) |
||
2429 | { |
||
2430 | Custom_List = Entity.SYMBOL_PUBLIC.Where(data => data.DEPARTMENT == dept).ToList(); |
||
2431 | } |
||
2432 | else |
||
2433 | { |
||
2434 | Custom_List = Entity.SYMBOL_PUBLIC.ToList(); |
||
2435 | } |
||
2436 | |||
2437 | } |
||
2438 | } |
||
2439 | 5c64268e | taeseongkim | catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex); |
2440 | 2ab012e8 | djkim | return null; |
2441 | } |
||
2442 | return Custom_List; |
||
2443 | } |
||
2444 | |||
2445 | /// <summary> |
||
2446 | /// |
||
2447 | /// </summary> |
||
2448 | /// <param name="id">symbol id</param> |
||
2449 | /// <param name="type"> 0 : PRIVATE, 1 : PUBLIC</param> |
||
2450 | /// <returns></returns> |
||
2451 | [OperationContract] |
||
2452 | public string GetSymbolData(string id, int type) |
||
2453 | { |
||
2454 | string result; |
||
2455 | try |
||
2456 | { |
||
2457 | ff01c725 | humkyung | string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; |
2458 | using (KCOMEntities Entity = new KCOMEntities(sConnString)) |
||
2459 | 2ab012e8 | djkim | { |
2460 | if(type == 0) |
||
2461 | { |
||
2462 | result = Entity.SYMBOL_PRIVATE.Where(data => data.ID == id).FirstOrDefault().DATA; |
||
2463 | } |
||
2464 | else |
||
2465 | { |
||
2466 | result = Entity.SYMBOL_PUBLIC.Where(data => data.ID == id).FirstOrDefault().DATA; |
||
2467 | } |
||
2468 | } |
||
2469 | } |
||
2470 | 5c64268e | taeseongkim | catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex); |
2471 | 2ab012e8 | djkim | return null; |
2472 | } |
||
2473 | return result; |
||
2474 | } |
||
2475 | 53880c83 | ljiyeon | [OperationContract] |
2476 | public string GetSymbolImageURL(string id, int type) |
||
2477 | { |
||
2478 | string result; |
||
2479 | try |
||
2480 | { |
||
2481 | ff01c725 | humkyung | string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; |
2482 | using (KCOMEntities Entity = new KCOMEntities(sConnString)) |
||
2483 | 53880c83 | ljiyeon | { |
2484 | if (type == 0) |
||
2485 | { |
||
2486 | result = Entity.SYMBOL_PRIVATE.Where(data => data.ID == id).FirstOrDefault().IMAGE_URL; |
||
2487 | } |
||
2488 | else |
||
2489 | { |
||
2490 | result = Entity.SYMBOL_PUBLIC.Where(data => data.ID == id).FirstOrDefault().IMAGE_URL; |
||
2491 | } |
||
2492 | } |
||
2493 | } |
||
2494 | 5c64268e | taeseongkim | catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex); |
2495 | 53880c83 | ljiyeon | return null; |
2496 | } |
||
2497 | return result; |
||
2498 | } |
||
2499 | cf1cc862 | taeseongkim | |
2500 | 2ab012e8 | djkim | [OperationContract] |
2501 | public string GetSignData(string project_no, string user_id) |
||
2502 | { |
||
2503 | string result = null; |
||
2504 | try |
||
2505 | { |
||
2506 | dfb95d0f | djkim | string ifsign = getEnsembleSign(user_id); |
2507 | if (string.IsNullOrEmpty(ifsign)) |
||
2508 | 2ab012e8 | djkim | { |
2509 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
2510 | var ModelWFConnectionString = sCIConnString; |
||
2511 | dfb95d0f | djkim | if (null != ModelWFConnectionString) |
2512 | 2ab012e8 | djkim | { |
2513 | dfb95d0f | djkim | using (CIEntities entity = new CIEntities(ModelWFConnectionString)) |
2514 | 2ab012e8 | djkim | { |
2515 | dfb95d0f | djkim | var _sign = entity.SIGN_INFO.Where(sin => sin.MEMBER_USER_ID == user_id); |
2516 | if (_sign.Count() > 0) |
||
2517 | { |
||
2518 | result = _sign.First().SIGN_STR; |
||
2519 | } |
||
2520 | else |
||
2521 | { |
||
2522 | return null; |
||
2523 | } |
||
2524 | 2ab012e8 | djkim | } |
2525 | } |
||
2526 | } |
||
2527 | dfb95d0f | djkim | else |
2528 | { |
||
2529 | result = ifsign; |
||
2530 | } |
||
2531 | |||
2532 | 2ab012e8 | djkim | } |
2533 | 5c64268e | taeseongkim | catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex); |
2534 | 2ab012e8 | djkim | return null; |
2535 | } |
||
2536 | return result; |
||
2537 | } |
||
2538 | |||
2539 | cf1cc862 | taeseongkim | [OperationContract] |
2540 | 74abcf6f | taeseongkim | public string GetSignStrokes(string project_no, string user_id) |
2541 | { |
||
2542 | string result = null; |
||
2543 | try |
||
2544 | { |
||
2545 | string ifsign = getEnsembleSign(user_id); |
||
2546 | if (string.IsNullOrEmpty(ifsign)) |
||
2547 | { |
||
2548 | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
||
2549 | var ModelWFConnectionString = sCIConnString; |
||
2550 | if (null != ModelWFConnectionString) |
||
2551 | { |
||
2552 | using (CIEntities entity = new CIEntities(ModelWFConnectionString)) |
||
2553 | { |
||
2554 | var _sign = entity.SIGN_INFO.Where(sin => sin.MEMBER_USER_ID == user_id); |
||
2555 | if (_sign.Count() > 0) |
||
2556 | { |
||
2557 | result = _sign.First().SIGN_STROKES; |
||
2558 | } |
||
2559 | else |
||
2560 | { |
||
2561 | return null; |
||
2562 | } |
||
2563 | } |
||
2564 | } |
||
2565 | } |
||
2566 | else |
||
2567 | { |
||
2568 | result = ifsign; |
||
2569 | } |
||
2570 | |||
2571 | } |
||
2572 | catch (Exception ex) |
||
2573 | { |
||
2574 | 5c64268e | taeseongkim | System.Diagnostics.Trace.WriteLine(ex); |
2575 | 74abcf6f | taeseongkim | return null; |
2576 | } |
||
2577 | return result; |
||
2578 | } |
||
2579 | |||
2580 | [OperationContract] |
||
2581 | public int SetSignData(string user_id,string SignStr,int CropX,int CropY,int CropWidth,int CropHeight) |
||
2582 | cf1cc862 | taeseongkim | { |
2583 | int result = -1; |
||
2584 | |||
2585 | try |
||
2586 | { |
||
2587 | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
||
2588 | |||
2589 | using (CIEntities entity = new CIEntities(sCIConnString)) |
||
2590 | { |
||
2591 | var _sign = entity.SIGN_INFO.Where(sin => sin.MEMBER_USER_ID == user_id); |
||
2592 | |||
2593 | 74abcf6f | taeseongkim | var cropImg = Convert.ToBase64String(SignatureCrop(SignStr, CropX, CropY, CropWidth, CropHeight)); |
2594 | |||
2595 | cf1cc862 | taeseongkim | if (_sign.Count() > 0) |
2596 | { |
||
2597 | 74abcf6f | taeseongkim | _sign.First().SIGN_STR = cropImg; |
2598 | cf1cc862 | taeseongkim | _sign.First().MODIFY_DATE = DateTime.Now; |
2599 | } |
||
2600 | else |
||
2601 | { |
||
2602 | entity.SIGN_INFO.AddObject(new SIGN_INFO |
||
2603 | { |
||
2604 | ID = shortGuid(), |
||
2605 | MEMBER_USER_ID = user_id, |
||
2606 | CREATE_DATE = DateTime.Now, |
||
2607 | 74abcf6f | taeseongkim | SIGN_STR = cropImg |
2608 | cf1cc862 | taeseongkim | }); |
2609 | } |
||
2610 | |||
2611 | result = entity.SaveChanges(); |
||
2612 | } |
||
2613 | } |
||
2614 | catch (Exception ex) |
||
2615 | { |
||
2616 | 5c64268e | taeseongkim | System.Diagnostics.Trace.WriteLine(ex); |
2617 | cf1cc862 | taeseongkim | } |
2618 | return result; |
||
2619 | } |
||
2620 | |||
2621 | 74abcf6f | taeseongkim | |
2622 | [OperationContract] |
||
2623 | public int SetSignStrokes(string user_id, string strokesData) |
||
2624 | { |
||
2625 | int result = -1; |
||
2626 | |||
2627 | try |
||
2628 | { |
||
2629 | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
||
2630 | |||
2631 | using (CIEntities entity = new CIEntities(sCIConnString)) |
||
2632 | { |
||
2633 | var _sign = entity.SIGN_INFO.Where(sin => sin.MEMBER_USER_ID == user_id); |
||
2634 | |||
2635 | if (_sign.Count() > 0) |
||
2636 | { |
||
2637 | _sign.First().SIGN_STROKES = strokesData; |
||
2638 | _sign.First().MODIFY_DATE = DateTime.Now; |
||
2639 | } |
||
2640 | else |
||
2641 | { |
||
2642 | entity.SIGN_INFO.AddObject(new SIGN_INFO |
||
2643 | { |
||
2644 | ID = shortGuid(), |
||
2645 | MEMBER_USER_ID = user_id, |
||
2646 | CREATE_DATE = DateTime.Now, |
||
2647 | SIGN_STROKES = strokesData |
||
2648 | }); |
||
2649 | } |
||
2650 | |||
2651 | result = entity.SaveChanges(); |
||
2652 | } |
||
2653 | } |
||
2654 | catch (Exception ex) |
||
2655 | { |
||
2656 | 5c64268e | taeseongkim | System.Diagnostics.Trace.WriteLine(ex); |
2657 | 74abcf6f | taeseongkim | } |
2658 | return result; |
||
2659 | } |
||
2660 | |||
2661 | private byte[] SignatureCrop(string imgStr,int X,int Y,int Width,int Height) |
||
2662 | { |
||
2663 | using (System.IO.MemoryStream readStream = new System.IO.MemoryStream(Convert.FromBase64String(imgStr))) |
||
2664 | { |
||
2665 | using (System.Drawing.Image OriginalImage = System.Drawing.Image.FromStream(readStream)) |
||
2666 | { |
||
2667 | using (System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(Width, Height)) |
||
2668 | { |
||
2669 | bmp.SetResolution(OriginalImage.HorizontalResolution, OriginalImage.VerticalResolution); |
||
2670 | using (System.Drawing.Graphics Graphic = System.Drawing.Graphics.FromImage(bmp)) |
||
2671 | { |
||
2672 | Graphic.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; |
||
2673 | Graphic.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic; |
||
2674 | Graphic.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality; |
||
2675 | Graphic.DrawImage(OriginalImage, new System.Drawing.Rectangle(0, 0, Width, Height), X, Y, Width, Height, System.Drawing.GraphicsUnit.Pixel); |
||
2676 | System.IO.MemoryStream ms = new System.IO.MemoryStream(); |
||
2677 | bmp.Save(ms, OriginalImage.RawFormat); |
||
2678 | return ms.GetBuffer(); |
||
2679 | } |
||
2680 | } |
||
2681 | } |
||
2682 | } |
||
2683 | } |
||
2684 | |||
2685 | 2ab012e8 | djkim | [OperationContract] |
2686 | public string GetProjectName(string project_no) |
||
2687 | { |
||
2688 | string result = null; |
||
2689 | |||
2690 | try |
||
2691 | { |
||
2692 | ff01c725 | humkyung | string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; |
2693 | using (KCOMDataModel.DataModel.KCOMEntities Entity = new KCOMDataModel.DataModel.KCOMEntities(sConnString)) |
||
2694 | 2ab012e8 | djkim | { |
2695 | result = Entity.RUN_PROJECTS.Where(i => i.PROJECT_NO == project_no).FirstOrDefault().PROJECT_NAME.ToString(); |
||
2696 | } |
||
2697 | } |
||
2698 | 5c64268e | taeseongkim | catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex); |
2699 | 2ab012e8 | djkim | return null; |
2700 | } |
||
2701 | return result; |
||
2702 | } |
||
2703 | |||
2704 | [OperationContract] |
||
2705 | public List<DOCUMENT_ITEM> GetPreRevSelect(string project_no, string doc_no, string current_rev) |
||
2706 | { |
||
2707 | List<DOCUMENT_ITEM> result = new List<DOCUMENT_ITEM>(); |
||
2708 | |||
2709 | try |
||
2710 | { |
||
2711 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
2712 | using (CIEntities Entity = new CIEntities(sCIConnString)) |
||
2713 | 2ab012e8 | djkim | { |
2714 | result = Entity.DOCUMENT_ITEM.Where(i => i.PROJECT_NO == project_no |
||
2715 | && i.DOCUMENT_NO == doc_no |
||
2716 | && i.REVISION != current_rev).OrderByDescending(i => i.GROUP_NO).ToList(); |
||
2717 | } |
||
2718 | } |
||
2719 | 5c64268e | taeseongkim | catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex); |
2720 | 2ab012e8 | djkim | return null; |
2721 | } |
||
2722 | return result; |
||
2723 | } |
||
2724 | |||
2725 | [OperationContract] |
||
2726 | public DOCINFO GetDocInfoOneSelect(string project_no, string doc_id) |
||
2727 | { |
||
2728 | DOCINFO docinfo = null; |
||
2729 | |||
2730 | try |
||
2731 | { |
||
2732 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
2733 | using (CIEntities Entity = new CIEntities(sCIConnString)) |
||
2734 | 2ab012e8 | djkim | { |
2735 | docinfo = (from info in Entity.DOCINFO |
||
2736 | where info.DOCUMENT_ID == doc_id |
||
2737 | && info.PROJECT_NO == project_no |
||
2738 | select info).First(); |
||
2739 | } |
||
2740 | } |
||
2741 | 5c64268e | taeseongkim | catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex); |
2742 | 2ab012e8 | djkim | return null; |
2743 | } |
||
2744 | return docinfo; |
||
2745 | } |
||
2746 | |||
2747 | [OperationContract] |
||
2748 | public List<MarkupInfoItem> GetPrintDocItemList(string project_no, string doc_id, List<MarkupInfoItem> _markupInfoList) |
||
2749 | { |
||
2750 | MarkupInfoItem _result = null; |
||
2751 | List<MarkupInfoItem> markupinfo = new List<MarkupInfoItem>(); |
||
2752 | try |
||
2753 | { |
||
2754 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
2755 | using (CIEntities Entity = new CIEntities(sCIConnString)) |
||
2756 | 2ab012e8 | djkim | { |
2757 | var docitem = (from info in Entity.DOCINFO |
||
2758 | where info.DOCUMENT_ID == doc_id |
||
2759 | && info.PROJECT_NO == project_no |
||
2760 | select info).First(); |
||
2761 | |||
2762 | foreach (MARKUP_INFO markinfo in docitem.MARKUP_INFO) |
||
2763 | { |
||
2764 | 285635d3 | taeseongkim | var members = GetMemberQuery(Entity, markinfo.USER_ID); |
2765 | |||
2766 | MEMBER member = new MEMBER(); |
||
2767 | |||
2768 | if (members.Count() > 0) |
||
2769 | { |
||
2770 | member = members.First(); |
||
2771 | } |
||
2772 | |||
2773 | 2ab012e8 | djkim | string displaycolor = null; |
2774 | 285635d3 | taeseongkim | |
2775 | 2ab012e8 | djkim | try |
2776 | { |
||
2777 | displaycolor = _markupInfoList.Where(info => info.MarkupInfoID == markinfo.ID).First().DisplayColor; |
||
2778 | } |
||
2779 | 0585d5cc | taeseongkim | catch (Exception ex) |
2780 | 2ab012e8 | djkim | { |
2781 | 5c64268e | taeseongkim | System.Diagnostics.Trace.WriteLine("KCOM_API - GetPrintDocItemList displaycolor : " + ex.ToString()); |
2782 | 0585d5cc | taeseongkim | |
2783 | 2ab012e8 | djkim | displaycolor = "#FFFFFF"; |
2784 | } |
||
2785 | |||
2786 | _result = new MarkupInfoItem |
||
2787 | { |
||
2788 | MarkupInfoID = markinfo.ID, |
||
2789 | Consolidate = markinfo.CONSOLIDATE, |
||
2790 | CreateTime = markinfo.UPDATE_TIME.HasValue ? markinfo.UPDATE_TIME.Value : markinfo.CREATE_TIME, |
||
2791 | DisplayColor = displaycolor, |
||
2792 | UserID = markinfo.USER_ID, |
||
2793 | UserName = member.NAME, |
||
2794 | Depatment = member.DEPARTMENT, |
||
2795 | }; |
||
2796 | |||
2797 | _result.MarkupList = new List<IKCOM.MarkupItem>(); |
||
2798 | var markup_Version = markinfo.MARKUP_INFO_VERSION.OrderByDescending(p => p.CREATE_DATE).First(); |
||
2799 | |||
2800 | foreach (MARKUP_DATA markdata in markup_Version.MARKUP_DATA) |
||
2801 | { |
||
2802 | MarkupItem markitem = new MarkupItem() |
||
2803 | { |
||
2804 | ID = markdata.ID, |
||
2805 | PageNumber = markdata.PAGENUMBER, |
||
2806 | }; |
||
2807 | _result.MarkupList.Add(markitem); |
||
2808 | } |
||
2809 | |||
2810 | _result.PageCount = _result.MarkupList.GroupBy(i => i.PageNumber).Count(); |
||
2811 | |||
2812 | markupinfo.Add(_result); |
||
2813 | } |
||
2814 | } |
||
2815 | } |
||
2816 | 285635d3 | taeseongkim | catch (Exception ex) |
2817 | 2ab012e8 | djkim | { |
2818 | return null; |
||
2819 | } |
||
2820 | return markupinfo; |
||
2821 | } |
||
2822 | 04a7385a | djkim | |
2823 | [OperationContract] |
||
2824 | public bool AddMessage(string project_no, TALK value) |
||
2825 | { |
||
2826 | try |
||
2827 | { |
||
2828 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
2829 | using (CIEntities entity = new CIEntities(sCIConnString)) |
||
2830 | 04a7385a | djkim | { |
2831 | entity.TALK.AddObject(value); |
||
2832 | entity.SaveChanges(); |
||
2833 | } |
||
2834 | } |
||
2835 | 5c64268e | taeseongkim | catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex); |
2836 | 04a7385a | djkim | return false; |
2837 | } |
||
2838 | return true; |
||
2839 | } |
||
2840 | |||
2841 | [OperationContract] |
||
2842 | public List<TALK> GetMessage(string project_no, string doc_id) |
||
2843 | { |
||
2844 | List<TALK> result = new List<TALK>(); |
||
2845 | try |
||
2846 | { |
||
2847 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
2848 | using (CIEntities entity = new CIEntities(sCIConnString)) |
||
2849 | 04a7385a | djkim | { |
2850 | result = entity.TALK.Where(data => data.DOCUMENT_ID == doc_id).ToList(); |
||
2851 | } |
||
2852 | } |
||
2853 | ff01c725 | humkyung | catch (Exception ex) |
2854 | 04a7385a | djkim | { |
2855 | return result; |
||
2856 | } |
||
2857 | return result; |
||
2858 | } |
||
2859 | dfb95d0f | djkim | |
2860 | |||
2861 | #region Legacy System I/F |
||
2862 | /// <summary> |
||
2863 | /// Ensemble+ Sign Data Return |
||
2864 | /// </summary> |
||
2865 | /// <param name="user_id"></param> |
||
2866 | /// <returns></returns> |
||
2867 | private string getEnsembleSign(string user_id) |
||
2868 | { |
||
2869 | ac4f1e13 | taeseongkim | string result = null; |
2870 | dfb95d0f | djkim | string soapurl = string.Empty; |
2871 | ac4f1e13 | taeseongkim | |
2872 | dfb95d0f | djkim | try |
2873 | { |
||
2874 | ff01c725 | humkyung | string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; |
2875 | using (KCOMEntities Entity = new KCOMEntities(sConnString)) |
||
2876 | dfb95d0f | djkim | { |
2877 | var item = Entity.PROPERTIES.Where(d => d.TYPE == "UpLoadServiceUrl").FirstOrDefault(); |
||
2878 | ac4f1e13 | taeseongkim | |
2879 | if (item != null) |
||
2880 | { |
||
2881 | soapurl = item.VALUE; |
||
2882 | |||
2883 | WebClient webClient = new WebClient(); |
||
2884 | string data = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ens=\"http://EnsemblePlus.Webservice\"> <soapenv:Header/> <soapenv:Body> <ens:checkoutSignImage>" |
||
2885 | + "<ens:sUserNo>" + user_id + "</ens:sUserNo>" |
||
2886 | + "</ens:checkoutSignImage> </soapenv:Body></soapenv:Envelope>"; |
||
2887 | webClient.Headers.Add(HttpRequestHeader.ContentType, "text/xml"); |
||
2888 | webClient.Headers.Add("SOAPAction", "http://EnsemblePlus.Webservice"); |
||
2889 | var _result = webClient.UploadString(new Uri(soapurl), data); |
||
2890 | XmlDocument xmlDoc = new XmlDocument(); |
||
2891 | xmlDoc.LoadXml(_result); |
||
2892 | XmlNodeList list = xmlDoc.GetElementsByTagName("checkoutSignImageResponse"); |
||
2893 | |||
2894 | foreach (XmlNode xn in list) |
||
2895 | { |
||
2896 | result = xn["checkoutSignImageReturn"].InnerText; |
||
2897 | } |
||
2898 | |||
2899 | if (result.Contains("No business object")) |
||
2900 | { |
||
2901 | result = null; |
||
2902 | } |
||
2903 | } |
||
2904 | else |
||
2905 | { |
||
2906 | result = null; |
||
2907 | } |
||
2908 | dfb95d0f | djkim | } |
2909 | ac4f1e13 | taeseongkim | |
2910 | dfb95d0f | djkim | } |
2911 | catch (Exception ex) |
||
2912 | ac4f1e13 | taeseongkim | { |
2913 | result = null; |
||
2914 | dfb95d0f | djkim | } |
2915 | |||
2916 | ac4f1e13 | taeseongkim | return result; |
2917 | dfb95d0f | djkim | } |
2918 | #endregion |
||
2919 | 6c9fec59 | djkim | |
2920 | #region Final Service |
||
2921 | [OperationContract] |
||
2922 | [ServiceKnownType(typeof(DOCINFO))] |
||
2923 | public DOCINFO FinalPDF_GetDocinfo(string project_no, string docinfo_id) |
||
2924 | { |
||
2925 | DOCINFO docinfo = null; |
||
2926 | |||
2927 | try |
||
2928 | { |
||
2929 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
2930 | using (CIEntities _entity = new CIEntities(sCIConnString)) |
||
2931 | 6c9fec59 | djkim | { |
2932 | var doc = _entity.DOCINFO.Where(x => x.ID == docinfo_id).FirstOrDefault(); |
||
2933 | if(doc != null) |
||
2934 | { |
||
2935 | docinfo = new DOCINFO() |
||
2936 | { |
||
2937 | ID = doc.ID, |
||
2938 | DOCUMENT_ID = doc.DOCUMENT_ID, |
||
2939 | PAGE_COUNT = doc.PAGE_COUNT, |
||
2940 | ORIGINAL_FILE = doc.ORIGINAL_FILE, |
||
2941 | PROJECT_NO = doc.PROJECT_NO |
||
2942 | }; |
||
2943 | } |
||
2944 | } |
||
2945 | } |
||
2946 | 5c64268e | taeseongkim | catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex); |
2947 | 6c9fec59 | djkim | throw; |
2948 | } |
||
2949 | return docinfo; |
||
2950 | } |
||
2951 | [OperationContract] |
||
2952 | [ServiceKnownType(typeof(DOCUMENT_ITEM))] |
||
2953 | public DOCUMENT_ITEM FinalPDF_GetDocumentItem(string project_no, string document_id) |
||
2954 | { |
||
2955 | DOCUMENT_ITEM item = null; |
||
2956 | |||
2957 | try |
||
2958 | { |
||
2959 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
2960 | using (CIEntities _entity = new CIEntities(sCIConnString)) |
||
2961 | 6c9fec59 | djkim | { |
2962 | 0585d5cc | taeseongkim | var doc = _entity.DOCUMENT_ITEM.Where(x => x.PROJECT_NO == project_no && x.DOCUMENT_ID == document_id).FirstOrDefault(); |
2963 | 6c9fec59 | djkim | if(doc != null) |
2964 | { |
||
2965 | item = new DOCUMENT_ITEM() |
||
2966 | { |
||
2967 | ID = doc.ID, |
||
2968 | ORIGINAL_FILE = doc.ORIGINAL_FILE, |
||
2969 | PROJECT_NO = doc.PROJECT_NO, |
||
2970 | DOCUMENT_ID = doc.DOCUMENT_ID, |
||
2971 | DOCUMENT_NO = doc.DOCUMENT_NO, |
||
2972 | DOCUMENT_NAME = doc.DOCUMENT_NAME, |
||
2973 | ab5aa762 | taeseongkim | //ENSEMBLEINFO_URL = doc.ENSEMBLEINFO_URL, |
2974 | 6c9fec59 | djkim | GROUP_NO = doc.GROUP_NO, |
2975 | RESULT = doc.RESULT, |
||
2976 | REVISION = doc.REVISION, |
||
2977 | RESULT_FILE = doc.RESULT_FILE |
||
2978 | }; |
||
2979 | } |
||
2980 | |||
2981 | } |
||
2982 | } |
||
2983 | 5c64268e | taeseongkim | catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex); |
2984 | 6c9fec59 | djkim | throw; |
2985 | } |
||
2986 | return item; |
||
2987 | } |
||
2988 | [OperationContract] |
||
2989 | [ServiceKnownType(typeof(MARKUP_DATA))] |
||
2990 | public List<MARKUP_DATA> FinalPDF_GetMarkupdata(string project_no, string docinfo_id) |
||
2991 | { |
||
2992 | List<MARKUP_DATA> results = new List<MARKUP_DATA>(); |
||
2993 | |||
2994 | try |
||
2995 | { |
||
2996 | c0977e97 | djkim | //using (CIEntities _entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
2997 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
2998 | using (CIEntities _entity = new CIEntities(sCIConnString)) |
||
2999 | 6c9fec59 | djkim | { |
3000 | var datas = _entity.MARKUP_DATA.Where(x => x.MARKUP_INFO_VERSION.MARKUP_INFO.DOCINFO_ID == docinfo_id |
||
3001 | && x.MARKUP_INFO_VERSION.MARKUP_INFO.CONSOLIDATE == 1 |
||
3002 | && x.MARKUP_INFO_VERSION.MARKUP_INFO.AVOID_CONSOLIDATE == 0 |
||
3003 | && x.MARKUP_INFO_VERSION.MARKUP_INFO.PART_CONSOLIDATE == 0).ToList(); |
||
3004 | foreach (var data in datas) |
||
3005 | { |
||
3006 | MARKUP_DATA d = new MARKUP_DATA() |
||
3007 | { |
||
3008 | ID = data.ID, |
||
3009 | c0977e97 | djkim | //GROUP_ID = data.GROUP_ID, |
3010 | 6c9fec59 | djkim | SYMBOL_ID = data.SYMBOL_ID, |
3011 | DATA = data.DATA, |
||
3012 | abaa85b4 | djkim | DATA_TYPE = data.DATA_TYPE, |
3013 | MARKUPINFO_VERSION_ID = data.MARKUPINFO_VERSION_ID, |
||
3014 | PAGENUMBER = data.PAGENUMBER |
||
3015 | 6c9fec59 | djkim | }; |
3016 | results.Add(d); |
||
3017 | } |
||
3018 | } |
||
3019 | } |
||
3020 | 5c64268e | taeseongkim | catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex); |
3021 | 6c9fec59 | djkim | throw; |
3022 | } |
||
3023 | return results; |
||
3024 | } |
||
3025 | [OperationContract] |
||
3026 | [ServiceKnownType(typeof(MARKUP_INFO))] |
||
3027 | public MARKUP_INFO FinalPDF_GetMarkupinfo(string project_no, string docinfo_id) |
||
3028 | { |
||
3029 | MARKUP_INFO markupInfo = null; |
||
3030 | |||
3031 | try |
||
3032 | { |
||
3033 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
3034 | using (CIEntities _entity = new CIEntities(sCIConnString)) |
||
3035 | 6c9fec59 | djkim | { |
3036 | var tmp = _entity.MARKUP_INFO.Where(x => x.DOCINFO_ID == docinfo_id && x.CONSOLIDATE == 1 && x.AVOID_CONSOLIDATE == 0 && x.PART_CONSOLIDATE == 0).FirstOrDefault(); |
||
3037 | if (tmp != null) |
||
3038 | { |
||
3039 | markupInfo = new MARKUP_INFO() |
||
3040 | { |
||
3041 | ID = tmp.ID, |
||
3042 | DOCINFO_ID = tmp.DOCINFO_ID, |
||
3043 | USER_ID = tmp.USER_ID |
||
3044 | }; |
||
3045 | } |
||
3046 | } |
||
3047 | } |
||
3048 | 5c64268e | taeseongkim | catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex); |
3049 | 6c9fec59 | djkim | throw; |
3050 | } |
||
3051 | return markupInfo; |
||
3052 | } |
||
3053 | [OperationContract] |
||
3054 | abaa85b4 | djkim | [ServiceKnownType(typeof(FINAL_PDF))] |
3055 | public List<FINAL_PDF> FinalPDF_GetFinalPDFs(string final_id) |
||
3056 | { |
||
3057 | List<FINAL_PDF> results = new List<FINAL_PDF>(); |
||
3058 | |||
3059 | try |
||
3060 | { |
||
3061 | ff01c725 | humkyung | string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; |
3062 | using (KCOMEntities _entity = new KCOMEntities(sConnString)) |
||
3063 | abaa85b4 | djkim | { |
3064 | var finalList = _entity.FINAL_PDF.Where(final => final.ID == final_id).ToList(); |
||
3065 | foreach(var final in finalList) |
||
3066 | { |
||
3067 | FINAL_PDF pdf = new FINAL_PDF() |
||
3068 | { |
||
3069 | ID = final.ID, |
||
3070 | DOCINFO_ID = final.DOCINFO_ID, |
||
3071 | DOCUMENT_ID = final.DOCUMENT_ID, |
||
3072 | STATUS = final.STATUS, |
||
3073 | CURRENT_PAGE = final.CURRENT_PAGE, |
||
3074 | CREATE_DATETIME = final.CREATE_DATETIME, |
||
3075 | START_DATETIME = final.START_DATETIME, |
||
3076 | END_DATETIME = final.END_DATETIME, |
||
3077 | EXCEPTION = final.EXCEPTION, |
||
3078 | PROJECT_NO = final.PROJECT_NO, |
||
3079 | TOTAL_PAGE = final.TOTAL_PAGE, |
||
3080 | MARKUPINFO_ID = final.MARKUPINFO_ID, |
||
3081 | CREATE_USER_ID = final.CREATE_USER_ID |
||
3082 | }; |
||
3083 | results.Add(pdf); |
||
3084 | } |
||
3085 | } |
||
3086 | } |
||
3087 | 5c64268e | taeseongkim | catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex); |
3088 | abaa85b4 | djkim | throw; |
3089 | } |
||
3090 | return results; |
||
3091 | } |
||
3092 | [OperationContract] |
||
3093 | 6c9fec59 | djkim | [ServiceKnownType(typeof(DOCPAGE))] |
3094 | public List<DOCPAGE> FinalPDF_GetDocpage(string project_no, string docinfo_id) |
||
3095 | { |
||
3096 | List<DOCPAGE> results = new List<DOCPAGE>(); |
||
3097 | |||
3098 | try |
||
3099 | { |
||
3100 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
3101 | using (CIEntities _entity = new CIEntities(sCIConnString)) |
||
3102 | 6c9fec59 | djkim | { |
3103 | var pages = _entity.DOCPAGE.Where(x => x.DOCINFO_ID == docinfo_id).OrderBy(x => x.PAGE_NUMBER).ToList(); |
||
3104 | foreach(var page in pages) |
||
3105 | { |
||
3106 | DOCPAGE p = new DOCPAGE() |
||
3107 | { |
||
3108 | PAGE_ANGLE = page.PAGE_ANGLE, |
||
3109 | PAGE_NUMBER = page.PAGE_NUMBER, |
||
3110 | PAGE_HEIGHT = page.PAGE_HEIGHT, |
||
3111 | PAGE_WIDTH = page.PAGE_WIDTH, |
||
3112 | DOCINFO_ID = page.DOCINFO_ID |
||
3113 | }; |
||
3114 | results.Add(p); |
||
3115 | } |
||
3116 | } |
||
3117 | } |
||
3118 | 5c64268e | taeseongkim | catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex); |
3119 | 6c9fec59 | djkim | throw; |
3120 | } |
||
3121 | return results; |
||
3122 | } |
||
3123 | abaa85b4 | djkim | [OperationContract] |
3124 | public bool FinalPDF_SetFinalPDFStatus(string final_id, FinalStatus status) |
||
3125 | { |
||
3126 | bool result = false; |
||
3127 | |||
3128 | try |
||
3129 | { |
||
3130 | ff01c725 | humkyung | string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; |
3131 | using (KCOMEntities _entity = new KCOMEntities(sConnString)) |
||
3132 | abaa85b4 | djkim | { |
3133 | var tmp = _entity.FINAL_PDF.Where(x => x.ID == final_id).FirstOrDefault(); |
||
3134 | if(tmp != null) |
||
3135 | { |
||
3136 | switch(status) |
||
3137 | { |
||
3138 | case FinalStatus.Create: |
||
3139 | tmp.START_DATETIME = DateTime.Now; |
||
3140 | break; |
||
3141 | case FinalStatus.Success: |
||
3142 | tmp.END_DATETIME = DateTime.Now; |
||
3143 | tmp.EXCEPTION = string.Empty; |
||
3144 | break; |
||
3145 | } |
||
3146 | tmp.STATUS = (int)status; |
||
3147 | _entity.SaveChanges(); |
||
3148 | result = true; |
||
3149 | } |
||
3150 | } |
||
3151 | } |
||
3152 | 5c64268e | taeseongkim | catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex); |
3153 | abaa85b4 | djkim | throw; |
3154 | } |
||
3155 | return result; |
||
3156 | } |
||
3157 | |||
3158 | 3c71b3a5 | taeseongkim | /// <summary> |
3159 | /// 현재 진행중인 Final PDF 가 없거나 Success 일 경우에만 true return |
||
3160 | /// </summary> |
||
3161 | /// <param name="DocInfoID"></param> |
||
3162 | /// <param name="MarkupInfoID"></param> |
||
3163 | /// <param name="CreateUserID"></param> |
||
3164 | /// <returns></returns> |
||
3165 | abaa85b4 | djkim | [OperationContract] |
3166 | 3b62305d | ljiyeon | public bool FinalPDF_GetFinalPDFStatus(string DocInfoID, string MarkupInfoID, string CreateUserID) |
3167 | { |
||
3168 | bool result = false; |
||
3169 | |||
3170 | try |
||
3171 | { |
||
3172 | ff01c725 | humkyung | string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; |
3173 | using (KCOMEntities _entity = new KCOMEntities(sConnString)) |
||
3174 | 3b62305d | ljiyeon | { |
3175 | 76688e76 | djkim | var finalpdf = _entity.FINAL_PDF.Where(x => x.DOCINFO_ID == DocInfoID && x.MARKUPINFO_ID == MarkupInfoID && x.CREATE_USER_ID == CreateUserID && x.STATUS != (int)FinalStatus.Error).FirstOrDefault(); |
3176 | 3b62305d | ljiyeon | if (finalpdf != null) |
3177 | { |
||
3178 | 3c71b3a5 | taeseongkim | if (finalpdf.STATUS == (int)FinalStatus.Success) |
3179 | 3b62305d | ljiyeon | { |
3180 | result = true; |
||
3181 | } |
||
3182 | } |
||
3183 | 3c71b3a5 | taeseongkim | else |
3184 | result = true; |
||
3185 | 3b62305d | ljiyeon | } |
3186 | } |
||
3187 | 5c64268e | taeseongkim | catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex); |
3188 | 3b62305d | ljiyeon | throw; |
3189 | } |
||
3190 | return result; |
||
3191 | } |
||
3192 | |||
3193 | [OperationContract] |
||
3194 | abaa85b4 | djkim | public bool FinalPDF_SetCurrentPage(string final_id, int currentpage) |
3195 | { |
||
3196 | bool result = false; |
||
3197 | |||
3198 | try |
||
3199 | { |
||
3200 | ff01c725 | humkyung | string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; |
3201 | using (KCOMEntities _entity = new KCOMEntities(sConnString)) |
||
3202 | abaa85b4 | djkim | { |
3203 | var tmp = _entity.FINAL_PDF.Where(x => x.ID == final_id).FirstOrDefault(); |
||
3204 | if (tmp != null) |
||
3205 | { |
||
3206 | tmp.CURRENT_PAGE = currentpage; |
||
3207 | _entity.SaveChanges(); |
||
3208 | result = true; |
||
3209 | } |
||
3210 | } |
||
3211 | } |
||
3212 | 5c64268e | taeseongkim | catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex); |
3213 | abaa85b4 | djkim | throw; |
3214 | } |
||
3215 | return result; |
||
3216 | } |
||
3217 | [OperationContract] |
||
3218 | public bool FinalPDF_SetError(string final_id, string msg) |
||
3219 | { |
||
3220 | bool result = false; |
||
3221 | |||
3222 | try |
||
3223 | { |
||
3224 | ff01c725 | humkyung | string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; |
3225 | using (KCOMEntities _entity = new KCOMEntities(sConnString)) |
||
3226 | abaa85b4 | djkim | { |
3227 | var tmp = _entity.FINAL_PDF.Where(x => x.ID == final_id).FirstOrDefault(); |
||
3228 | if (tmp != null) |
||
3229 | { |
||
3230 | tmp.STATUS = (int)FinalStatus.Error; |
||
3231 | tmp.EXCEPTION = DateTime.Now.ToShortDateString() + " " + msg; |
||
3232 | _entity.SaveChanges(); |
||
3233 | result = true; |
||
3234 | } |
||
3235 | } |
||
3236 | } |
||
3237 | 5c64268e | taeseongkim | catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex); |
3238 | abaa85b4 | djkim | throw; |
3239 | } |
||
3240 | return result; |
||
3241 | } |
||
3242 | |||
3243 | [OperationContract] |
||
3244 | public bool FinalPDF_SetFinalResultPath(string project_no, string document_id, string url) |
||
3245 | { |
||
3246 | bool result = false; |
||
3247 | |||
3248 | try |
||
3249 | { |
||
3250 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
3251 | using (CIEntities _entity = new CIEntities(sCIConnString)) |
||
3252 | abaa85b4 | djkim | { |
3253 | 0585d5cc | taeseongkim | var item = _entity.DOCUMENT_ITEM.Where(d =>d.PROJECT_NO == project_no && d.DOCUMENT_ID == document_id).FirstOrDefault(); |
3254 | abaa85b4 | djkim | if (item != null) |
3255 | { |
||
3256 | item.RESULT_FILE = url; |
||
3257 | _entity.SaveChanges(); |
||
3258 | result = true; |
||
3259 | } |
||
3260 | } |
||
3261 | } |
||
3262 | 5c64268e | taeseongkim | catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex); |
3263 | abaa85b4 | djkim | throw; |
3264 | } |
||
3265 | return result; |
||
3266 | } |
||
3267 | bae83c92 | taeseongkim | |
3268 | [OperationContract] |
||
3269 | public bool SaveLog(string project_no, string document_id, string Log) |
||
3270 | { |
||
3271 | bool result = false; |
||
3272 | |||
3273 | try |
||
3274 | { |
||
3275 | string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; |
||
3276 | using (KCOMEntities _entity = new KCOMEntities(sConnString)) |
||
3277 | { |
||
3278 | _entity.AddToERROR_LOG(new ERROR_LOG |
||
3279 | { |
||
3280 | PROJECT_NO = project_no, |
||
3281 | DOCUMENT_ID = document_id, |
||
3282 | CONTENTS = Log, |
||
3283 | CREATE_DATETIME = DateTime.Now.ToString("yyMMddssmm"), |
||
3284 | CODE = "", |
||
3285 | TYPE = "Markus Log", |
||
3286 | LEVEL = "", |
||
3287 | SERVICE_NAME = "Markus", |
||
3288 | }); |
||
3289 | |||
3290 | _entity.SaveChanges(); |
||
3291 | } |
||
3292 | } |
||
3293 | catch (Exception ex) |
||
3294 | { |
||
3295 | } |
||
3296 | |||
3297 | return result; |
||
3298 | } |
||
3299 | |||
3300 | abaa85b4 | djkim | [OperationContract] |
3301 | [ServiceKnownType(typeof(MEMBER))] |
||
3302 | public MEMBER FinalPDF_GetCommentMember(string project_no, string markupdata_id) |
||
3303 | { |
||
3304 | MEMBER member = null; |
||
3305 | try |
||
3306 | { |
||
3307 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
3308 | using (CIEntities _entity = new CIEntities(sCIConnString)) |
||
3309 | abaa85b4 | djkim | { |
3310 | var data = _entity.MARKUP_DATA.Where(x => x.ID == markupdata_id).FirstOrDefault(); |
||
3311 | string user_id = data.MARKUP_INFO_VERSION.MARKUP_INFO.USER_ID; |
||
3312 | 285635d3 | taeseongkim | |
3313 | var person = GetMemberQuery(_entity,user_id); |
||
3314 | |||
3315 | if(person.Count() > 0) |
||
3316 | abaa85b4 | djkim | { |
3317 | 285635d3 | taeseongkim | member = person.First(); |
3318 | abaa85b4 | djkim | } |
3319 | } |
||
3320 | } |
||
3321 | 5c64268e | taeseongkim | catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex); |
3322 | abaa85b4 | djkim | throw; |
3323 | } |
||
3324 | 285635d3 | taeseongkim | |
3325 | abaa85b4 | djkim | return member; |
3326 | } |
||
3327 | |||
3328 | [OperationContract] |
||
3329 | [ServiceKnownType(typeof(PROPERTIES))] |
||
3330 | public List<PROPERTIES> FinalPDF_GetProperties(string project_no) |
||
3331 | { |
||
3332 | List<PROPERTIES> results = new List<PROPERTIES>(); |
||
3333 | try |
||
3334 | { |
||
3335 | ff01c725 | humkyung | string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; |
3336 | using (KCOMEntities _entity = new KCOMEntities(sConnString)) |
||
3337 | abaa85b4 | djkim | { |
3338 | var _items = _entity.PROPERTIES.Where(x => x.PROPERTY == project_no).ToList(); |
||
3339 | foreach(var item in _items) |
||
3340 | { |
||
3341 | PROPERTIES pROPERTIES = new PROPERTIES() |
||
3342 | { |
||
3343 | ID = item.ID, |
||
3344 | PROPERTY = item.PROPERTY, |
||
3345 | TYPE = item.TYPE, |
||
3346 | VALUE = item.VALUE |
||
3347 | }; |
||
3348 | results.Add(pROPERTIES); |
||
3349 | } |
||
3350 | } |
||
3351 | |||
3352 | } |
||
3353 | 5c64268e | taeseongkim | catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex); |
3354 | abaa85b4 | djkim | throw; |
3355 | } |
||
3356 | return results; |
||
3357 | } |
||
3358 | 6c9fec59 | djkim | #endregion |
3359 | ffddbe4e | djkim | } |
3360 | 787a4489 | KangIngu | } |