markus / KCOM_API / ServiceDeepView.svc.cs @ 285635d3
이력 | 보기 | 이력해설 | 다운로드 (122 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 | 285635d3 | taeseongkim | |
894 | ff01c725 | humkyung | using (CIEntities entity = new CIEntities(sCIConnString)) |
895 | 2ab012e8 | djkim | { |
896 | 285635d3 | taeseongkim | _result = GetMemberQuery(entity, UserID); |
897 | 2ab012e8 | djkim | } |
898 | //GC.Collect(2); |
||
899 | return _result; |
||
900 | } |
||
901 | 787a4489 | KangIngu | |
902 | |||
903 | [OperationContract] |
||
904 | public List<string> GetDeptData(string UserDept) //그룹 추가 옵션 부여 예정 |
||
905 | { |
||
906 | List<string> _result = new List<string>(); |
||
907 | |||
908 | try |
||
909 | { |
||
910 | ff01c725 | humkyung | string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; |
911 | KCOMEntities entity = new KCOMEntities(sConnString); |
||
912 | 787a4489 | KangIngu | var YourEnginner = (from dept in entity.PROPERTIES |
913 | where dept.TYPE == "DeptName" && UserDept.Contains(dept.VALUE) |
||
914 | select dept).FirstOrDefault(); |
||
915 | |||
916 | if (YourEnginner != null) |
||
917 | { |
||
918 | _result = (from dept in entity.PROPERTIES |
||
919 | where dept.PROPERTY == YourEnginner.PROPERTY |
||
920 | select dept.VALUE).ToList(); |
||
921 | return _result; |
||
922 | } |
||
923 | else |
||
924 | { |
||
925 | return null; |
||
926 | } |
||
927 | } |
||
928 | catch (Exception ex) |
||
929 | { |
||
930 | System.Diagnostics.Debug.WriteLine(ex.Message); |
||
931 | } |
||
932 | finally |
||
933 | { |
||
934 | GC.Collect(2); |
||
935 | } |
||
936 | return _result; |
||
937 | } |
||
938 | |||
939 | [OperationContract] |
||
940 | public bool DeleteMarkup(string ProjectNo, string MarkupInfoID) |
||
941 | { |
||
942 | bool _result = false; |
||
943 | try |
||
944 | { |
||
945 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
946 | using (KCOMDataModel.DataModel.CIEntities Entity = new KCOMDataModel.DataModel.CIEntities(sCIConnString)) |
||
947 | 787a4489 | KangIngu | { |
948 | |||
949 | MARKUP_INFO instance = Entity.MARKUP_INFO.Where(root => root.ID == MarkupInfoID).FirstOrDefault(); |
||
950 | |||
951 | if (instance == null) |
||
952 | { |
||
953 | return false; |
||
954 | } |
||
955 | MARKUP_INFO_VERSION version = instance.MARKUP_INFO_VERSION.FirstOrDefault(); |
||
956 | |||
957 | |||
958 | version.MARKUP_DATA.ToList().ForEach(data => |
||
959 | { |
||
960 | Entity.MARKUP_DATA.DeleteObject(data); |
||
961 | Entity.SaveChanges(); |
||
962 | }); |
||
963 | |||
964 | Entity.MARKUP_INFO_VERSION.DeleteObject(version); |
||
965 | Entity.SaveChanges(); |
||
966 | |||
967 | Entity.MARKUP_INFO.DeleteObject(instance); |
||
968 | Entity.SaveChanges(); |
||
969 | |||
970 | } |
||
971 | _result = true; |
||
972 | } |
||
973 | catch (Exception ex) |
||
974 | { |
||
975 | System.Diagnostics.Trace.WriteLine(ex, "SaveMarkup"); |
||
976 | } |
||
977 | finally |
||
978 | { |
||
979 | GC.Collect(2); |
||
980 | } |
||
981 | return _result; |
||
982 | } |
||
983 | 992a98b4 | KangIngu | |
984 | #region Favorite |
||
985 | [OperationContract] |
||
986 | public bool SetFavoriteVP(string prjNo, string userID, string groupNo, string docNo, string rev, int SavePageNo, string documentItemID, string VPDescription, IKCOM.FAVORITE_FLAG flag) |
||
987 | { |
||
988 | ff01c725 | humkyung | string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; |
989 | using (KCOMEntities entity = new KCOMEntities(sConnString)) |
||
990 | 992a98b4 | KangIngu | { |
991 | try |
||
992 | { |
||
993 | entity.FAVORITE_DOC.AddObject(new FAVORITE_DOC |
||
994 | { |
||
995 | ID = shortGuid(), |
||
996 | PROJECT_NO = prjNo, |
||
997 | DOCUMENT_ID = documentItemID, |
||
998 | GROUP_NO = groupNo, |
||
999 | DOCUMENT_NO = docNo, |
||
1000 | MEMBER_USER_ID = userID, |
||
1001 | DESCRIPTION = VPDescription, |
||
1002 | CREATE_TIME = DateTime.Now, |
||
1003 | REVISION = rev, |
||
1004 | FLAG = (int)flag, |
||
1005 | PAGE_NO = SavePageNo, |
||
1006 | }); |
||
1007 | entity.SaveChanges(); |
||
1008 | } |
||
1009 | catch (Exception) |
||
1010 | { |
||
1011 | return false; |
||
1012 | } |
||
1013 | |||
1014 | return true; |
||
1015 | } |
||
1016 | } |
||
1017 | |||
1018 | //[OperationContract] |
||
1019 | //public List<FAVORITE_DOC> GetFavoriteVP(string PrjNo, string userID, string sharepointItemID) |
||
1020 | //{ |
||
1021 | // using (KCOMEntities entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
||
1022 | // { |
||
1023 | |||
1024 | // int flagString = Convert.ToInt32(IKCOM.FAVORITE_FLAG.Personal); |
||
1025 | // List<FAVORITE_DOC> favoriteListSet = new List<FAVORITE_DOC>(); |
||
1026 | // entity.FAVORITE_DOC.Where(data => data.PROJECT_NO == PrjNo && data.DOCUMENT_ID == sharepointItemID && data.FLAG != |
||
1027 | // flagString).ToList().ForEach(data => favoriteListSet.Add(data)); |
||
1028 | // entity.FAVORITE_DOC.Where(data => data.PROJECT_NO == PrjNo && data.MEMBER_USER_ID == userID).ToList().ForEach(data => favoriteListSet.Add(data)); |
||
1029 | // favoriteListSet = favoriteListSet.Distinct().ToList(); |
||
1030 | // return favoriteListSet; |
||
1031 | // } |
||
1032 | //} |
||
1033 | //[OperationContract] |
||
1034 | //public bool EditFavoriteVP(string prjNo, string userID, int SavePageNo, string sharepointItemID, DateTime createTime, int state, string description) |
||
1035 | //{ |
||
1036 | // using (DeepViewEntities dc = new DeepViewEntities(ConnectStringBuilder.DeepViewConnectionString().ToString())) |
||
1037 | // { |
||
1038 | // List<FavoriteVP> favoriteSet = dc.FavoriteVP.Where(data => data.ProjectNo == prjNo && data.CreateUserID == userID |
||
1039 | // && data.PageNo == SavePageNo && data.CreateTime == createTime).ToList(); |
||
1040 | |||
1041 | // try |
||
1042 | // { |
||
1043 | |||
1044 | |||
1045 | // if (favoriteSet.Count > 0) |
||
1046 | // { |
||
1047 | // var FavoriteVP_Instance = favoriteSet.First(); |
||
1048 | |||
1049 | // FavoriteVP_Instance.Description = description; |
||
1050 | // FavoriteVP_Instance.Flag = state; |
||
1051 | |||
1052 | // dc.SaveChanges(); |
||
1053 | |||
1054 | // return true; |
||
1055 | // } |
||
1056 | // else |
||
1057 | // { |
||
1058 | // return false; |
||
1059 | // } |
||
1060 | // } |
||
1061 | // catch (Exception) |
||
1062 | // { |
||
1063 | // return false; |
||
1064 | // } |
||
1065 | // } |
||
1066 | //} |
||
1067 | //[OperationContract] |
||
1068 | //public bool DelFavoriteVP(string prjNo, string userID, int SavePageNo, string sharepointItemID, DateTime createTime) |
||
1069 | //{ |
||
1070 | |||
1071 | // using (DeepViewEntities dc = new DeepViewEntities(ConnectStringBuilder.DeepViewConnectionString().ToString())) |
||
1072 | // { |
||
1073 | // List<FavoriteVP> favoriteSet = dc.FavoriteVP.Where(data => data.ProjectNo == prjNo && data.CreateUserID == userID |
||
1074 | // && data.PageNo == SavePageNo && data.CreateTime == createTime).ToList(); |
||
1075 | |||
1076 | // try |
||
1077 | // { |
||
1078 | |||
1079 | |||
1080 | // if (favoriteSet.Count > 0) |
||
1081 | // { |
||
1082 | // favoriteSet.ForEach(data => dc.FavoriteVP.DeleteObject(data)); |
||
1083 | // dc.SaveChanges(); |
||
1084 | // return true; |
||
1085 | // } |
||
1086 | // else |
||
1087 | // { |
||
1088 | // return false; |
||
1089 | // } |
||
1090 | // } |
||
1091 | // catch (Exception) |
||
1092 | // { |
||
1093 | // return false; |
||
1094 | // } |
||
1095 | // } |
||
1096 | //} |
||
1097 | #endregion |
||
1098 | 2ab012e8 | djkim | |
1099 | [OperationContract] |
||
1100 | public bool SaveMarkupData(MarkupInfoItem UserState,string project_no,string doc_id, string user_id, List<MARKUP_DATA> mlmarkup_data) |
||
1101 | { |
||
1102 | 6b6e937c | taeseongkim | |
1103 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
1104 | using (CIEntities Entity = new CIEntities(sCIConnString)) |
||
1105 | 2ab012e8 | djkim | { |
1106 | #region Docinfo 정보 가져오기 |
||
1107 | |||
1108 | string docinfoid_ = (from info in Entity.DOCINFO |
||
1109 | where info.DOCUMENT_ID == doc_id |
||
1110 | && info.PROJECT_NO == project_no |
||
1111 | select info.ID |
||
1112 | ).First().ToString(); |
||
1113 | #endregion |
||
1114 | |||
1115 | #region Markup_Info 저장 |
||
1116 | |||
1117 | MARKUP_INFO markup_info = new MARKUP_INFO(); |
||
1118 | try |
||
1119 | { |
||
1120 | markup_info = (from info in Entity.MARKUP_INFO |
||
1121 | where info.ID == UserState.MarkupInfoID && info.USER_ID == user_id |
||
1122 | select info).FirstOrDefault(); |
||
1123 | } |
||
1124 | catch (Exception) |
||
1125 | { |
||
1126 | markup_info = null; |
||
1127 | } |
||
1128 | |||
1129 | //markup_info가 없을 경우 생성 |
||
1130 | if (markup_info == null) |
||
1131 | { |
||
1132 | //MarkupInfo 저장 |
||
1133 | markup_info = new MARKUP_INFO |
||
1134 | { |
||
1135 | ID = UserState.MarkupInfoID, |
||
1136 | DOCINFO_ID = docinfoid_, |
||
1137 | USER_ID = user_id, |
||
1138 | CREATE_TIME = DateTime.Now, |
||
1139 | CONSOLIDATE = UserState.Consolidate, |
||
1140 | AVOID_CONSOLIDATE = UserState.AvoidConsolidate, |
||
1141 | PART_CONSOLIDATE = UserState.PartConsolidate, |
||
1142 | DESCRIPTION = UserState.Description, |
||
1143 | UPDATE_TIME = DateTime.Now |
||
1144 | }; |
||
1145 | Entity.MARKUP_INFO.AddObject(markup_info); |
||
1146 | } |
||
1147 | //markup_info가 있을 경우 업데이트 |
||
1148 | else |
||
1149 | { |
||
1150 | markup_info.UPDATE_TIME = DateTime.Now; |
||
1151 | } |
||
1152 | Entity.SaveChanges(); |
||
1153 | #endregion |
||
1154 | |||
1155 | #region Markup_Info_Version 저장 |
||
1156 | |||
1157 | MARKUP_INFO_VERSION markup_info_version = new MARKUP_INFO_VERSION(); |
||
1158 | |||
1159 | try |
||
1160 | { |
||
1161 | markup_info_version = (from info in Entity.MARKUP_INFO_VERSION |
||
1162 | where info.MARKUPINFO_ID == markup_info.ID |
||
1163 | select info).FirstOrDefault(); |
||
1164 | } |
||
1165 | catch (Exception) |
||
1166 | { |
||
1167 | markup_info_version = null; |
||
1168 | } |
||
1169 | |||
1170 | //markup_info_version 없을 경우 생성 |
||
1171 | if (markup_info_version == null) |
||
1172 | { |
||
1173 | //MarkupInfo_version 저장 |
||
1174 | markup_info_version = new MARKUP_INFO_VERSION() |
||
1175 | { |
||
1176 | ID = UserState.MarkupVersionID, |
||
1177 | MARKUPINFO_ID = markup_info.ID, |
||
1178 | CREATE_DATE = DateTime.Now |
||
1179 | }; |
||
1180 | Entity.MARKUP_INFO_VERSION.AddObject(markup_info_version); |
||
1181 | Entity.SaveChanges(); |
||
1182 | } |
||
1183 | #endregion |
||
1184 | |||
1185 | |||
1186 | Entity.MARKUP_DATA.Where(data => data.MARKUPINFO_VERSION_ID == markup_info_version.ID).ToList().ForEach(item => |
||
1187 | { |
||
1188 | Entity.MARKUP_DATA.DeleteObject(item); |
||
1189 | }); |
||
1190 | Entity.SaveChanges(); |
||
1191 | 6b6e937c | taeseongkim | |
1192 | try |
||
1193 | { |
||
1194 | mlmarkup_data.ForEach(value => |
||
1195 | { |
||
1196 | Entity.MARKUP_DATA.AddObject(new MARKUP_DATA |
||
1197 | { |
||
1198 | ID = value.ID, |
||
1199 | DATA = value.DATA, |
||
1200 | DATA_TYPE = value.DATA_TYPE, |
||
1201 | PAGENUMBER = value.PAGENUMBER, |
||
1202 | MARKUPINFO_VERSION_ID = markup_info_version.ID, |
||
1203 | SYMBOL_ID = value.SYMBOL_ID, |
||
1204 | //GROUP_ID = value.GROUP_ID |
||
1205 | }); |
||
1206 | }); |
||
1207 | Entity.SaveChanges(); |
||
1208 | } |
||
1209 | catch (Exception) |
||
1210 | { |
||
1211 | return false; |
||
1212 | } |
||
1213 | } |
||
1214 | return true; |
||
1215 | } |
||
1216 | |||
1217 | [OperationContract] |
||
1218 | public bool SavePageMarkupData(MarkupInfoItem UserState,int PageNo, string project_no, string doc_id, string user_id, List<MARKUP_DATA> mlmarkup_data) |
||
1219 | { |
||
1220 | |||
1221 | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
||
1222 | using (CIEntities Entity = new CIEntities(sCIConnString)) |
||
1223 | { |
||
1224 | #region Docinfo 정보 가져오기 |
||
1225 | |||
1226 | string docinfoid_ = (from info in Entity.DOCINFO |
||
1227 | where info.DOCUMENT_ID == doc_id |
||
1228 | && info.PROJECT_NO == project_no |
||
1229 | select info.ID |
||
1230 | ).First().ToString(); |
||
1231 | #endregion |
||
1232 | |||
1233 | #region Markup_Info 저장 |
||
1234 | |||
1235 | MARKUP_INFO markup_info = new MARKUP_INFO(); |
||
1236 | try |
||
1237 | { |
||
1238 | markup_info = (from info in Entity.MARKUP_INFO |
||
1239 | where info.ID == UserState.MarkupInfoID && info.USER_ID == user_id |
||
1240 | select info).FirstOrDefault(); |
||
1241 | } |
||
1242 | catch (Exception) |
||
1243 | { |
||
1244 | markup_info = null; |
||
1245 | } |
||
1246 | |||
1247 | //markup_info가 없을 경우 생성 |
||
1248 | if (markup_info == null) |
||
1249 | { |
||
1250 | //MarkupInfo 저장 |
||
1251 | markup_info = new MARKUP_INFO |
||
1252 | { |
||
1253 | ID = UserState.MarkupInfoID, |
||
1254 | DOCINFO_ID = docinfoid_, |
||
1255 | USER_ID = user_id, |
||
1256 | CREATE_TIME = DateTime.Now, |
||
1257 | CONSOLIDATE = UserState.Consolidate, |
||
1258 | AVOID_CONSOLIDATE = UserState.AvoidConsolidate, |
||
1259 | PART_CONSOLIDATE = UserState.PartConsolidate, |
||
1260 | DESCRIPTION = UserState.Description, |
||
1261 | UPDATE_TIME = DateTime.Now |
||
1262 | }; |
||
1263 | Entity.MARKUP_INFO.AddObject(markup_info); |
||
1264 | } |
||
1265 | //markup_info가 있을 경우 업데이트 |
||
1266 | else |
||
1267 | { |
||
1268 | markup_info.UPDATE_TIME = DateTime.Now; |
||
1269 | } |
||
1270 | Entity.SaveChanges(); |
||
1271 | #endregion |
||
1272 | |||
1273 | #region Markup_Info_Version 저장 |
||
1274 | |||
1275 | MARKUP_INFO_VERSION markup_info_version = new MARKUP_INFO_VERSION(); |
||
1276 | |||
1277 | try |
||
1278 | { |
||
1279 | markup_info_version = (from info in Entity.MARKUP_INFO_VERSION |
||
1280 | where info.MARKUPINFO_ID == markup_info.ID |
||
1281 | select info).FirstOrDefault(); |
||
1282 | } |
||
1283 | catch (Exception) |
||
1284 | { |
||
1285 | markup_info_version = null; |
||
1286 | } |
||
1287 | |||
1288 | //markup_info_version 없을 경우 생성 |
||
1289 | if (markup_info_version == null) |
||
1290 | { |
||
1291 | //MarkupInfo_version 저장 |
||
1292 | markup_info_version = new MARKUP_INFO_VERSION() |
||
1293 | { |
||
1294 | ID = UserState.MarkupVersionID, |
||
1295 | MARKUPINFO_ID = markup_info.ID, |
||
1296 | CREATE_DATE = DateTime.Now |
||
1297 | }; |
||
1298 | Entity.MARKUP_INFO_VERSION.AddObject(markup_info_version); |
||
1299 | Entity.SaveChanges(); |
||
1300 | } |
||
1301 | #endregion |
||
1302 | |||
1303 | |||
1304 | Entity.MARKUP_DATA.Where(data => data.PAGENUMBER == PageNo && data.MARKUPINFO_VERSION_ID == markup_info_version.ID).ToList().ForEach(item => |
||
1305 | { |
||
1306 | Entity.MARKUP_DATA.DeleteObject(item); |
||
1307 | }); |
||
1308 | Entity.SaveChanges(); |
||
1309 | 2ab012e8 | djkim | |
1310 | try |
||
1311 | { |
||
1312 | mlmarkup_data.ForEach(value => |
||
1313 | { |
||
1314 | Entity.MARKUP_DATA.AddObject(new MARKUP_DATA |
||
1315 | { |
||
1316 | ID = value.ID, |
||
1317 | DATA = value.DATA, |
||
1318 | DATA_TYPE = value.DATA_TYPE, |
||
1319 | PAGENUMBER = value.PAGENUMBER, |
||
1320 | c8e9b3e4 | ljiyeon | MARKUPINFO_VERSION_ID = markup_info_version.ID, |
1321 | 53880c83 | ljiyeon | SYMBOL_ID = value.SYMBOL_ID, |
1322 | c0977e97 | djkim | //GROUP_ID = value.GROUP_ID |
1323 | 2ab012e8 | djkim | }); |
1324 | }); |
||
1325 | Entity.SaveChanges(); |
||
1326 | } |
||
1327 | catch (Exception) |
||
1328 | { |
||
1329 | return false; |
||
1330 | } |
||
1331 | } |
||
1332 | return true; |
||
1333 | } |
||
1334 | |||
1335 | c0977e97 | djkim | //[OperationContract] |
1336 | //public long AddMarkupDataGroup(MARKUP_DATA_GROUP mARKUP_DATA_GROUP, string ProjectNo) |
||
1337 | //{ |
||
1338 | // try |
||
1339 | // { |
||
1340 | // using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString())) |
||
1341 | // { |
||
1342 | // Entity.AddToMARKUP_DATA_GROUP(mARKUP_DATA_GROUP); |
||
1343 | // //MARKUP_DATA_GROUP tt = Entity.MARKUP_DATA_GROUP.Where(info => info.ID == id).FirstOrDefault(); |
||
1344 | // Entity.SaveChanges(); |
||
1345 | 53880c83 | ljiyeon | |
1346 | c0977e97 | djkim | // return Entity.MARKUP_DATA_GROUP.ToList().LastOrDefault().ID; |
1347 | // } |
||
1348 | // } |
||
1349 | // catch (Exception) |
||
1350 | // { |
||
1351 | // return 0; |
||
1352 | // } |
||
1353 | //} |
||
1354 | //[OperationContract] |
||
1355 | //public bool UpdateMarkupDataGroup(long Group_ID, string ProjectNo) |
||
1356 | //{ |
||
1357 | // try |
||
1358 | // { |
||
1359 | // using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString())) |
||
1360 | // { |
||
1361 | // var UpdateItem = Entity.MARKUP_DATA_GROUP.Where(info => info.ID == Group_ID).FirstOrDefault(); |
||
1362 | // UpdateItem.STATE = 1; |
||
1363 | // Entity.SaveChanges(); |
||
1364 | // } |
||
1365 | // } |
||
1366 | // catch (Exception) |
||
1367 | // { |
||
1368 | // return false; |
||
1369 | // } |
||
1370 | // return true; |
||
1371 | //} |
||
1372 | 53880c83 | ljiyeon | [OperationContract] |
1373 | public bool UpdateMarkupData(string CommentID, long Group_ID, string ProjectNo) |
||
1374 | { |
||
1375 | try |
||
1376 | { |
||
1377 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
1378 | using (CIEntities Entity = new CIEntities(sCIConnString)) |
||
1379 | 53880c83 | ljiyeon | { |
1380 | var UpdateItem = Entity.MARKUP_DATA.Where(info => info.ID == CommentID).FirstOrDefault(); |
||
1381 | c0977e97 | djkim | //UpdateItem.GROUP_ID = Group_ID; |
1382 | 53880c83 | ljiyeon | Entity.SaveChanges(); |
1383 | } |
||
1384 | } |
||
1385 | catch (Exception) |
||
1386 | { |
||
1387 | return false; |
||
1388 | } |
||
1389 | return true; |
||
1390 | } |
||
1391 | 2ab012e8 | djkim | |
1392 | [OperationContract] |
||
1393 | public bool SaveSymbol(SYMBOL_PRIVATE symbol_private) |
||
1394 | { |
||
1395 | try |
||
1396 | { |
||
1397 | ff01c725 | humkyung | string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; |
1398 | using (KCOMDataModel.DataModel.KCOMEntities uc = new KCOMDataModel.DataModel.KCOMEntities(sConnString)) |
||
1399 | 2ab012e8 | djkim | { |
1400 | uc.AddToSYMBOL_PRIVATE(symbol_private); |
||
1401 | uc.SaveChanges(); |
||
1402 | } |
||
1403 | } |
||
1404 | catch(Exception) |
||
1405 | { |
||
1406 | return false; |
||
1407 | } |
||
1408 | return true; |
||
1409 | } |
||
1410 | [OperationContract] |
||
1411 | 498f0fc9 | ljiyeon | public bool AddPublicSymbol(SYMBOL_PUBLIC symbol) |
1412 | { |
||
1413 | try |
||
1414 | { |
||
1415 | ff01c725 | humkyung | string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; |
1416 | using (KCOMDataModel.DataModel.KCOMEntities uc = new KCOMDataModel.DataModel.KCOMEntities(sConnString)) |
||
1417 | 498f0fc9 | ljiyeon | { |
1418 | uc.AddToSYMBOL_PUBLIC(symbol); |
||
1419 | uc.SaveChanges(); |
||
1420 | } |
||
1421 | } |
||
1422 | catch (Exception) |
||
1423 | { |
||
1424 | return false; |
||
1425 | } |
||
1426 | return true; |
||
1427 | } |
||
1428 | [OperationContract] |
||
1429 | public bool DeleteSymbol(string symbol_id, int type) |
||
1430 | 2ab012e8 | djkim | { |
1431 | try |
||
1432 | { |
||
1433 | ff01c725 | humkyung | string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; |
1434 | using (KCOMEntities Entity = new KCOMEntities(sConnString)) |
||
1435 | 2ab012e8 | djkim | { |
1436 | 498f0fc9 | ljiyeon | if (type == 0) |
1437 | { |
||
1438 | string delItem_ID = symbol_id; |
||
1439 | var delitem = Entity.SYMBOL_PRIVATE.Where(data => data.ID == delItem_ID).FirstOrDefault(); |
||
1440 | Entity.SYMBOL_PRIVATE.DeleteObject(delitem); |
||
1441 | Entity.SaveChanges(); |
||
1442 | } |
||
1443 | else |
||
1444 | { |
||
1445 | string delItem_ID = symbol_id; |
||
1446 | var delitem = Entity.SYMBOL_PUBLIC.Where(data => data.ID == delItem_ID).FirstOrDefault(); |
||
1447 | Entity.SYMBOL_PUBLIC.DeleteObject(delitem); |
||
1448 | Entity.SaveChanges(); |
||
1449 | } |
||
1450 | 2ab012e8 | djkim | } |
1451 | } |
||
1452 | catch(Exception) |
||
1453 | { |
||
1454 | return false; |
||
1455 | } |
||
1456 | return true; |
||
1457 | } |
||
1458 | |||
1459 | [OperationContract] |
||
1460 | 498f0fc9 | ljiyeon | public bool RenameSymbol(string symbol_id, string name, int type) |
1461 | 2ab012e8 | djkim | { |
1462 | try |
||
1463 | { |
||
1464 | ff01c725 | humkyung | string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; |
1465 | using (KCOMEntities Entity = new KCOMEntities(sConnString)) |
||
1466 | 2ab012e8 | djkim | { |
1467 | 498f0fc9 | ljiyeon | if (type == 0) |
1468 | { |
||
1469 | var UpdateItem = Entity.SYMBOL_PRIVATE.Where(info => info.ID == symbol_id).FirstOrDefault(); |
||
1470 | UpdateItem.NAME = name; |
||
1471 | Entity.SaveChanges(); |
||
1472 | } |
||
1473 | else |
||
1474 | { |
||
1475 | var UpdateItem = Entity.SYMBOL_PUBLIC.Where(info => info.ID == symbol_id).FirstOrDefault(); |
||
1476 | UpdateItem.NAME = name; |
||
1477 | Entity.SaveChanges(); |
||
1478 | } |
||
1479 | 2ab012e8 | djkim | } |
1480 | } |
||
1481 | catch (Exception) |
||
1482 | { |
||
1483 | return false; |
||
1484 | } |
||
1485 | return true; |
||
1486 | } |
||
1487 | |||
1488 | [OperationContract] |
||
1489 | public bool AddCheckListHistory(string project_no, CHECK_LIST_HISTORY Check_History) |
||
1490 | { |
||
1491 | try |
||
1492 | ff01c725 | humkyung | { |
1493 | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
||
1494 | using (CIEntities Entity = new CIEntities(sCIConnString)) |
||
1495 | 2ab012e8 | djkim | { |
1496 | Entity.CHECK_LIST_HISTORY.AddObject(Check_History); |
||
1497 | Entity.SaveChanges(); |
||
1498 | } |
||
1499 | } |
||
1500 | catch (Exception) |
||
1501 | { |
||
1502 | return false; |
||
1503 | } |
||
1504 | return true; |
||
1505 | } |
||
1506 | [OperationContract] |
||
1507 | public bool SaveCheckListHistory(string project_no, string rev, CHECK_LIST_HISTORY Check_History) |
||
1508 | { |
||
1509 | try |
||
1510 | { |
||
1511 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
1512 | using (CIEntities Entity = new CIEntities(sCIConnString)) |
||
1513 | 2ab012e8 | djkim | { |
1514 | var item = Entity.CHECK_LIST_HISTORY.Where(info => info.REVISION == rev).FirstOrDefault(); |
||
1515 | item = Check_History; |
||
1516 | Entity.SaveChanges(); |
||
1517 | } |
||
1518 | } |
||
1519 | catch (Exception) |
||
1520 | { |
||
1521 | return false; |
||
1522 | } |
||
1523 | return true; |
||
1524 | } |
||
1525 | [OperationContract] |
||
1526 | public bool SaveCheckList(string project_no, string _id, CHECK_LIST Check_value) |
||
1527 | { |
||
1528 | try |
||
1529 | { |
||
1530 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
1531 | using (CIEntities Entity = new CIEntities(sCIConnString)) |
||
1532 | 2ab012e8 | djkim | { |
1533 | var item = Entity.CHECK_LIST.Where(info => info.ID == _id).FirstOrDefault(); |
||
1534 | item.TODOLIST = Check_value.TODOLIST; |
||
1535 | item.REMARK = Check_value.REMARK; |
||
1536 | item.STATUS = Check_value.STATUS; |
||
1537 | item.VENDOR = Check_value.VENDOR; |
||
1538 | item.REPLY = Check_value.REPLY; |
||
1539 | item.IMAGE_URL = Check_value.IMAGE_URL; |
||
1540 | item.IMAGE_ANCHOR = Check_value.IMAGE_ANCHOR; |
||
1541 | item.UPDATE_TIME = Check_value.UPDATE_TIME; |
||
1542 | 5de0c110 | ljiyeon | if(Check_value.STATUS == "False") |
1543 | { |
||
1544 | item.STATUS_DESC_OPEN = Check_value.STATUS_DESC_OPEN; |
||
1545 | } |
||
1546 | else |
||
1547 | { |
||
1548 | item.STATUS_DESC_CLOSE = Check_value.STATUS_DESC_CLOSE; |
||
1549 | } |
||
1550 | 2ab012e8 | djkim | Entity.SaveChanges(); |
1551 | } |
||
1552 | } |
||
1553 | catch (Exception) |
||
1554 | { |
||
1555 | return false; |
||
1556 | } |
||
1557 | return true; |
||
1558 | } |
||
1559 | [OperationContract] |
||
1560 | public bool AddCheckList(string project_no, CHECK_LIST Check_value) |
||
1561 | { |
||
1562 | try |
||
1563 | { |
||
1564 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
1565 | using (CIEntities Entity = new CIEntities(sCIConnString)) |
||
1566 | 2ab012e8 | djkim | { |
1567 | Entity.CHECK_LIST.AddObject(Check_value); |
||
1568 | Entity.SaveChanges(); |
||
1569 | } |
||
1570 | } |
||
1571 | catch (Exception) |
||
1572 | { |
||
1573 | return false; |
||
1574 | } |
||
1575 | return true; |
||
1576 | } |
||
1577 | |||
1578 | [OperationContract] |
||
1579 | public CHECK_LIST GetCheckList(string project_no, string _id) |
||
1580 | { |
||
1581 | CHECK_LIST Check_value = new CHECK_LIST(); |
||
1582 | try |
||
1583 | { |
||
1584 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
1585 | using (CIEntities Entity = new CIEntities(sCIConnString)) |
||
1586 | 2ab012e8 | djkim | { |
1587 | Check_value = Entity.CHECK_LIST.Where(info => info.ID == _id).FirstOrDefault(); |
||
1588 | } |
||
1589 | } |
||
1590 | catch (Exception) |
||
1591 | { |
||
1592 | return null; |
||
1593 | } |
||
1594 | return Check_value; |
||
1595 | } |
||
1596 | [OperationContract] |
||
1597 | public List<CHECK_LIST> GetUserCheckList(string project_no, string user_id, string doc_no) |
||
1598 | { |
||
1599 | List<CHECK_LIST> list = new List<CHECK_LIST>(); |
||
1600 | try |
||
1601 | { |
||
1602 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
1603 | using (CIEntities Entity = new CIEntities(sCIConnString)) |
||
1604 | 2ab012e8 | djkim | { |
1605 | 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(); |
||
1606 | } |
||
1607 | } |
||
1608 | catch (Exception) |
||
1609 | { |
||
1610 | return null; |
||
1611 | } |
||
1612 | return list; |
||
1613 | } |
||
1614 | [OperationContract] |
||
1615 | public List<CHECK_LIST_HISTORY> GetCheckListHistory(string project_no, string _id) |
||
1616 | { |
||
1617 | List<CHECK_LIST_HISTORY> history = new List<CHECK_LIST_HISTORY>(); |
||
1618 | try |
||
1619 | { |
||
1620 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
1621 | using (CIEntities Entity = new CIEntities(sCIConnString)) |
||
1622 | 2ab012e8 | djkim | { |
1623 | history = Entity.CHECK_LIST_HISTORY.Where(data => data.CHECKLIST_ID == _id).ToList(); |
||
1624 | } |
||
1625 | } |
||
1626 | catch (Exception) |
||
1627 | { |
||
1628 | return null; |
||
1629 | } |
||
1630 | return history; |
||
1631 | } |
||
1632 | [OperationContract] |
||
1633 | public CHECK_LIST_HISTORY GetCheckListHistoryFirstOrDefault(string project_no, string checklist_id, string rev) |
||
1634 | { |
||
1635 | CHECK_LIST_HISTORY Check_Item = new CHECK_LIST_HISTORY(); |
||
1636 | try |
||
1637 | { |
||
1638 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
1639 | using (CIEntities Entity = new CIEntities(sCIConnString)) |
||
1640 | 2ab012e8 | djkim | { |
1641 | Check_Item = Entity.CHECK_LIST_HISTORY.Where(info => info.CHECKLIST_ID == checklist_id && info.REVISION == rev).FirstOrDefault(); |
||
1642 | } |
||
1643 | } |
||
1644 | catch (Exception) |
||
1645 | { |
||
1646 | return null; |
||
1647 | } |
||
1648 | return Check_Item; |
||
1649 | } |
||
1650 | [OperationContract] |
||
1651 | public bool SavePageAngle(string project_no, List<DOCPAGE> _mldocpage) |
||
1652 | { |
||
1653 | try |
||
1654 | { |
||
1655 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
1656 | using (CIEntities Entity = new CIEntities(sCIConnString)) |
||
1657 | 2ab012e8 | djkim | { |
1658 | KCOMDataModel.DataModel.DOCPAGE _docpage = new KCOMDataModel.DataModel.DOCPAGE(); |
||
1659 | _mldocpage.ForEach(data => |
||
1660 | { |
||
1661 | _docpage = (from info in Entity.DOCPAGE |
||
1662 | where info.ID == data.ID |
||
1663 | select info).FirstOrDefault(); |
||
1664 | |||
1665 | if (_docpage.PAGE_ANGLE != data.PAGE_ANGLE) |
||
1666 | { |
||
1667 | _docpage.PAGE_ANGLE = data.PAGE_ANGLE; |
||
1668 | } |
||
1669 | }); |
||
1670 | |||
1671 | Entity.SaveChanges(); |
||
1672 | } |
||
1673 | } |
||
1674 | catch (Exception) |
||
1675 | { |
||
1676 | return false; |
||
1677 | } |
||
1678 | return true; |
||
1679 | } |
||
1680 | |||
1681 | [OperationContract] |
||
1682 | public MARKUP_INFO GetMarkupInfo(string project_no, string _id) |
||
1683 | { |
||
1684 | MARKUP_INFO markupInfo = new MARKUP_INFO(); |
||
1685 | |||
1686 | try |
||
1687 | { |
||
1688 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
1689 | using (CIEntities Entity = new CIEntities(sCIConnString)) |
||
1690 | 2ab012e8 | djkim | { |
1691 | markupInfo = Entity.MARKUP_INFO.Where(entity => entity.DOCINFO_ID == _id).OrderByDescending(i => i.CONSOLIDATE).OrderByDescending(j => j.CREATE_TIME).FirstOrDefault(); |
||
1692 | } |
||
1693 | } |
||
1694 | catch (Exception) |
||
1695 | { |
||
1696 | return null; |
||
1697 | } |
||
1698 | return markupInfo; |
||
1699 | } |
||
1700 | |||
1701 | [OperationContract] |
||
1702 | public List<string> GetMarkupDataListperPage(string project_no, string _markupinfoid, int _pageNo) |
||
1703 | { |
||
1704 | List<string> markupdata = new List<string>(); |
||
1705 | MARKUP_INFO_VERSION markup_info_version = new MARKUP_INFO_VERSION(); |
||
1706 | try |
||
1707 | { |
||
1708 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
1709 | using (CIEntities Entity = new CIEntities(sCIConnString)) |
||
1710 | 2ab012e8 | djkim | { |
1711 | markup_info_version = (from version in Entity.MARKUP_INFO_VERSION |
||
1712 | where version.MARKUPINFO_ID == _markupinfoid |
||
1713 | orderby version.CREATE_DATE descending |
||
1714 | select version).First(); |
||
1715 | markupdata = (from data in Entity.MARKUP_DATA |
||
1716 | where data.MARKUPINFO_VERSION_ID == markup_info_version.ID && data.PAGENUMBER == _pageNo |
||
1717 | select data.DATA).ToList(); |
||
1718 | } |
||
1719 | } |
||
1720 | catch (Exception) |
||
1721 | { |
||
1722 | return null; |
||
1723 | } |
||
1724 | return markupdata; |
||
1725 | } |
||
1726 | |||
1727 | [OperationContract] |
||
1728 | public bool AddMarkupInfo(string project_no, MARKUP_INFO value) |
||
1729 | { |
||
1730 | try |
||
1731 | { |
||
1732 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
1733 | using (CIEntities Entity = new CIEntities(sCIConnString)) |
||
1734 | 2ab012e8 | djkim | { |
1735 | Entity.MARKUP_INFO.AddObject(value); |
||
1736 | Entity.SaveChanges(); |
||
1737 | } |
||
1738 | } |
||
1739 | catch (Exception) |
||
1740 | { |
||
1741 | return false; |
||
1742 | } |
||
1743 | return true; |
||
1744 | } |
||
1745 | |||
1746 | [OperationContract] |
||
1747 | public bool AddMarkupInfoVersion(string project_no, MARKUP_INFO_VERSION value) |
||
1748 | { |
||
1749 | try |
||
1750 | { |
||
1751 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
1752 | using (CIEntities Entity = new CIEntities(sCIConnString)) |
||
1753 | 2ab012e8 | djkim | { |
1754 | Entity.MARKUP_INFO_VERSION.AddObject(value); |
||
1755 | Entity.SaveChanges(); |
||
1756 | } |
||
1757 | } |
||
1758 | catch (Exception) |
||
1759 | { |
||
1760 | return false; |
||
1761 | } |
||
1762 | return true; |
||
1763 | } |
||
1764 | |||
1765 | [OperationContract] |
||
1766 | public bool AddMarkupData(string project_no, MARKUP_DATA value) |
||
1767 | { |
||
1768 | try |
||
1769 | { |
||
1770 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
1771 | using (CIEntities Entity = new CIEntities(sCIConnString)) |
||
1772 | 2ab012e8 | djkim | { |
1773 | Entity.MARKUP_DATA.AddObject(value); |
||
1774 | Entity.SaveChanges(); |
||
1775 | } |
||
1776 | } |
||
1777 | catch (Exception) |
||
1778 | { |
||
1779 | return false; |
||
1780 | } |
||
1781 | return true; |
||
1782 | } |
||
1783 | |||
1784 | [OperationContract] |
||
1785 | public bool AvoidMarkupInfo(string project_no, string _doc_id) |
||
1786 | { |
||
1787 | try |
||
1788 | { |
||
1789 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
1790 | using (CIEntities Entity = new CIEntities(sCIConnString)) |
||
1791 | 2ab012e8 | djkim | { |
1792 | var item = Entity.MARKUP_INFO.Where(entity => entity.DOCINFO_ID == _doc_id).OrderByDescending(i => i.CONSOLIDATE).OrderByDescending(j => j.CREATE_TIME).FirstOrDefault(); |
||
1793 | item.AVOID_CONSOLIDATE = 1; |
||
1794 | Entity.SaveChanges(); |
||
1795 | } |
||
1796 | } |
||
1797 | catch (Exception) |
||
1798 | { |
||
1799 | return false; |
||
1800 | } |
||
1801 | return true; |
||
1802 | } |
||
1803 | |||
1804 | [OperationContract] |
||
1805 | public bool SaveMarkupInfo(string project_no, string _id, MARKUP_INFO value) |
||
1806 | { |
||
1807 | try |
||
1808 | { |
||
1809 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
1810 | using (CIEntities Entity = new CIEntities(sCIConnString)) |
||
1811 | 2ab012e8 | djkim | { |
1812 | var item = Entity.MARKUP_INFO.Where(info => info.ID == _id).FirstOrDefault(); |
||
1813 | item = value; |
||
1814 | Entity.SaveChanges(); |
||
1815 | } |
||
1816 | } |
||
1817 | catch (Exception) |
||
1818 | { |
||
1819 | return false; |
||
1820 | } |
||
1821 | return true; |
||
1822 | } |
||
1823 | [OperationContract] |
||
1824 | public List<MARKUP_DATA> GetMarkupDataList(string project_no, string _versionid) |
||
1825 | { |
||
1826 | List<MARKUP_DATA> mlresult = new List<MARKUP_DATA>(); |
||
1827 | |||
1828 | try |
||
1829 | { |
||
1830 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
1831 | using (CIEntities Entity = new CIEntities(sCIConnString)) |
||
1832 | 2ab012e8 | djkim | { |
1833 | mlresult = Entity.MARKUP_DATA.Where(data => data.MARKUPINFO_VERSION_ID == _versionid).ToList(); |
||
1834 | } |
||
1835 | } |
||
1836 | catch (Exception) |
||
1837 | { |
||
1838 | return null; |
||
1839 | } |
||
1840 | return mlresult; |
||
1841 | } |
||
1842 | |||
1843 | [OperationContract] |
||
1844 | public bool Consolidate(string project_no, string _user_id, string _doc_id, List<MarkupInfoItem> markupInfoItems) |
||
1845 | { |
||
1846 | try |
||
1847 | { |
||
1848 | List<KCOMDataModel.DataModel.MARKUP_DATA> instanceDataSet = new List<KCOMDataModel.DataModel.MARKUP_DATA>(); |
||
1849 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
1850 | using (CIEntities Entity = new CIEntities(sCIConnString)) |
||
1851 | 2ab012e8 | djkim | { |
1852 | 0c624340 | djkim | var markupInfo = Entity.MARKUP_INFO.Where(entity => entity.DOCINFO_ID == _doc_id && entity.CONSOLIDATE == 1).OrderByDescending(j => j.CREATE_TIME).FirstOrDefault(); |
1853 | if (markupInfo != null) |
||
1854 | 2ab012e8 | djkim | { |
1855 | markupInfo.AVOID_CONSOLIDATE = 1; |
||
1856 | } |
||
1857 | |||
1858 | foreach (MarkupInfoItem item in markupInfoItems) |
||
1859 | { |
||
1860 | Entity.MARKUP_DATA.Where(data => data.MARKUPINFO_VERSION_ID == item.MarkupVersionID).ToList().ForEach(d => |
||
1861 | { |
||
1862 | instanceDataSet.Add(d); |
||
1863 | }); |
||
1864 | } |
||
1865 | |||
1866 | KCOMDataModel.DataModel.MARKUP_INFO info = new KCOMDataModel.DataModel.MARKUP_INFO(); |
||
1867 | info.ID = shortGuid(); |
||
1868 | info.CONSOLIDATE = 1; |
||
1869 | info.CREATE_TIME = DateTime.Now; |
||
1870 | info.DOCINFO_ID = _doc_id; |
||
1871 | info.UPDATE_TIME = DateTime.Now; |
||
1872 | info.USER_ID = _user_id; |
||
1873 | info.AVOID_CONSOLIDATE = 0; |
||
1874 | |||
1875 | Entity.MARKUP_INFO.AddObject(info); |
||
1876 | Entity.SaveChanges(); |
||
1877 | |||
1878 | |||
1879 | KCOMDataModel.DataModel.MARKUP_INFO_VERSION info2 = new KCOMDataModel.DataModel.MARKUP_INFO_VERSION |
||
1880 | { |
||
1881 | ID = shortGuid(), |
||
1882 | CREATE_DATE = DateTime.Now, |
||
1883 | MARKUP_INFO = info, |
||
1884 | }; |
||
1885 | Entity.SaveChanges(); |
||
1886 | |||
1887 | foreach (var item in instanceDataSet) |
||
1888 | { |
||
1889 | Entity.MARKUP_DATA.AddObject(new KCOMDataModel.DataModel.MARKUP_DATA |
||
1890 | { |
||
1891 | ID = shortGuid(), |
||
1892 | DATA = item.DATA, |
||
1893 | DATA_TYPE = item.DATA_TYPE, |
||
1894 | PAGENUMBER = item.PAGENUMBER, |
||
1895 | c8e9b3e4 | ljiyeon | MARKUP_INFO_VERSION = info2, |
1896 | 53880c83 | ljiyeon | SYMBOL_ID = item.SYMBOL_ID, |
1897 | c0977e97 | djkim | //GROUP_ID = item.GROUP_ID |
1898 | 2ab012e8 | djkim | }); |
1899 | } |
||
1900 | Entity.SaveChanges(); |
||
1901 | |||
1902 | |||
1903 | } |
||
1904 | } |
||
1905 | catch (Exception) |
||
1906 | { |
||
1907 | return false; |
||
1908 | } |
||
1909 | return true; |
||
1910 | } |
||
1911 | |||
1912 | 49d444ef | ljiyeon | |
1913 | [OperationContract] |
||
1914 | public FinalPDFResult ConsolidateMergedPDF(string project_no, string _user_id, string _doc_id, List<MarkupInfoItem> markupInfoItems, string ProjectNo, string DocInfoID, string CreateUserID) |
||
1915 | { |
||
1916 | bool consolidate = false; |
||
1917 | try |
||
1918 | { |
||
1919 | List<KCOMDataModel.DataModel.MARKUP_DATA> instanceDataSet = new List<KCOMDataModel.DataModel.MARKUP_DATA>(); |
||
1920 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
1921 | using (CIEntities Entity = new CIEntities(sCIConnString)) |
||
1922 | 49d444ef | ljiyeon | { |
1923 | var markupInfo = Entity.MARKUP_INFO.Where(entity => entity.DOCINFO_ID == _doc_id).OrderByDescending(i => i.CONSOLIDATE).OrderByDescending(j => j.CREATE_TIME).FirstOrDefault(); |
||
1924 | if (markupInfo.CONSOLIDATE == 1) |
||
1925 | { |
||
1926 | markupInfo.AVOID_CONSOLIDATE = 1; |
||
1927 | } |
||
1928 | |||
1929 | foreach (MarkupInfoItem item in markupInfoItems) |
||
1930 | { |
||
1931 | Entity.MARKUP_DATA.Where(data => data.MARKUPINFO_VERSION_ID == item.MarkupVersionID).ToList().ForEach(d => |
||
1932 | { |
||
1933 | instanceDataSet.Add(d); |
||
1934 | }); |
||
1935 | } |
||
1936 | |||
1937 | KCOMDataModel.DataModel.MARKUP_INFO info = new KCOMDataModel.DataModel.MARKUP_INFO(); |
||
1938 | info.ID = shortGuid(); |
||
1939 | info.CONSOLIDATE = 1; |
||
1940 | info.CREATE_TIME = DateTime.Now; |
||
1941 | info.DOCINFO_ID = _doc_id; |
||
1942 | info.UPDATE_TIME = DateTime.Now; |
||
1943 | info.USER_ID = _user_id; |
||
1944 | info.AVOID_CONSOLIDATE = 0; |
||
1945 | |||
1946 | Entity.MARKUP_INFO.AddObject(info); |
||
1947 | Entity.SaveChanges(); |
||
1948 | |||
1949 | |||
1950 | KCOMDataModel.DataModel.MARKUP_INFO_VERSION info2 = new KCOMDataModel.DataModel.MARKUP_INFO_VERSION |
||
1951 | { |
||
1952 | ID = shortGuid(), |
||
1953 | CREATE_DATE = DateTime.Now, |
||
1954 | MARKUP_INFO = info, |
||
1955 | }; |
||
1956 | Entity.SaveChanges(); |
||
1957 | |||
1958 | foreach (var item in instanceDataSet) |
||
1959 | { |
||
1960 | Entity.MARKUP_DATA.AddObject(new KCOMDataModel.DataModel.MARKUP_DATA |
||
1961 | { |
||
1962 | ID = shortGuid(), |
||
1963 | DATA = item.DATA, |
||
1964 | DATA_TYPE = item.DATA_TYPE, |
||
1965 | PAGENUMBER = item.PAGENUMBER, |
||
1966 | MARKUP_INFO_VERSION = info2, |
||
1967 | 53880c83 | ljiyeon | SYMBOL_ID = item.SYMBOL_ID, |
1968 | c0977e97 | djkim | //GROUP_ID = item.GROUP_ID |
1969 | 49d444ef | ljiyeon | }); |
1970 | } |
||
1971 | Entity.SaveChanges(); |
||
1972 | |||
1973 | |||
1974 | } |
||
1975 | consolidate = true; |
||
1976 | } |
||
1977 | catch (Exception) |
||
1978 | { |
||
1979 | consolidate = false; |
||
1980 | } |
||
1981 | FinalPDFResult _result = new FinalPDFResult(); |
||
1982 | if (consolidate == true) |
||
1983 | { |
||
1984 | RemFinalPDFObject remObj = null; |
||
1985 | try |
||
1986 | { |
||
1987 | string _finalID = shortGuid(); |
||
1988 | int _DocTotalPages = -1; |
||
1989 | string docItemId; |
||
1990 | |||
1991 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
1992 | using (CIEntities _ci = new CIEntities(sCIConnString)) |
||
1993 | 49d444ef | ljiyeon | { |
1994 | var _doc = _ci.DOCINFO.Where(info => info.ID == DocInfoID); |
||
1995 | |||
1996 | if (_doc.Count() > 0) |
||
1997 | { |
||
1998 | _DocTotalPages = _doc.First().PAGE_COUNT; |
||
1999 | docItemId = _doc.First().DOCUMENT_ID; |
||
2000 | } |
||
2001 | else |
||
2002 | { |
||
2003 | _result.Status = FinalStatus.Error; |
||
2004 | _result.Exception = "페이지 정보를 가져올 수 없습니다."; |
||
2005 | return _result; |
||
2006 | } |
||
2007 | } |
||
2008 | |||
2009 | var Items = GetMarkupInfoItems(ProjectNo, DocInfoID); |
||
2010 | if (_DocTotalPages > 0) |
||
2011 | { |
||
2012 | var item2 = Items.Cast<MarkupInfoItem>().Where(d => d.Consolidate == 1 && d.AvoidConsolidate == 0).FirstOrDefault(); |
||
2013 | FINAL_PDF fm = new FINAL_PDF() |
||
2014 | { |
||
2015 | ID = _finalID, |
||
2016 | PROJECT_NO = ProjectNo, |
||
2017 | DOCINFO_ID = DocInfoID, |
||
2018 | DOCUMENT_ID = docItemId, |
||
2019 | MARKUPINFO_ID = item2.MarkupInfoID, |
||
2020 | CREATE_USER_ID = CreateUserID, |
||
2021 | TOTAL_PAGE = _DocTotalPages, |
||
2022 | CREATE_DATETIME = DateTime.Now, |
||
2023 | STATUS = (int)IFinalPDF.FinalStatus.Insert |
||
2024 | }; |
||
2025 | ff01c725 | humkyung | |
2026 | string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; |
||
2027 | using (KCOMEntities _entity = new KCOMEntities(sConnString)) |
||
2028 | 49d444ef | ljiyeon | { |
2029 | _entity.AddToFINAL_PDF(fm); |
||
2030 | _entity.SaveChanges(System.Data.Objects.SaveOptions.AcceptAllChangesAfterSave); |
||
2031 | }; |
||
2032 | |||
2033 | System.Runtime.Remoting.Channels.IChannel _ch = System.Runtime.Remoting.Channels.ChannelServices.GetChannel("tcp"); |
||
2034 | if (_ch == null) |
||
2035 | { |
||
2036 | chan = new TcpChannel(); |
||
2037 | _ChanID = chan.ChannelName; |
||
2038 | System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(chan, false); |
||
2039 | // Create an instance of the remote object |
||
2040 | |||
2041 | ff01c725 | humkyung | using (KCOMEntities ec = new KCOMEntities(sConnString)) |
2042 | 49d444ef | ljiyeon | { |
2043 | |||
2044 | //remObj = (RemFinalPDFObject)Activator.GetObject(typeof(RemFinalPDFObject), |
||
2045 | // "tcp://localhost:9092/remFinalPDF"); |
||
2046 | remObj = (RemFinalPDFObject)Activator.GetObject(typeof(RemFinalPDFObject), |
||
2047 | //"tcp://192.168.0.67:9092/remFinalPDF"); |
||
2048 | "tcp://192.168.0.67:9092/remFinalPDF"); |
||
2049 | } |
||
2050 | |||
2051 | //"tcp://localhost:8080/remFinalPDF"); |
||
2052 | |||
2053 | _result = remObj.SetFinalPDF(ProjectNo, _finalID); |
||
2054 | _result.FinalID = _finalID; |
||
2055 | _result.Status = FinalStatus.Success; |
||
2056 | |||
2057 | //MarkupToPDF.MarkupToPDF fa = new MarkupToPDF.MarkupToPDF(); |
||
2058 | //fa.MakeFinalPDF(fm); |
||
2059 | } |
||
2060 | else |
||
2061 | { |
||
2062 | _ChanID = _ch.ChannelName; |
||
2063 | } |
||
2064 | } |
||
2065 | } |
||
2066 | catch (Exception ex) |
||
2067 | { |
||
2068 | _result.Status = FinalStatus.Error; |
||
2069 | |||
2070 | if (ex.GetType() == typeof(System.Net.Sockets.SocketException)) |
||
2071 | _result.Exception = "Final Server Not Connection"; |
||
2072 | } |
||
2073 | finally |
||
2074 | { |
||
2075 | remObj = null; |
||
2076 | if (System.Runtime.Remoting.Channels.ChannelServices.GetChannel("tcp") != null) |
||
2077 | System.Runtime.Remoting.Channels.ChannelServices.UnregisterChannel(chan); |
||
2078 | |||
2079 | GC.Collect(2); |
||
2080 | } |
||
2081 | } |
||
2082 | return _result; |
||
2083 | } |
||
2084 | 2ab012e8 | djkim | [OperationContract] |
2085 | 04a7385a | djkim | public bool TeamConsolidate(string project_no, string _user_id, string _doc_id, List<MarkupInfoItem> markupInfoItems) |
2086 | { |
||
2087 | try |
||
2088 | { |
||
2089 | List<KCOMDataModel.DataModel.MARKUP_DATA> instanceDataSet = new List<KCOMDataModel.DataModel.MARKUP_DATA>(); |
||
2090 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
2091 | using (CIEntities Entity = new CIEntities(sCIConnString)) |
||
2092 | 04a7385a | djkim | { |
2093 | 285635d3 | taeseongkim | var members = GetMemberQuery(Entity, _user_id); |
2094 | |||
2095 | string user_dept = ""; |
||
2096 | |||
2097 | if(members.Count() > 0) |
||
2098 | { |
||
2099 | user_dept = members.First().DEPARTMENT; |
||
2100 | } |
||
2101 | |||
2102 | var markupInfos = Entity.MARKUP_INFO.Where(entity => entity.DOCINFO_ID == _doc_id && entity.PART_CONSOLIDATE == 1) |
||
2103 | .OrderByDescending(j => j.CREATE_TIME).ToList(); |
||
2104 | |||
2105 | 0c624340 | djkim | foreach (var markupinfo in markupInfos) |
2106 | 04a7385a | djkim | { |
2107 | 285635d3 | taeseongkim | string markupdept = ""; |
2108 | |||
2109 | var markupMembers = GetMemberQuery(Entity, markupinfo.USER_ID); |
||
2110 | |||
2111 | if (markupMembers.Count() > 0) |
||
2112 | { |
||
2113 | markupdept = markupMembers.First().DEPARTMENT; |
||
2114 | } |
||
2115 | |||
2116 | 0c624340 | djkim | if (user_dept == markupdept) |
2117 | { |
||
2118 | markupinfo.AVOID_CONSOLIDATE = 1; |
||
2119 | } |
||
2120 | 04a7385a | djkim | } |
2121 | |||
2122 | foreach (MarkupInfoItem item in markupInfoItems) |
||
2123 | { |
||
2124 | Entity.MARKUP_DATA.Where(data => data.MARKUPINFO_VERSION_ID == item.MarkupVersionID).ToList().ForEach(d => |
||
2125 | { |
||
2126 | instanceDataSet.Add(d); |
||
2127 | }); |
||
2128 | } |
||
2129 | |||
2130 | KCOMDataModel.DataModel.MARKUP_INFO info = new KCOMDataModel.DataModel.MARKUP_INFO(); |
||
2131 | info.ID = shortGuid(); |
||
2132 | info.PART_CONSOLIDATE = 1; |
||
2133 | info.CREATE_TIME = DateTime.Now; |
||
2134 | info.DOCINFO_ID = _doc_id; |
||
2135 | info.UPDATE_TIME = DateTime.Now; |
||
2136 | info.USER_ID = _user_id; |
||
2137 | info.AVOID_CONSOLIDATE = 0; |
||
2138 | |||
2139 | Entity.MARKUP_INFO.AddObject(info); |
||
2140 | Entity.SaveChanges(); |
||
2141 | |||
2142 | |||
2143 | KCOMDataModel.DataModel.MARKUP_INFO_VERSION info2 = new KCOMDataModel.DataModel.MARKUP_INFO_VERSION |
||
2144 | { |
||
2145 | ID = shortGuid(), |
||
2146 | CREATE_DATE = DateTime.Now, |
||
2147 | MARKUP_INFO = info, |
||
2148 | }; |
||
2149 | Entity.SaveChanges(); |
||
2150 | |||
2151 | foreach (var item in instanceDataSet) |
||
2152 | { |
||
2153 | Entity.MARKUP_DATA.AddObject(new KCOMDataModel.DataModel.MARKUP_DATA |
||
2154 | { |
||
2155 | ID = shortGuid(), |
||
2156 | DATA = item.DATA, |
||
2157 | DATA_TYPE = item.DATA_TYPE, |
||
2158 | PAGENUMBER = item.PAGENUMBER, |
||
2159 | c8e9b3e4 | ljiyeon | MARKUP_INFO_VERSION = info2, |
2160 | 53880c83 | ljiyeon | SYMBOL_ID = item.SYMBOL_ID, |
2161 | c0977e97 | djkim | //GROUP_ID = item.GROUP_ID |
2162 | 04a7385a | djkim | }); |
2163 | } |
||
2164 | Entity.SaveChanges(); |
||
2165 | |||
2166 | |||
2167 | } |
||
2168 | } |
||
2169 | catch (Exception) |
||
2170 | { |
||
2171 | return false; |
||
2172 | } |
||
2173 | return true; |
||
2174 | } |
||
2175 | |||
2176 | [OperationContract] |
||
2177 | 2ab012e8 | djkim | [ServiceKnownType(typeof(MEMBER))] |
2178 | public MEMBER GetMember(string project_no, string user_id) |
||
2179 | { |
||
2180 | 503cb09e | taeseongkim | MEMBER rstmember = null; |
2181 | 2ab012e8 | djkim | try |
2182 | { |
||
2183 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
2184 | using (CIEntities Entity = new CIEntities(sCIConnString)) |
||
2185 | 2ab012e8 | djkim | { |
2186 | 285635d3 | taeseongkim | var members = GetMemberQuery(Entity, user_id); |
2187 | 503cb09e | taeseongkim | |
2188 | 285635d3 | taeseongkim | if(members.Count() > 0) |
2189 | { |
||
2190 | rstmember = members.First(); |
||
2191 | } |
||
2192 | } |
||
2193 | } |
||
2194 | catch (Exception ex) |
||
2195 | { |
||
2196 | return null; |
||
2197 | } |
||
2198 | return rstmember; |
||
2199 | } |
||
2200 | 503cb09e | taeseongkim | |
2201 | 285635d3 | taeseongkim | private List<MEMBER> GetMemberQuery(System.Data.Objects.ObjectContext context, string UserID) |
2202 | { |
||
2203 | List<MEMBER> result = new List<MEMBER>(); |
||
2204 | 503cb09e | taeseongkim | |
2205 | 285635d3 | taeseongkim | try |
2206 | { |
||
2207 | string query = "SELECT members.ID,members.NAME,members.DEPARTMENT FROM CIEntities.MEMBER as members where members.ID = @userId"; |
||
2208 | |||
2209 | var param = new[] { new System.Data.Objects.ObjectParameter("userId", UserID) }; |
||
2210 | |||
2211 | System.Data.Objects.ObjectQuery<System.Data.Common.DbDataRecord> memberQuery |
||
2212 | = context.CreateQuery<System.Data.Common.DbDataRecord>(query, param); |
||
2213 | |||
2214 | if (memberQuery.Count() > 0) |
||
2215 | { |
||
2216 | foreach (var dataRecord in memberQuery) |
||
2217 | 503cb09e | taeseongkim | { |
2218 | 285635d3 | taeseongkim | MEMBER member = new MEMBER(); |
2219 | |||
2220 | string userName = dataRecord["NAME"]?.ToString().Trim(); |
||
2221 | string ID = dataRecord["ID"]?.ToString().Trim(); |
||
2222 | string depatment = dataRecord["DEPARTMENT"]?.ToString().Trim(); |
||
2223 | a7372e37 | taeseongkim | |
2224 | 285635d3 | taeseongkim | member.NAME = userName; |
2225 | member.ID = ID; |
||
2226 | member.DEPARTMENT = depatment; |
||
2227 | 503cb09e | taeseongkim | |
2228 | 285635d3 | taeseongkim | result.Add(member); |
2229 | 503cb09e | taeseongkim | } |
2230 | 2ab012e8 | djkim | } |
2231 | } |
||
2232 | ff01c725 | humkyung | catch (Exception ex) |
2233 | 2ab012e8 | djkim | { |
2234 | 285635d3 | taeseongkim | throw new Exception("GetMember(System.Data.Objects.ObjectContext context, string UserID) " , ex); |
2235 | 2ab012e8 | djkim | } |
2236 | 285635d3 | taeseongkim | |
2237 | return result; |
||
2238 | 2ab012e8 | djkim | } |
2239 | |||
2240 | ff01c725 | humkyung | [WebMethod] |
2241 | 2ab012e8 | djkim | [OperationContract] |
2242 | public List<SYMBOL_PRIVATE> GetSymbolList(string user_id) |
||
2243 | { |
||
2244 | List<SYMBOL_PRIVATE> Custom_List = new List<SYMBOL_PRIVATE>(); |
||
2245 | try |
||
2246 | { |
||
2247 | ff01c725 | humkyung | string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; |
2248 | using (KCOMEntities Entity = new KCOMEntities(sConnString)) |
||
2249 | 2ab012e8 | djkim | { |
2250 | Custom_List = Entity.SYMBOL_PRIVATE.Where(data => data.MEMBER_USER_ID == user_id).ToList(); |
||
2251 | } |
||
2252 | } |
||
2253 | ff01c725 | humkyung | catch (Exception ex) |
2254 | 2ab012e8 | djkim | { |
2255 | return null; |
||
2256 | } |
||
2257 | return Custom_List; |
||
2258 | } |
||
2259 | [OperationContract] |
||
2260 | public List<string> GetPublicSymbolDeptList() |
||
2261 | { |
||
2262 | List<string> Custom_List = new List<string>(); |
||
2263 | try |
||
2264 | { |
||
2265 | ff01c725 | humkyung | string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; |
2266 | using (KCOMEntities Entity = new KCOMEntities(sConnString)) |
||
2267 | 2ab012e8 | djkim | { |
2268 | b3251eea | ljiyeon | Custom_List = Entity.SYMBOL_PUBLIC.Select(data => data.DEPARTMENT).Distinct().ToList(); |
2269 | 2ab012e8 | djkim | } |
2270 | } |
||
2271 | catch (Exception) |
||
2272 | { |
||
2273 | return null; |
||
2274 | } |
||
2275 | return Custom_List; |
||
2276 | } |
||
2277 | [OperationContract] |
||
2278 | public List<SYMBOL_PUBLIC> GetPublicSymbolList(string dept) |
||
2279 | { |
||
2280 | List<SYMBOL_PUBLIC> Custom_List = new List<SYMBOL_PUBLIC>(); |
||
2281 | try |
||
2282 | { |
||
2283 | ff01c725 | humkyung | string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; |
2284 | using (KCOMEntities Entity = new KCOMEntities(sConnString)) |
||
2285 | 2ab012e8 | djkim | { |
2286 | if(!string.IsNullOrEmpty(dept)) |
||
2287 | { |
||
2288 | Custom_List = Entity.SYMBOL_PUBLIC.Where(data => data.DEPARTMENT == dept).ToList(); |
||
2289 | } |
||
2290 | else |
||
2291 | { |
||
2292 | Custom_List = Entity.SYMBOL_PUBLIC.ToList(); |
||
2293 | } |
||
2294 | |||
2295 | } |
||
2296 | } |
||
2297 | catch (Exception) |
||
2298 | { |
||
2299 | return null; |
||
2300 | } |
||
2301 | return Custom_List; |
||
2302 | } |
||
2303 | |||
2304 | /// <summary> |
||
2305 | /// |
||
2306 | /// </summary> |
||
2307 | /// <param name="id">symbol id</param> |
||
2308 | /// <param name="type"> 0 : PRIVATE, 1 : PUBLIC</param> |
||
2309 | /// <returns></returns> |
||
2310 | [OperationContract] |
||
2311 | public string GetSymbolData(string id, int type) |
||
2312 | { |
||
2313 | string result; |
||
2314 | try |
||
2315 | { |
||
2316 | ff01c725 | humkyung | string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; |
2317 | using (KCOMEntities Entity = new KCOMEntities(sConnString)) |
||
2318 | 2ab012e8 | djkim | { |
2319 | if(type == 0) |
||
2320 | { |
||
2321 | result = Entity.SYMBOL_PRIVATE.Where(data => data.ID == id).FirstOrDefault().DATA; |
||
2322 | } |
||
2323 | else |
||
2324 | { |
||
2325 | result = Entity.SYMBOL_PUBLIC.Where(data => data.ID == id).FirstOrDefault().DATA; |
||
2326 | } |
||
2327 | } |
||
2328 | } |
||
2329 | catch (Exception) |
||
2330 | { |
||
2331 | return null; |
||
2332 | } |
||
2333 | return result; |
||
2334 | } |
||
2335 | 53880c83 | ljiyeon | [OperationContract] |
2336 | public string GetSymbolImageURL(string id, int type) |
||
2337 | { |
||
2338 | string result; |
||
2339 | try |
||
2340 | { |
||
2341 | ff01c725 | humkyung | string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; |
2342 | using (KCOMEntities Entity = new KCOMEntities(sConnString)) |
||
2343 | 53880c83 | ljiyeon | { |
2344 | if (type == 0) |
||
2345 | { |
||
2346 | result = Entity.SYMBOL_PRIVATE.Where(data => data.ID == id).FirstOrDefault().IMAGE_URL; |
||
2347 | } |
||
2348 | else |
||
2349 | { |
||
2350 | result = Entity.SYMBOL_PUBLIC.Where(data => data.ID == id).FirstOrDefault().IMAGE_URL; |
||
2351 | } |
||
2352 | } |
||
2353 | } |
||
2354 | catch (Exception) |
||
2355 | { |
||
2356 | return null; |
||
2357 | } |
||
2358 | return result; |
||
2359 | } |
||
2360 | 2ab012e8 | djkim | [OperationContract] |
2361 | public string GetSignData(string project_no, string user_id) |
||
2362 | { |
||
2363 | string result = null; |
||
2364 | try |
||
2365 | { |
||
2366 | dfb95d0f | djkim | string ifsign = getEnsembleSign(user_id); |
2367 | if (string.IsNullOrEmpty(ifsign)) |
||
2368 | 2ab012e8 | djkim | { |
2369 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
2370 | var ModelWFConnectionString = sCIConnString; |
||
2371 | dfb95d0f | djkim | if (null != ModelWFConnectionString) |
2372 | 2ab012e8 | djkim | { |
2373 | dfb95d0f | djkim | using (CIEntities entity = new CIEntities(ModelWFConnectionString)) |
2374 | 2ab012e8 | djkim | { |
2375 | dfb95d0f | djkim | var _sign = entity.SIGN_INFO.Where(sin => sin.MEMBER_USER_ID == user_id); |
2376 | if (_sign.Count() > 0) |
||
2377 | { |
||
2378 | result = _sign.First().SIGN_STR; |
||
2379 | } |
||
2380 | else |
||
2381 | { |
||
2382 | return null; |
||
2383 | } |
||
2384 | 2ab012e8 | djkim | } |
2385 | } |
||
2386 | } |
||
2387 | dfb95d0f | djkim | else |
2388 | { |
||
2389 | result = ifsign; |
||
2390 | } |
||
2391 | |||
2392 | 2ab012e8 | djkim | } |
2393 | catch (Exception) |
||
2394 | { |
||
2395 | return null; |
||
2396 | } |
||
2397 | return result; |
||
2398 | } |
||
2399 | |||
2400 | [OperationContract] |
||
2401 | public string GetProjectName(string project_no) |
||
2402 | { |
||
2403 | string result = null; |
||
2404 | |||
2405 | try |
||
2406 | { |
||
2407 | ff01c725 | humkyung | string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; |
2408 | using (KCOMDataModel.DataModel.KCOMEntities Entity = new KCOMDataModel.DataModel.KCOMEntities(sConnString)) |
||
2409 | 2ab012e8 | djkim | { |
2410 | result = Entity.RUN_PROJECTS.Where(i => i.PROJECT_NO == project_no).FirstOrDefault().PROJECT_NAME.ToString(); |
||
2411 | } |
||
2412 | } |
||
2413 | catch (Exception) |
||
2414 | { |
||
2415 | return null; |
||
2416 | } |
||
2417 | return result; |
||
2418 | } |
||
2419 | |||
2420 | [OperationContract] |
||
2421 | public List<DOCUMENT_ITEM> GetPreRevSelect(string project_no, string doc_no, string current_rev) |
||
2422 | { |
||
2423 | List<DOCUMENT_ITEM> result = new List<DOCUMENT_ITEM>(); |
||
2424 | |||
2425 | try |
||
2426 | { |
||
2427 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
2428 | using (CIEntities Entity = new CIEntities(sCIConnString)) |
||
2429 | 2ab012e8 | djkim | { |
2430 | result = Entity.DOCUMENT_ITEM.Where(i => i.PROJECT_NO == project_no |
||
2431 | && i.DOCUMENT_NO == doc_no |
||
2432 | && i.REVISION != current_rev).OrderByDescending(i => i.GROUP_NO).ToList(); |
||
2433 | } |
||
2434 | } |
||
2435 | catch (Exception) |
||
2436 | { |
||
2437 | return null; |
||
2438 | } |
||
2439 | return result; |
||
2440 | } |
||
2441 | |||
2442 | [OperationContract] |
||
2443 | public DOCINFO GetDocInfoOneSelect(string project_no, string doc_id) |
||
2444 | { |
||
2445 | DOCINFO docinfo = null; |
||
2446 | |||
2447 | try |
||
2448 | { |
||
2449 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
2450 | using (CIEntities Entity = new CIEntities(sCIConnString)) |
||
2451 | 2ab012e8 | djkim | { |
2452 | docinfo = (from info in Entity.DOCINFO |
||
2453 | where info.DOCUMENT_ID == doc_id |
||
2454 | && info.PROJECT_NO == project_no |
||
2455 | select info).First(); |
||
2456 | } |
||
2457 | } |
||
2458 | catch (Exception) |
||
2459 | { |
||
2460 | return null; |
||
2461 | } |
||
2462 | return docinfo; |
||
2463 | } |
||
2464 | |||
2465 | [OperationContract] |
||
2466 | public List<MarkupInfoItem> GetPrintDocItemList(string project_no, string doc_id, List<MarkupInfoItem> _markupInfoList) |
||
2467 | { |
||
2468 | MarkupInfoItem _result = null; |
||
2469 | List<MarkupInfoItem> markupinfo = new List<MarkupInfoItem>(); |
||
2470 | try |
||
2471 | { |
||
2472 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
2473 | using (CIEntities Entity = new CIEntities(sCIConnString)) |
||
2474 | 2ab012e8 | djkim | { |
2475 | var docitem = (from info in Entity.DOCINFO |
||
2476 | where info.DOCUMENT_ID == doc_id |
||
2477 | && info.PROJECT_NO == project_no |
||
2478 | select info).First(); |
||
2479 | |||
2480 | foreach (MARKUP_INFO markinfo in docitem.MARKUP_INFO) |
||
2481 | { |
||
2482 | 285635d3 | taeseongkim | var members = GetMemberQuery(Entity, markinfo.USER_ID); |
2483 | |||
2484 | MEMBER member = new MEMBER(); |
||
2485 | |||
2486 | if (members.Count() > 0) |
||
2487 | { |
||
2488 | member = members.First(); |
||
2489 | } |
||
2490 | |||
2491 | 2ab012e8 | djkim | string displaycolor = null; |
2492 | 285635d3 | taeseongkim | |
2493 | 2ab012e8 | djkim | try |
2494 | { |
||
2495 | displaycolor = _markupInfoList.Where(info => info.MarkupInfoID == markinfo.ID).First().DisplayColor; |
||
2496 | } |
||
2497 | catch(Exception) |
||
2498 | { |
||
2499 | displaycolor = "#FFFFFF"; |
||
2500 | } |
||
2501 | |||
2502 | _result = new MarkupInfoItem |
||
2503 | { |
||
2504 | MarkupInfoID = markinfo.ID, |
||
2505 | Consolidate = markinfo.CONSOLIDATE, |
||
2506 | CreateTime = markinfo.UPDATE_TIME.HasValue ? markinfo.UPDATE_TIME.Value : markinfo.CREATE_TIME, |
||
2507 | DisplayColor = displaycolor, |
||
2508 | UserID = markinfo.USER_ID, |
||
2509 | UserName = member.NAME, |
||
2510 | Depatment = member.DEPARTMENT, |
||
2511 | }; |
||
2512 | |||
2513 | _result.MarkupList = new List<IKCOM.MarkupItem>(); |
||
2514 | var markup_Version = markinfo.MARKUP_INFO_VERSION.OrderByDescending(p => p.CREATE_DATE).First(); |
||
2515 | |||
2516 | foreach (MARKUP_DATA markdata in markup_Version.MARKUP_DATA) |
||
2517 | { |
||
2518 | MarkupItem markitem = new MarkupItem() |
||
2519 | { |
||
2520 | ID = markdata.ID, |
||
2521 | PageNumber = markdata.PAGENUMBER, |
||
2522 | }; |
||
2523 | _result.MarkupList.Add(markitem); |
||
2524 | } |
||
2525 | |||
2526 | _result.PageCount = _result.MarkupList.GroupBy(i => i.PageNumber).Count(); |
||
2527 | |||
2528 | markupinfo.Add(_result); |
||
2529 | } |
||
2530 | } |
||
2531 | } |
||
2532 | 285635d3 | taeseongkim | catch (Exception ex) |
2533 | 2ab012e8 | djkim | { |
2534 | return null; |
||
2535 | } |
||
2536 | return markupinfo; |
||
2537 | } |
||
2538 | 04a7385a | djkim | |
2539 | [OperationContract] |
||
2540 | public bool AddMessage(string project_no, TALK value) |
||
2541 | { |
||
2542 | try |
||
2543 | { |
||
2544 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
2545 | using (CIEntities entity = new CIEntities(sCIConnString)) |
||
2546 | 04a7385a | djkim | { |
2547 | entity.TALK.AddObject(value); |
||
2548 | entity.SaveChanges(); |
||
2549 | } |
||
2550 | } |
||
2551 | catch (Exception) |
||
2552 | { |
||
2553 | return false; |
||
2554 | } |
||
2555 | return true; |
||
2556 | } |
||
2557 | |||
2558 | [OperationContract] |
||
2559 | public List<TALK> GetMessage(string project_no, string doc_id) |
||
2560 | { |
||
2561 | List<TALK> result = new List<TALK>(); |
||
2562 | try |
||
2563 | { |
||
2564 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
2565 | using (CIEntities entity = new CIEntities(sCIConnString)) |
||
2566 | 04a7385a | djkim | { |
2567 | result = entity.TALK.Where(data => data.DOCUMENT_ID == doc_id).ToList(); |
||
2568 | } |
||
2569 | } |
||
2570 | ff01c725 | humkyung | catch (Exception ex) |
2571 | 04a7385a | djkim | { |
2572 | return result; |
||
2573 | } |
||
2574 | return result; |
||
2575 | } |
||
2576 | dfb95d0f | djkim | |
2577 | |||
2578 | #region Legacy System I/F |
||
2579 | /// <summary> |
||
2580 | /// Ensemble+ Sign Data Return |
||
2581 | /// </summary> |
||
2582 | /// <param name="user_id"></param> |
||
2583 | /// <returns></returns> |
||
2584 | private string getEnsembleSign(string user_id) |
||
2585 | { |
||
2586 | ac4f1e13 | taeseongkim | string result = null; |
2587 | dfb95d0f | djkim | string soapurl = string.Empty; |
2588 | ac4f1e13 | taeseongkim | |
2589 | dfb95d0f | djkim | try |
2590 | { |
||
2591 | ff01c725 | humkyung | string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; |
2592 | using (KCOMEntities Entity = new KCOMEntities(sConnString)) |
||
2593 | dfb95d0f | djkim | { |
2594 | var item = Entity.PROPERTIES.Where(d => d.TYPE == "UpLoadServiceUrl").FirstOrDefault(); |
||
2595 | ac4f1e13 | taeseongkim | |
2596 | if (item != null) |
||
2597 | { |
||
2598 | soapurl = item.VALUE; |
||
2599 | |||
2600 | WebClient webClient = new WebClient(); |
||
2601 | string data = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ens=\"http://EnsemblePlus.Webservice\"> <soapenv:Header/> <soapenv:Body> <ens:checkoutSignImage>" |
||
2602 | + "<ens:sUserNo>" + user_id + "</ens:sUserNo>" |
||
2603 | + "</ens:checkoutSignImage> </soapenv:Body></soapenv:Envelope>"; |
||
2604 | webClient.Headers.Add(HttpRequestHeader.ContentType, "text/xml"); |
||
2605 | webClient.Headers.Add("SOAPAction", "http://EnsemblePlus.Webservice"); |
||
2606 | var _result = webClient.UploadString(new Uri(soapurl), data); |
||
2607 | XmlDocument xmlDoc = new XmlDocument(); |
||
2608 | xmlDoc.LoadXml(_result); |
||
2609 | XmlNodeList list = xmlDoc.GetElementsByTagName("checkoutSignImageResponse"); |
||
2610 | |||
2611 | foreach (XmlNode xn in list) |
||
2612 | { |
||
2613 | result = xn["checkoutSignImageReturn"].InnerText; |
||
2614 | } |
||
2615 | |||
2616 | if (result.Contains("No business object")) |
||
2617 | { |
||
2618 | result = null; |
||
2619 | } |
||
2620 | } |
||
2621 | else |
||
2622 | { |
||
2623 | result = null; |
||
2624 | } |
||
2625 | dfb95d0f | djkim | } |
2626 | ac4f1e13 | taeseongkim | |
2627 | dfb95d0f | djkim | } |
2628 | catch (Exception ex) |
||
2629 | ac4f1e13 | taeseongkim | { |
2630 | result = null; |
||
2631 | dfb95d0f | djkim | } |
2632 | |||
2633 | ac4f1e13 | taeseongkim | return result; |
2634 | dfb95d0f | djkim | } |
2635 | #endregion |
||
2636 | 6c9fec59 | djkim | |
2637 | #region Final Service |
||
2638 | [OperationContract] |
||
2639 | [ServiceKnownType(typeof(DOCINFO))] |
||
2640 | public DOCINFO FinalPDF_GetDocinfo(string project_no, string docinfo_id) |
||
2641 | { |
||
2642 | DOCINFO docinfo = null; |
||
2643 | |||
2644 | try |
||
2645 | { |
||
2646 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
2647 | using (CIEntities _entity = new CIEntities(sCIConnString)) |
||
2648 | 6c9fec59 | djkim | { |
2649 | var doc = _entity.DOCINFO.Where(x => x.ID == docinfo_id).FirstOrDefault(); |
||
2650 | if(doc != null) |
||
2651 | { |
||
2652 | docinfo = new DOCINFO() |
||
2653 | { |
||
2654 | ID = doc.ID, |
||
2655 | DOCUMENT_ID = doc.DOCUMENT_ID, |
||
2656 | PAGE_COUNT = doc.PAGE_COUNT, |
||
2657 | ORIGINAL_FILE = doc.ORIGINAL_FILE, |
||
2658 | PROJECT_NO = doc.PROJECT_NO |
||
2659 | }; |
||
2660 | } |
||
2661 | } |
||
2662 | } |
||
2663 | catch (Exception) |
||
2664 | { |
||
2665 | throw; |
||
2666 | } |
||
2667 | return docinfo; |
||
2668 | } |
||
2669 | [OperationContract] |
||
2670 | [ServiceKnownType(typeof(DOCUMENT_ITEM))] |
||
2671 | public DOCUMENT_ITEM FinalPDF_GetDocumentItem(string project_no, string document_id) |
||
2672 | { |
||
2673 | DOCUMENT_ITEM item = null; |
||
2674 | |||
2675 | try |
||
2676 | { |
||
2677 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
2678 | using (CIEntities _entity = new CIEntities(sCIConnString)) |
||
2679 | 6c9fec59 | djkim | { |
2680 | var doc = _entity.DOCUMENT_ITEM.Where(x => x.DOCUMENT_ID == document_id).FirstOrDefault(); |
||
2681 | if(doc != null) |
||
2682 | { |
||
2683 | item = new DOCUMENT_ITEM() |
||
2684 | { |
||
2685 | ID = doc.ID, |
||
2686 | ORIGINAL_FILE = doc.ORIGINAL_FILE, |
||
2687 | PROJECT_NO = doc.PROJECT_NO, |
||
2688 | DOCUMENT_ID = doc.DOCUMENT_ID, |
||
2689 | DOCUMENT_NO = doc.DOCUMENT_NO, |
||
2690 | DOCUMENT_NAME = doc.DOCUMENT_NAME, |
||
2691 | ab5aa762 | taeseongkim | //ENSEMBLEINFO_URL = doc.ENSEMBLEINFO_URL, |
2692 | 6c9fec59 | djkim | GROUP_NO = doc.GROUP_NO, |
2693 | RESULT = doc.RESULT, |
||
2694 | REVISION = doc.REVISION, |
||
2695 | RESULT_FILE = doc.RESULT_FILE |
||
2696 | }; |
||
2697 | } |
||
2698 | |||
2699 | } |
||
2700 | } |
||
2701 | catch (Exception) |
||
2702 | { |
||
2703 | throw; |
||
2704 | } |
||
2705 | return item; |
||
2706 | } |
||
2707 | [OperationContract] |
||
2708 | [ServiceKnownType(typeof(MARKUP_DATA))] |
||
2709 | public List<MARKUP_DATA> FinalPDF_GetMarkupdata(string project_no, string docinfo_id) |
||
2710 | { |
||
2711 | List<MARKUP_DATA> results = new List<MARKUP_DATA>(); |
||
2712 | |||
2713 | try |
||
2714 | { |
||
2715 | c0977e97 | djkim | //using (CIEntities _entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
2716 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
2717 | using (CIEntities _entity = new CIEntities(sCIConnString)) |
||
2718 | 6c9fec59 | djkim | { |
2719 | var datas = _entity.MARKUP_DATA.Where(x => x.MARKUP_INFO_VERSION.MARKUP_INFO.DOCINFO_ID == docinfo_id |
||
2720 | && x.MARKUP_INFO_VERSION.MARKUP_INFO.CONSOLIDATE == 1 |
||
2721 | && x.MARKUP_INFO_VERSION.MARKUP_INFO.AVOID_CONSOLIDATE == 0 |
||
2722 | && x.MARKUP_INFO_VERSION.MARKUP_INFO.PART_CONSOLIDATE == 0).ToList(); |
||
2723 | foreach (var data in datas) |
||
2724 | { |
||
2725 | MARKUP_DATA d = new MARKUP_DATA() |
||
2726 | { |
||
2727 | ID = data.ID, |
||
2728 | c0977e97 | djkim | //GROUP_ID = data.GROUP_ID, |
2729 | 6c9fec59 | djkim | SYMBOL_ID = data.SYMBOL_ID, |
2730 | DATA = data.DATA, |
||
2731 | abaa85b4 | djkim | DATA_TYPE = data.DATA_TYPE, |
2732 | MARKUPINFO_VERSION_ID = data.MARKUPINFO_VERSION_ID, |
||
2733 | PAGENUMBER = data.PAGENUMBER |
||
2734 | 6c9fec59 | djkim | }; |
2735 | results.Add(d); |
||
2736 | } |
||
2737 | } |
||
2738 | } |
||
2739 | catch (Exception) |
||
2740 | { |
||
2741 | throw; |
||
2742 | } |
||
2743 | return results; |
||
2744 | } |
||
2745 | [OperationContract] |
||
2746 | [ServiceKnownType(typeof(MARKUP_INFO))] |
||
2747 | public MARKUP_INFO FinalPDF_GetMarkupinfo(string project_no, string docinfo_id) |
||
2748 | { |
||
2749 | MARKUP_INFO markupInfo = null; |
||
2750 | |||
2751 | try |
||
2752 | { |
||
2753 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
2754 | using (CIEntities _entity = new CIEntities(sCIConnString)) |
||
2755 | 6c9fec59 | djkim | { |
2756 | var tmp = _entity.MARKUP_INFO.Where(x => x.DOCINFO_ID == docinfo_id && x.CONSOLIDATE == 1 && x.AVOID_CONSOLIDATE == 0 && x.PART_CONSOLIDATE == 0).FirstOrDefault(); |
||
2757 | if (tmp != null) |
||
2758 | { |
||
2759 | markupInfo = new MARKUP_INFO() |
||
2760 | { |
||
2761 | ID = tmp.ID, |
||
2762 | DOCINFO_ID = tmp.DOCINFO_ID, |
||
2763 | USER_ID = tmp.USER_ID |
||
2764 | }; |
||
2765 | } |
||
2766 | } |
||
2767 | } |
||
2768 | catch (Exception) |
||
2769 | { |
||
2770 | throw; |
||
2771 | } |
||
2772 | return markupInfo; |
||
2773 | } |
||
2774 | [OperationContract] |
||
2775 | abaa85b4 | djkim | [ServiceKnownType(typeof(FINAL_PDF))] |
2776 | public List<FINAL_PDF> FinalPDF_GetFinalPDFs(string final_id) |
||
2777 | { |
||
2778 | List<FINAL_PDF> results = new List<FINAL_PDF>(); |
||
2779 | |||
2780 | try |
||
2781 | { |
||
2782 | ff01c725 | humkyung | string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; |
2783 | using (KCOMEntities _entity = new KCOMEntities(sConnString)) |
||
2784 | abaa85b4 | djkim | { |
2785 | var finalList = _entity.FINAL_PDF.Where(final => final.ID == final_id).ToList(); |
||
2786 | foreach(var final in finalList) |
||
2787 | { |
||
2788 | FINAL_PDF pdf = new FINAL_PDF() |
||
2789 | { |
||
2790 | ID = final.ID, |
||
2791 | DOCINFO_ID = final.DOCINFO_ID, |
||
2792 | DOCUMENT_ID = final.DOCUMENT_ID, |
||
2793 | STATUS = final.STATUS, |
||
2794 | CURRENT_PAGE = final.CURRENT_PAGE, |
||
2795 | CREATE_DATETIME = final.CREATE_DATETIME, |
||
2796 | START_DATETIME = final.START_DATETIME, |
||
2797 | END_DATETIME = final.END_DATETIME, |
||
2798 | EXCEPTION = final.EXCEPTION, |
||
2799 | PROJECT_NO = final.PROJECT_NO, |
||
2800 | TOTAL_PAGE = final.TOTAL_PAGE, |
||
2801 | MARKUPINFO_ID = final.MARKUPINFO_ID, |
||
2802 | CREATE_USER_ID = final.CREATE_USER_ID |
||
2803 | }; |
||
2804 | results.Add(pdf); |
||
2805 | } |
||
2806 | } |
||
2807 | } |
||
2808 | catch (Exception) |
||
2809 | { |
||
2810 | throw; |
||
2811 | } |
||
2812 | return results; |
||
2813 | } |
||
2814 | [OperationContract] |
||
2815 | 6c9fec59 | djkim | [ServiceKnownType(typeof(DOCPAGE))] |
2816 | public List<DOCPAGE> FinalPDF_GetDocpage(string project_no, string docinfo_id) |
||
2817 | { |
||
2818 | List<DOCPAGE> results = new List<DOCPAGE>(); |
||
2819 | |||
2820 | try |
||
2821 | { |
||
2822 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
2823 | using (CIEntities _entity = new CIEntities(sCIConnString)) |
||
2824 | 6c9fec59 | djkim | { |
2825 | var pages = _entity.DOCPAGE.Where(x => x.DOCINFO_ID == docinfo_id).OrderBy(x => x.PAGE_NUMBER).ToList(); |
||
2826 | foreach(var page in pages) |
||
2827 | { |
||
2828 | DOCPAGE p = new DOCPAGE() |
||
2829 | { |
||
2830 | PAGE_ANGLE = page.PAGE_ANGLE, |
||
2831 | PAGE_NUMBER = page.PAGE_NUMBER, |
||
2832 | PAGE_HEIGHT = page.PAGE_HEIGHT, |
||
2833 | PAGE_WIDTH = page.PAGE_WIDTH, |
||
2834 | DOCINFO_ID = page.DOCINFO_ID |
||
2835 | }; |
||
2836 | results.Add(p); |
||
2837 | } |
||
2838 | } |
||
2839 | } |
||
2840 | catch (Exception) |
||
2841 | { |
||
2842 | throw; |
||
2843 | } |
||
2844 | return results; |
||
2845 | } |
||
2846 | abaa85b4 | djkim | [OperationContract] |
2847 | public bool FinalPDF_SetFinalPDFStatus(string final_id, FinalStatus status) |
||
2848 | { |
||
2849 | bool result = false; |
||
2850 | |||
2851 | try |
||
2852 | { |
||
2853 | ff01c725 | humkyung | string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; |
2854 | using (KCOMEntities _entity = new KCOMEntities(sConnString)) |
||
2855 | abaa85b4 | djkim | { |
2856 | var tmp = _entity.FINAL_PDF.Where(x => x.ID == final_id).FirstOrDefault(); |
||
2857 | if(tmp != null) |
||
2858 | { |
||
2859 | switch(status) |
||
2860 | { |
||
2861 | case FinalStatus.Create: |
||
2862 | tmp.START_DATETIME = DateTime.Now; |
||
2863 | break; |
||
2864 | case FinalStatus.Success: |
||
2865 | tmp.END_DATETIME = DateTime.Now; |
||
2866 | tmp.EXCEPTION = string.Empty; |
||
2867 | break; |
||
2868 | } |
||
2869 | tmp.STATUS = (int)status; |
||
2870 | _entity.SaveChanges(); |
||
2871 | result = true; |
||
2872 | } |
||
2873 | } |
||
2874 | } |
||
2875 | catch (Exception) |
||
2876 | { |
||
2877 | throw; |
||
2878 | } |
||
2879 | return result; |
||
2880 | } |
||
2881 | |||
2882 | 3c71b3a5 | taeseongkim | /// <summary> |
2883 | /// 현재 진행중인 Final PDF 가 없거나 Success 일 경우에만 true return |
||
2884 | /// </summary> |
||
2885 | /// <param name="DocInfoID"></param> |
||
2886 | /// <param name="MarkupInfoID"></param> |
||
2887 | /// <param name="CreateUserID"></param> |
||
2888 | /// <returns></returns> |
||
2889 | abaa85b4 | djkim | [OperationContract] |
2890 | 3b62305d | ljiyeon | public bool FinalPDF_GetFinalPDFStatus(string DocInfoID, string MarkupInfoID, string CreateUserID) |
2891 | { |
||
2892 | bool result = false; |
||
2893 | |||
2894 | try |
||
2895 | { |
||
2896 | ff01c725 | humkyung | string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; |
2897 | using (KCOMEntities _entity = new KCOMEntities(sConnString)) |
||
2898 | 3b62305d | ljiyeon | { |
2899 | 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(); |
2900 | 3b62305d | ljiyeon | if (finalpdf != null) |
2901 | { |
||
2902 | 3c71b3a5 | taeseongkim | if (finalpdf.STATUS == (int)FinalStatus.Success) |
2903 | 3b62305d | ljiyeon | { |
2904 | result = true; |
||
2905 | } |
||
2906 | } |
||
2907 | 3c71b3a5 | taeseongkim | else |
2908 | result = true; |
||
2909 | 3b62305d | ljiyeon | } |
2910 | } |
||
2911 | catch (Exception) |
||
2912 | { |
||
2913 | throw; |
||
2914 | } |
||
2915 | return result; |
||
2916 | } |
||
2917 | |||
2918 | [OperationContract] |
||
2919 | abaa85b4 | djkim | public bool FinalPDF_SetCurrentPage(string final_id, int currentpage) |
2920 | { |
||
2921 | bool result = false; |
||
2922 | |||
2923 | try |
||
2924 | { |
||
2925 | ff01c725 | humkyung | string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; |
2926 | using (KCOMEntities _entity = new KCOMEntities(sConnString)) |
||
2927 | abaa85b4 | djkim | { |
2928 | var tmp = _entity.FINAL_PDF.Where(x => x.ID == final_id).FirstOrDefault(); |
||
2929 | if (tmp != null) |
||
2930 | { |
||
2931 | tmp.CURRENT_PAGE = currentpage; |
||
2932 | _entity.SaveChanges(); |
||
2933 | result = true; |
||
2934 | } |
||
2935 | } |
||
2936 | } |
||
2937 | catch (Exception) |
||
2938 | { |
||
2939 | throw; |
||
2940 | } |
||
2941 | return result; |
||
2942 | } |
||
2943 | [OperationContract] |
||
2944 | public bool FinalPDF_SetError(string final_id, string msg) |
||
2945 | { |
||
2946 | bool result = false; |
||
2947 | |||
2948 | try |
||
2949 | { |
||
2950 | ff01c725 | humkyung | string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; |
2951 | using (KCOMEntities _entity = new KCOMEntities(sConnString)) |
||
2952 | abaa85b4 | djkim | { |
2953 | var tmp = _entity.FINAL_PDF.Where(x => x.ID == final_id).FirstOrDefault(); |
||
2954 | if (tmp != null) |
||
2955 | { |
||
2956 | tmp.STATUS = (int)FinalStatus.Error; |
||
2957 | tmp.EXCEPTION = DateTime.Now.ToShortDateString() + " " + msg; |
||
2958 | _entity.SaveChanges(); |
||
2959 | result = true; |
||
2960 | } |
||
2961 | } |
||
2962 | } |
||
2963 | catch (Exception) |
||
2964 | { |
||
2965 | throw; |
||
2966 | } |
||
2967 | return result; |
||
2968 | } |
||
2969 | |||
2970 | [OperationContract] |
||
2971 | public bool FinalPDF_SetFinalResultPath(string project_no, string document_id, string url) |
||
2972 | { |
||
2973 | bool result = false; |
||
2974 | |||
2975 | try |
||
2976 | { |
||
2977 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
2978 | using (CIEntities _entity = new CIEntities(sCIConnString)) |
||
2979 | abaa85b4 | djkim | { |
2980 | var item = _entity.DOCUMENT_ITEM.Where(d => d.DOCUMENT_ID == document_id).FirstOrDefault(); |
||
2981 | if (item != null) |
||
2982 | { |
||
2983 | item.RESULT_FILE = url; |
||
2984 | _entity.SaveChanges(); |
||
2985 | result = true; |
||
2986 | } |
||
2987 | } |
||
2988 | } |
||
2989 | catch (Exception) |
||
2990 | { |
||
2991 | throw; |
||
2992 | } |
||
2993 | return result; |
||
2994 | } |
||
2995 | [OperationContract] |
||
2996 | [ServiceKnownType(typeof(MEMBER))] |
||
2997 | public MEMBER FinalPDF_GetCommentMember(string project_no, string markupdata_id) |
||
2998 | { |
||
2999 | MEMBER member = null; |
||
3000 | try |
||
3001 | { |
||
3002 | ff01c725 | humkyung | string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
3003 | using (CIEntities _entity = new CIEntities(sCIConnString)) |
||
3004 | abaa85b4 | djkim | { |
3005 | var data = _entity.MARKUP_DATA.Where(x => x.ID == markupdata_id).FirstOrDefault(); |
||
3006 | string user_id = data.MARKUP_INFO_VERSION.MARKUP_INFO.USER_ID; |
||
3007 | 285635d3 | taeseongkim | |
3008 | var person = GetMemberQuery(_entity,user_id); |
||
3009 | |||
3010 | if(person.Count() > 0) |
||
3011 | abaa85b4 | djkim | { |
3012 | 285635d3 | taeseongkim | member = person.First(); |
3013 | abaa85b4 | djkim | } |
3014 | } |
||
3015 | } |
||
3016 | catch (Exception) |
||
3017 | { |
||
3018 | throw; |
||
3019 | } |
||
3020 | 285635d3 | taeseongkim | |
3021 | abaa85b4 | djkim | return member; |
3022 | } |
||
3023 | |||
3024 | [OperationContract] |
||
3025 | [ServiceKnownType(typeof(PROPERTIES))] |
||
3026 | public List<PROPERTIES> FinalPDF_GetProperties(string project_no) |
||
3027 | { |
||
3028 | List<PROPERTIES> results = new List<PROPERTIES>(); |
||
3029 | try |
||
3030 | { |
||
3031 | ff01c725 | humkyung | string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; |
3032 | using (KCOMEntities _entity = new KCOMEntities(sConnString)) |
||
3033 | abaa85b4 | djkim | { |
3034 | var _items = _entity.PROPERTIES.Where(x => x.PROPERTY == project_no).ToList(); |
||
3035 | foreach(var item in _items) |
||
3036 | { |
||
3037 | PROPERTIES pROPERTIES = new PROPERTIES() |
||
3038 | { |
||
3039 | ID = item.ID, |
||
3040 | PROPERTY = item.PROPERTY, |
||
3041 | TYPE = item.TYPE, |
||
3042 | VALUE = item.VALUE |
||
3043 | }; |
||
3044 | results.Add(pROPERTIES); |
||
3045 | } |
||
3046 | } |
||
3047 | |||
3048 | } |
||
3049 | catch (Exception) |
||
3050 | { |
||
3051 | throw; |
||
3052 | } |
||
3053 | return results; |
||
3054 | } |
||
3055 | 6c9fec59 | djkim | #endregion |
3056 | ffddbe4e | djkim | } |
3057 | 787a4489 | KangIngu | } |