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