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