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