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