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