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