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