markus / KCOM_API / ServiceDeepView.svc.cs @ 53880c83
이력 | 보기 | 이력해설 | 다운로드 (94.4 KB)
1 | 787a4489 | KangIngu | using IFinalPDF; |
---|---|---|---|
2 | using IKCOM; |
||
3 | using KCOMDataModel.Common; |
||
4 | using KCOMDataModel.DataModel; |
||
5 | 992a98b4 | KangIngu | using MARKUS; |
6 | 787a4489 | KangIngu | using System; |
7 | using System.Collections.Generic; |
||
8 | 2ab012e8 | djkim | using System.Collections.ObjectModel; |
9 | 787a4489 | KangIngu | using System.Linq; |
10 | using System.Runtime.Remoting.Channels.Tcp; |
||
11 | using System.Runtime.Serialization; |
||
12 | using System.ServiceModel; |
||
13 | using System.ServiceModel.Activation; |
||
14 | using System.Text; |
||
15 | using System.Windows; |
||
16 | |||
17 | namespace KCOM_API |
||
18 | { |
||
19 | // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "ServiceDeepView" in code, svc and config file together. |
||
20 | // 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. |
||
21 | [ServiceContract(Namespace = "")] |
||
22 | [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] |
||
23 | public partial class ServiceDeepView : System.Web.Services.WebService |
||
24 | { |
||
25 | //[OperationContract] |
||
26 | //public List<HoneyheadTEXT> GetSearchText(int pageNo, string filePath,bool IsAllPage) //0아 아니면 지정 페이지 |
||
27 | //{ |
||
28 | |||
29 | // return null; |
||
30 | //} |
||
31 | |||
32 | |||
33 | [OperationContract] |
||
34 | public KCOM_SystemInfo GetSystemData() |
||
35 | { |
||
36 | try |
||
37 | { |
||
38 | using (KCOMEntities uc = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
||
39 | { |
||
40 | var SystemInfoSet = uc.PROPERTIES.Where(data => data.TYPE == "SystemInfo").ToList(); |
||
41 | |||
42 | KCOM_SystemInfo sysInfo = new KCOM_SystemInfo(); |
||
43 | |||
44 | var url = SystemInfoSet.Where(data => data.PROPERTY == "Url").FirstOrDefault(); |
||
45 | if (url != null) |
||
46 | { |
||
47 | sysInfo.HostName = url.VALUE; |
||
48 | } |
||
49 | |||
50 | url = SystemInfoSet.Where(data => data.PROPERTY == "Port").FirstOrDefault(); |
||
51 | if (url != null) |
||
52 | { |
||
53 | sysInfo.HostPort = url.VALUE; |
||
54 | } |
||
55 | 9a1ce1db | KangIngu | |
56 | url = uc.PROPERTIES.Where(data => data.TYPE == "STAMP").FirstOrDefault(); |
||
57 | if(url != null) |
||
58 | { |
||
59 | sysInfo.STAMP = url.VALUE; |
||
60 | } |
||
61 | 787a4489 | KangIngu | return sysInfo; |
62 | } |
||
63 | } |
||
64 | catch (Exception ex) |
||
65 | { |
||
66 | } |
||
67 | return null; |
||
68 | GC.Collect(2); |
||
69 | } |
||
70 | |||
71 | private static string shortGuid() |
||
72 | { |
||
73 | byte[] bytes = new byte[16]; |
||
74 | using (var provider = System.Security.Cryptography.RandomNumberGenerator.Create()) |
||
75 | { |
||
76 | provider.GetBytes(bytes); |
||
77 | } |
||
78 | |||
79 | var guid = new Guid(bytes); |
||
80 | |||
81 | return Convert.ToBase64String(guid.ToByteArray()) |
||
82 | .Substring(0, 10) |
||
83 | .Replace("/", "") |
||
84 | .Replace("+", "") + DateTime.UtcNow.Ticks.ToString("x"); |
||
85 | } |
||
86 | |||
87 | |||
88 | [OperationContract] |
||
89 | 992a98b4 | KangIngu | public List<FAVORITE_DOC> GetFavoriteVP(string PrjNo, string userID, string sharepointItemID) |
90 | { |
||
91 | |||
92 | |||
93 | using (KCOMEntities dc = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
||
94 | { |
||
95 | |||
96 | int flagString = Convert.ToInt32(FAVORITE_FLAG.Personal); |
||
97 | List<FAVORITE_DOC> favoriteListSet = new List<FAVORITE_DOC>(); |
||
98 | //dc.FAVORITE_DOC.Where(data => data.PROJECT_NO == PrjNo && data.DOCUMENT_ID == sharepointItemID && data.FLAG != |
||
99 | // flagString).ToList().ForEach(data => favoriteListSet.Add(data)); |
||
100 | |||
101 | |||
102 | //dc.FAVORITE_DOC.Where(data => data.PROJECT_NO == PrjNo && data.MEMBER_USER_ID == userID).ToList().ForEach(data => favoriteListSet.Add(data)); |
||
103 | |||
104 | favoriteListSet = dc.FAVORITE_DOC.Where(data => data.PROJECT_NO == PrjNo && data.MEMBER_USER_ID == userID && data.DOCUMENT_ID == sharepointItemID).ToList(); |
||
105 | |||
106 | //favoriteListSet = favoriteListSet.Distinct().ToList(); |
||
107 | return favoriteListSet; |
||
108 | } |
||
109 | } |
||
110 | [OperationContract] |
||
111 | public bool EditFavoriteVP(string prjNo, string userID, string docID, int state, string description) |
||
112 | { |
||
113 | using (KCOMEntities dc = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
||
114 | { |
||
115 | //List<FAVORITE_DOC> favoriteSet = dc.FAVORITE_DOC.Where(data => data.PROJECT_NO == prjNo && data.MEMBER_USER_ID == userID |
||
116 | // && data.PAGE_NO == SavePageNo && data.CREATE_TIME == createTime).ToList(); |
||
117 | List<FAVORITE_DOC> favoriteSet = dc.FAVORITE_DOC.Where(data => data.PROJECT_NO == prjNo && data.MEMBER_USER_ID == userID |
||
118 | && data.ID == docID).ToList(); |
||
119 | try |
||
120 | { |
||
121 | |||
122 | if (favoriteSet.Count > 0) |
||
123 | { |
||
124 | var FavoriteVP_Instance = favoriteSet.First(); |
||
125 | |||
126 | FavoriteVP_Instance.DESCRIPTION = description; |
||
127 | FavoriteVP_Instance.FLAG = state; |
||
128 | |||
129 | dc.SaveChanges(); |
||
130 | |||
131 | return true; |
||
132 | } |
||
133 | else |
||
134 | { |
||
135 | return false; |
||
136 | } |
||
137 | } |
||
138 | catch (Exception) |
||
139 | { |
||
140 | return false; |
||
141 | } |
||
142 | } |
||
143 | } |
||
144 | |||
145 | [OperationContract] |
||
146 | public bool DelFavoriteVP(string prjNo, string userID, int SavePageNo, string docID) |
||
147 | { |
||
148 | |||
149 | using (KCOMEntities dc = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
||
150 | { |
||
151 | |||
152 | List<FAVORITE_DOC> favoriteSet = dc.FAVORITE_DOC.Where(data => data.PROJECT_NO == prjNo && data.MEMBER_USER_ID == userID |
||
153 | && data.ID == docID).ToList(); |
||
154 | |||
155 | try |
||
156 | { |
||
157 | if (favoriteSet.Count > 0) |
||
158 | { |
||
159 | favoriteSet.ForEach(data => dc.FAVORITE_DOC.DeleteObject(data)); |
||
160 | dc.SaveChanges(); |
||
161 | return true; |
||
162 | } |
||
163 | else |
||
164 | { |
||
165 | return false; |
||
166 | } |
||
167 | } |
||
168 | catch (Exception) |
||
169 | { |
||
170 | return false; |
||
171 | } |
||
172 | } |
||
173 | } |
||
174 | |||
175 | |||
176 | [OperationContract] |
||
177 | d9cf7d6e | djkim | public List<Rect> GetCompareRect(string projectNo, string originDocItem_ID, string targetDocItem_ID, string originPageNo, string targetPageNo, string isInternalAddress) |
178 | 787a4489 | KangIngu | { |
179 | //string originFile = String.Format(@"http://cloud.devdoftech.co.kr:5977/TileSource/{0}_Tile/{1}/{2}/{3}.cmp", projectNo, (Convert.ToInt32(originDocItem_ID) / 100).ToString(), originDocItem_ID, originPageNo); |
||
180 | //string targetFile = String.Format(@"http://cloud.devdoftech.co.kr:5977/TileSource/{0}_Tile/{1}/{2}/{3}.cmp", projectNo, (Convert.ToInt32(targetDocItem_ID) / 100).ToString(), targetDocItem_ID, targetPageNo); |
||
181 | a874198d | humkyung | |
182 | string originFile = ""; |
||
183 | string targetFile = ""; |
||
184 | |||
185 | d9cf7d6e | djkim | if (Boolean.Parse(isInternalAddress)) |
186 | a874198d | humkyung | { |
187 | originFile = String.Format(KCOM_API.Properties.Settings.Default.TileSoucePath, projectNo, (Convert.ToInt32(originDocItem_ID) / 100).ToString(), originDocItem_ID, originPageNo); |
||
188 | targetFile = String.Format(KCOM_API.Properties.Settings.Default.TileSoucePath, projectNo, (Convert.ToInt32(targetDocItem_ID) / 100).ToString(), targetDocItem_ID, targetPageNo); |
||
189 | } |
||
190 | else |
||
191 | { |
||
192 | originFile = String.Format(KCOM_API.Properties.Settings.Default.TileSoucePath_SUB, projectNo, originDocItem_ID, originPageNo); |
||
193 | targetFile = String.Format(KCOM_API.Properties.Settings.Default.TileSoucePath_SUB, projectNo, targetDocItem_ID, targetPageNo); |
||
194 | } |
||
195 | 787a4489 | KangIngu | |
196 | 992a98b4 | KangIngu | CompareLib compareLib = new CompareLib(); |
197 | 787a4489 | KangIngu | //System.IO.Stream resultOrigin = compareLib.ChangeCmpUrlToPng(originFile); |
198 | //System.IO.Stream resultTarget = compareLib.ChangeCmpUrlToPng(targetFile); |
||
199 | |||
200 | var resultOrigin = compareLib.ChangeCmpUrlToPng_File(originFile); |
||
201 | var resultTarget = compareLib.ChangeCmpUrlToPng_File(targetFile); |
||
202 | |||
203 | string outPutFile = compareLib.ImageCompare_File(resultOrigin, resultTarget); |
||
204 | var result = compareLib.GetBoundBoxInImage(outPutFile); |
||
205 | |||
206 | return result; |
||
207 | } |
||
208 | |||
209 | |||
210 | |||
211 | #region Final PDF |
||
212 | private string _ChanID = null; |
||
213 | TcpChannel chan = null; |
||
214 | [OperationContract] |
||
215 | public FinalPDFResult SetFinalPDF(string ProjectNo, string DocInfoID, string MarkupInfoID, string CreateUserID) |
||
216 | { |
||
217 | #region 임시보관 |
||
218 | #endregion |
||
219 | FinalPDFResult _result = new FinalPDFResult(); |
||
220 | RemFinalPDFObject remObj = null; |
||
221 | try |
||
222 | { |
||
223 | string _finalID = shortGuid(); |
||
224 | int _DocTotalPages = -1; |
||
225 | string docItemId; |
||
226 | |||
227 | |||
228 | using (CIEntities _ci = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString())) |
||
229 | { |
||
230 | var _doc = _ci.DOCINFO.Where(info => info.ID == DocInfoID); |
||
231 | |||
232 | if (_doc.Count() > 0) |
||
233 | { |
||
234 | _DocTotalPages = _doc.First().PAGE_COUNT; |
||
235 | docItemId = _doc.First().DOCUMENT_ID; |
||
236 | } |
||
237 | else |
||
238 | { |
||
239 | _result.Status = FinalStatus.Error; |
||
240 | _result.Exception = "페이지 정보를 가져올 수 없습니다."; |
||
241 | return _result; |
||
242 | } |
||
243 | } |
||
244 | if (_DocTotalPages > 0) |
||
245 | { |
||
246 | FINAL_PDF fm = new FINAL_PDF() |
||
247 | { |
||
248 | ID = _finalID, |
||
249 | PROJECT_NO = ProjectNo, |
||
250 | DOCINFO_ID = DocInfoID, |
||
251 | DOCUMENT_ID = docItemId, |
||
252 | MARKUPINFO_ID = MarkupInfoID, |
||
253 | CREATE_USER_ID = CreateUserID, |
||
254 | TOTAL_PAGE = _DocTotalPages, |
||
255 | CREATE_DATETIME = DateTime.Now, |
||
256 | STATUS = (int)IFinalPDF.FinalStatus.Insert |
||
257 | }; |
||
258 | using (KCOMEntities _entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
||
259 | { |
||
260 | _entity.AddToFINAL_PDF(fm); |
||
261 | _entity.SaveChanges(System.Data.Objects.SaveOptions.AcceptAllChangesAfterSave); |
||
262 | }; |
||
263 | |||
264 | System.Runtime.Remoting.Channels.IChannel _ch = System.Runtime.Remoting.Channels.ChannelServices.GetChannel("tcp"); |
||
265 | if (_ch == null) |
||
266 | { |
||
267 | chan = new TcpChannel(); |
||
268 | _ChanID = chan.ChannelName; |
||
269 | System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(chan, false); |
||
270 | // Create an instance of the remote object |
||
271 | |||
272 | |||
273 | using (KCOMEntities ec = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
||
274 | { |
||
275 | |||
276 | //remObj = (RemFinalPDFObject)Activator.GetObject(typeof(RemFinalPDFObject), |
||
277 | // "tcp://localhost:9092/remFinalPDF"); |
||
278 | remObj = (RemFinalPDFObject)Activator.GetObject(typeof(RemFinalPDFObject), |
||
279 | //"tcp://192.168.0.67:9092/remFinalPDF"); |
||
280 | "tcp://192.168.0.67:9092/remFinalPDF"); |
||
281 | } |
||
282 | |||
283 | //"tcp://localhost:8080/remFinalPDF"); |
||
284 | |||
285 | _result = remObj.SetFinalPDF(ProjectNo, _finalID); |
||
286 | _result.FinalID = _finalID; |
||
287 | _result.Status = FinalStatus.Success; |
||
288 | |||
289 | //MarkupToPDF.MarkupToPDF fa = new MarkupToPDF.MarkupToPDF(); |
||
290 | //fa.MakeFinalPDF(fm); |
||
291 | } |
||
292 | else |
||
293 | { |
||
294 | _ChanID = _ch.ChannelName; |
||
295 | } |
||
296 | } |
||
297 | } |
||
298 | catch (Exception ex) |
||
299 | { |
||
300 | _result.Status = FinalStatus.Error; |
||
301 | |||
302 | if (ex.GetType() == typeof(System.Net.Sockets.SocketException)) |
||
303 | _result.Exception = "Final Server Not Connection"; |
||
304 | } |
||
305 | finally |
||
306 | { |
||
307 | remObj = null; |
||
308 | if (System.Runtime.Remoting.Channels.ChannelServices.GetChannel("tcp") != null) |
||
309 | System.Runtime.Remoting.Channels.ChannelServices.UnregisterChannel(chan); |
||
310 | |||
311 | GC.Collect(2); |
||
312 | } |
||
313 | return _result; |
||
314 | } |
||
315 | #endregion |
||
316 | |||
317 | |||
318 | [OperationContract] |
||
319 | public bool GetConversionState(KCOM_BasicParam param) |
||
320 | { |
||
321 | using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(param.projectNo).ToString())) |
||
322 | { |
||
323 | var doc = entity.DOCINFO.Where(data => data.DOCUMENT_ID == param.documentID).FirstOrDefault(); |
||
324 | if (doc != null) |
||
325 | { |
||
326 | var count = doc.DOCPAGE.Where(data => data.DOCINFO_ID == doc.ID).Count(); |
||
327 | if (doc.PAGE_COUNT == count) //페이지 수가 일치하는지 |
||
328 | { |
||
329 | return true; |
||
330 | } |
||
331 | else //페이지 수가 일치하지 않는 경우 |
||
332 | { |
||
333 | KCOMEntities entity_kcom = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()); |
||
334 | 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(); |
||
335 | |||
336 | if (lst != null || lst.Count >= 1) |
||
337 | { |
||
338 | //Common.Helper.SystemErrorNotify(SERVICE_NAME.API, LEVEL.MEDIUM, ERROR_TYPE.CONVERT, Resources.ResourceManager.GetString("MSG_ERROR_PAGECOUNT"), param.documentID, param.projectNo); |
||
339 | //이메일 클라이언트를 구현해야함 |
||
340 | } |
||
341 | return false; |
||
342 | } |
||
343 | } |
||
344 | else |
||
345 | { |
||
346 | //Common.Helper.SystemErrorNotify(SERVICE_NAME.API, LEVEL.MEDIUM, ERROR_TYPE.CONVERT, Resources.ResourceManager.GetString("MSG_ERROR_CONVERTFAILED"), param.documentID, param.projectNo); |
||
347 | //이메일 클라이언트를 구현해야함 |
||
348 | return false; |
||
349 | } |
||
350 | } |
||
351 | } |
||
352 | |||
353 | [OperationContract] |
||
354 | public List<VPRevision> GetVPRevisionHistory(string ProjectNo, string vpNo, string DocumentId) |
||
355 | { |
||
356 | List<VPRevision> _result = new List<VPRevision>(); |
||
357 | try |
||
358 | { |
||
359 | using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString())) |
||
360 | { |
||
361 | var _vpList = (from docitem in entity.DOCUMENT_ITEM |
||
362 | where docitem.DOCUMENT_NO == vpNo |
||
363 | select new VPRevision |
||
364 | { |
||
365 | RevNo = docitem.REVISION, |
||
366 | GroupNo = docitem.GROUP_NO, |
||
367 | FROM_VENDOR = docitem.ORIGINAL_FILE, |
||
368 | DOCUMENT_ID = docitem.DOCUMENT_ID, |
||
369 | TO_VENDOR = docitem.RESULT_FILE, |
||
370 | RESULT = docitem.RESULT, |
||
371 | c91f45f3 | djkim | DocNo = docitem.DOCUMENT_NO, |
372 | 787a4489 | KangIngu | IsSyncPossible = docitem.DOCUMENT_ID == DocumentId ? false : true |
373 | }); |
||
374 | _result = _vpList.ToList(); |
||
375 | b421ac6b | djkim | _result = _result.OrderByDescending(r => r.GroupNo).ToList(); |
376 | 787a4489 | KangIngu | } |
377 | } |
||
378 | catch (Exception) |
||
379 | { |
||
380 | |||
381 | throw; |
||
382 | } |
||
383 | finally |
||
384 | { |
||
385 | GC.Collect(2); |
||
386 | } |
||
387 | return _result; |
||
388 | } |
||
389 | |||
390 | [OperationContract] |
||
391 | 2ab012e8 | djkim | public VPRevision GetVPRevisionFirstOrDefault(string ProjectNo, string DocumentId) |
392 | { |
||
393 | VPRevision _result = null; |
||
394 | try |
||
395 | { |
||
396 | using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString())) |
||
397 | { |
||
398 | _result = (from docitem in entity.DOCUMENT_ITEM |
||
399 | where docitem.DOCUMENT_ID == DocumentId |
||
400 | select new VPRevision |
||
401 | { |
||
402 | RevNo = docitem.REVISION, |
||
403 | GroupNo = docitem.GROUP_NO, |
||
404 | FROM_VENDOR = docitem.ORIGINAL_FILE, |
||
405 | DOCUMENT_ID = docitem.DOCUMENT_ID, |
||
406 | TO_VENDOR = docitem.RESULT_FILE, |
||
407 | RESULT = docitem.RESULT |
||
408 | }).FirstOrDefault(); |
||
409 | } |
||
410 | } |
||
411 | catch (Exception) |
||
412 | { |
||
413 | throw; |
||
414 | } |
||
415 | finally |
||
416 | { |
||
417 | GC.Collect(2); |
||
418 | } |
||
419 | return _result; |
||
420 | } |
||
421 | |||
422 | [OperationContract] |
||
423 | 787a4489 | KangIngu | public DOCINFO GetDocInfo(KCOM_BasicParam param) |
424 | { |
||
425 | DOCINFO _result = null; |
||
426 | try |
||
427 | { |
||
428 | // 차후 아래의 코드로 변경 |
||
429 | //using (CI_Entities ModelDeeview = new CI_Entities(DaelimCiConnectionString.ToString())) |
||
430 | CIEntities ModelDeeview = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(param.projectNo).ToString()); |
||
431 | |||
432 | var docinfo = ModelDeeview.DOCINFO.Where(doc => doc.DOCUMENT_ID == param.documentID); |
||
433 | if (docinfo.Count() > 0) |
||
434 | { |
||
435 | _result = docinfo.First(); |
||
436 | _result.MARKUP_INFO.Clear(); |
||
437 | |||
438 | } |
||
439 | return _result; |
||
440 | |||
441 | } |
||
442 | catch (Exception ex) |
||
443 | { |
||
444 | System.Diagnostics.Trace.WriteLine("GetDocInfo Error : " + ex); |
||
445 | } |
||
446 | finally |
||
447 | { |
||
448 | GC.Collect(2); |
||
449 | } |
||
450 | return null; |
||
451 | } |
||
452 | |||
453 | [OperationContract] |
||
454 | public bool GetCheckSystemAdmin(string UserID) |
||
455 | { |
||
456 | using (KCOMEntities uc = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
||
457 | { |
||
458 | var user = uc.PROPERTIES.Where(data => data.TYPE == "Administrator" && data.PROPERTY.Contains(UserID)).FirstOrDefault(); |
||
459 | if (user != null) |
||
460 | { |
||
461 | return true; |
||
462 | } |
||
463 | else |
||
464 | { |
||
465 | return false; |
||
466 | } |
||
467 | } |
||
468 | GC.Collect(2); |
||
469 | } |
||
470 | |||
471 | [OperationContract] |
||
472 | public DOCUMENT_ITEM GetDocumentItemInfo(KCOM_BasicParam param) |
||
473 | { |
||
474 | ///param : prjNo, documentId, userId |
||
475 | DOCUMENT_ITEM _result = null; |
||
476 | |||
477 | try |
||
478 | { |
||
479 | CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(param.projectNo).ToString()); |
||
480 | |||
481 | var _items = entity.DOCUMENT_ITEM.Where(data => data.DOCUMENT_ID == param.documentID); |
||
482 | |||
483 | if (_items.Count() > 0) |
||
484 | { |
||
485 | _result = _items.First(); |
||
486 | |||
487 | return _result; |
||
488 | } |
||
489 | //else |
||
490 | //{ |
||
491 | // Common.Helper.SystemErrorNotify(SERVICE_NAME.API, LEVEL.MEDIUM, ERROR_TYPE.CONVERT, Resources.ResourceManager.GetString("MSG_ERROR_DOCUMENTNOTFOUND"), param.documentID, param.projectNo); |
||
492 | //} |
||
493 | } |
||
494 | catch (Exception ex) |
||
495 | { |
||
496 | System.Diagnostics.Trace.WriteLine("GetVendorItemInfo Error : " + ex); |
||
497 | //Common.Helper.SystemErrorNotify(SERVICE_NAME.API, LEVEL.MEDIUM, ERROR_TYPE.CONVERT, "GetDocumentItemInfo / " + ex.Message, param.documentID, param.projectNo); |
||
498 | } |
||
499 | |||
500 | return _result; |
||
501 | } |
||
502 | |||
503 | public string UserGO(MARKUP_INFO item) |
||
504 | { |
||
505 | if (item != null) |
||
506 | { |
||
507 | return item.MARKUP_INFO_VERSION.OrderByDescending(data => data.CREATE_DATE).FirstOrDefault().ID; |
||
508 | } |
||
509 | return null; |
||
510 | } |
||
511 | 53880c83 | ljiyeon | |
512 | [OperationContract] |
||
513 | public List<MarkupInfoItem> GetMarkupInfoItems(string ProjectNo, string DocInfoId) |
||
514 | { |
||
515 | List<MarkupInfoItem> _result = new List<MarkupInfoItem>(); |
||
516 | try |
||
517 | { |
||
518 | using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString())) |
||
519 | { |
||
520 | var markupListData = entity.MARKUP_INFO.Where(data => data.DOCINFO_ID == DocInfoId).ToList(); |
||
521 | |||
522 | var markupList = from markup in markupListData |
||
523 | orderby markup.CREATE_TIME descending |
||
524 | select new MarkupInfoItem |
||
525 | { |
||
526 | MarkupInfoID = markup.ID, |
||
527 | UserID = markup.USER_ID, |
||
528 | MarkupVersionID = markup.MARKUP_INFO_VERSION.Count() == 0 ? null : markup.MARKUP_INFO_VERSION.OrderByDescending(data => data.CREATE_DATE).FirstOrDefault().ID, |
||
529 | CreateTime = markup.CREATE_TIME, |
||
530 | Consolidate = markup.CONSOLIDATE, |
||
531 | Description = markup.DESCRIPTION, |
||
532 | AvoidConsolidate = markup.AVOID_CONSOLIDATE, |
||
533 | PartConsolidate = markup.PART_CONSOLIDATE, |
||
534 | UpdateTime = DateTime.Parse(markup.UPDATE_TIME.ToString()), |
||
535 | }; |
||
536 | |||
537 | if (markupList.Count() > 0) |
||
538 | { |
||
539 | _result = markupList.ToList(); |
||
540 | } |
||
541 | |||
542 | _result.ForEach(r => |
||
543 | { |
||
544 | |||
545 | r.MarkupList = (from markupData in entity.MARKUP_DATA |
||
546 | where markupData.MARKUPINFO_VERSION_ID == r.MarkupVersionID |
||
547 | orderby markupData.PAGENUMBER |
||
548 | select new MarkupItem { ID = markupData.ID, PageNumber = markupData.PAGENUMBER, Data = markupData.DATA, Data_Type = markupData.DATA_TYPE, Symbol_ID = markupData.SYMBOL_ID, Group_ID = markupData.GROUP_ID ?? 0 }).ToList(); |
||
549 | }); |
||
550 | |||
551 | Random random = new Random(); |
||
552 | |||
553 | _MemberDeptColors memberDeptColors = new _MemberDeptColors(); |
||
554 | _MemberDeptColorsInfo memberDeptColorsInfo = new _MemberDeptColorsInfo(); |
||
555 | |||
556 | |||
557 | memberDeptColors._memberDeptColors = (from memberdeptcolor in entity.MEMBER_DEPT_COLOR |
||
558 | //where memberdeptcolor.DEPARTMENT == "DisplayColor" |
||
559 | select memberdeptcolor).ToList(); |
||
560 | memberDeptColorsInfo._memberDeptColorsInfo = (from memberdeptcolorinfo in entity.MEMBER_DEPT_COLORINFO |
||
561 | //where memberdeptcolor.DEPARTMENT == "DisplayColor" |
||
562 | select memberdeptcolorinfo).ToList(); |
||
563 | |||
564 | |||
565 | foreach (var item in _result) |
||
566 | { |
||
567 | var _member = entity.MEMBER.Where(member => member.ID == item.UserID); |
||
568 | |||
569 | if (_member.Count() > 0) |
||
570 | { |
||
571 | item.UserName = _member.First().NAME; |
||
572 | item.Depatment = _member.First().DEPARTMENT; |
||
573 | } |
||
574 | |||
575 | foreach(var dept in memberDeptColors._memberDeptColors) |
||
576 | {//dept 지정 색상 |
||
577 | if(dept.DEPARTMENT == item.Depatment) |
||
578 | { |
||
579 | var colorlist = memberDeptColorsInfo._memberDeptColorsInfo.Where(d => d.COLORID == dept.COLORID).ToList(); |
||
580 | |||
581 | int colorIdx = random.Next(1, colorlist.Count()); |
||
582 | if(colorlist.Count > 0) |
||
583 | { |
||
584 | item.DisplayColor = "#FF" + colorlist[colorIdx].DISPLAYCOLOR; |
||
585 | memberDeptColorsInfo._memberDeptColorsInfo.Remove(colorlist[colorIdx]); |
||
586 | break; |
||
587 | } |
||
588 | else |
||
589 | { |
||
590 | item.DisplayColor = String.Format("#FF{0:X6}", random.Next(0x1000000)); |
||
591 | break; |
||
592 | } |
||
593 | } |
||
594 | } |
||
595 | |||
596 | |||
597 | if (item.DisplayColor == null) |
||
598 | { |
||
599 | foreach (var dept in memberDeptColors._memberDeptColors) |
||
600 | { |
||
601 | if(dept.DEPARTMENT == null) |
||
602 | { |
||
603 | dept.DEPARTMENT = item.Depatment; |
||
604 | var colorlist = memberDeptColorsInfo._memberDeptColorsInfo.Where(d => d.COLORID == dept.COLORID).ToList(); |
||
605 | int colorIdx = random.Next(1, colorlist.Count()); |
||
606 | if (colorlist.Count > 0) |
||
607 | { |
||
608 | item.DisplayColor = "#FF" + colorlist[colorIdx].DISPLAYCOLOR; |
||
609 | memberDeptColorsInfo._memberDeptColorsInfo.Remove(colorlist[colorIdx]); |
||
610 | break; |
||
611 | } |
||
612 | else |
||
613 | { |
||
614 | item.DisplayColor = String.Format("#FF{0:X6}", random.Next(0x1000000)); |
||
615 | break; |
||
616 | } |
||
617 | } |
||
618 | } |
||
619 | } |
||
620 | |||
621 | if(item.DisplayColor == null) |
||
622 | { |
||
623 | item.DisplayColor = String.Format("#FF{0:X6}", random.Next(0x1000000)); |
||
624 | } |
||
625 | } |
||
626 | } |
||
627 | } |
||
628 | catch (Exception EX) |
||
629 | { |
||
630 | System.Diagnostics.Debug.WriteLine(this.GetType().ToString() + " " + EX); |
||
631 | return _result; |
||
632 | } |
||
633 | finally |
||
634 | { |
||
635 | GC.Collect(2); |
||
636 | } |
||
637 | |||
638 | return _result; |
||
639 | } |
||
640 | |||
641 | 787a4489 | KangIngu | |
642 | 53880c83 | ljiyeon | /* |
643 | 787a4489 | KangIngu | [OperationContract] |
644 | public List<MarkupInfoItem> GetMarkupInfoItems(string ProjectNo, string DocInfoId) |
||
645 | { |
||
646 | List<MarkupInfoItem> _result = new List<MarkupInfoItem>(); |
||
647 | try |
||
648 | { |
||
649 | using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString())) |
||
650 | { |
||
651 | var markupListData = entity.MARKUP_INFO.Where(data => data.DOCINFO_ID == DocInfoId).ToList(); |
||
652 | //foreach (var item in markupListData) |
||
653 | //{ |
||
654 | // if (!item.AVOID_CONSOLIDATE.HasValue) |
||
655 | // { |
||
656 | // item.AVOID_CONSOLIDATE = 0; |
||
657 | // } |
||
658 | //} |
||
659 | |||
660 | var markupList = from markup in markupListData |
||
661 | orderby markup.CREATE_TIME descending |
||
662 | select new MarkupInfoItem |
||
663 | { |
||
664 | MarkupInfoID = markup.ID, |
||
665 | UserID = markup.USER_ID, |
||
666 | MarkupVersionID = markup.MARKUP_INFO_VERSION.Count() == 0 ? null : markup.MARKUP_INFO_VERSION.OrderByDescending(data => data.CREATE_DATE).FirstOrDefault().ID, |
||
667 | CreateTime = markup.CREATE_TIME, |
||
668 | Consolidate = markup.CONSOLIDATE, |
||
669 | Description = markup.DESCRIPTION, |
||
670 | AvoidConsolidate = markup.AVOID_CONSOLIDATE, |
||
671 | PartConsolidate = markup.PART_CONSOLIDATE, |
||
672 | 992a98b4 | KangIngu | UpdateTime = DateTime.Parse(markup.UPDATE_TIME.ToString()), |
673 | 787a4489 | KangIngu | }; |
674 | |||
675 | |||
676 | |||
677 | if (markupList.Count() > 0) |
||
678 | { |
||
679 | _result = markupList.ToList(); |
||
680 | } |
||
681 | |||
682 | |||
683 | |||
684 | _result.ForEach(r => |
||
685 | { |
||
686 | |||
687 | r.MarkupList = (from markupData in entity.MARKUP_DATA |
||
688 | where markupData.MARKUPINFO_VERSION_ID == r.MarkupVersionID |
||
689 | orderby markupData.PAGENUMBER |
||
690 | 53880c83 | ljiyeon | select new MarkupItem { ID = markupData.ID, PageNumber = markupData.PAGENUMBER, Data = markupData.DATA, Data_Type = markupData.DATA_TYPE, Symbol_ID = markupData.SYMBOL_ID, Group_ID = markupData.GROUP_ID ?? 0 }).ToList(); |
691 | 787a4489 | KangIngu | }); |
692 | |||
693 | 53880c83 | ljiyeon | _ColorsProperties colors = new _ColorsProperties(); |
694 | 787a4489 | KangIngu | Random random = new Random(); |
695 | |||
696 | using (KCOMEntities kcomEntity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
||
697 | { |
||
698 | 53880c83 | ljiyeon | colors._colorsProperties = (from property in kcomEntity.PROPERTIES |
699 | 787a4489 | KangIngu | where property.TYPE == "DisplayColor" |
700 | select property).ToList(); |
||
701 | } |
||
702 | 53880c83 | ljiyeon | List<DeptColor> deptColor = new List<DeptColor>(); |
703 | |||
704 | List<DeptColor> listTest = new List<DeptColor>(); |
||
705 | //Dictionary<string, string> d = new Dictionary<string, string>(); |
||
706 | var list = new List<KeyValuePair<string, string>>(); |
||
707 | foreach (var test in colors._colorsProperties) |
||
708 | { |
||
709 | list.Add(new KeyValuePair<string, string>(test.PROPERTY, test.VALUE)); |
||
710 | //d.Add(test.PROPERTY, test.VALUE); |
||
711 | listTest.Add(new DeptColor { Property = test.PROPERTY,DisplayColor = test.VALUE}); |
||
712 | } |
||
713 | |||
714 | 787a4489 | KangIngu | |
715 | foreach (var item in _result) |
||
716 | { |
||
717 | var _member = entity.MEMBER.Where(member => member.ID == item.UserID); |
||
718 | |||
719 | if (_member.Count() > 0) |
||
720 | { |
||
721 | item.UserName = _member.First().NAME; |
||
722 | item.Depatment = _member.First().DEPARTMENT; |
||
723 | } |
||
724 | |||
725 | 53880c83 | ljiyeon | if (colors._colorsProperties.Count > 0) |
726 | 787a4489 | KangIngu | { |
727 | 53880c83 | ljiyeon | int colorIdx = random.Next(1, colors._colorsProperties.Count()); |
728 | 787a4489 | KangIngu | #region 부서별로 색상을 지정하고자 할때 |
729 | 53880c83 | ljiyeon | |
730 | if(deptColor.Count > 0) |
||
731 | { |
||
732 | foreach (var dept in deptColor) |
||
733 | { |
||
734 | if (dept.Depatment == item.Depatment) |
||
735 | { |
||
736 | //list에서 deptColor.Property의 값 중 상위의 데이터를 뽑아서 지정하고 list에서 삭제 |
||
737 | item.DisplayColor = "#FF" + list.Where(p => p.Key == dept.Property).FirstOrDefault().Value; |
||
738 | list.Remove(new KeyValuePair<string, string>(dept.Property, dept.DisplayColor)); |
||
739 | break; |
||
740 | } |
||
741 | else |
||
742 | { |
||
743 | item.DisplayColor = "#FF" + colors._colorsProperties[colorIdx].VALUE; |
||
744 | deptColor.Add(new DeptColor { DisplayColor = item.DisplayColor, Depatment = item.Depatment, Property = colors._colorsProperties[colorIdx].PROPERTY }); |
||
745 | colors._colorsProperties.RemoveAll(p => p.PROPERTY.Equals(colors._colorsProperties[colorIdx].PROPERTY)); //같은 계열의 색상은 지운다 |
||
746 | break; |
||
747 | } |
||
748 | } |
||
749 | } |
||
750 | else |
||
751 | { |
||
752 | item.DisplayColor = "#FF" + colors._colorsProperties[colorIdx].VALUE; |
||
753 | deptColor.Add(new DeptColor { DisplayColor = item.DisplayColor, Depatment = item.Depatment, Property = colors._colorsProperties[colorIdx].PROPERTY }); |
||
754 | colors._colorsProperties.RemoveAll(p => p.PROPERTY.Equals(colors._colorsProperties[colorIdx].PROPERTY)); //같은 계열의 색상은 지운다 |
||
755 | } |
||
756 | 787a4489 | KangIngu | #endregion |
757 | } |
||
758 | else |
||
759 | { |
||
760 | item.DisplayColor = String.Format("#FF{0:X6}", random.Next(0x1000000)); |
||
761 | } |
||
762 | } |
||
763 | } |
||
764 | } |
||
765 | catch (Exception EX) |
||
766 | { |
||
767 | System.Diagnostics.Debug.WriteLine(this.GetType().ToString() + " " + EX); |
||
768 | return _result; |
||
769 | } |
||
770 | finally |
||
771 | { |
||
772 | GC.Collect(2); |
||
773 | } |
||
774 | |||
775 | return _result; |
||
776 | } |
||
777 | 53880c83 | ljiyeon | */ |
778 | 787a4489 | KangIngu | [OperationContract] |
779 | public List<MarkupInfoItem> GetSyncMarkupInfoItems(string ProjectNo, string DocInfoId, string currentUser) |
||
780 | { |
||
781 | List<MarkupInfoItem> _result = new List<MarkupInfoItem>(); |
||
782 | try |
||
783 | { |
||
784 | using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString())) |
||
785 | { |
||
786 | var docItem = entity.DOCINFO.Where(data => data.DOCUMENT_ID == DocInfoId).FirstOrDefault(); |
||
787 | if (docItem == null) |
||
788 | { |
||
789 | return null; |
||
790 | } |
||
791 | var markupListData = entity.MARKUP_INFO.Where(data => data.DOCINFO_ID == docItem.ID).ToList(); |
||
792 | |||
793 | var markupList = from markup in markupListData |
||
794 | where markup.USER_ID == currentUser || markup.CONSOLIDATE == 1 |
||
795 | orderby markup.CREATE_TIME descending |
||
796 | select new MarkupInfoItem |
||
797 | { |
||
798 | MarkupInfoID = markup.ID, |
||
799 | UserID = markup.USER_ID, |
||
800 | MarkupVersionID = markup.MARKUP_INFO_VERSION.Count() == 0 ? null : markup.MARKUP_INFO_VERSION.OrderByDescending(data => data.CREATE_DATE).FirstOrDefault().ID, |
||
801 | CreateTime = markup.CREATE_TIME, |
||
802 | Consolidate = markup.CONSOLIDATE, |
||
803 | Description = markup.DESCRIPTION, |
||
804 | AvoidConsolidate = markup.AVOID_CONSOLIDATE, |
||
805 | PartConsolidate = markup.PART_CONSOLIDATE, |
||
806 | }; |
||
807 | |||
808 | |||
809 | |||
810 | if (markupList.Count() > 0) |
||
811 | { |
||
812 | _result = markupList.ToList(); |
||
813 | } |
||
814 | |||
815 | |||
816 | |||
817 | _result.ForEach(r => |
||
818 | { |
||
819 | |||
820 | r.MarkupList = (from markupData in entity.MARKUP_DATA |
||
821 | where markupData.MARKUPINFO_VERSION_ID == r.MarkupVersionID |
||
822 | orderby markupData.PAGENUMBER |
||
823 | 53880c83 | ljiyeon | select new MarkupItem { ID = markupData.ID, PageNumber = markupData.PAGENUMBER, Data = markupData.DATA, Data_Type = markupData.DATA_TYPE, Symbol_ID = markupData.SYMBOL_ID, Group_ID = markupData.GROUP_ID ?? 0 }).ToList(); |
824 | 787a4489 | KangIngu | }); |
825 | |||
826 | List<PROPERTIES> _ColorsProperties = new List<PROPERTIES>(); |
||
827 | Random random = new Random(); |
||
828 | |||
829 | using (KCOMEntities kcomEntity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
||
830 | { |
||
831 | _ColorsProperties = (from property in kcomEntity.PROPERTIES |
||
832 | where property.TYPE == "DisplayColor" |
||
833 | select property).ToList(); |
||
834 | } |
||
835 | |||
836 | foreach (var item in _result) |
||
837 | { |
||
838 | var _member = entity.MEMBER.Where(member => member.ID == item.UserID); |
||
839 | |||
840 | if (_member.Count() > 0) |
||
841 | { |
||
842 | item.UserName = _member.First().NAME; |
||
843 | item.Depatment = _member.First().DEPARTMENT; |
||
844 | } |
||
845 | |||
846 | if (_ColorsProperties.Count > 0) |
||
847 | { |
||
848 | int colorIdx = random.Next(1, _ColorsProperties.Count()); |
||
849 | #region 부서별로 색상을 지정하고자 할때 |
||
850 | /// 일단 의견을 들어보자구! |
||
851 | #endregion |
||
852 | item.DisplayColor = "#FF" + _ColorsProperties[colorIdx].VALUE; |
||
853 | _ColorsProperties.Remove(_ColorsProperties[colorIdx]); |
||
854 | //item.DisplayColor = "#FF" + _Colors.First(); |
||
855 | //_Colors.Remove(_Colors.First()); |
||
856 | } |
||
857 | else |
||
858 | { |
||
859 | item.DisplayColor = String.Format("#FF{0:X6}", random.Next(0x1000000)); |
||
860 | } |
||
861 | } |
||
862 | } |
||
863 | } |
||
864 | catch (Exception EX) |
||
865 | { |
||
866 | System.Diagnostics.Debug.WriteLine(this.GetType().ToString() + " " + EX); |
||
867 | return _result; |
||
868 | } |
||
869 | finally |
||
870 | { |
||
871 | GC.Collect(2); |
||
872 | } |
||
873 | |||
874 | return _result; |
||
875 | } |
||
876 | |||
877 | |||
878 | //[OperationContract] |
||
879 | //[ServiceKnownType(typeof(MEMBER))] |
||
880 | //public List<MEMBER> GetUserData(string ProjectNo, string UserID) |
||
881 | //{ |
||
882 | // List<MEMBER> _result = new List<MEMBER>(); |
||
883 | |||
884 | // using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString())) |
||
885 | // { |
||
886 | // var _UserList = from member in entity.MEMBER |
||
887 | // where member.ID == UserID |
||
888 | // select member; |
||
889 | // _result = _UserList.ToList(); |
||
890 | // } |
||
891 | // //GC.Collect(2); |
||
892 | // return _result; |
||
893 | //} |
||
894 | |||
895 | 2ab012e8 | djkim | [OperationContract] |
896 | [ServiceKnownType(typeof(MEMBER))] |
||
897 | public List<MEMBER> GetUserData(string ProjectNo, string UserID) |
||
898 | { |
||
899 | List<MEMBER> _result = new List<MEMBER>(); |
||
900 | 787a4489 | KangIngu | |
901 | 2ab012e8 | djkim | using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString())) |
902 | { |
||
903 | var _UserList = from member in entity.MEMBER |
||
904 | where member.ID == UserID |
||
905 | select member; |
||
906 | _result = _UserList.ToList(); |
||
907 | } |
||
908 | //GC.Collect(2); |
||
909 | return _result; |
||
910 | } |
||
911 | 787a4489 | KangIngu | |
912 | |||
913 | [OperationContract] |
||
914 | public List<string> GetDeptData(string UserDept) //그룹 추가 옵션 부여 예정 |
||
915 | { |
||
916 | List<string> _result = new List<string>(); |
||
917 | |||
918 | try |
||
919 | { |
||
920 | KCOMEntities entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()); |
||
921 | var YourEnginner = (from dept in entity.PROPERTIES |
||
922 | where dept.TYPE == "DeptName" && UserDept.Contains(dept.VALUE) |
||
923 | select dept).FirstOrDefault(); |
||
924 | |||
925 | if (YourEnginner != null) |
||
926 | { |
||
927 | _result = (from dept in entity.PROPERTIES |
||
928 | where dept.PROPERTY == YourEnginner.PROPERTY |
||
929 | select dept.VALUE).ToList(); |
||
930 | return _result; |
||
931 | } |
||
932 | else |
||
933 | { |
||
934 | return null; |
||
935 | } |
||
936 | } |
||
937 | catch (Exception ex) |
||
938 | { |
||
939 | System.Diagnostics.Debug.WriteLine(ex.Message); |
||
940 | } |
||
941 | finally |
||
942 | { |
||
943 | GC.Collect(2); |
||
944 | } |
||
945 | return _result; |
||
946 | } |
||
947 | |||
948 | [OperationContract] |
||
949 | public bool DeleteMarkup(string ProjectNo, string MarkupInfoID) |
||
950 | { |
||
951 | bool _result = false; |
||
952 | try |
||
953 | { |
||
954 | using (KCOMDataModel.DataModel.CIEntities Entity = new KCOMDataModel.DataModel.CIEntities(KCOMDataModel.Common.ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString())) |
||
955 | { |
||
956 | |||
957 | MARKUP_INFO instance = Entity.MARKUP_INFO.Where(root => root.ID == MarkupInfoID).FirstOrDefault(); |
||
958 | |||
959 | if (instance == null) |
||
960 | { |
||
961 | return false; |
||
962 | } |
||
963 | MARKUP_INFO_VERSION version = instance.MARKUP_INFO_VERSION.FirstOrDefault(); |
||
964 | |||
965 | |||
966 | version.MARKUP_DATA.ToList().ForEach(data => |
||
967 | { |
||
968 | Entity.MARKUP_DATA.DeleteObject(data); |
||
969 | Entity.SaveChanges(); |
||
970 | }); |
||
971 | |||
972 | Entity.MARKUP_INFO_VERSION.DeleteObject(version); |
||
973 | Entity.SaveChanges(); |
||
974 | |||
975 | Entity.MARKUP_INFO.DeleteObject(instance); |
||
976 | Entity.SaveChanges(); |
||
977 | |||
978 | } |
||
979 | _result = true; |
||
980 | } |
||
981 | catch (Exception ex) |
||
982 | { |
||
983 | System.Diagnostics.Trace.WriteLine(ex, "SaveMarkup"); |
||
984 | } |
||
985 | finally |
||
986 | { |
||
987 | GC.Collect(2); |
||
988 | } |
||
989 | return _result; |
||
990 | } |
||
991 | 992a98b4 | KangIngu | |
992 | #region Favorite |
||
993 | [OperationContract] |
||
994 | public bool SetFavoriteVP(string prjNo, string userID, string groupNo, string docNo, string rev, int SavePageNo, string documentItemID, string VPDescription, IKCOM.FAVORITE_FLAG flag) |
||
995 | { |
||
996 | |||
997 | using (KCOMEntities entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
||
998 | { |
||
999 | try |
||
1000 | { |
||
1001 | entity.FAVORITE_DOC.AddObject(new FAVORITE_DOC |
||
1002 | { |
||
1003 | ID = shortGuid(), |
||
1004 | PROJECT_NO = prjNo, |
||
1005 | DOCUMENT_ID = documentItemID, |
||
1006 | GROUP_NO = groupNo, |
||
1007 | DOCUMENT_NO = docNo, |
||
1008 | MEMBER_USER_ID = userID, |
||
1009 | DESCRIPTION = VPDescription, |
||
1010 | CREATE_TIME = DateTime.Now, |
||
1011 | REVISION = rev, |
||
1012 | FLAG = (int)flag, |
||
1013 | PAGE_NO = SavePageNo, |
||
1014 | }); |
||
1015 | entity.SaveChanges(); |
||
1016 | } |
||
1017 | catch (Exception) |
||
1018 | { |
||
1019 | return false; |
||
1020 | } |
||
1021 | |||
1022 | return true; |
||
1023 | } |
||
1024 | } |
||
1025 | |||
1026 | //[OperationContract] |
||
1027 | //public List<FAVORITE_DOC> GetFavoriteVP(string PrjNo, string userID, string sharepointItemID) |
||
1028 | //{ |
||
1029 | // using (KCOMEntities entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
||
1030 | // { |
||
1031 | |||
1032 | // int flagString = Convert.ToInt32(IKCOM.FAVORITE_FLAG.Personal); |
||
1033 | // List<FAVORITE_DOC> favoriteListSet = new List<FAVORITE_DOC>(); |
||
1034 | // entity.FAVORITE_DOC.Where(data => data.PROJECT_NO == PrjNo && data.DOCUMENT_ID == sharepointItemID && data.FLAG != |
||
1035 | // flagString).ToList().ForEach(data => favoriteListSet.Add(data)); |
||
1036 | // entity.FAVORITE_DOC.Where(data => data.PROJECT_NO == PrjNo && data.MEMBER_USER_ID == userID).ToList().ForEach(data => favoriteListSet.Add(data)); |
||
1037 | // favoriteListSet = favoriteListSet.Distinct().ToList(); |
||
1038 | // return favoriteListSet; |
||
1039 | // } |
||
1040 | //} |
||
1041 | //[OperationContract] |
||
1042 | //public bool EditFavoriteVP(string prjNo, string userID, int SavePageNo, string sharepointItemID, DateTime createTime, int state, string description) |
||
1043 | //{ |
||
1044 | // using (DeepViewEntities dc = new DeepViewEntities(ConnectStringBuilder.DeepViewConnectionString().ToString())) |
||
1045 | // { |
||
1046 | // List<FavoriteVP> favoriteSet = dc.FavoriteVP.Where(data => data.ProjectNo == prjNo && data.CreateUserID == userID |
||
1047 | // && data.PageNo == SavePageNo && data.CreateTime == createTime).ToList(); |
||
1048 | |||
1049 | // try |
||
1050 | // { |
||
1051 | |||
1052 | |||
1053 | // if (favoriteSet.Count > 0) |
||
1054 | // { |
||
1055 | // var FavoriteVP_Instance = favoriteSet.First(); |
||
1056 | |||
1057 | // FavoriteVP_Instance.Description = description; |
||
1058 | // FavoriteVP_Instance.Flag = state; |
||
1059 | |||
1060 | // dc.SaveChanges(); |
||
1061 | |||
1062 | // return true; |
||
1063 | // } |
||
1064 | // else |
||
1065 | // { |
||
1066 | // return false; |
||
1067 | // } |
||
1068 | // } |
||
1069 | // catch (Exception) |
||
1070 | // { |
||
1071 | // return false; |
||
1072 | // } |
||
1073 | // } |
||
1074 | //} |
||
1075 | //[OperationContract] |
||
1076 | //public bool DelFavoriteVP(string prjNo, string userID, int SavePageNo, string sharepointItemID, DateTime createTime) |
||
1077 | //{ |
||
1078 | |||
1079 | // using (DeepViewEntities dc = new DeepViewEntities(ConnectStringBuilder.DeepViewConnectionString().ToString())) |
||
1080 | // { |
||
1081 | // List<FavoriteVP> favoriteSet = dc.FavoriteVP.Where(data => data.ProjectNo == prjNo && data.CreateUserID == userID |
||
1082 | // && data.PageNo == SavePageNo && data.CreateTime == createTime).ToList(); |
||
1083 | |||
1084 | // try |
||
1085 | // { |
||
1086 | |||
1087 | |||
1088 | // if (favoriteSet.Count > 0) |
||
1089 | // { |
||
1090 | // favoriteSet.ForEach(data => dc.FavoriteVP.DeleteObject(data)); |
||
1091 | // dc.SaveChanges(); |
||
1092 | // return true; |
||
1093 | // } |
||
1094 | // else |
||
1095 | // { |
||
1096 | // return false; |
||
1097 | // } |
||
1098 | // } |
||
1099 | // catch (Exception) |
||
1100 | // { |
||
1101 | // return false; |
||
1102 | // } |
||
1103 | // } |
||
1104 | //} |
||
1105 | #endregion |
||
1106 | 2ab012e8 | djkim | |
1107 | [OperationContract] |
||
1108 | public bool SaveMarkupData(MarkupInfoItem UserState,string project_no,string doc_id, string user_id, List<MARKUP_DATA> mlmarkup_data) |
||
1109 | { |
||
1110 | using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
||
1111 | { |
||
1112 | #region Docinfo 정보 가져오기 |
||
1113 | |||
1114 | string docinfoid_ = (from info in Entity.DOCINFO |
||
1115 | where info.DOCUMENT_ID == doc_id |
||
1116 | && info.PROJECT_NO == project_no |
||
1117 | select info.ID |
||
1118 | ).First().ToString(); |
||
1119 | #endregion |
||
1120 | |||
1121 | #region Markup_Info 저장 |
||
1122 | |||
1123 | MARKUP_INFO markup_info = new MARKUP_INFO(); |
||
1124 | try |
||
1125 | { |
||
1126 | markup_info = (from info in Entity.MARKUP_INFO |
||
1127 | where info.ID == UserState.MarkupInfoID && info.USER_ID == user_id |
||
1128 | select info).FirstOrDefault(); |
||
1129 | } |
||
1130 | catch (Exception) |
||
1131 | { |
||
1132 | markup_info = null; |
||
1133 | } |
||
1134 | |||
1135 | //markup_info가 없을 경우 생성 |
||
1136 | if (markup_info == null) |
||
1137 | { |
||
1138 | //MarkupInfo 저장 |
||
1139 | markup_info = new MARKUP_INFO |
||
1140 | { |
||
1141 | ID = UserState.MarkupInfoID, |
||
1142 | DOCINFO_ID = docinfoid_, |
||
1143 | USER_ID = user_id, |
||
1144 | CREATE_TIME = DateTime.Now, |
||
1145 | CONSOLIDATE = UserState.Consolidate, |
||
1146 | AVOID_CONSOLIDATE = UserState.AvoidConsolidate, |
||
1147 | PART_CONSOLIDATE = UserState.PartConsolidate, |
||
1148 | DESCRIPTION = UserState.Description, |
||
1149 | UPDATE_TIME = DateTime.Now |
||
1150 | }; |
||
1151 | Entity.MARKUP_INFO.AddObject(markup_info); |
||
1152 | } |
||
1153 | //markup_info가 있을 경우 업데이트 |
||
1154 | else |
||
1155 | { |
||
1156 | markup_info.UPDATE_TIME = DateTime.Now; |
||
1157 | } |
||
1158 | Entity.SaveChanges(); |
||
1159 | #endregion |
||
1160 | |||
1161 | #region Markup_Info_Version 저장 |
||
1162 | |||
1163 | MARKUP_INFO_VERSION markup_info_version = new MARKUP_INFO_VERSION(); |
||
1164 | |||
1165 | try |
||
1166 | { |
||
1167 | markup_info_version = (from info in Entity.MARKUP_INFO_VERSION |
||
1168 | where info.MARKUPINFO_ID == markup_info.ID |
||
1169 | select info).FirstOrDefault(); |
||
1170 | } |
||
1171 | catch (Exception) |
||
1172 | { |
||
1173 | markup_info_version = null; |
||
1174 | } |
||
1175 | |||
1176 | //markup_info_version 없을 경우 생성 |
||
1177 | if (markup_info_version == null) |
||
1178 | { |
||
1179 | //MarkupInfo_version 저장 |
||
1180 | markup_info_version = new MARKUP_INFO_VERSION() |
||
1181 | { |
||
1182 | ID = UserState.MarkupVersionID, |
||
1183 | MARKUPINFO_ID = markup_info.ID, |
||
1184 | CREATE_DATE = DateTime.Now |
||
1185 | }; |
||
1186 | Entity.MARKUP_INFO_VERSION.AddObject(markup_info_version); |
||
1187 | Entity.SaveChanges(); |
||
1188 | } |
||
1189 | #endregion |
||
1190 | |||
1191 | |||
1192 | Entity.MARKUP_DATA.Where(data => data.MARKUPINFO_VERSION_ID == markup_info_version.ID).ToList().ForEach(item => |
||
1193 | { |
||
1194 | Entity.MARKUP_DATA.DeleteObject(item); |
||
1195 | }); |
||
1196 | Entity.SaveChanges(); |
||
1197 | |||
1198 | try |
||
1199 | { |
||
1200 | mlmarkup_data.ForEach(value => |
||
1201 | { |
||
1202 | Entity.MARKUP_DATA.AddObject(new MARKUP_DATA |
||
1203 | { |
||
1204 | ID = value.ID, |
||
1205 | DATA = value.DATA, |
||
1206 | DATA_TYPE = value.DATA_TYPE, |
||
1207 | PAGENUMBER = value.PAGENUMBER, |
||
1208 | c8e9b3e4 | ljiyeon | MARKUPINFO_VERSION_ID = markup_info_version.ID, |
1209 | 53880c83 | ljiyeon | SYMBOL_ID = value.SYMBOL_ID, |
1210 | GROUP_ID = value.GROUP_ID |
||
1211 | 2ab012e8 | djkim | }); |
1212 | }); |
||
1213 | Entity.SaveChanges(); |
||
1214 | } |
||
1215 | catch (Exception) |
||
1216 | { |
||
1217 | return false; |
||
1218 | } |
||
1219 | } |
||
1220 | return true; |
||
1221 | } |
||
1222 | |||
1223 | 53880c83 | ljiyeon | [OperationContract] |
1224 | public long AddMarkupDataGroup(MARKUP_DATA_GROUP mARKUP_DATA_GROUP, string ProjectNo) |
||
1225 | { |
||
1226 | try |
||
1227 | { |
||
1228 | using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString())) |
||
1229 | { |
||
1230 | Entity.AddToMARKUP_DATA_GROUP(mARKUP_DATA_GROUP); |
||
1231 | //MARKUP_DATA_GROUP tt = Entity.MARKUP_DATA_GROUP.Where(info => info.ID == id).FirstOrDefault(); |
||
1232 | Entity.SaveChanges(); |
||
1233 | |||
1234 | return Entity.MARKUP_DATA_GROUP.ToList().LastOrDefault().ID; |
||
1235 | } |
||
1236 | } |
||
1237 | catch (Exception) |
||
1238 | { |
||
1239 | return 0; |
||
1240 | } |
||
1241 | } |
||
1242 | [OperationContract] |
||
1243 | public bool UpdateMarkupDataGroup(long Group_ID, string ProjectNo) |
||
1244 | { |
||
1245 | try |
||
1246 | { |
||
1247 | using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString())) |
||
1248 | { |
||
1249 | var UpdateItem = Entity.MARKUP_DATA_GROUP.Where(info => info.ID == Group_ID).FirstOrDefault(); |
||
1250 | UpdateItem.STATE = 1; |
||
1251 | Entity.SaveChanges(); |
||
1252 | } |
||
1253 | } |
||
1254 | catch (Exception) |
||
1255 | { |
||
1256 | return false; |
||
1257 | } |
||
1258 | return true; |
||
1259 | } |
||
1260 | [OperationContract] |
||
1261 | public bool UpdateMarkupData(string CommentID, long Group_ID, string ProjectNo) |
||
1262 | { |
||
1263 | try |
||
1264 | { |
||
1265 | using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString())) |
||
1266 | { |
||
1267 | var UpdateItem = Entity.MARKUP_DATA.Where(info => info.ID == CommentID).FirstOrDefault(); |
||
1268 | UpdateItem.GROUP_ID = Group_ID; |
||
1269 | Entity.SaveChanges(); |
||
1270 | } |
||
1271 | } |
||
1272 | catch (Exception) |
||
1273 | { |
||
1274 | return false; |
||
1275 | } |
||
1276 | return true; |
||
1277 | } |
||
1278 | 2ab012e8 | djkim | |
1279 | [OperationContract] |
||
1280 | public bool SaveSymbol(SYMBOL_PRIVATE symbol_private) |
||
1281 | { |
||
1282 | try |
||
1283 | { |
||
1284 | using (KCOMDataModel.DataModel.KCOMEntities uc = new KCOMDataModel.DataModel.KCOMEntities(KCOMDataModel.Common.ConnectStringBuilder.KCOMConnectionString().ToString())) |
||
1285 | { |
||
1286 | uc.AddToSYMBOL_PRIVATE(symbol_private); |
||
1287 | uc.SaveChanges(); |
||
1288 | } |
||
1289 | } |
||
1290 | catch(Exception) |
||
1291 | { |
||
1292 | return false; |
||
1293 | } |
||
1294 | return true; |
||
1295 | } |
||
1296 | [OperationContract] |
||
1297 | 498f0fc9 | ljiyeon | public bool AddPublicSymbol(SYMBOL_PUBLIC symbol) |
1298 | { |
||
1299 | try |
||
1300 | { |
||
1301 | using (KCOMDataModel.DataModel.KCOMEntities uc = new KCOMDataModel.DataModel.KCOMEntities(KCOMDataModel.Common.ConnectStringBuilder.KCOMConnectionString().ToString())) |
||
1302 | { |
||
1303 | uc.AddToSYMBOL_PUBLIC(symbol); |
||
1304 | uc.SaveChanges(); |
||
1305 | } |
||
1306 | } |
||
1307 | catch (Exception) |
||
1308 | { |
||
1309 | return false; |
||
1310 | } |
||
1311 | return true; |
||
1312 | } |
||
1313 | [OperationContract] |
||
1314 | public bool DeleteSymbol(string symbol_id, int type) |
||
1315 | 2ab012e8 | djkim | { |
1316 | try |
||
1317 | { |
||
1318 | using (KCOMEntities Entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
||
1319 | { |
||
1320 | 498f0fc9 | ljiyeon | if (type == 0) |
1321 | { |
||
1322 | string delItem_ID = symbol_id; |
||
1323 | var delitem = Entity.SYMBOL_PRIVATE.Where(data => data.ID == delItem_ID).FirstOrDefault(); |
||
1324 | Entity.SYMBOL_PRIVATE.DeleteObject(delitem); |
||
1325 | Entity.SaveChanges(); |
||
1326 | } |
||
1327 | else |
||
1328 | { |
||
1329 | string delItem_ID = symbol_id; |
||
1330 | var delitem = Entity.SYMBOL_PUBLIC.Where(data => data.ID == delItem_ID).FirstOrDefault(); |
||
1331 | Entity.SYMBOL_PUBLIC.DeleteObject(delitem); |
||
1332 | Entity.SaveChanges(); |
||
1333 | } |
||
1334 | 2ab012e8 | djkim | } |
1335 | } |
||
1336 | catch(Exception) |
||
1337 | { |
||
1338 | return false; |
||
1339 | } |
||
1340 | return true; |
||
1341 | } |
||
1342 | |||
1343 | [OperationContract] |
||
1344 | 498f0fc9 | ljiyeon | public bool RenameSymbol(string symbol_id, string name, int type) |
1345 | 2ab012e8 | djkim | { |
1346 | try |
||
1347 | { |
||
1348 | using (KCOMEntities Entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
||
1349 | { |
||
1350 | 498f0fc9 | ljiyeon | if (type == 0) |
1351 | { |
||
1352 | var UpdateItem = Entity.SYMBOL_PRIVATE.Where(info => info.ID == symbol_id).FirstOrDefault(); |
||
1353 | UpdateItem.NAME = name; |
||
1354 | Entity.SaveChanges(); |
||
1355 | } |
||
1356 | else |
||
1357 | { |
||
1358 | var UpdateItem = Entity.SYMBOL_PUBLIC.Where(info => info.ID == symbol_id).FirstOrDefault(); |
||
1359 | UpdateItem.NAME = name; |
||
1360 | Entity.SaveChanges(); |
||
1361 | } |
||
1362 | 2ab012e8 | djkim | } |
1363 | } |
||
1364 | catch (Exception) |
||
1365 | { |
||
1366 | return false; |
||
1367 | } |
||
1368 | return true; |
||
1369 | } |
||
1370 | |||
1371 | [OperationContract] |
||
1372 | public bool AddCheckListHistory(string project_no, CHECK_LIST_HISTORY Check_History) |
||
1373 | { |
||
1374 | try |
||
1375 | { |
||
1376 | using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
||
1377 | { |
||
1378 | Entity.CHECK_LIST_HISTORY.AddObject(Check_History); |
||
1379 | Entity.SaveChanges(); |
||
1380 | } |
||
1381 | } |
||
1382 | catch (Exception) |
||
1383 | { |
||
1384 | return false; |
||
1385 | } |
||
1386 | return true; |
||
1387 | } |
||
1388 | [OperationContract] |
||
1389 | public bool SaveCheckListHistory(string project_no, string rev, CHECK_LIST_HISTORY Check_History) |
||
1390 | { |
||
1391 | try |
||
1392 | { |
||
1393 | using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
||
1394 | { |
||
1395 | var item = Entity.CHECK_LIST_HISTORY.Where(info => info.REVISION == rev).FirstOrDefault(); |
||
1396 | item = Check_History; |
||
1397 | Entity.SaveChanges(); |
||
1398 | } |
||
1399 | } |
||
1400 | catch (Exception) |
||
1401 | { |
||
1402 | return false; |
||
1403 | } |
||
1404 | return true; |
||
1405 | } |
||
1406 | [OperationContract] |
||
1407 | public bool SaveCheckList(string project_no, string _id, CHECK_LIST Check_value) |
||
1408 | { |
||
1409 | try |
||
1410 | { |
||
1411 | using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
||
1412 | { |
||
1413 | var item = Entity.CHECK_LIST.Where(info => info.ID == _id).FirstOrDefault(); |
||
1414 | item.TODOLIST = Check_value.TODOLIST; |
||
1415 | item.REMARK = Check_value.REMARK; |
||
1416 | item.STATUS = Check_value.STATUS; |
||
1417 | item.VENDOR = Check_value.VENDOR; |
||
1418 | item.REPLY = Check_value.REPLY; |
||
1419 | item.IMAGE_URL = Check_value.IMAGE_URL; |
||
1420 | item.IMAGE_ANCHOR = Check_value.IMAGE_ANCHOR; |
||
1421 | item.UPDATE_TIME = Check_value.UPDATE_TIME; |
||
1422 | 5de0c110 | ljiyeon | if(Check_value.STATUS == "False") |
1423 | { |
||
1424 | item.STATUS_DESC_OPEN = Check_value.STATUS_DESC_OPEN; |
||
1425 | } |
||
1426 | else |
||
1427 | { |
||
1428 | item.STATUS_DESC_CLOSE = Check_value.STATUS_DESC_CLOSE; |
||
1429 | } |
||
1430 | 2ab012e8 | djkim | Entity.SaveChanges(); |
1431 | } |
||
1432 | } |
||
1433 | catch (Exception) |
||
1434 | { |
||
1435 | return false; |
||
1436 | } |
||
1437 | return true; |
||
1438 | } |
||
1439 | [OperationContract] |
||
1440 | public bool AddCheckList(string project_no, CHECK_LIST Check_value) |
||
1441 | { |
||
1442 | try |
||
1443 | { |
||
1444 | using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
||
1445 | { |
||
1446 | Entity.CHECK_LIST.AddObject(Check_value); |
||
1447 | Entity.SaveChanges(); |
||
1448 | } |
||
1449 | } |
||
1450 | catch (Exception) |
||
1451 | { |
||
1452 | return false; |
||
1453 | } |
||
1454 | return true; |
||
1455 | } |
||
1456 | |||
1457 | [OperationContract] |
||
1458 | public CHECK_LIST GetCheckList(string project_no, string _id) |
||
1459 | { |
||
1460 | CHECK_LIST Check_value = new CHECK_LIST(); |
||
1461 | try |
||
1462 | { |
||
1463 | using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
||
1464 | { |
||
1465 | Check_value = Entity.CHECK_LIST.Where(info => info.ID == _id).FirstOrDefault(); |
||
1466 | } |
||
1467 | } |
||
1468 | catch (Exception) |
||
1469 | { |
||
1470 | return null; |
||
1471 | } |
||
1472 | return Check_value; |
||
1473 | } |
||
1474 | [OperationContract] |
||
1475 | public List<CHECK_LIST> GetUserCheckList(string project_no, string user_id, string doc_no) |
||
1476 | { |
||
1477 | List<CHECK_LIST> list = new List<CHECK_LIST>(); |
||
1478 | try |
||
1479 | { |
||
1480 | using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
||
1481 | { |
||
1482 | 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(); |
||
1483 | } |
||
1484 | } |
||
1485 | catch (Exception) |
||
1486 | { |
||
1487 | return null; |
||
1488 | } |
||
1489 | return list; |
||
1490 | } |
||
1491 | [OperationContract] |
||
1492 | public List<CHECK_LIST_HISTORY> GetCheckListHistory(string project_no, string _id) |
||
1493 | { |
||
1494 | List<CHECK_LIST_HISTORY> history = new List<CHECK_LIST_HISTORY>(); |
||
1495 | try |
||
1496 | { |
||
1497 | using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
||
1498 | { |
||
1499 | history = Entity.CHECK_LIST_HISTORY.Where(data => data.CHECKLIST_ID == _id).ToList(); |
||
1500 | } |
||
1501 | } |
||
1502 | catch (Exception) |
||
1503 | { |
||
1504 | return null; |
||
1505 | } |
||
1506 | return history; |
||
1507 | } |
||
1508 | [OperationContract] |
||
1509 | public CHECK_LIST_HISTORY GetCheckListHistoryFirstOrDefault(string project_no, string checklist_id, string rev) |
||
1510 | { |
||
1511 | CHECK_LIST_HISTORY Check_Item = new CHECK_LIST_HISTORY(); |
||
1512 | try |
||
1513 | { |
||
1514 | using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
||
1515 | { |
||
1516 | Check_Item = Entity.CHECK_LIST_HISTORY.Where(info => info.CHECKLIST_ID == checklist_id && info.REVISION == rev).FirstOrDefault(); |
||
1517 | } |
||
1518 | } |
||
1519 | catch (Exception) |
||
1520 | { |
||
1521 | return null; |
||
1522 | } |
||
1523 | return Check_Item; |
||
1524 | } |
||
1525 | [OperationContract] |
||
1526 | public bool SavePageAngle(string project_no, List<DOCPAGE> _mldocpage) |
||
1527 | { |
||
1528 | try |
||
1529 | { |
||
1530 | using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
||
1531 | { |
||
1532 | KCOMDataModel.DataModel.DOCPAGE _docpage = new KCOMDataModel.DataModel.DOCPAGE(); |
||
1533 | _mldocpage.ForEach(data => |
||
1534 | { |
||
1535 | _docpage = (from info in Entity.DOCPAGE |
||
1536 | where info.ID == data.ID |
||
1537 | select info).FirstOrDefault(); |
||
1538 | |||
1539 | if (_docpage.PAGE_ANGLE != data.PAGE_ANGLE) |
||
1540 | { |
||
1541 | _docpage.PAGE_ANGLE = data.PAGE_ANGLE; |
||
1542 | } |
||
1543 | }); |
||
1544 | |||
1545 | Entity.SaveChanges(); |
||
1546 | } |
||
1547 | } |
||
1548 | catch (Exception) |
||
1549 | { |
||
1550 | return false; |
||
1551 | } |
||
1552 | return true; |
||
1553 | } |
||
1554 | |||
1555 | [OperationContract] |
||
1556 | public MARKUP_INFO GetMarkupInfo(string project_no, string _id) |
||
1557 | { |
||
1558 | MARKUP_INFO markupInfo = new MARKUP_INFO(); |
||
1559 | |||
1560 | try |
||
1561 | { |
||
1562 | using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
||
1563 | { |
||
1564 | markupInfo = Entity.MARKUP_INFO.Where(entity => entity.DOCINFO_ID == _id).OrderByDescending(i => i.CONSOLIDATE).OrderByDescending(j => j.CREATE_TIME).FirstOrDefault(); |
||
1565 | } |
||
1566 | } |
||
1567 | catch (Exception) |
||
1568 | { |
||
1569 | return null; |
||
1570 | } |
||
1571 | return markupInfo; |
||
1572 | } |
||
1573 | |||
1574 | [OperationContract] |
||
1575 | public List<string> GetMarkupDataListperPage(string project_no, string _markupinfoid, int _pageNo) |
||
1576 | { |
||
1577 | List<string> markupdata = new List<string>(); |
||
1578 | MARKUP_INFO_VERSION markup_info_version = new MARKUP_INFO_VERSION(); |
||
1579 | try |
||
1580 | { |
||
1581 | using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
||
1582 | { |
||
1583 | markup_info_version = (from version in Entity.MARKUP_INFO_VERSION |
||
1584 | where version.MARKUPINFO_ID == _markupinfoid |
||
1585 | orderby version.CREATE_DATE descending |
||
1586 | select version).First(); |
||
1587 | markupdata = (from data in Entity.MARKUP_DATA |
||
1588 | where data.MARKUPINFO_VERSION_ID == markup_info_version.ID && data.PAGENUMBER == _pageNo |
||
1589 | select data.DATA).ToList(); |
||
1590 | } |
||
1591 | } |
||
1592 | catch (Exception) |
||
1593 | { |
||
1594 | return null; |
||
1595 | } |
||
1596 | return markupdata; |
||
1597 | } |
||
1598 | |||
1599 | [OperationContract] |
||
1600 | public bool AddMarkupInfo(string project_no, MARKUP_INFO value) |
||
1601 | { |
||
1602 | try |
||
1603 | { |
||
1604 | using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
||
1605 | { |
||
1606 | Entity.MARKUP_INFO.AddObject(value); |
||
1607 | Entity.SaveChanges(); |
||
1608 | } |
||
1609 | } |
||
1610 | catch (Exception) |
||
1611 | { |
||
1612 | return false; |
||
1613 | } |
||
1614 | return true; |
||
1615 | } |
||
1616 | |||
1617 | [OperationContract] |
||
1618 | public bool AddMarkupInfoVersion(string project_no, MARKUP_INFO_VERSION value) |
||
1619 | { |
||
1620 | try |
||
1621 | { |
||
1622 | using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
||
1623 | { |
||
1624 | Entity.MARKUP_INFO_VERSION.AddObject(value); |
||
1625 | Entity.SaveChanges(); |
||
1626 | } |
||
1627 | } |
||
1628 | catch (Exception) |
||
1629 | { |
||
1630 | return false; |
||
1631 | } |
||
1632 | return true; |
||
1633 | } |
||
1634 | |||
1635 | [OperationContract] |
||
1636 | public bool AddMarkupData(string project_no, MARKUP_DATA value) |
||
1637 | { |
||
1638 | try |
||
1639 | { |
||
1640 | using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
||
1641 | { |
||
1642 | Entity.MARKUP_DATA.AddObject(value); |
||
1643 | Entity.SaveChanges(); |
||
1644 | } |
||
1645 | } |
||
1646 | catch (Exception) |
||
1647 | { |
||
1648 | return false; |
||
1649 | } |
||
1650 | return true; |
||
1651 | } |
||
1652 | |||
1653 | [OperationContract] |
||
1654 | public bool AvoidMarkupInfo(string project_no, string _doc_id) |
||
1655 | { |
||
1656 | try |
||
1657 | { |
||
1658 | using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
||
1659 | { |
||
1660 | var item = Entity.MARKUP_INFO.Where(entity => entity.DOCINFO_ID == _doc_id).OrderByDescending(i => i.CONSOLIDATE).OrderByDescending(j => j.CREATE_TIME).FirstOrDefault(); |
||
1661 | item.AVOID_CONSOLIDATE = 1; |
||
1662 | Entity.SaveChanges(); |
||
1663 | } |
||
1664 | } |
||
1665 | catch (Exception) |
||
1666 | { |
||
1667 | return false; |
||
1668 | } |
||
1669 | return true; |
||
1670 | } |
||
1671 | |||
1672 | [OperationContract] |
||
1673 | public bool SaveMarkupInfo(string project_no, string _id, MARKUP_INFO value) |
||
1674 | { |
||
1675 | try |
||
1676 | { |
||
1677 | using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
||
1678 | { |
||
1679 | var item = Entity.MARKUP_INFO.Where(info => info.ID == _id).FirstOrDefault(); |
||
1680 | item = value; |
||
1681 | Entity.SaveChanges(); |
||
1682 | } |
||
1683 | } |
||
1684 | catch (Exception) |
||
1685 | { |
||
1686 | return false; |
||
1687 | } |
||
1688 | return true; |
||
1689 | } |
||
1690 | [OperationContract] |
||
1691 | public List<MARKUP_DATA> GetMarkupDataList(string project_no, string _versionid) |
||
1692 | { |
||
1693 | List<MARKUP_DATA> mlresult = new List<MARKUP_DATA>(); |
||
1694 | |||
1695 | try |
||
1696 | { |
||
1697 | using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
||
1698 | { |
||
1699 | mlresult = Entity.MARKUP_DATA.Where(data => data.MARKUPINFO_VERSION_ID == _versionid).ToList(); |
||
1700 | } |
||
1701 | } |
||
1702 | catch (Exception) |
||
1703 | { |
||
1704 | return null; |
||
1705 | } |
||
1706 | return mlresult; |
||
1707 | } |
||
1708 | |||
1709 | [OperationContract] |
||
1710 | public bool Consolidate(string project_no, string _user_id, string _doc_id, List<MarkupInfoItem> markupInfoItems) |
||
1711 | { |
||
1712 | try |
||
1713 | { |
||
1714 | List<KCOMDataModel.DataModel.MARKUP_DATA> instanceDataSet = new List<KCOMDataModel.DataModel.MARKUP_DATA>(); |
||
1715 | using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
||
1716 | { |
||
1717 | var markupInfo = Entity.MARKUP_INFO.Where(entity => entity.DOCINFO_ID == _doc_id).OrderByDescending(i => i.CONSOLIDATE).OrderByDescending(j => j.CREATE_TIME).FirstOrDefault(); |
||
1718 | if (markupInfo.CONSOLIDATE == 1) |
||
1719 | { |
||
1720 | markupInfo.AVOID_CONSOLIDATE = 1; |
||
1721 | } |
||
1722 | |||
1723 | foreach (MarkupInfoItem item in markupInfoItems) |
||
1724 | { |
||
1725 | Entity.MARKUP_DATA.Where(data => data.MARKUPINFO_VERSION_ID == item.MarkupVersionID).ToList().ForEach(d => |
||
1726 | { |
||
1727 | instanceDataSet.Add(d); |
||
1728 | }); |
||
1729 | } |
||
1730 | |||
1731 | KCOMDataModel.DataModel.MARKUP_INFO info = new KCOMDataModel.DataModel.MARKUP_INFO(); |
||
1732 | info.ID = shortGuid(); |
||
1733 | info.CONSOLIDATE = 1; |
||
1734 | info.CREATE_TIME = DateTime.Now; |
||
1735 | info.DOCINFO_ID = _doc_id; |
||
1736 | info.UPDATE_TIME = DateTime.Now; |
||
1737 | info.USER_ID = _user_id; |
||
1738 | info.AVOID_CONSOLIDATE = 0; |
||
1739 | |||
1740 | Entity.MARKUP_INFO.AddObject(info); |
||
1741 | Entity.SaveChanges(); |
||
1742 | |||
1743 | |||
1744 | KCOMDataModel.DataModel.MARKUP_INFO_VERSION info2 = new KCOMDataModel.DataModel.MARKUP_INFO_VERSION |
||
1745 | { |
||
1746 | ID = shortGuid(), |
||
1747 | CREATE_DATE = DateTime.Now, |
||
1748 | MARKUP_INFO = info, |
||
1749 | }; |
||
1750 | Entity.SaveChanges(); |
||
1751 | |||
1752 | foreach (var item in instanceDataSet) |
||
1753 | { |
||
1754 | Entity.MARKUP_DATA.AddObject(new KCOMDataModel.DataModel.MARKUP_DATA |
||
1755 | { |
||
1756 | ID = shortGuid(), |
||
1757 | DATA = item.DATA, |
||
1758 | DATA_TYPE = item.DATA_TYPE, |
||
1759 | PAGENUMBER = item.PAGENUMBER, |
||
1760 | c8e9b3e4 | ljiyeon | MARKUP_INFO_VERSION = info2, |
1761 | 53880c83 | ljiyeon | SYMBOL_ID = item.SYMBOL_ID, |
1762 | GROUP_ID = item.GROUP_ID |
||
1763 | 2ab012e8 | djkim | }); |
1764 | } |
||
1765 | Entity.SaveChanges(); |
||
1766 | |||
1767 | |||
1768 | } |
||
1769 | } |
||
1770 | catch (Exception) |
||
1771 | { |
||
1772 | return false; |
||
1773 | } |
||
1774 | return true; |
||
1775 | } |
||
1776 | |||
1777 | 49d444ef | ljiyeon | |
1778 | [OperationContract] |
||
1779 | public FinalPDFResult ConsolidateMergedPDF(string project_no, string _user_id, string _doc_id, List<MarkupInfoItem> markupInfoItems, string ProjectNo, string DocInfoID, string CreateUserID) |
||
1780 | { |
||
1781 | bool consolidate = false; |
||
1782 | try |
||
1783 | { |
||
1784 | List<KCOMDataModel.DataModel.MARKUP_DATA> instanceDataSet = new List<KCOMDataModel.DataModel.MARKUP_DATA>(); |
||
1785 | using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
||
1786 | { |
||
1787 | var markupInfo = Entity.MARKUP_INFO.Where(entity => entity.DOCINFO_ID == _doc_id).OrderByDescending(i => i.CONSOLIDATE).OrderByDescending(j => j.CREATE_TIME).FirstOrDefault(); |
||
1788 | if (markupInfo.CONSOLIDATE == 1) |
||
1789 | { |
||
1790 | markupInfo.AVOID_CONSOLIDATE = 1; |
||
1791 | } |
||
1792 | |||
1793 | foreach (MarkupInfoItem item in markupInfoItems) |
||
1794 | { |
||
1795 | Entity.MARKUP_DATA.Where(data => data.MARKUPINFO_VERSION_ID == item.MarkupVersionID).ToList().ForEach(d => |
||
1796 | { |
||
1797 | instanceDataSet.Add(d); |
||
1798 | }); |
||
1799 | } |
||
1800 | |||
1801 | KCOMDataModel.DataModel.MARKUP_INFO info = new KCOMDataModel.DataModel.MARKUP_INFO(); |
||
1802 | info.ID = shortGuid(); |
||
1803 | info.CONSOLIDATE = 1; |
||
1804 | info.CREATE_TIME = DateTime.Now; |
||
1805 | info.DOCINFO_ID = _doc_id; |
||
1806 | info.UPDATE_TIME = DateTime.Now; |
||
1807 | info.USER_ID = _user_id; |
||
1808 | info.AVOID_CONSOLIDATE = 0; |
||
1809 | |||
1810 | Entity.MARKUP_INFO.AddObject(info); |
||
1811 | Entity.SaveChanges(); |
||
1812 | |||
1813 | |||
1814 | KCOMDataModel.DataModel.MARKUP_INFO_VERSION info2 = new KCOMDataModel.DataModel.MARKUP_INFO_VERSION |
||
1815 | { |
||
1816 | ID = shortGuid(), |
||
1817 | CREATE_DATE = DateTime.Now, |
||
1818 | MARKUP_INFO = info, |
||
1819 | }; |
||
1820 | Entity.SaveChanges(); |
||
1821 | |||
1822 | foreach (var item in instanceDataSet) |
||
1823 | { |
||
1824 | Entity.MARKUP_DATA.AddObject(new KCOMDataModel.DataModel.MARKUP_DATA |
||
1825 | { |
||
1826 | ID = shortGuid(), |
||
1827 | DATA = item.DATA, |
||
1828 | DATA_TYPE = item.DATA_TYPE, |
||
1829 | PAGENUMBER = item.PAGENUMBER, |
||
1830 | MARKUP_INFO_VERSION = info2, |
||
1831 | 53880c83 | ljiyeon | SYMBOL_ID = item.SYMBOL_ID, |
1832 | GROUP_ID = item.GROUP_ID |
||
1833 | 49d444ef | ljiyeon | }); |
1834 | } |
||
1835 | Entity.SaveChanges(); |
||
1836 | |||
1837 | |||
1838 | } |
||
1839 | consolidate = true; |
||
1840 | } |
||
1841 | catch (Exception) |
||
1842 | { |
||
1843 | consolidate = false; |
||
1844 | } |
||
1845 | FinalPDFResult _result = new FinalPDFResult(); |
||
1846 | if (consolidate == true) |
||
1847 | { |
||
1848 | RemFinalPDFObject remObj = null; |
||
1849 | try |
||
1850 | { |
||
1851 | string _finalID = shortGuid(); |
||
1852 | int _DocTotalPages = -1; |
||
1853 | string docItemId; |
||
1854 | |||
1855 | |||
1856 | using (CIEntities _ci = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString())) |
||
1857 | { |
||
1858 | var _doc = _ci.DOCINFO.Where(info => info.ID == DocInfoID); |
||
1859 | |||
1860 | if (_doc.Count() > 0) |
||
1861 | { |
||
1862 | _DocTotalPages = _doc.First().PAGE_COUNT; |
||
1863 | docItemId = _doc.First().DOCUMENT_ID; |
||
1864 | } |
||
1865 | else |
||
1866 | { |
||
1867 | _result.Status = FinalStatus.Error; |
||
1868 | _result.Exception = "페이지 정보를 가져올 수 없습니다."; |
||
1869 | return _result; |
||
1870 | } |
||
1871 | } |
||
1872 | |||
1873 | var Items = GetMarkupInfoItems(ProjectNo, DocInfoID); |
||
1874 | if (_DocTotalPages > 0) |
||
1875 | { |
||
1876 | var item2 = Items.Cast<MarkupInfoItem>().Where(d => d.Consolidate == 1 && d.AvoidConsolidate == 0).FirstOrDefault(); |
||
1877 | FINAL_PDF fm = new FINAL_PDF() |
||
1878 | { |
||
1879 | ID = _finalID, |
||
1880 | PROJECT_NO = ProjectNo, |
||
1881 | DOCINFO_ID = DocInfoID, |
||
1882 | DOCUMENT_ID = docItemId, |
||
1883 | MARKUPINFO_ID = item2.MarkupInfoID, |
||
1884 | CREATE_USER_ID = CreateUserID, |
||
1885 | TOTAL_PAGE = _DocTotalPages, |
||
1886 | CREATE_DATETIME = DateTime.Now, |
||
1887 | STATUS = (int)IFinalPDF.FinalStatus.Insert |
||
1888 | }; |
||
1889 | using (KCOMEntities _entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
||
1890 | { |
||
1891 | _entity.AddToFINAL_PDF(fm); |
||
1892 | _entity.SaveChanges(System.Data.Objects.SaveOptions.AcceptAllChangesAfterSave); |
||
1893 | }; |
||
1894 | |||
1895 | System.Runtime.Remoting.Channels.IChannel _ch = System.Runtime.Remoting.Channels.ChannelServices.GetChannel("tcp"); |
||
1896 | if (_ch == null) |
||
1897 | { |
||
1898 | chan = new TcpChannel(); |
||
1899 | _ChanID = chan.ChannelName; |
||
1900 | System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(chan, false); |
||
1901 | // Create an instance of the remote object |
||
1902 | |||
1903 | |||
1904 | using (KCOMEntities ec = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
||
1905 | { |
||
1906 | |||
1907 | //remObj = (RemFinalPDFObject)Activator.GetObject(typeof(RemFinalPDFObject), |
||
1908 | // "tcp://localhost:9092/remFinalPDF"); |
||
1909 | remObj = (RemFinalPDFObject)Activator.GetObject(typeof(RemFinalPDFObject), |
||
1910 | //"tcp://192.168.0.67:9092/remFinalPDF"); |
||
1911 | "tcp://192.168.0.67:9092/remFinalPDF"); |
||
1912 | } |
||
1913 | |||
1914 | //"tcp://localhost:8080/remFinalPDF"); |
||
1915 | |||
1916 | _result = remObj.SetFinalPDF(ProjectNo, _finalID); |
||
1917 | _result.FinalID = _finalID; |
||
1918 | _result.Status = FinalStatus.Success; |
||
1919 | |||
1920 | //MarkupToPDF.MarkupToPDF fa = new MarkupToPDF.MarkupToPDF(); |
||
1921 | //fa.MakeFinalPDF(fm); |
||
1922 | } |
||
1923 | else |
||
1924 | { |
||
1925 | _ChanID = _ch.ChannelName; |
||
1926 | } |
||
1927 | } |
||
1928 | } |
||
1929 | catch (Exception ex) |
||
1930 | { |
||
1931 | _result.Status = FinalStatus.Error; |
||
1932 | |||
1933 | if (ex.GetType() == typeof(System.Net.Sockets.SocketException)) |
||
1934 | _result.Exception = "Final Server Not Connection"; |
||
1935 | } |
||
1936 | finally |
||
1937 | { |
||
1938 | remObj = null; |
||
1939 | if (System.Runtime.Remoting.Channels.ChannelServices.GetChannel("tcp") != null) |
||
1940 | System.Runtime.Remoting.Channels.ChannelServices.UnregisterChannel(chan); |
||
1941 | |||
1942 | GC.Collect(2); |
||
1943 | } |
||
1944 | } |
||
1945 | return _result; |
||
1946 | } |
||
1947 | 2ab012e8 | djkim | [OperationContract] |
1948 | 04a7385a | djkim | public bool TeamConsolidate(string project_no, string _user_id, string _doc_id, List<MarkupInfoItem> markupInfoItems) |
1949 | { |
||
1950 | try |
||
1951 | { |
||
1952 | List<KCOMDataModel.DataModel.MARKUP_DATA> instanceDataSet = new List<KCOMDataModel.DataModel.MARKUP_DATA>(); |
||
1953 | using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
||
1954 | { |
||
1955 | var markupInfo = Entity.MARKUP_INFO.Where(entity => entity.DOCINFO_ID == _doc_id).OrderByDescending(i => i.CONSOLIDATE).OrderByDescending(j => j.CREATE_TIME).FirstOrDefault(); |
||
1956 | if (markupInfo.PART_CONSOLIDATE == 1) |
||
1957 | { |
||
1958 | markupInfo.AVOID_CONSOLIDATE = 1; |
||
1959 | } |
||
1960 | |||
1961 | foreach (MarkupInfoItem item in markupInfoItems) |
||
1962 | { |
||
1963 | Entity.MARKUP_DATA.Where(data => data.MARKUPINFO_VERSION_ID == item.MarkupVersionID).ToList().ForEach(d => |
||
1964 | { |
||
1965 | instanceDataSet.Add(d); |
||
1966 | }); |
||
1967 | } |
||
1968 | |||
1969 | KCOMDataModel.DataModel.MARKUP_INFO info = new KCOMDataModel.DataModel.MARKUP_INFO(); |
||
1970 | info.ID = shortGuid(); |
||
1971 | info.PART_CONSOLIDATE = 1; |
||
1972 | info.CREATE_TIME = DateTime.Now; |
||
1973 | info.DOCINFO_ID = _doc_id; |
||
1974 | info.UPDATE_TIME = DateTime.Now; |
||
1975 | info.USER_ID = _user_id; |
||
1976 | info.AVOID_CONSOLIDATE = 0; |
||
1977 | |||
1978 | Entity.MARKUP_INFO.AddObject(info); |
||
1979 | Entity.SaveChanges(); |
||
1980 | |||
1981 | |||
1982 | KCOMDataModel.DataModel.MARKUP_INFO_VERSION info2 = new KCOMDataModel.DataModel.MARKUP_INFO_VERSION |
||
1983 | { |
||
1984 | ID = shortGuid(), |
||
1985 | CREATE_DATE = DateTime.Now, |
||
1986 | MARKUP_INFO = info, |
||
1987 | }; |
||
1988 | Entity.SaveChanges(); |
||
1989 | |||
1990 | foreach (var item in instanceDataSet) |
||
1991 | { |
||
1992 | Entity.MARKUP_DATA.AddObject(new KCOMDataModel.DataModel.MARKUP_DATA |
||
1993 | { |
||
1994 | ID = shortGuid(), |
||
1995 | DATA = item.DATA, |
||
1996 | DATA_TYPE = item.DATA_TYPE, |
||
1997 | PAGENUMBER = item.PAGENUMBER, |
||
1998 | c8e9b3e4 | ljiyeon | MARKUP_INFO_VERSION = info2, |
1999 | 53880c83 | ljiyeon | SYMBOL_ID = item.SYMBOL_ID, |
2000 | GROUP_ID = item.GROUP_ID |
||
2001 | 04a7385a | djkim | }); |
2002 | } |
||
2003 | Entity.SaveChanges(); |
||
2004 | |||
2005 | |||
2006 | } |
||
2007 | } |
||
2008 | catch (Exception) |
||
2009 | { |
||
2010 | return false; |
||
2011 | } |
||
2012 | return true; |
||
2013 | } |
||
2014 | |||
2015 | [OperationContract] |
||
2016 | 2ab012e8 | djkim | [ServiceKnownType(typeof(MEMBER))] |
2017 | public MEMBER GetMember(string project_no, string user_id) |
||
2018 | { |
||
2019 | MEMBER rstmember = new MEMBER(); |
||
2020 | try |
||
2021 | { |
||
2022 | using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
||
2023 | { |
||
2024 | var tmp = (from member in Entity.MEMBER |
||
2025 | where member.ID == user_id |
||
2026 | select member).FirstOrDefault(); |
||
2027 | rstmember.DEPARTMENT = tmp.DEPARTMENT; |
||
2028 | rstmember.ID = tmp.ID; |
||
2029 | rstmember.NAME = tmp.NAME; |
||
2030 | } |
||
2031 | } |
||
2032 | catch (Exception) |
||
2033 | { |
||
2034 | return null; |
||
2035 | } |
||
2036 | return rstmember; |
||
2037 | } |
||
2038 | |||
2039 | [OperationContract] |
||
2040 | public List<SYMBOL_PRIVATE> GetSymbolList(string user_id) |
||
2041 | { |
||
2042 | List<SYMBOL_PRIVATE> Custom_List = new List<SYMBOL_PRIVATE>(); |
||
2043 | try |
||
2044 | { |
||
2045 | using (KCOMEntities Entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
||
2046 | { |
||
2047 | Custom_List = Entity.SYMBOL_PRIVATE.Where(data => data.MEMBER_USER_ID == user_id).ToList(); |
||
2048 | } |
||
2049 | } |
||
2050 | catch (Exception) |
||
2051 | { |
||
2052 | return null; |
||
2053 | } |
||
2054 | return Custom_List; |
||
2055 | } |
||
2056 | [OperationContract] |
||
2057 | public List<string> GetPublicSymbolDeptList() |
||
2058 | { |
||
2059 | List<string> Custom_List = new List<string>(); |
||
2060 | try |
||
2061 | { |
||
2062 | using (KCOMEntities Entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
||
2063 | { |
||
2064 | Custom_List = Entity.SYMBOL_PUBLIC.Select(data => data.DEPARTMENT).ToList(); |
||
2065 | } |
||
2066 | } |
||
2067 | catch (Exception) |
||
2068 | { |
||
2069 | return null; |
||
2070 | } |
||
2071 | return Custom_List; |
||
2072 | } |
||
2073 | [OperationContract] |
||
2074 | public List<SYMBOL_PUBLIC> GetPublicSymbolList(string dept) |
||
2075 | { |
||
2076 | List<SYMBOL_PUBLIC> Custom_List = new List<SYMBOL_PUBLIC>(); |
||
2077 | try |
||
2078 | { |
||
2079 | using (KCOMEntities Entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
||
2080 | { |
||
2081 | if(!string.IsNullOrEmpty(dept)) |
||
2082 | { |
||
2083 | Custom_List = Entity.SYMBOL_PUBLIC.Where(data => data.DEPARTMENT == dept).ToList(); |
||
2084 | } |
||
2085 | else |
||
2086 | { |
||
2087 | Custom_List = Entity.SYMBOL_PUBLIC.ToList(); |
||
2088 | } |
||
2089 | |||
2090 | } |
||
2091 | } |
||
2092 | catch (Exception) |
||
2093 | { |
||
2094 | return null; |
||
2095 | } |
||
2096 | return Custom_List; |
||
2097 | } |
||
2098 | |||
2099 | /// <summary> |
||
2100 | /// |
||
2101 | /// </summary> |
||
2102 | /// <param name="id">symbol id</param> |
||
2103 | /// <param name="type"> 0 : PRIVATE, 1 : PUBLIC</param> |
||
2104 | /// <returns></returns> |
||
2105 | [OperationContract] |
||
2106 | public string GetSymbolData(string id, int type) |
||
2107 | { |
||
2108 | string result; |
||
2109 | try |
||
2110 | { |
||
2111 | using (KCOMEntities Entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
||
2112 | { |
||
2113 | if(type == 0) |
||
2114 | { |
||
2115 | result = Entity.SYMBOL_PRIVATE.Where(data => data.ID == id).FirstOrDefault().DATA; |
||
2116 | } |
||
2117 | else |
||
2118 | { |
||
2119 | result = Entity.SYMBOL_PUBLIC.Where(data => data.ID == id).FirstOrDefault().DATA; |
||
2120 | } |
||
2121 | } |
||
2122 | } |
||
2123 | catch (Exception) |
||
2124 | { |
||
2125 | return null; |
||
2126 | } |
||
2127 | return result; |
||
2128 | } |
||
2129 | 53880c83 | ljiyeon | [OperationContract] |
2130 | public string GetSymbolImageURL(string id, int type) |
||
2131 | { |
||
2132 | string result; |
||
2133 | try |
||
2134 | { |
||
2135 | using (KCOMEntities Entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
||
2136 | { |
||
2137 | if (type == 0) |
||
2138 | { |
||
2139 | result = Entity.SYMBOL_PRIVATE.Where(data => data.ID == id).FirstOrDefault().IMAGE_URL; |
||
2140 | } |
||
2141 | else |
||
2142 | { |
||
2143 | result = Entity.SYMBOL_PUBLIC.Where(data => data.ID == id).FirstOrDefault().IMAGE_URL; |
||
2144 | } |
||
2145 | } |
||
2146 | } |
||
2147 | catch (Exception) |
||
2148 | { |
||
2149 | return null; |
||
2150 | } |
||
2151 | return result; |
||
2152 | } |
||
2153 | 2ab012e8 | djkim | [OperationContract] |
2154 | public string GetSignData(string project_no, string user_id) |
||
2155 | { |
||
2156 | string result = null; |
||
2157 | try |
||
2158 | { |
||
2159 | var ModelWFConnectionString = ConnectStringBuilder.ProjectCIConnectString(project_no).ToString(); |
||
2160 | if (null != ModelWFConnectionString) |
||
2161 | { |
||
2162 | using (CIEntities entity = new CIEntities(ModelWFConnectionString)) |
||
2163 | { |
||
2164 | var _sign = entity.SIGN_INFO.Where(sin => sin.MEMBER_USER_ID == user_id); |
||
2165 | if (_sign.Count() > 0) |
||
2166 | { |
||
2167 | result = _sign.First().SIGN_STR; |
||
2168 | } |
||
2169 | else |
||
2170 | { |
||
2171 | return null; |
||
2172 | } |
||
2173 | } |
||
2174 | } |
||
2175 | } |
||
2176 | catch (Exception) |
||
2177 | { |
||
2178 | return null; |
||
2179 | } |
||
2180 | return result; |
||
2181 | } |
||
2182 | |||
2183 | [OperationContract] |
||
2184 | public string GetProjectName(string project_no) |
||
2185 | { |
||
2186 | string result = null; |
||
2187 | |||
2188 | try |
||
2189 | { |
||
2190 | using (KCOMDataModel.DataModel.KCOMEntities Entity = new KCOMDataModel.DataModel.KCOMEntities(KCOMDataModel.Common.ConnectStringBuilder.KCOMConnectionString().ToString())) |
||
2191 | { |
||
2192 | result = Entity.RUN_PROJECTS.Where(i => i.PROJECT_NO == project_no).FirstOrDefault().PROJECT_NAME.ToString(); |
||
2193 | } |
||
2194 | } |
||
2195 | catch (Exception) |
||
2196 | { |
||
2197 | return null; |
||
2198 | } |
||
2199 | return result; |
||
2200 | } |
||
2201 | |||
2202 | [OperationContract] |
||
2203 | public List<DOCUMENT_ITEM> GetPreRevSelect(string project_no, string doc_no, string current_rev) |
||
2204 | { |
||
2205 | List<DOCUMENT_ITEM> result = new List<DOCUMENT_ITEM>(); |
||
2206 | |||
2207 | try |
||
2208 | { |
||
2209 | using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
||
2210 | { |
||
2211 | result = Entity.DOCUMENT_ITEM.Where(i => i.PROJECT_NO == project_no |
||
2212 | && i.DOCUMENT_NO == doc_no |
||
2213 | && i.REVISION != current_rev).OrderByDescending(i => i.GROUP_NO).ToList(); |
||
2214 | } |
||
2215 | } |
||
2216 | catch (Exception) |
||
2217 | { |
||
2218 | return null; |
||
2219 | } |
||
2220 | return result; |
||
2221 | } |
||
2222 | |||
2223 | [OperationContract] |
||
2224 | public DOCINFO GetDocInfoOneSelect(string project_no, string doc_id) |
||
2225 | { |
||
2226 | DOCINFO docinfo = null; |
||
2227 | |||
2228 | try |
||
2229 | { |
||
2230 | using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
||
2231 | { |
||
2232 | docinfo = (from info in Entity.DOCINFO |
||
2233 | where info.DOCUMENT_ID == doc_id |
||
2234 | && info.PROJECT_NO == project_no |
||
2235 | select info).First(); |
||
2236 | } |
||
2237 | } |
||
2238 | catch (Exception) |
||
2239 | { |
||
2240 | return null; |
||
2241 | } |
||
2242 | return docinfo; |
||
2243 | } |
||
2244 | |||
2245 | [OperationContract] |
||
2246 | public List<MarkupInfoItem> GetPrintDocItemList(string project_no, string doc_id, List<MarkupInfoItem> _markupInfoList) |
||
2247 | { |
||
2248 | MarkupInfoItem _result = null; |
||
2249 | List<MarkupInfoItem> markupinfo = new List<MarkupInfoItem>(); |
||
2250 | try |
||
2251 | { |
||
2252 | using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
||
2253 | { |
||
2254 | var docitem = (from info in Entity.DOCINFO |
||
2255 | where info.DOCUMENT_ID == doc_id |
||
2256 | && info.PROJECT_NO == project_no |
||
2257 | select info).First(); |
||
2258 | |||
2259 | foreach (MARKUP_INFO markinfo in docitem.MARKUP_INFO) |
||
2260 | { |
||
2261 | var member = (from mem in Entity.MEMBER |
||
2262 | where mem.ID == markinfo.USER_ID |
||
2263 | select mem).First(); |
||
2264 | string displaycolor = null; |
||
2265 | try |
||
2266 | { |
||
2267 | displaycolor = _markupInfoList.Where(info => info.MarkupInfoID == markinfo.ID).First().DisplayColor; |
||
2268 | } |
||
2269 | catch(Exception) |
||
2270 | { |
||
2271 | displaycolor = "#FFFFFF"; |
||
2272 | } |
||
2273 | |||
2274 | _result = new MarkupInfoItem |
||
2275 | { |
||
2276 | MarkupInfoID = markinfo.ID, |
||
2277 | Consolidate = markinfo.CONSOLIDATE, |
||
2278 | CreateTime = markinfo.UPDATE_TIME.HasValue ? markinfo.UPDATE_TIME.Value : markinfo.CREATE_TIME, |
||
2279 | DisplayColor = displaycolor, |
||
2280 | UserID = markinfo.USER_ID, |
||
2281 | UserName = member.NAME, |
||
2282 | Depatment = member.DEPARTMENT, |
||
2283 | }; |
||
2284 | |||
2285 | _result.MarkupList = new List<IKCOM.MarkupItem>(); |
||
2286 | var markup_Version = markinfo.MARKUP_INFO_VERSION.OrderByDescending(p => p.CREATE_DATE).First(); |
||
2287 | |||
2288 | foreach (MARKUP_DATA markdata in markup_Version.MARKUP_DATA) |
||
2289 | { |
||
2290 | MarkupItem markitem = new MarkupItem() |
||
2291 | { |
||
2292 | ID = markdata.ID, |
||
2293 | PageNumber = markdata.PAGENUMBER, |
||
2294 | }; |
||
2295 | _result.MarkupList.Add(markitem); |
||
2296 | } |
||
2297 | |||
2298 | _result.PageCount = _result.MarkupList.GroupBy(i => i.PageNumber).Count(); |
||
2299 | |||
2300 | markupinfo.Add(_result); |
||
2301 | } |
||
2302 | } |
||
2303 | } |
||
2304 | catch (Exception) |
||
2305 | { |
||
2306 | return null; |
||
2307 | } |
||
2308 | return markupinfo; |
||
2309 | } |
||
2310 | 04a7385a | djkim | |
2311 | [OperationContract] |
||
2312 | public bool AddMessage(string project_no, TALK value) |
||
2313 | { |
||
2314 | try |
||
2315 | { |
||
2316 | using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
||
2317 | { |
||
2318 | entity.TALK.AddObject(value); |
||
2319 | entity.SaveChanges(); |
||
2320 | } |
||
2321 | } |
||
2322 | catch (Exception) |
||
2323 | { |
||
2324 | return false; |
||
2325 | } |
||
2326 | return true; |
||
2327 | } |
||
2328 | |||
2329 | [OperationContract] |
||
2330 | public List<TALK> GetMessage(string project_no, string doc_id) |
||
2331 | { |
||
2332 | List<TALK> result = new List<TALK>(); |
||
2333 | try |
||
2334 | { |
||
2335 | using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
||
2336 | { |
||
2337 | result = entity.TALK.Where(data => data.DOCUMENT_ID == doc_id).ToList(); |
||
2338 | } |
||
2339 | } |
||
2340 | catch (Exception) |
||
2341 | { |
||
2342 | return result; |
||
2343 | } |
||
2344 | return result; |
||
2345 | } |
||
2346 | 787a4489 | KangIngu | } |
2347 | } |