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