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