markus / KCOM_API / ServiceDeepView.svc.cs @ f9d986d9
이력 | 보기 | 이력해설 | 다운로드 (88.9 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.Runtime.Remoting.Channels.Tcp; |
11 |
using System.Runtime.Serialization; |
12 |
using System.ServiceModel; |
13 |
using System.ServiceModel.Activation; |
14 |
using System.Text; |
15 |
using System.Windows; |
16 |
|
17 |
namespace KCOM_API |
18 |
{ |
19 |
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "ServiceDeepView" in code, svc and config file together. |
20 |
// 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. |
21 |
[ServiceContract(Namespace = "")] |
22 |
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] |
23 |
public partial class ServiceDeepView : System.Web.Services.WebService |
24 |
{ |
25 |
//[OperationContract] |
26 |
//public List<HoneyheadTEXT> GetSearchText(int pageNo, string filePath,bool IsAllPage) //0아 아니면 지정 페이지 |
27 |
//{ |
28 |
|
29 |
// return null; |
30 |
//} |
31 |
|
32 |
|
33 |
[OperationContract] |
34 |
public KCOM_SystemInfo GetSystemData() |
35 |
{ |
36 |
try |
37 |
{ |
38 |
using (KCOMEntities uc = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
39 |
{ |
40 |
var SystemInfoSet = uc.PROPERTIES.Where(data => data.TYPE == "SystemInfo").ToList(); |
41 |
|
42 |
KCOM_SystemInfo sysInfo = new KCOM_SystemInfo(); |
43 |
|
44 |
var url = SystemInfoSet.Where(data => data.PROPERTY == "Url").FirstOrDefault(); |
45 |
if (url != null) |
46 |
{ |
47 |
sysInfo.HostName = url.VALUE; |
48 |
} |
49 |
|
50 |
url = SystemInfoSet.Where(data => data.PROPERTY == "Port").FirstOrDefault(); |
51 |
if (url != null) |
52 |
{ |
53 |
sysInfo.HostPort = url.VALUE; |
54 |
} |
55 |
|
56 |
url = uc.PROPERTIES.Where(data => data.TYPE == "STAMP").FirstOrDefault(); |
57 |
if(url != null) |
58 |
{ |
59 |
sysInfo.STAMP = url.VALUE; |
60 |
} |
61 |
return sysInfo; |
62 |
} |
63 |
} |
64 |
catch (Exception ex) |
65 |
{ |
66 |
} |
67 |
return null; |
68 |
GC.Collect(2); |
69 |
} |
70 |
|
71 |
private static string shortGuid() |
72 |
{ |
73 |
byte[] bytes = new byte[16]; |
74 |
using (var provider = System.Security.Cryptography.RandomNumberGenerator.Create()) |
75 |
{ |
76 |
provider.GetBytes(bytes); |
77 |
} |
78 |
|
79 |
var guid = new Guid(bytes); |
80 |
|
81 |
return Convert.ToBase64String(guid.ToByteArray()) |
82 |
.Substring(0, 10) |
83 |
.Replace("/", "") |
84 |
.Replace("+", "") + DateTime.UtcNow.Ticks.ToString("x"); |
85 |
} |
86 |
|
87 |
|
88 |
[OperationContract] |
89 |
public List<FAVORITE_DOC> GetFavoriteVP(string PrjNo, string userID, string sharepointItemID) |
90 |
{ |
91 |
|
92 |
|
93 |
using (KCOMEntities dc = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
94 |
{ |
95 |
|
96 |
int flagString = Convert.ToInt32(FAVORITE_FLAG.Personal); |
97 |
List<FAVORITE_DOC> favoriteListSet = new List<FAVORITE_DOC>(); |
98 |
//dc.FAVORITE_DOC.Where(data => data.PROJECT_NO == PrjNo && data.DOCUMENT_ID == sharepointItemID && data.FLAG != |
99 |
// flagString).ToList().ForEach(data => favoriteListSet.Add(data)); |
100 |
|
101 |
|
102 |
//dc.FAVORITE_DOC.Where(data => data.PROJECT_NO == PrjNo && data.MEMBER_USER_ID == userID).ToList().ForEach(data => favoriteListSet.Add(data)); |
103 |
|
104 |
favoriteListSet = dc.FAVORITE_DOC.Where(data => data.PROJECT_NO == PrjNo && data.MEMBER_USER_ID == userID && data.DOCUMENT_ID == sharepointItemID).ToList(); |
105 |
|
106 |
//favoriteListSet = favoriteListSet.Distinct().ToList(); |
107 |
return favoriteListSet; |
108 |
} |
109 |
} |
110 |
[OperationContract] |
111 |
public bool EditFavoriteVP(string prjNo, string userID, string docID, int state, string description) |
112 |
{ |
113 |
using (KCOMEntities dc = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
114 |
{ |
115 |
//List<FAVORITE_DOC> favoriteSet = dc.FAVORITE_DOC.Where(data => data.PROJECT_NO == prjNo && data.MEMBER_USER_ID == userID |
116 |
// && data.PAGE_NO == SavePageNo && data.CREATE_TIME == createTime).ToList(); |
117 |
List<FAVORITE_DOC> favoriteSet = dc.FAVORITE_DOC.Where(data => data.PROJECT_NO == prjNo && data.MEMBER_USER_ID == userID |
118 |
&& data.ID == docID).ToList(); |
119 |
try |
120 |
{ |
121 |
|
122 |
if (favoriteSet.Count > 0) |
123 |
{ |
124 |
var FavoriteVP_Instance = favoriteSet.First(); |
125 |
|
126 |
FavoriteVP_Instance.DESCRIPTION = description; |
127 |
FavoriteVP_Instance.FLAG = state; |
128 |
|
129 |
dc.SaveChanges(); |
130 |
|
131 |
return true; |
132 |
} |
133 |
else |
134 |
{ |
135 |
return false; |
136 |
} |
137 |
} |
138 |
catch (Exception) |
139 |
{ |
140 |
return false; |
141 |
} |
142 |
} |
143 |
} |
144 |
|
145 |
[OperationContract] |
146 |
public bool DelFavoriteVP(string prjNo, string userID, int SavePageNo, string docID) |
147 |
{ |
148 |
|
149 |
using (KCOMEntities dc = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
150 |
{ |
151 |
|
152 |
List<FAVORITE_DOC> favoriteSet = dc.FAVORITE_DOC.Where(data => data.PROJECT_NO == prjNo && data.MEMBER_USER_ID == userID |
153 |
&& data.ID == docID).ToList(); |
154 |
|
155 |
try |
156 |
{ |
157 |
if (favoriteSet.Count > 0) |
158 |
{ |
159 |
favoriteSet.ForEach(data => dc.FAVORITE_DOC.DeleteObject(data)); |
160 |
dc.SaveChanges(); |
161 |
return true; |
162 |
} |
163 |
else |
164 |
{ |
165 |
return false; |
166 |
} |
167 |
} |
168 |
catch (Exception) |
169 |
{ |
170 |
return false; |
171 |
} |
172 |
} |
173 |
} |
174 |
|
175 |
|
176 |
[OperationContract] |
177 |
public List<Rect> GetCompareRect(string projectNo, string originDocItem_ID, string targetDocItem_ID, string originPageNo, string targetPageNo, string isInternalAddress) |
178 |
{ |
179 |
//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); |
180 |
//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); |
181 |
|
182 |
string originFile = ""; |
183 |
string targetFile = ""; |
184 |
|
185 |
if (Boolean.Parse(isInternalAddress)) |
186 |
{ |
187 |
originFile = String.Format(KCOM_API.Properties.Settings.Default.TileSoucePath, projectNo, (Convert.ToInt32(originDocItem_ID) / 100).ToString(), originDocItem_ID, originPageNo); |
188 |
targetFile = String.Format(KCOM_API.Properties.Settings.Default.TileSoucePath, projectNo, (Convert.ToInt32(targetDocItem_ID) / 100).ToString(), targetDocItem_ID, targetPageNo); |
189 |
} |
190 |
else |
191 |
{ |
192 |
originFile = String.Format(KCOM_API.Properties.Settings.Default.TileSoucePath_SUB, projectNo, originDocItem_ID, originPageNo); |
193 |
targetFile = String.Format(KCOM_API.Properties.Settings.Default.TileSoucePath_SUB, projectNo, targetDocItem_ID, targetPageNo); |
194 |
} |
195 |
|
196 |
CompareLib compareLib = new CompareLib(); |
197 |
//System.IO.Stream resultOrigin = compareLib.ChangeCmpUrlToPng(originFile); |
198 |
//System.IO.Stream resultTarget = compareLib.ChangeCmpUrlToPng(targetFile); |
199 |
|
200 |
var resultOrigin = compareLib.ChangeCmpUrlToPng_File(originFile); |
201 |
var resultTarget = compareLib.ChangeCmpUrlToPng_File(targetFile); |
202 |
|
203 |
string outPutFile = compareLib.ImageCompare_File(resultOrigin, resultTarget); |
204 |
var result = compareLib.GetBoundBoxInImage(outPutFile); |
205 |
|
206 |
return result; |
207 |
} |
208 |
|
209 |
|
210 |
|
211 |
#region Final PDF |
212 |
private string _ChanID = null; |
213 |
TcpChannel chan = null; |
214 |
[OperationContract] |
215 |
public FinalPDFResult SetFinalPDF(string ProjectNo, string DocInfoID, string MarkupInfoID, string CreateUserID) |
216 |
{ |
217 |
#region 임시보관 |
218 |
#endregion |
219 |
FinalPDFResult _result = new FinalPDFResult(); |
220 |
RemFinalPDFObject remObj = null; |
221 |
try |
222 |
{ |
223 |
string _finalID = shortGuid(); |
224 |
int _DocTotalPages = -1; |
225 |
string docItemId; |
226 |
|
227 |
|
228 |
using (CIEntities _ci = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString())) |
229 |
{ |
230 |
var _doc = _ci.DOCINFO.Where(info => info.ID == DocInfoID); |
231 |
|
232 |
if (_doc.Count() > 0) |
233 |
{ |
234 |
_DocTotalPages = _doc.First().PAGE_COUNT; |
235 |
docItemId = _doc.First().DOCUMENT_ID; |
236 |
} |
237 |
else |
238 |
{ |
239 |
_result.Status = FinalStatus.Error; |
240 |
_result.Exception = "페이지 정보를 가져올 수 없습니다."; |
241 |
return _result; |
242 |
} |
243 |
} |
244 |
if (_DocTotalPages > 0) |
245 |
{ |
246 |
FINAL_PDF fm = new FINAL_PDF() |
247 |
{ |
248 |
ID = _finalID, |
249 |
PROJECT_NO = ProjectNo, |
250 |
DOCINFO_ID = DocInfoID, |
251 |
DOCUMENT_ID = docItemId, |
252 |
MARKUPINFO_ID = MarkupInfoID, |
253 |
CREATE_USER_ID = CreateUserID, |
254 |
TOTAL_PAGE = _DocTotalPages, |
255 |
CREATE_DATETIME = DateTime.Now, |
256 |
STATUS = (int)IFinalPDF.FinalStatus.Insert |
257 |
}; |
258 |
using (KCOMEntities _entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
259 |
{ |
260 |
_entity.AddToFINAL_PDF(fm); |
261 |
_entity.SaveChanges(System.Data.Objects.SaveOptions.AcceptAllChangesAfterSave); |
262 |
}; |
263 |
|
264 |
System.Runtime.Remoting.Channels.IChannel _ch = System.Runtime.Remoting.Channels.ChannelServices.GetChannel("tcp"); |
265 |
if (_ch == null) |
266 |
{ |
267 |
chan = new TcpChannel(); |
268 |
_ChanID = chan.ChannelName; |
269 |
System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(chan, false); |
270 |
// Create an instance of the remote object |
271 |
|
272 |
|
273 |
using (KCOMEntities ec = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
274 |
{ |
275 |
|
276 |
//remObj = (RemFinalPDFObject)Activator.GetObject(typeof(RemFinalPDFObject), |
277 |
// "tcp://localhost:9092/remFinalPDF"); |
278 |
remObj = (RemFinalPDFObject)Activator.GetObject(typeof(RemFinalPDFObject), |
279 |
//"tcp://192.168.0.67:9092/remFinalPDF"); |
280 |
"tcp://192.168.0.67:9092/remFinalPDF"); |
281 |
} |
282 |
|
283 |
//"tcp://localhost:8080/remFinalPDF"); |
284 |
|
285 |
_result = remObj.SetFinalPDF(ProjectNo, _finalID); |
286 |
_result.FinalID = _finalID; |
287 |
_result.Status = FinalStatus.Success; |
288 |
|
289 |
//MarkupToPDF.MarkupToPDF fa = new MarkupToPDF.MarkupToPDF(); |
290 |
//fa.MakeFinalPDF(fm); |
291 |
} |
292 |
else |
293 |
{ |
294 |
_ChanID = _ch.ChannelName; |
295 |
} |
296 |
} |
297 |
} |
298 |
catch (Exception ex) |
299 |
{ |
300 |
_result.Status = FinalStatus.Error; |
301 |
|
302 |
if (ex.GetType() == typeof(System.Net.Sockets.SocketException)) |
303 |
_result.Exception = "Final Server Not Connection"; |
304 |
} |
305 |
finally |
306 |
{ |
307 |
remObj = null; |
308 |
if (System.Runtime.Remoting.Channels.ChannelServices.GetChannel("tcp") != null) |
309 |
System.Runtime.Remoting.Channels.ChannelServices.UnregisterChannel(chan); |
310 |
|
311 |
GC.Collect(2); |
312 |
} |
313 |
return _result; |
314 |
} |
315 |
#endregion |
316 |
|
317 |
|
318 |
[OperationContract] |
319 |
public bool GetConversionState(KCOM_BasicParam param) |
320 |
{ |
321 |
using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(param.projectNo).ToString())) |
322 |
{ |
323 |
var doc = entity.DOCINFO.Where(data => data.DOCUMENT_ID == param.documentID).FirstOrDefault(); |
324 |
if (doc != null) |
325 |
{ |
326 |
var count = doc.DOCPAGE.Where(data => data.DOCINFO_ID == doc.ID).Count(); |
327 |
if (doc.PAGE_COUNT == count) //페이지 수가 일치하는지 |
328 |
{ |
329 |
return true; |
330 |
} |
331 |
else //페이지 수가 일치하지 않는 경우 |
332 |
{ |
333 |
KCOMEntities entity_kcom = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()); |
334 |
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(); |
335 |
|
336 |
if (lst != null || lst.Count >= 1) |
337 |
{ |
338 |
//Common.Helper.SystemErrorNotify(SERVICE_NAME.API, LEVEL.MEDIUM, ERROR_TYPE.CONVERT, Resources.ResourceManager.GetString("MSG_ERROR_PAGECOUNT"), param.documentID, param.projectNo); |
339 |
//이메일 클라이언트를 구현해야함 |
340 |
} |
341 |
return false; |
342 |
} |
343 |
} |
344 |
else |
345 |
{ |
346 |
//Common.Helper.SystemErrorNotify(SERVICE_NAME.API, LEVEL.MEDIUM, ERROR_TYPE.CONVERT, Resources.ResourceManager.GetString("MSG_ERROR_CONVERTFAILED"), param.documentID, param.projectNo); |
347 |
//이메일 클라이언트를 구현해야함 |
348 |
return false; |
349 |
} |
350 |
} |
351 |
} |
352 |
|
353 |
[OperationContract] |
354 |
public List<VPRevision> GetVPRevisionHistory(string ProjectNo, string vpNo, string DocumentId) |
355 |
{ |
356 |
List<VPRevision> _result = new List<VPRevision>(); |
357 |
try |
358 |
{ |
359 |
using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString())) |
360 |
{ |
361 |
var _vpList = (from docitem in entity.DOCUMENT_ITEM |
362 |
where docitem.DOCUMENT_NO == vpNo |
363 |
select new VPRevision |
364 |
{ |
365 |
RevNo = docitem.REVISION, |
366 |
GroupNo = docitem.GROUP_NO, |
367 |
FROM_VENDOR = docitem.ORIGINAL_FILE, |
368 |
DOCUMENT_ID = docitem.DOCUMENT_ID, |
369 |
TO_VENDOR = docitem.RESULT_FILE, |
370 |
RESULT = docitem.RESULT, |
371 |
DocNo = docitem.DOCUMENT_NO, |
372 |
IsSyncPossible = docitem.DOCUMENT_ID == DocumentId ? false : true |
373 |
}); |
374 |
_result = _vpList.ToList(); |
375 |
_result = _result.OrderByDescending(r => r.GroupNo).ToList(); |
376 |
} |
377 |
} |
378 |
catch (Exception) |
379 |
{ |
380 |
|
381 |
throw; |
382 |
} |
383 |
finally |
384 |
{ |
385 |
GC.Collect(2); |
386 |
} |
387 |
return _result; |
388 |
} |
389 |
|
390 |
[OperationContract] |
391 |
public VPRevision GetVPRevisionFirstOrDefault(string ProjectNo, string DocumentId) |
392 |
{ |
393 |
VPRevision _result = null; |
394 |
try |
395 |
{ |
396 |
using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString())) |
397 |
{ |
398 |
_result = (from docitem in entity.DOCUMENT_ITEM |
399 |
where docitem.DOCUMENT_ID == DocumentId |
400 |
select new VPRevision |
401 |
{ |
402 |
RevNo = docitem.REVISION, |
403 |
GroupNo = docitem.GROUP_NO, |
404 |
FROM_VENDOR = docitem.ORIGINAL_FILE, |
405 |
DOCUMENT_ID = docitem.DOCUMENT_ID, |
406 |
TO_VENDOR = docitem.RESULT_FILE, |
407 |
RESULT = docitem.RESULT |
408 |
}).FirstOrDefault(); |
409 |
} |
410 |
} |
411 |
catch (Exception) |
412 |
{ |
413 |
throw; |
414 |
} |
415 |
finally |
416 |
{ |
417 |
GC.Collect(2); |
418 |
} |
419 |
return _result; |
420 |
} |
421 |
|
422 |
[OperationContract] |
423 |
public DOCINFO GetDocInfo(KCOM_BasicParam param) |
424 |
{ |
425 |
DOCINFO _result = null; |
426 |
try |
427 |
{ |
428 |
// 차후 아래의 코드로 변경 |
429 |
//using (CI_Entities ModelDeeview = new CI_Entities(DaelimCiConnectionString.ToString())) |
430 |
CIEntities ModelDeeview = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(param.projectNo).ToString()); |
431 |
|
432 |
var docinfo = ModelDeeview.DOCINFO.Where(doc => doc.DOCUMENT_ID == param.documentID); |
433 |
if (docinfo.Count() > 0) |
434 |
{ |
435 |
_result = docinfo.First(); |
436 |
_result.MARKUP_INFO.Clear(); |
437 |
|
438 |
} |
439 |
return _result; |
440 |
|
441 |
} |
442 |
catch (Exception ex) |
443 |
{ |
444 |
System.Diagnostics.Trace.WriteLine("GetDocInfo Error : " + ex); |
445 |
} |
446 |
finally |
447 |
{ |
448 |
GC.Collect(2); |
449 |
} |
450 |
return null; |
451 |
} |
452 |
|
453 |
[OperationContract] |
454 |
public bool GetCheckSystemAdmin(string UserID) |
455 |
{ |
456 |
using (KCOMEntities uc = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
457 |
{ |
458 |
var user = uc.PROPERTIES.Where(data => data.TYPE == "Administrator" && data.PROPERTY.Contains(UserID)).FirstOrDefault(); |
459 |
if (user != null) |
460 |
{ |
461 |
return true; |
462 |
} |
463 |
else |
464 |
{ |
465 |
return false; |
466 |
} |
467 |
} |
468 |
GC.Collect(2); |
469 |
} |
470 |
|
471 |
[OperationContract] |
472 |
public DOCUMENT_ITEM GetDocumentItemInfo(KCOM_BasicParam param) |
473 |
{ |
474 |
///param : prjNo, documentId, userId |
475 |
DOCUMENT_ITEM _result = null; |
476 |
|
477 |
try |
478 |
{ |
479 |
CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(param.projectNo).ToString()); |
480 |
|
481 |
var _items = entity.DOCUMENT_ITEM.Where(data => data.DOCUMENT_ID == param.documentID); |
482 |
|
483 |
if (_items.Count() > 0) |
484 |
{ |
485 |
_result = _items.First(); |
486 |
|
487 |
return _result; |
488 |
} |
489 |
//else |
490 |
//{ |
491 |
// Common.Helper.SystemErrorNotify(SERVICE_NAME.API, LEVEL.MEDIUM, ERROR_TYPE.CONVERT, Resources.ResourceManager.GetString("MSG_ERROR_DOCUMENTNOTFOUND"), param.documentID, param.projectNo); |
492 |
//} |
493 |
} |
494 |
catch (Exception ex) |
495 |
{ |
496 |
System.Diagnostics.Trace.WriteLine("GetVendorItemInfo Error : " + ex); |
497 |
//Common.Helper.SystemErrorNotify(SERVICE_NAME.API, LEVEL.MEDIUM, ERROR_TYPE.CONVERT, "GetDocumentItemInfo / " + ex.Message, param.documentID, param.projectNo); |
498 |
} |
499 |
|
500 |
return _result; |
501 |
} |
502 |
|
503 |
public string UserGO(MARKUP_INFO item) |
504 |
{ |
505 |
if (item != null) |
506 |
{ |
507 |
return item.MARKUP_INFO_VERSION.OrderByDescending(data => data.CREATE_DATE).FirstOrDefault().ID; |
508 |
} |
509 |
return null; |
510 |
} |
511 |
|
512 |
[OperationContract] |
513 |
public List<MarkupInfoItem> GetMarkupInfoItems(string ProjectNo, string DocInfoId) |
514 |
{ |
515 |
List<MarkupInfoItem> _result = new List<MarkupInfoItem>(); |
516 |
try |
517 |
{ |
518 |
using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString())) |
519 |
{ |
520 |
var markupListData = entity.MARKUP_INFO.Where(data => data.DOCINFO_ID == DocInfoId).ToList(); |
521 |
|
522 |
var markupList = from markup in markupListData |
523 |
orderby markup.CREATE_TIME descending |
524 |
select new MarkupInfoItem |
525 |
{ |
526 |
MarkupInfoID = markup.ID, |
527 |
UserID = markup.USER_ID, |
528 |
MarkupVersionID = markup.MARKUP_INFO_VERSION.Count() == 0 ? null : markup.MARKUP_INFO_VERSION.OrderByDescending(data => data.CREATE_DATE).FirstOrDefault().ID, |
529 |
CreateTime = markup.CREATE_TIME, |
530 |
Consolidate = markup.CONSOLIDATE, |
531 |
Description = markup.DESCRIPTION, |
532 |
AvoidConsolidate = markup.AVOID_CONSOLIDATE, |
533 |
PartConsolidate = markup.PART_CONSOLIDATE, |
534 |
UpdateTime = DateTime.Parse(markup.UPDATE_TIME.ToString()), |
535 |
}; |
536 |
|
537 |
if (markupList.Count() > 0) |
538 |
{ |
539 |
_result = markupList.ToList(); |
540 |
} |
541 |
|
542 |
_result.ForEach(r => |
543 |
{ |
544 |
|
545 |
r.MarkupList = (from markupData in entity.MARKUP_DATA |
546 |
where markupData.MARKUPINFO_VERSION_ID == r.MarkupVersionID |
547 |
orderby markupData.PAGENUMBER |
548 |
select new MarkupItem { ID = markupData.ID, PageNumber = markupData.PAGENUMBER, Data = markupData.DATA, Data_Type = markupData.DATA_TYPE, Symbol_ID = markupData.SYMBOL_ID }).ToList(); |
549 |
}); |
550 |
|
551 |
Random random = new Random(); |
552 |
|
553 |
_MemberDeptColors memberDeptColors = new _MemberDeptColors(); |
554 |
_MemberDeptColorsInfo memberDeptColorsInfo = new _MemberDeptColorsInfo(); |
555 |
|
556 |
|
557 |
memberDeptColors._memberDeptColors = (from memberdeptcolor in entity.MEMBER_DEPT_COLOR |
558 |
//where memberdeptcolor.DEPARTMENT == "DisplayColor" |
559 |
select memberdeptcolor).ToList(); |
560 |
memberDeptColorsInfo._memberDeptColorsInfo = (from memberdeptcolorinfo in entity.MEMBER_DEPT_COLORINFO |
561 |
//where memberdeptcolor.DEPARTMENT == "DisplayColor" |
562 |
select memberdeptcolorinfo).ToList(); |
563 |
|
564 |
|
565 |
foreach (var item in _result) |
566 |
{ |
567 |
var _member = entity.MEMBER.Where(member => member.ID == item.UserID); |
568 |
|
569 |
if (_member.Count() > 0) |
570 |
{ |
571 |
item.UserName = _member.First().NAME; |
572 |
item.Depatment = _member.First().DEPARTMENT; |
573 |
} |
574 |
|
575 |
foreach (var dept in memberDeptColors._memberDeptColors) |
576 |
{//dept 지정 색상 |
577 |
if (dept.DEPARTMENT == item.Depatment) |
578 |
{ |
579 |
var colorlist = memberDeptColorsInfo._memberDeptColorsInfo.Where(d => d.COLORID == dept.COLORID).ToList(); |
580 |
|
581 |
int colorIdx = random.Next(1, colorlist.Count()); |
582 |
if (colorlist.Count > 0) |
583 |
{ |
584 |
item.DisplayColor = "#FF" + colorlist[colorIdx].DISPLAYCOLOR; |
585 |
memberDeptColorsInfo._memberDeptColorsInfo.Remove(colorlist[colorIdx]); |
586 |
break; |
587 |
} |
588 |
else |
589 |
{ |
590 |
item.DisplayColor = String.Format("#FF{0:X6}", random.Next(0x1000000)); |
591 |
break; |
592 |
} |
593 |
} |
594 |
} |
595 |
|
596 |
|
597 |
if (item.DisplayColor == null) |
598 |
{ |
599 |
foreach (var dept in memberDeptColors._memberDeptColors) |
600 |
{ |
601 |
if (dept.DEPARTMENT == null) |
602 |
{ |
603 |
dept.DEPARTMENT = item.Depatment; |
604 |
var colorlist = memberDeptColorsInfo._memberDeptColorsInfo.Where(d => d.COLORID == dept.COLORID).ToList(); |
605 |
int colorIdx = random.Next(1, colorlist.Count()); |
606 |
if (colorlist.Count > 0) |
607 |
{ |
608 |
item.DisplayColor = "#FF" + colorlist[colorIdx].DISPLAYCOLOR; |
609 |
memberDeptColorsInfo._memberDeptColorsInfo.Remove(colorlist[colorIdx]); |
610 |
break; |
611 |
} |
612 |
else |
613 |
{ |
614 |
item.DisplayColor = String.Format("#FF{0:X6}", random.Next(0x1000000)); |
615 |
break; |
616 |
} |
617 |
} |
618 |
} |
619 |
} |
620 |
|
621 |
if (item.DisplayColor == null) |
622 |
{ |
623 |
item.DisplayColor = String.Format("#FF{0:X6}", random.Next(0x1000000)); |
624 |
} |
625 |
} |
626 |
} |
627 |
} |
628 |
catch (Exception EX) |
629 |
{ |
630 |
System.Diagnostics.Debug.WriteLine(this.GetType().ToString() + " " + EX); |
631 |
return _result; |
632 |
} |
633 |
finally |
634 |
{ |
635 |
GC.Collect(2); |
636 |
} |
637 |
|
638 |
return _result; |
639 |
} |
640 |
|
641 |
/* |
642 |
[OperationContract] |
643 |
public List<MarkupInfoItem> GetMarkupInfoItems(string ProjectNo, string DocInfoId) |
644 |
{ |
645 |
List<MarkupInfoItem> _result = new List<MarkupInfoItem>(); |
646 |
try |
647 |
{ |
648 |
using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString())) |
649 |
{ |
650 |
var markupListData = entity.MARKUP_INFO.Where(data => data.DOCINFO_ID == DocInfoId).ToList(); |
651 |
//foreach (var item in markupListData) |
652 |
//{ |
653 |
// if (!item.AVOID_CONSOLIDATE.HasValue) |
654 |
// { |
655 |
// item.AVOID_CONSOLIDATE = 0; |
656 |
// } |
657 |
//} |
658 |
|
659 |
var markupList = from markup in markupListData |
660 |
orderby markup.CREATE_TIME descending |
661 |
select new MarkupInfoItem |
662 |
{ |
663 |
MarkupInfoID = markup.ID, |
664 |
UserID = markup.USER_ID, |
665 |
MarkupVersionID = markup.MARKUP_INFO_VERSION.Count() == 0 ? null : markup.MARKUP_INFO_VERSION.OrderByDescending(data => data.CREATE_DATE).FirstOrDefault().ID, |
666 |
CreateTime = markup.CREATE_TIME, |
667 |
Consolidate = markup.CONSOLIDATE, |
668 |
Description = markup.DESCRIPTION, |
669 |
AvoidConsolidate = markup.AVOID_CONSOLIDATE, |
670 |
PartConsolidate = markup.PART_CONSOLIDATE, |
671 |
UpdateTime = DateTime.Parse(markup.UPDATE_TIME.ToString()), |
672 |
}; |
673 |
|
674 |
|
675 |
|
676 |
if (markupList.Count() > 0) |
677 |
{ |
678 |
_result = markupList.ToList(); |
679 |
} |
680 |
|
681 |
|
682 |
|
683 |
_result.ForEach(r => |
684 |
{ |
685 |
|
686 |
r.MarkupList = (from markupData in entity.MARKUP_DATA |
687 |
where markupData.MARKUPINFO_VERSION_ID == r.MarkupVersionID |
688 |
orderby markupData.PAGENUMBER |
689 |
select new MarkupItem { ID = markupData.ID, PageNumber = markupData.PAGENUMBER, Data = markupData.DATA, Data_Type = markupData.DATA_TYPE, Symbol_ID = markupData.SYMBOL_ID }).ToList(); |
690 |
}); |
691 |
|
692 |
List<PROPERTIES> _ColorsProperties = new List<PROPERTIES>(); |
693 |
Random random = new Random(); |
694 |
|
695 |
using (KCOMEntities kcomEntity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
696 |
{ |
697 |
_ColorsProperties = (from property in kcomEntity.PROPERTIES |
698 |
where property.TYPE == "DisplayColor" |
699 |
select property).ToList(); |
700 |
} |
701 |
|
702 |
foreach (var item in _result) |
703 |
{ |
704 |
var _member = entity.MEMBER.Where(member => member.ID == item.UserID); |
705 |
|
706 |
if (_member.Count() > 0) |
707 |
{ |
708 |
item.UserName = _member.First().NAME; |
709 |
item.Depatment = _member.First().DEPARTMENT; |
710 |
} |
711 |
|
712 |
if (_ColorsProperties.Count > 0) |
713 |
{ |
714 |
int colorIdx = random.Next(1, _ColorsProperties.Count()); |
715 |
#region 부서별로 색상을 지정하고자 할때 |
716 |
/// 일단 의견을 들어보자구! |
717 |
#endregion |
718 |
item.DisplayColor = "#FF" + _ColorsProperties[colorIdx].VALUE; |
719 |
_ColorsProperties.Remove(_ColorsProperties[colorIdx]); |
720 |
//item.DisplayColor = "#FF" + _Colors.First(); |
721 |
//_Colors.Remove(_Colors.First()); |
722 |
} |
723 |
else |
724 |
{ |
725 |
item.DisplayColor = String.Format("#FF{0:X6}", random.Next(0x1000000)); |
726 |
} |
727 |
} |
728 |
} |
729 |
} |
730 |
catch (Exception EX) |
731 |
{ |
732 |
System.Diagnostics.Debug.WriteLine(this.GetType().ToString() + " " + EX); |
733 |
return _result; |
734 |
} |
735 |
finally |
736 |
{ |
737 |
GC.Collect(2); |
738 |
} |
739 |
|
740 |
return _result; |
741 |
} |
742 |
*/ |
743 |
[OperationContract] |
744 |
public List<MarkupInfoItem> GetSyncMarkupInfoItems(string ProjectNo, string DocInfoId, string currentUser) |
745 |
{ |
746 |
List<MarkupInfoItem> _result = new List<MarkupInfoItem>(); |
747 |
try |
748 |
{ |
749 |
using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString())) |
750 |
{ |
751 |
var docItem = entity.DOCINFO.Where(data => data.DOCUMENT_ID == DocInfoId).FirstOrDefault(); |
752 |
if (docItem == null) |
753 |
{ |
754 |
return null; |
755 |
} |
756 |
var markupListData = entity.MARKUP_INFO.Where(data => data.DOCINFO_ID == docItem.ID).ToList(); |
757 |
|
758 |
var markupList = from markup in markupListData |
759 |
where markup.USER_ID == currentUser || markup.CONSOLIDATE == 1 |
760 |
orderby markup.CREATE_TIME descending |
761 |
select new MarkupInfoItem |
762 |
{ |
763 |
MarkupInfoID = markup.ID, |
764 |
UserID = markup.USER_ID, |
765 |
MarkupVersionID = markup.MARKUP_INFO_VERSION.Count() == 0 ? null : markup.MARKUP_INFO_VERSION.OrderByDescending(data => data.CREATE_DATE).FirstOrDefault().ID, |
766 |
CreateTime = markup.CREATE_TIME, |
767 |
Consolidate = markup.CONSOLIDATE, |
768 |
Description = markup.DESCRIPTION, |
769 |
AvoidConsolidate = markup.AVOID_CONSOLIDATE, |
770 |
PartConsolidate = markup.PART_CONSOLIDATE, |
771 |
}; |
772 |
|
773 |
|
774 |
|
775 |
if (markupList.Count() > 0) |
776 |
{ |
777 |
_result = markupList.ToList(); |
778 |
} |
779 |
|
780 |
|
781 |
|
782 |
_result.ForEach(r => |
783 |
{ |
784 |
|
785 |
r.MarkupList = (from markupData in entity.MARKUP_DATA |
786 |
where markupData.MARKUPINFO_VERSION_ID == r.MarkupVersionID |
787 |
orderby markupData.PAGENUMBER |
788 |
select new MarkupItem { ID = markupData.ID, PageNumber = markupData.PAGENUMBER, Data = markupData.DATA, Data_Type = markupData.DATA_TYPE, Symbol_ID = markupData.SYMBOL_ID }).ToList(); |
789 |
}); |
790 |
|
791 |
List<PROPERTIES> _ColorsProperties = new List<PROPERTIES>(); |
792 |
Random random = new Random(); |
793 |
|
794 |
using (KCOMEntities kcomEntity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
795 |
{ |
796 |
_ColorsProperties = (from property in kcomEntity.PROPERTIES |
797 |
where property.TYPE == "DisplayColor" |
798 |
select property).ToList(); |
799 |
} |
800 |
|
801 |
foreach (var item in _result) |
802 |
{ |
803 |
var _member = entity.MEMBER.Where(member => member.ID == item.UserID); |
804 |
|
805 |
if (_member.Count() > 0) |
806 |
{ |
807 |
item.UserName = _member.First().NAME; |
808 |
item.Depatment = _member.First().DEPARTMENT; |
809 |
} |
810 |
|
811 |
if (_ColorsProperties.Count > 0) |
812 |
{ |
813 |
int colorIdx = random.Next(1, _ColorsProperties.Count()); |
814 |
#region 부서별로 색상을 지정하고자 할때 |
815 |
/// 일단 의견을 들어보자구! |
816 |
#endregion |
817 |
item.DisplayColor = "#FF" + _ColorsProperties[colorIdx].VALUE; |
818 |
_ColorsProperties.Remove(_ColorsProperties[colorIdx]); |
819 |
//item.DisplayColor = "#FF" + _Colors.First(); |
820 |
//_Colors.Remove(_Colors.First()); |
821 |
} |
822 |
else |
823 |
{ |
824 |
item.DisplayColor = String.Format("#FF{0:X6}", random.Next(0x1000000)); |
825 |
} |
826 |
} |
827 |
} |
828 |
} |
829 |
catch (Exception EX) |
830 |
{ |
831 |
System.Diagnostics.Debug.WriteLine(this.GetType().ToString() + " " + EX); |
832 |
return _result; |
833 |
} |
834 |
finally |
835 |
{ |
836 |
GC.Collect(2); |
837 |
} |
838 |
|
839 |
return _result; |
840 |
} |
841 |
|
842 |
|
843 |
//[OperationContract] |
844 |
//[ServiceKnownType(typeof(MEMBER))] |
845 |
//public List<MEMBER> GetUserData(string ProjectNo, string UserID) |
846 |
//{ |
847 |
// List<MEMBER> _result = new List<MEMBER>(); |
848 |
|
849 |
// using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString())) |
850 |
// { |
851 |
// var _UserList = from member in entity.MEMBER |
852 |
// where member.ID == UserID |
853 |
// select member; |
854 |
// _result = _UserList.ToList(); |
855 |
// } |
856 |
// //GC.Collect(2); |
857 |
// return _result; |
858 |
//} |
859 |
|
860 |
[OperationContract] |
861 |
[ServiceKnownType(typeof(MEMBER))] |
862 |
public List<MEMBER> GetUserData(string ProjectNo, string UserID) |
863 |
{ |
864 |
List<MEMBER> _result = new List<MEMBER>(); |
865 |
|
866 |
using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString())) |
867 |
{ |
868 |
var _UserList = from member in entity.MEMBER |
869 |
where member.ID == UserID |
870 |
select member; |
871 |
_result = _UserList.ToList(); |
872 |
} |
873 |
//GC.Collect(2); |
874 |
return _result; |
875 |
} |
876 |
|
877 |
|
878 |
[OperationContract] |
879 |
public List<string> GetDeptData(string UserDept) //그룹 추가 옵션 부여 예정 |
880 |
{ |
881 |
List<string> _result = new List<string>(); |
882 |
|
883 |
try |
884 |
{ |
885 |
KCOMEntities entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()); |
886 |
var YourEnginner = (from dept in entity.PROPERTIES |
887 |
where dept.TYPE == "DeptName" && UserDept.Contains(dept.VALUE) |
888 |
select dept).FirstOrDefault(); |
889 |
|
890 |
if (YourEnginner != null) |
891 |
{ |
892 |
_result = (from dept in entity.PROPERTIES |
893 |
where dept.PROPERTY == YourEnginner.PROPERTY |
894 |
select dept.VALUE).ToList(); |
895 |
return _result; |
896 |
} |
897 |
else |
898 |
{ |
899 |
return null; |
900 |
} |
901 |
} |
902 |
catch (Exception ex) |
903 |
{ |
904 |
System.Diagnostics.Debug.WriteLine(ex.Message); |
905 |
} |
906 |
finally |
907 |
{ |
908 |
GC.Collect(2); |
909 |
} |
910 |
return _result; |
911 |
} |
912 |
|
913 |
[OperationContract] |
914 |
public bool DeleteMarkup(string ProjectNo, string MarkupInfoID) |
915 |
{ |
916 |
bool _result = false; |
917 |
try |
918 |
{ |
919 |
using (KCOMDataModel.DataModel.CIEntities Entity = new KCOMDataModel.DataModel.CIEntities(KCOMDataModel.Common.ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString())) |
920 |
{ |
921 |
|
922 |
MARKUP_INFO instance = Entity.MARKUP_INFO.Where(root => root.ID == MarkupInfoID).FirstOrDefault(); |
923 |
|
924 |
if (instance == null) |
925 |
{ |
926 |
return false; |
927 |
} |
928 |
MARKUP_INFO_VERSION version = instance.MARKUP_INFO_VERSION.FirstOrDefault(); |
929 |
|
930 |
|
931 |
version.MARKUP_DATA.ToList().ForEach(data => |
932 |
{ |
933 |
Entity.MARKUP_DATA.DeleteObject(data); |
934 |
Entity.SaveChanges(); |
935 |
}); |
936 |
|
937 |
Entity.MARKUP_INFO_VERSION.DeleteObject(version); |
938 |
Entity.SaveChanges(); |
939 |
|
940 |
Entity.MARKUP_INFO.DeleteObject(instance); |
941 |
Entity.SaveChanges(); |
942 |
|
943 |
} |
944 |
_result = true; |
945 |
} |
946 |
catch (Exception ex) |
947 |
{ |
948 |
System.Diagnostics.Trace.WriteLine(ex, "SaveMarkup"); |
949 |
} |
950 |
finally |
951 |
{ |
952 |
GC.Collect(2); |
953 |
} |
954 |
return _result; |
955 |
} |
956 |
|
957 |
#region Favorite |
958 |
[OperationContract] |
959 |
public bool SetFavoriteVP(string prjNo, string userID, string groupNo, string docNo, string rev, int SavePageNo, string documentItemID, string VPDescription, IKCOM.FAVORITE_FLAG flag) |
960 |
{ |
961 |
|
962 |
using (KCOMEntities entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
963 |
{ |
964 |
try |
965 |
{ |
966 |
entity.FAVORITE_DOC.AddObject(new FAVORITE_DOC |
967 |
{ |
968 |
ID = shortGuid(), |
969 |
PROJECT_NO = prjNo, |
970 |
DOCUMENT_ID = documentItemID, |
971 |
GROUP_NO = groupNo, |
972 |
DOCUMENT_NO = docNo, |
973 |
MEMBER_USER_ID = userID, |
974 |
DESCRIPTION = VPDescription, |
975 |
CREATE_TIME = DateTime.Now, |
976 |
REVISION = rev, |
977 |
FLAG = (int)flag, |
978 |
PAGE_NO = SavePageNo, |
979 |
}); |
980 |
entity.SaveChanges(); |
981 |
} |
982 |
catch (Exception) |
983 |
{ |
984 |
return false; |
985 |
} |
986 |
|
987 |
return true; |
988 |
} |
989 |
} |
990 |
|
991 |
//[OperationContract] |
992 |
//public List<FAVORITE_DOC> GetFavoriteVP(string PrjNo, string userID, string sharepointItemID) |
993 |
//{ |
994 |
// using (KCOMEntities entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
995 |
// { |
996 |
|
997 |
// int flagString = Convert.ToInt32(IKCOM.FAVORITE_FLAG.Personal); |
998 |
// List<FAVORITE_DOC> favoriteListSet = new List<FAVORITE_DOC>(); |
999 |
// entity.FAVORITE_DOC.Where(data => data.PROJECT_NO == PrjNo && data.DOCUMENT_ID == sharepointItemID && data.FLAG != |
1000 |
// flagString).ToList().ForEach(data => favoriteListSet.Add(data)); |
1001 |
// entity.FAVORITE_DOC.Where(data => data.PROJECT_NO == PrjNo && data.MEMBER_USER_ID == userID).ToList().ForEach(data => favoriteListSet.Add(data)); |
1002 |
// favoriteListSet = favoriteListSet.Distinct().ToList(); |
1003 |
// return favoriteListSet; |
1004 |
// } |
1005 |
//} |
1006 |
//[OperationContract] |
1007 |
//public bool EditFavoriteVP(string prjNo, string userID, int SavePageNo, string sharepointItemID, DateTime createTime, int state, string description) |
1008 |
//{ |
1009 |
// using (DeepViewEntities dc = new DeepViewEntities(ConnectStringBuilder.DeepViewConnectionString().ToString())) |
1010 |
// { |
1011 |
// List<FavoriteVP> favoriteSet = dc.FavoriteVP.Where(data => data.ProjectNo == prjNo && data.CreateUserID == userID |
1012 |
// && data.PageNo == SavePageNo && data.CreateTime == createTime).ToList(); |
1013 |
|
1014 |
// try |
1015 |
// { |
1016 |
|
1017 |
|
1018 |
// if (favoriteSet.Count > 0) |
1019 |
// { |
1020 |
// var FavoriteVP_Instance = favoriteSet.First(); |
1021 |
|
1022 |
// FavoriteVP_Instance.Description = description; |
1023 |
// FavoriteVP_Instance.Flag = state; |
1024 |
|
1025 |
// dc.SaveChanges(); |
1026 |
|
1027 |
// return true; |
1028 |
// } |
1029 |
// else |
1030 |
// { |
1031 |
// return false; |
1032 |
// } |
1033 |
// } |
1034 |
// catch (Exception) |
1035 |
// { |
1036 |
// return false; |
1037 |
// } |
1038 |
// } |
1039 |
//} |
1040 |
//[OperationContract] |
1041 |
//public bool DelFavoriteVP(string prjNo, string userID, int SavePageNo, string sharepointItemID, DateTime createTime) |
1042 |
//{ |
1043 |
|
1044 |
// using (DeepViewEntities dc = new DeepViewEntities(ConnectStringBuilder.DeepViewConnectionString().ToString())) |
1045 |
// { |
1046 |
// List<FavoriteVP> favoriteSet = dc.FavoriteVP.Where(data => data.ProjectNo == prjNo && data.CreateUserID == userID |
1047 |
// && data.PageNo == SavePageNo && data.CreateTime == createTime).ToList(); |
1048 |
|
1049 |
// try |
1050 |
// { |
1051 |
|
1052 |
|
1053 |
// if (favoriteSet.Count > 0) |
1054 |
// { |
1055 |
// favoriteSet.ForEach(data => dc.FavoriteVP.DeleteObject(data)); |
1056 |
// dc.SaveChanges(); |
1057 |
// return true; |
1058 |
// } |
1059 |
// else |
1060 |
// { |
1061 |
// return false; |
1062 |
// } |
1063 |
// } |
1064 |
// catch (Exception) |
1065 |
// { |
1066 |
// return false; |
1067 |
// } |
1068 |
// } |
1069 |
//} |
1070 |
#endregion |
1071 |
|
1072 |
[OperationContract] |
1073 |
public bool SaveMarkupData(MarkupInfoItem UserState,string project_no,string doc_id, string user_id, List<MARKUP_DATA> mlmarkup_data) |
1074 |
{ |
1075 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
1076 |
{ |
1077 |
#region Docinfo 정보 가져오기 |
1078 |
|
1079 |
string docinfoid_ = (from info in Entity.DOCINFO |
1080 |
where info.DOCUMENT_ID == doc_id |
1081 |
&& info.PROJECT_NO == project_no |
1082 |
select info.ID |
1083 |
).First().ToString(); |
1084 |
#endregion |
1085 |
|
1086 |
#region Markup_Info 저장 |
1087 |
|
1088 |
MARKUP_INFO markup_info = new MARKUP_INFO(); |
1089 |
try |
1090 |
{ |
1091 |
markup_info = (from info in Entity.MARKUP_INFO |
1092 |
where info.ID == UserState.MarkupInfoID && info.USER_ID == user_id |
1093 |
select info).FirstOrDefault(); |
1094 |
} |
1095 |
catch (Exception) |
1096 |
{ |
1097 |
markup_info = null; |
1098 |
} |
1099 |
|
1100 |
//markup_info가 없을 경우 생성 |
1101 |
if (markup_info == null) |
1102 |
{ |
1103 |
//MarkupInfo 저장 |
1104 |
markup_info = new MARKUP_INFO |
1105 |
{ |
1106 |
ID = UserState.MarkupInfoID, |
1107 |
DOCINFO_ID = docinfoid_, |
1108 |
USER_ID = user_id, |
1109 |
CREATE_TIME = DateTime.Now, |
1110 |
CONSOLIDATE = UserState.Consolidate, |
1111 |
AVOID_CONSOLIDATE = UserState.AvoidConsolidate, |
1112 |
PART_CONSOLIDATE = UserState.PartConsolidate, |
1113 |
DESCRIPTION = UserState.Description, |
1114 |
UPDATE_TIME = DateTime.Now |
1115 |
}; |
1116 |
Entity.MARKUP_INFO.AddObject(markup_info); |
1117 |
} |
1118 |
//markup_info가 있을 경우 업데이트 |
1119 |
else |
1120 |
{ |
1121 |
markup_info.UPDATE_TIME = DateTime.Now; |
1122 |
} |
1123 |
Entity.SaveChanges(); |
1124 |
#endregion |
1125 |
|
1126 |
#region Markup_Info_Version 저장 |
1127 |
|
1128 |
MARKUP_INFO_VERSION markup_info_version = new MARKUP_INFO_VERSION(); |
1129 |
|
1130 |
try |
1131 |
{ |
1132 |
markup_info_version = (from info in Entity.MARKUP_INFO_VERSION |
1133 |
where info.MARKUPINFO_ID == markup_info.ID |
1134 |
select info).FirstOrDefault(); |
1135 |
} |
1136 |
catch (Exception) |
1137 |
{ |
1138 |
markup_info_version = null; |
1139 |
} |
1140 |
|
1141 |
//markup_info_version 없을 경우 생성 |
1142 |
if (markup_info_version == null) |
1143 |
{ |
1144 |
//MarkupInfo_version 저장 |
1145 |
markup_info_version = new MARKUP_INFO_VERSION() |
1146 |
{ |
1147 |
ID = UserState.MarkupVersionID, |
1148 |
MARKUPINFO_ID = markup_info.ID, |
1149 |
CREATE_DATE = DateTime.Now |
1150 |
}; |
1151 |
Entity.MARKUP_INFO_VERSION.AddObject(markup_info_version); |
1152 |
Entity.SaveChanges(); |
1153 |
} |
1154 |
#endregion |
1155 |
|
1156 |
|
1157 |
Entity.MARKUP_DATA.Where(data => data.MARKUPINFO_VERSION_ID == markup_info_version.ID).ToList().ForEach(item => |
1158 |
{ |
1159 |
Entity.MARKUP_DATA.DeleteObject(item); |
1160 |
}); |
1161 |
Entity.SaveChanges(); |
1162 |
|
1163 |
try |
1164 |
{ |
1165 |
mlmarkup_data.ForEach(value => |
1166 |
{ |
1167 |
Entity.MARKUP_DATA.AddObject(new MARKUP_DATA |
1168 |
{ |
1169 |
ID = value.ID, |
1170 |
DATA = value.DATA, |
1171 |
DATA_TYPE = value.DATA_TYPE, |
1172 |
PAGENUMBER = value.PAGENUMBER, |
1173 |
MARKUPINFO_VERSION_ID = markup_info_version.ID, |
1174 |
SYMBOL_ID = value.SYMBOL_ID |
1175 |
}); |
1176 |
}); |
1177 |
Entity.SaveChanges(); |
1178 |
} |
1179 |
catch (Exception) |
1180 |
{ |
1181 |
return false; |
1182 |
} |
1183 |
} |
1184 |
return true; |
1185 |
} |
1186 |
|
1187 |
|
1188 |
[OperationContract] |
1189 |
public bool SaveSymbol(SYMBOL_PRIVATE symbol_private) |
1190 |
{ |
1191 |
try |
1192 |
{ |
1193 |
using (KCOMDataModel.DataModel.KCOMEntities uc = new KCOMDataModel.DataModel.KCOMEntities(KCOMDataModel.Common.ConnectStringBuilder.KCOMConnectionString().ToString())) |
1194 |
{ |
1195 |
uc.AddToSYMBOL_PRIVATE(symbol_private); |
1196 |
uc.SaveChanges(); |
1197 |
} |
1198 |
} |
1199 |
catch(Exception) |
1200 |
{ |
1201 |
return false; |
1202 |
} |
1203 |
return true; |
1204 |
} |
1205 |
[OperationContract] |
1206 |
public bool AddPublicSymbol(SYMBOL_PUBLIC symbol) |
1207 |
{ |
1208 |
try |
1209 |
{ |
1210 |
using (KCOMDataModel.DataModel.KCOMEntities uc = new KCOMDataModel.DataModel.KCOMEntities(KCOMDataModel.Common.ConnectStringBuilder.KCOMConnectionString().ToString())) |
1211 |
{ |
1212 |
uc.AddToSYMBOL_PUBLIC(symbol); |
1213 |
uc.SaveChanges(); |
1214 |
} |
1215 |
} |
1216 |
catch (Exception) |
1217 |
{ |
1218 |
return false; |
1219 |
} |
1220 |
return true; |
1221 |
} |
1222 |
[OperationContract] |
1223 |
public bool DeleteSymbol(string symbol_id, int type) |
1224 |
{ |
1225 |
try |
1226 |
{ |
1227 |
using (KCOMEntities Entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
1228 |
{ |
1229 |
if (type == 0) |
1230 |
{ |
1231 |
string delItem_ID = symbol_id; |
1232 |
var delitem = Entity.SYMBOL_PRIVATE.Where(data => data.ID == delItem_ID).FirstOrDefault(); |
1233 |
Entity.SYMBOL_PRIVATE.DeleteObject(delitem); |
1234 |
Entity.SaveChanges(); |
1235 |
} |
1236 |
else |
1237 |
{ |
1238 |
string delItem_ID = symbol_id; |
1239 |
var delitem = Entity.SYMBOL_PUBLIC.Where(data => data.ID == delItem_ID).FirstOrDefault(); |
1240 |
Entity.SYMBOL_PUBLIC.DeleteObject(delitem); |
1241 |
Entity.SaveChanges(); |
1242 |
} |
1243 |
} |
1244 |
} |
1245 |
catch(Exception) |
1246 |
{ |
1247 |
return false; |
1248 |
} |
1249 |
return true; |
1250 |
} |
1251 |
|
1252 |
[OperationContract] |
1253 |
public bool RenameSymbol(string symbol_id, string name, int type) |
1254 |
{ |
1255 |
try |
1256 |
{ |
1257 |
using (KCOMEntities Entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
1258 |
{ |
1259 |
if (type == 0) |
1260 |
{ |
1261 |
var UpdateItem = Entity.SYMBOL_PRIVATE.Where(info => info.ID == symbol_id).FirstOrDefault(); |
1262 |
UpdateItem.NAME = name; |
1263 |
Entity.SaveChanges(); |
1264 |
} |
1265 |
else |
1266 |
{ |
1267 |
var UpdateItem = Entity.SYMBOL_PUBLIC.Where(info => info.ID == symbol_id).FirstOrDefault(); |
1268 |
UpdateItem.NAME = name; |
1269 |
Entity.SaveChanges(); |
1270 |
} |
1271 |
} |
1272 |
} |
1273 |
catch (Exception) |
1274 |
{ |
1275 |
return false; |
1276 |
} |
1277 |
return true; |
1278 |
} |
1279 |
|
1280 |
[OperationContract] |
1281 |
public bool AddCheckListHistory(string project_no, CHECK_LIST_HISTORY Check_History) |
1282 |
{ |
1283 |
try |
1284 |
{ |
1285 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
1286 |
{ |
1287 |
Entity.CHECK_LIST_HISTORY.AddObject(Check_History); |
1288 |
Entity.SaveChanges(); |
1289 |
} |
1290 |
} |
1291 |
catch (Exception) |
1292 |
{ |
1293 |
return false; |
1294 |
} |
1295 |
return true; |
1296 |
} |
1297 |
[OperationContract] |
1298 |
public bool SaveCheckListHistory(string project_no, string rev, CHECK_LIST_HISTORY Check_History) |
1299 |
{ |
1300 |
try |
1301 |
{ |
1302 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
1303 |
{ |
1304 |
var item = Entity.CHECK_LIST_HISTORY.Where(info => info.REVISION == rev).FirstOrDefault(); |
1305 |
item = Check_History; |
1306 |
Entity.SaveChanges(); |
1307 |
} |
1308 |
} |
1309 |
catch (Exception) |
1310 |
{ |
1311 |
return false; |
1312 |
} |
1313 |
return true; |
1314 |
} |
1315 |
[OperationContract] |
1316 |
public bool SaveCheckList(string project_no, string _id, CHECK_LIST Check_value) |
1317 |
{ |
1318 |
try |
1319 |
{ |
1320 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
1321 |
{ |
1322 |
var item = Entity.CHECK_LIST.Where(info => info.ID == _id).FirstOrDefault(); |
1323 |
item.TODOLIST = Check_value.TODOLIST; |
1324 |
item.REMARK = Check_value.REMARK; |
1325 |
item.STATUS = Check_value.STATUS; |
1326 |
item.VENDOR = Check_value.VENDOR; |
1327 |
item.REPLY = Check_value.REPLY; |
1328 |
item.IMAGE_URL = Check_value.IMAGE_URL; |
1329 |
item.IMAGE_ANCHOR = Check_value.IMAGE_ANCHOR; |
1330 |
item.UPDATE_TIME = Check_value.UPDATE_TIME; |
1331 |
if(Check_value.STATUS == "False") |
1332 |
{ |
1333 |
item.STATUS_DESC_OPEN = Check_value.STATUS_DESC_OPEN; |
1334 |
} |
1335 |
else |
1336 |
{ |
1337 |
item.STATUS_DESC_CLOSE = Check_value.STATUS_DESC_CLOSE; |
1338 |
} |
1339 |
Entity.SaveChanges(); |
1340 |
} |
1341 |
} |
1342 |
catch (Exception) |
1343 |
{ |
1344 |
return false; |
1345 |
} |
1346 |
return true; |
1347 |
} |
1348 |
[OperationContract] |
1349 |
public bool AddCheckList(string project_no, CHECK_LIST Check_value) |
1350 |
{ |
1351 |
try |
1352 |
{ |
1353 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
1354 |
{ |
1355 |
Entity.CHECK_LIST.AddObject(Check_value); |
1356 |
Entity.SaveChanges(); |
1357 |
} |
1358 |
} |
1359 |
catch (Exception) |
1360 |
{ |
1361 |
return false; |
1362 |
} |
1363 |
return true; |
1364 |
} |
1365 |
|
1366 |
[OperationContract] |
1367 |
public CHECK_LIST GetCheckList(string project_no, string _id) |
1368 |
{ |
1369 |
CHECK_LIST Check_value = new CHECK_LIST(); |
1370 |
try |
1371 |
{ |
1372 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
1373 |
{ |
1374 |
Check_value = Entity.CHECK_LIST.Where(info => info.ID == _id).FirstOrDefault(); |
1375 |
} |
1376 |
} |
1377 |
catch (Exception) |
1378 |
{ |
1379 |
return null; |
1380 |
} |
1381 |
return Check_value; |
1382 |
} |
1383 |
[OperationContract] |
1384 |
public List<CHECK_LIST> GetUserCheckList(string project_no, string user_id, string doc_no) |
1385 |
{ |
1386 |
List<CHECK_LIST> list = new List<CHECK_LIST>(); |
1387 |
try |
1388 |
{ |
1389 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
1390 |
{ |
1391 |
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(); |
1392 |
} |
1393 |
} |
1394 |
catch (Exception) |
1395 |
{ |
1396 |
return null; |
1397 |
} |
1398 |
return list; |
1399 |
} |
1400 |
[OperationContract] |
1401 |
public List<CHECK_LIST_HISTORY> GetCheckListHistory(string project_no, string _id) |
1402 |
{ |
1403 |
List<CHECK_LIST_HISTORY> history = new List<CHECK_LIST_HISTORY>(); |
1404 |
try |
1405 |
{ |
1406 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
1407 |
{ |
1408 |
history = Entity.CHECK_LIST_HISTORY.Where(data => data.CHECKLIST_ID == _id).ToList(); |
1409 |
} |
1410 |
} |
1411 |
catch (Exception) |
1412 |
{ |
1413 |
return null; |
1414 |
} |
1415 |
return history; |
1416 |
} |
1417 |
[OperationContract] |
1418 |
public CHECK_LIST_HISTORY GetCheckListHistoryFirstOrDefault(string project_no, string checklist_id, string rev) |
1419 |
{ |
1420 |
CHECK_LIST_HISTORY Check_Item = new CHECK_LIST_HISTORY(); |
1421 |
try |
1422 |
{ |
1423 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
1424 |
{ |
1425 |
Check_Item = Entity.CHECK_LIST_HISTORY.Where(info => info.CHECKLIST_ID == checklist_id && info.REVISION == rev).FirstOrDefault(); |
1426 |
} |
1427 |
} |
1428 |
catch (Exception) |
1429 |
{ |
1430 |
return null; |
1431 |
} |
1432 |
return Check_Item; |
1433 |
} |
1434 |
[OperationContract] |
1435 |
public bool SavePageAngle(string project_no, List<DOCPAGE> _mldocpage) |
1436 |
{ |
1437 |
try |
1438 |
{ |
1439 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
1440 |
{ |
1441 |
KCOMDataModel.DataModel.DOCPAGE _docpage = new KCOMDataModel.DataModel.DOCPAGE(); |
1442 |
_mldocpage.ForEach(data => |
1443 |
{ |
1444 |
_docpage = (from info in Entity.DOCPAGE |
1445 |
where info.ID == data.ID |
1446 |
select info).FirstOrDefault(); |
1447 |
|
1448 |
if (_docpage.PAGE_ANGLE != data.PAGE_ANGLE) |
1449 |
{ |
1450 |
_docpage.PAGE_ANGLE = data.PAGE_ANGLE; |
1451 |
} |
1452 |
}); |
1453 |
|
1454 |
Entity.SaveChanges(); |
1455 |
} |
1456 |
} |
1457 |
catch (Exception) |
1458 |
{ |
1459 |
return false; |
1460 |
} |
1461 |
return true; |
1462 |
} |
1463 |
|
1464 |
[OperationContract] |
1465 |
public MARKUP_INFO GetMarkupInfo(string project_no, string _id) |
1466 |
{ |
1467 |
MARKUP_INFO markupInfo = new MARKUP_INFO(); |
1468 |
|
1469 |
try |
1470 |
{ |
1471 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
1472 |
{ |
1473 |
markupInfo = Entity.MARKUP_INFO.Where(entity => entity.DOCINFO_ID == _id).OrderByDescending(i => i.CONSOLIDATE).OrderByDescending(j => j.CREATE_TIME).FirstOrDefault(); |
1474 |
} |
1475 |
} |
1476 |
catch (Exception) |
1477 |
{ |
1478 |
return null; |
1479 |
} |
1480 |
return markupInfo; |
1481 |
} |
1482 |
|
1483 |
[OperationContract] |
1484 |
public List<string> GetMarkupDataListperPage(string project_no, string _markupinfoid, int _pageNo) |
1485 |
{ |
1486 |
List<string> markupdata = new List<string>(); |
1487 |
MARKUP_INFO_VERSION markup_info_version = new MARKUP_INFO_VERSION(); |
1488 |
try |
1489 |
{ |
1490 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
1491 |
{ |
1492 |
markup_info_version = (from version in Entity.MARKUP_INFO_VERSION |
1493 |
where version.MARKUPINFO_ID == _markupinfoid |
1494 |
orderby version.CREATE_DATE descending |
1495 |
select version).First(); |
1496 |
markupdata = (from data in Entity.MARKUP_DATA |
1497 |
where data.MARKUPINFO_VERSION_ID == markup_info_version.ID && data.PAGENUMBER == _pageNo |
1498 |
select data.DATA).ToList(); |
1499 |
} |
1500 |
} |
1501 |
catch (Exception) |
1502 |
{ |
1503 |
return null; |
1504 |
} |
1505 |
return markupdata; |
1506 |
} |
1507 |
|
1508 |
[OperationContract] |
1509 |
public bool AddMarkupInfo(string project_no, MARKUP_INFO value) |
1510 |
{ |
1511 |
try |
1512 |
{ |
1513 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
1514 |
{ |
1515 |
Entity.MARKUP_INFO.AddObject(value); |
1516 |
Entity.SaveChanges(); |
1517 |
} |
1518 |
} |
1519 |
catch (Exception) |
1520 |
{ |
1521 |
return false; |
1522 |
} |
1523 |
return true; |
1524 |
} |
1525 |
|
1526 |
[OperationContract] |
1527 |
public bool AddMarkupInfoVersion(string project_no, MARKUP_INFO_VERSION value) |
1528 |
{ |
1529 |
try |
1530 |
{ |
1531 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
1532 |
{ |
1533 |
Entity.MARKUP_INFO_VERSION.AddObject(value); |
1534 |
Entity.SaveChanges(); |
1535 |
} |
1536 |
} |
1537 |
catch (Exception) |
1538 |
{ |
1539 |
return false; |
1540 |
} |
1541 |
return true; |
1542 |
} |
1543 |
|
1544 |
[OperationContract] |
1545 |
public bool AddMarkupData(string project_no, MARKUP_DATA value) |
1546 |
{ |
1547 |
try |
1548 |
{ |
1549 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
1550 |
{ |
1551 |
Entity.MARKUP_DATA.AddObject(value); |
1552 |
Entity.SaveChanges(); |
1553 |
} |
1554 |
} |
1555 |
catch (Exception) |
1556 |
{ |
1557 |
return false; |
1558 |
} |
1559 |
return true; |
1560 |
} |
1561 |
|
1562 |
[OperationContract] |
1563 |
public bool AvoidMarkupInfo(string project_no, string _doc_id) |
1564 |
{ |
1565 |
try |
1566 |
{ |
1567 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
1568 |
{ |
1569 |
var item = Entity.MARKUP_INFO.Where(entity => entity.DOCINFO_ID == _doc_id).OrderByDescending(i => i.CONSOLIDATE).OrderByDescending(j => j.CREATE_TIME).FirstOrDefault(); |
1570 |
item.AVOID_CONSOLIDATE = 1; |
1571 |
Entity.SaveChanges(); |
1572 |
} |
1573 |
} |
1574 |
catch (Exception) |
1575 |
{ |
1576 |
return false; |
1577 |
} |
1578 |
return true; |
1579 |
} |
1580 |
|
1581 |
[OperationContract] |
1582 |
public bool SaveMarkupInfo(string project_no, string _id, MARKUP_INFO value) |
1583 |
{ |
1584 |
try |
1585 |
{ |
1586 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
1587 |
{ |
1588 |
var item = Entity.MARKUP_INFO.Where(info => info.ID == _id).FirstOrDefault(); |
1589 |
item = value; |
1590 |
Entity.SaveChanges(); |
1591 |
} |
1592 |
} |
1593 |
catch (Exception) |
1594 |
{ |
1595 |
return false; |
1596 |
} |
1597 |
return true; |
1598 |
} |
1599 |
[OperationContract] |
1600 |
public List<MARKUP_DATA> GetMarkupDataList(string project_no, string _versionid) |
1601 |
{ |
1602 |
List<MARKUP_DATA> mlresult = new List<MARKUP_DATA>(); |
1603 |
|
1604 |
try |
1605 |
{ |
1606 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
1607 |
{ |
1608 |
mlresult = Entity.MARKUP_DATA.Where(data => data.MARKUPINFO_VERSION_ID == _versionid).ToList(); |
1609 |
} |
1610 |
} |
1611 |
catch (Exception) |
1612 |
{ |
1613 |
return null; |
1614 |
} |
1615 |
return mlresult; |
1616 |
} |
1617 |
|
1618 |
[OperationContract] |
1619 |
public bool Consolidate(string project_no, string _user_id, string _doc_id, List<MarkupInfoItem> markupInfoItems) |
1620 |
{ |
1621 |
try |
1622 |
{ |
1623 |
List<KCOMDataModel.DataModel.MARKUP_DATA> instanceDataSet = new List<KCOMDataModel.DataModel.MARKUP_DATA>(); |
1624 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
1625 |
{ |
1626 |
var markupInfo = Entity.MARKUP_INFO.Where(entity => entity.DOCINFO_ID == _doc_id).OrderByDescending(i => i.CONSOLIDATE).OrderByDescending(j => j.CREATE_TIME).FirstOrDefault(); |
1627 |
if (markupInfo.CONSOLIDATE == 1) |
1628 |
{ |
1629 |
markupInfo.AVOID_CONSOLIDATE = 1; |
1630 |
} |
1631 |
|
1632 |
foreach (MarkupInfoItem item in markupInfoItems) |
1633 |
{ |
1634 |
Entity.MARKUP_DATA.Where(data => data.MARKUPINFO_VERSION_ID == item.MarkupVersionID).ToList().ForEach(d => |
1635 |
{ |
1636 |
instanceDataSet.Add(d); |
1637 |
}); |
1638 |
} |
1639 |
|
1640 |
KCOMDataModel.DataModel.MARKUP_INFO info = new KCOMDataModel.DataModel.MARKUP_INFO(); |
1641 |
info.ID = shortGuid(); |
1642 |
info.CONSOLIDATE = 1; |
1643 |
info.CREATE_TIME = DateTime.Now; |
1644 |
info.DOCINFO_ID = _doc_id; |
1645 |
info.UPDATE_TIME = DateTime.Now; |
1646 |
info.USER_ID = _user_id; |
1647 |
info.AVOID_CONSOLIDATE = 0; |
1648 |
|
1649 |
Entity.MARKUP_INFO.AddObject(info); |
1650 |
Entity.SaveChanges(); |
1651 |
|
1652 |
|
1653 |
KCOMDataModel.DataModel.MARKUP_INFO_VERSION info2 = new KCOMDataModel.DataModel.MARKUP_INFO_VERSION |
1654 |
{ |
1655 |
ID = shortGuid(), |
1656 |
CREATE_DATE = DateTime.Now, |
1657 |
MARKUP_INFO = info, |
1658 |
}; |
1659 |
Entity.SaveChanges(); |
1660 |
|
1661 |
foreach (var item in instanceDataSet) |
1662 |
{ |
1663 |
Entity.MARKUP_DATA.AddObject(new KCOMDataModel.DataModel.MARKUP_DATA |
1664 |
{ |
1665 |
ID = shortGuid(), |
1666 |
DATA = item.DATA, |
1667 |
DATA_TYPE = item.DATA_TYPE, |
1668 |
PAGENUMBER = item.PAGENUMBER, |
1669 |
MARKUP_INFO_VERSION = info2, |
1670 |
SYMBOL_ID = item.SYMBOL_ID |
1671 |
}); |
1672 |
} |
1673 |
Entity.SaveChanges(); |
1674 |
|
1675 |
|
1676 |
} |
1677 |
} |
1678 |
catch (Exception) |
1679 |
{ |
1680 |
return false; |
1681 |
} |
1682 |
return true; |
1683 |
} |
1684 |
|
1685 |
|
1686 |
[OperationContract] |
1687 |
public FinalPDFResult ConsolidateMergedPDF(string project_no, string _user_id, string _doc_id, List<MarkupInfoItem> markupInfoItems, string ProjectNo, string DocInfoID, string CreateUserID) |
1688 |
{ |
1689 |
bool consolidate = false; |
1690 |
try |
1691 |
{ |
1692 |
List<KCOMDataModel.DataModel.MARKUP_DATA> instanceDataSet = new List<KCOMDataModel.DataModel.MARKUP_DATA>(); |
1693 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
1694 |
{ |
1695 |
var markupInfo = Entity.MARKUP_INFO.Where(entity => entity.DOCINFO_ID == _doc_id).OrderByDescending(i => i.CONSOLIDATE).OrderByDescending(j => j.CREATE_TIME).FirstOrDefault(); |
1696 |
if (markupInfo.CONSOLIDATE == 1) |
1697 |
{ |
1698 |
markupInfo.AVOID_CONSOLIDATE = 1; |
1699 |
} |
1700 |
|
1701 |
foreach (MarkupInfoItem item in markupInfoItems) |
1702 |
{ |
1703 |
Entity.MARKUP_DATA.Where(data => data.MARKUPINFO_VERSION_ID == item.MarkupVersionID).ToList().ForEach(d => |
1704 |
{ |
1705 |
instanceDataSet.Add(d); |
1706 |
}); |
1707 |
} |
1708 |
|
1709 |
KCOMDataModel.DataModel.MARKUP_INFO info = new KCOMDataModel.DataModel.MARKUP_INFO(); |
1710 |
info.ID = shortGuid(); |
1711 |
info.CONSOLIDATE = 1; |
1712 |
info.CREATE_TIME = DateTime.Now; |
1713 |
info.DOCINFO_ID = _doc_id; |
1714 |
info.UPDATE_TIME = DateTime.Now; |
1715 |
info.USER_ID = _user_id; |
1716 |
info.AVOID_CONSOLIDATE = 0; |
1717 |
|
1718 |
Entity.MARKUP_INFO.AddObject(info); |
1719 |
Entity.SaveChanges(); |
1720 |
|
1721 |
|
1722 |
KCOMDataModel.DataModel.MARKUP_INFO_VERSION info2 = new KCOMDataModel.DataModel.MARKUP_INFO_VERSION |
1723 |
{ |
1724 |
ID = shortGuid(), |
1725 |
CREATE_DATE = DateTime.Now, |
1726 |
MARKUP_INFO = info, |
1727 |
}; |
1728 |
Entity.SaveChanges(); |
1729 |
|
1730 |
foreach (var item in instanceDataSet) |
1731 |
{ |
1732 |
Entity.MARKUP_DATA.AddObject(new KCOMDataModel.DataModel.MARKUP_DATA |
1733 |
{ |
1734 |
ID = shortGuid(), |
1735 |
DATA = item.DATA, |
1736 |
DATA_TYPE = item.DATA_TYPE, |
1737 |
PAGENUMBER = item.PAGENUMBER, |
1738 |
MARKUP_INFO_VERSION = info2, |
1739 |
SYMBOL_ID = item.SYMBOL_ID |
1740 |
}); |
1741 |
} |
1742 |
Entity.SaveChanges(); |
1743 |
|
1744 |
|
1745 |
} |
1746 |
consolidate = true; |
1747 |
} |
1748 |
catch (Exception) |
1749 |
{ |
1750 |
consolidate = false; |
1751 |
} |
1752 |
FinalPDFResult _result = new FinalPDFResult(); |
1753 |
if (consolidate == true) |
1754 |
{ |
1755 |
RemFinalPDFObject remObj = null; |
1756 |
try |
1757 |
{ |
1758 |
string _finalID = shortGuid(); |
1759 |
int _DocTotalPages = -1; |
1760 |
string docItemId; |
1761 |
|
1762 |
|
1763 |
using (CIEntities _ci = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString())) |
1764 |
{ |
1765 |
var _doc = _ci.DOCINFO.Where(info => info.ID == DocInfoID); |
1766 |
|
1767 |
if (_doc.Count() > 0) |
1768 |
{ |
1769 |
_DocTotalPages = _doc.First().PAGE_COUNT; |
1770 |
docItemId = _doc.First().DOCUMENT_ID; |
1771 |
} |
1772 |
else |
1773 |
{ |
1774 |
_result.Status = FinalStatus.Error; |
1775 |
_result.Exception = "페이지 정보를 가져올 수 없습니다."; |
1776 |
return _result; |
1777 |
} |
1778 |
} |
1779 |
|
1780 |
var Items = GetMarkupInfoItems(ProjectNo, DocInfoID); |
1781 |
if (_DocTotalPages > 0) |
1782 |
{ |
1783 |
var item2 = Items.Cast<MarkupInfoItem>().Where(d => d.Consolidate == 1 && d.AvoidConsolidate == 0).FirstOrDefault(); |
1784 |
FINAL_PDF fm = new FINAL_PDF() |
1785 |
{ |
1786 |
ID = _finalID, |
1787 |
PROJECT_NO = ProjectNo, |
1788 |
DOCINFO_ID = DocInfoID, |
1789 |
DOCUMENT_ID = docItemId, |
1790 |
MARKUPINFO_ID = item2.MarkupInfoID, |
1791 |
CREATE_USER_ID = CreateUserID, |
1792 |
TOTAL_PAGE = _DocTotalPages, |
1793 |
CREATE_DATETIME = DateTime.Now, |
1794 |
STATUS = (int)IFinalPDF.FinalStatus.Insert |
1795 |
}; |
1796 |
using (KCOMEntities _entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
1797 |
{ |
1798 |
_entity.AddToFINAL_PDF(fm); |
1799 |
_entity.SaveChanges(System.Data.Objects.SaveOptions.AcceptAllChangesAfterSave); |
1800 |
}; |
1801 |
|
1802 |
System.Runtime.Remoting.Channels.IChannel _ch = System.Runtime.Remoting.Channels.ChannelServices.GetChannel("tcp"); |
1803 |
if (_ch == null) |
1804 |
{ |
1805 |
chan = new TcpChannel(); |
1806 |
_ChanID = chan.ChannelName; |
1807 |
System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(chan, false); |
1808 |
// Create an instance of the remote object |
1809 |
|
1810 |
|
1811 |
using (KCOMEntities ec = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
1812 |
{ |
1813 |
|
1814 |
//remObj = (RemFinalPDFObject)Activator.GetObject(typeof(RemFinalPDFObject), |
1815 |
// "tcp://localhost:9092/remFinalPDF"); |
1816 |
remObj = (RemFinalPDFObject)Activator.GetObject(typeof(RemFinalPDFObject), |
1817 |
//"tcp://192.168.0.67:9092/remFinalPDF"); |
1818 |
"tcp://192.168.0.67:9092/remFinalPDF"); |
1819 |
} |
1820 |
|
1821 |
//"tcp://localhost:8080/remFinalPDF"); |
1822 |
|
1823 |
_result = remObj.SetFinalPDF(ProjectNo, _finalID); |
1824 |
_result.FinalID = _finalID; |
1825 |
_result.Status = FinalStatus.Success; |
1826 |
|
1827 |
//MarkupToPDF.MarkupToPDF fa = new MarkupToPDF.MarkupToPDF(); |
1828 |
//fa.MakeFinalPDF(fm); |
1829 |
} |
1830 |
else |
1831 |
{ |
1832 |
_ChanID = _ch.ChannelName; |
1833 |
} |
1834 |
} |
1835 |
} |
1836 |
catch (Exception ex) |
1837 |
{ |
1838 |
_result.Status = FinalStatus.Error; |
1839 |
|
1840 |
if (ex.GetType() == typeof(System.Net.Sockets.SocketException)) |
1841 |
_result.Exception = "Final Server Not Connection"; |
1842 |
} |
1843 |
finally |
1844 |
{ |
1845 |
remObj = null; |
1846 |
if (System.Runtime.Remoting.Channels.ChannelServices.GetChannel("tcp") != null) |
1847 |
System.Runtime.Remoting.Channels.ChannelServices.UnregisterChannel(chan); |
1848 |
|
1849 |
GC.Collect(2); |
1850 |
} |
1851 |
} |
1852 |
return _result; |
1853 |
} |
1854 |
[OperationContract] |
1855 |
public bool TeamConsolidate(string project_no, string _user_id, string _doc_id, List<MarkupInfoItem> markupInfoItems) |
1856 |
{ |
1857 |
try |
1858 |
{ |
1859 |
List<KCOMDataModel.DataModel.MARKUP_DATA> instanceDataSet = new List<KCOMDataModel.DataModel.MARKUP_DATA>(); |
1860 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
1861 |
{ |
1862 |
var markupInfo = Entity.MARKUP_INFO.Where(entity => entity.DOCINFO_ID == _doc_id).OrderByDescending(i => i.CONSOLIDATE).OrderByDescending(j => j.CREATE_TIME).FirstOrDefault(); |
1863 |
if (markupInfo.PART_CONSOLIDATE == 1) |
1864 |
{ |
1865 |
markupInfo.AVOID_CONSOLIDATE = 1; |
1866 |
} |
1867 |
|
1868 |
foreach (MarkupInfoItem item in markupInfoItems) |
1869 |
{ |
1870 |
Entity.MARKUP_DATA.Where(data => data.MARKUPINFO_VERSION_ID == item.MarkupVersionID).ToList().ForEach(d => |
1871 |
{ |
1872 |
instanceDataSet.Add(d); |
1873 |
}); |
1874 |
} |
1875 |
|
1876 |
KCOMDataModel.DataModel.MARKUP_INFO info = new KCOMDataModel.DataModel.MARKUP_INFO(); |
1877 |
info.ID = shortGuid(); |
1878 |
info.PART_CONSOLIDATE = 1; |
1879 |
info.CREATE_TIME = DateTime.Now; |
1880 |
info.DOCINFO_ID = _doc_id; |
1881 |
info.UPDATE_TIME = DateTime.Now; |
1882 |
info.USER_ID = _user_id; |
1883 |
info.AVOID_CONSOLIDATE = 0; |
1884 |
|
1885 |
Entity.MARKUP_INFO.AddObject(info); |
1886 |
Entity.SaveChanges(); |
1887 |
|
1888 |
|
1889 |
KCOMDataModel.DataModel.MARKUP_INFO_VERSION info2 = new KCOMDataModel.DataModel.MARKUP_INFO_VERSION |
1890 |
{ |
1891 |
ID = shortGuid(), |
1892 |
CREATE_DATE = DateTime.Now, |
1893 |
MARKUP_INFO = info, |
1894 |
}; |
1895 |
Entity.SaveChanges(); |
1896 |
|
1897 |
foreach (var item in instanceDataSet) |
1898 |
{ |
1899 |
Entity.MARKUP_DATA.AddObject(new KCOMDataModel.DataModel.MARKUP_DATA |
1900 |
{ |
1901 |
ID = shortGuid(), |
1902 |
DATA = item.DATA, |
1903 |
DATA_TYPE = item.DATA_TYPE, |
1904 |
PAGENUMBER = item.PAGENUMBER, |
1905 |
MARKUP_INFO_VERSION = info2, |
1906 |
SYMBOL_ID = item.SYMBOL_ID |
1907 |
}); |
1908 |
} |
1909 |
Entity.SaveChanges(); |
1910 |
|
1911 |
|
1912 |
} |
1913 |
} |
1914 |
catch (Exception) |
1915 |
{ |
1916 |
return false; |
1917 |
} |
1918 |
return true; |
1919 |
} |
1920 |
|
1921 |
[OperationContract] |
1922 |
[ServiceKnownType(typeof(MEMBER))] |
1923 |
public MEMBER GetMember(string project_no, string user_id) |
1924 |
{ |
1925 |
MEMBER rstmember = new MEMBER(); |
1926 |
try |
1927 |
{ |
1928 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
1929 |
{ |
1930 |
var tmp = (from member in Entity.MEMBER |
1931 |
where member.ID == user_id |
1932 |
select member).FirstOrDefault(); |
1933 |
rstmember.DEPARTMENT = tmp.DEPARTMENT; |
1934 |
rstmember.ID = tmp.ID; |
1935 |
rstmember.NAME = tmp.NAME; |
1936 |
} |
1937 |
} |
1938 |
catch (Exception) |
1939 |
{ |
1940 |
return null; |
1941 |
} |
1942 |
return rstmember; |
1943 |
} |
1944 |
|
1945 |
[OperationContract] |
1946 |
public List<SYMBOL_PRIVATE> GetSymbolList(string user_id) |
1947 |
{ |
1948 |
List<SYMBOL_PRIVATE> Custom_List = new List<SYMBOL_PRIVATE>(); |
1949 |
try |
1950 |
{ |
1951 |
using (KCOMEntities Entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
1952 |
{ |
1953 |
Custom_List = Entity.SYMBOL_PRIVATE.Where(data => data.MEMBER_USER_ID == user_id).ToList(); |
1954 |
} |
1955 |
} |
1956 |
catch (Exception) |
1957 |
{ |
1958 |
return null; |
1959 |
} |
1960 |
return Custom_List; |
1961 |
} |
1962 |
[OperationContract] |
1963 |
public List<string> GetPublicSymbolDeptList() |
1964 |
{ |
1965 |
List<string> Custom_List = new List<string>(); |
1966 |
try |
1967 |
{ |
1968 |
using (KCOMEntities Entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
1969 |
{ |
1970 |
Custom_List = Entity.SYMBOL_PUBLIC.Select(data => data.DEPARTMENT).ToList(); |
1971 |
} |
1972 |
} |
1973 |
catch (Exception) |
1974 |
{ |
1975 |
return null; |
1976 |
} |
1977 |
return Custom_List; |
1978 |
} |
1979 |
[OperationContract] |
1980 |
public List<SYMBOL_PUBLIC> GetPublicSymbolList(string dept) |
1981 |
{ |
1982 |
List<SYMBOL_PUBLIC> Custom_List = new List<SYMBOL_PUBLIC>(); |
1983 |
try |
1984 |
{ |
1985 |
using (KCOMEntities Entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
1986 |
{ |
1987 |
if(!string.IsNullOrEmpty(dept)) |
1988 |
{ |
1989 |
Custom_List = Entity.SYMBOL_PUBLIC.Where(data => data.DEPARTMENT == dept).ToList(); |
1990 |
} |
1991 |
else |
1992 |
{ |
1993 |
Custom_List = Entity.SYMBOL_PUBLIC.ToList(); |
1994 |
} |
1995 |
|
1996 |
} |
1997 |
} |
1998 |
catch (Exception) |
1999 |
{ |
2000 |
return null; |
2001 |
} |
2002 |
return Custom_List; |
2003 |
} |
2004 |
|
2005 |
/// <summary> |
2006 |
/// |
2007 |
/// </summary> |
2008 |
/// <param name="id">symbol id</param> |
2009 |
/// <param name="type"> 0 : PRIVATE, 1 : PUBLIC</param> |
2010 |
/// <returns></returns> |
2011 |
[OperationContract] |
2012 |
public string GetSymbolData(string id, int type) |
2013 |
{ |
2014 |
string result; |
2015 |
try |
2016 |
{ |
2017 |
using (KCOMEntities Entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
2018 |
{ |
2019 |
if(type == 0) |
2020 |
{ |
2021 |
result = Entity.SYMBOL_PRIVATE.Where(data => data.ID == id).FirstOrDefault().DATA; |
2022 |
} |
2023 |
else |
2024 |
{ |
2025 |
result = Entity.SYMBOL_PUBLIC.Where(data => data.ID == id).FirstOrDefault().DATA; |
2026 |
} |
2027 |
} |
2028 |
} |
2029 |
catch (Exception) |
2030 |
{ |
2031 |
return null; |
2032 |
} |
2033 |
return result; |
2034 |
} |
2035 |
|
2036 |
[OperationContract] |
2037 |
public string GetSignData(string project_no, string user_id) |
2038 |
{ |
2039 |
string result = null; |
2040 |
try |
2041 |
{ |
2042 |
var ModelWFConnectionString = ConnectStringBuilder.ProjectCIConnectString(project_no).ToString(); |
2043 |
if (null != ModelWFConnectionString) |
2044 |
{ |
2045 |
using (CIEntities entity = new CIEntities(ModelWFConnectionString)) |
2046 |
{ |
2047 |
var _sign = entity.SIGN_INFO.Where(sin => sin.MEMBER_USER_ID == user_id); |
2048 |
if (_sign.Count() > 0) |
2049 |
{ |
2050 |
result = _sign.First().SIGN_STR; |
2051 |
} |
2052 |
else |
2053 |
{ |
2054 |
return null; |
2055 |
} |
2056 |
} |
2057 |
} |
2058 |
} |
2059 |
catch (Exception) |
2060 |
{ |
2061 |
return null; |
2062 |
} |
2063 |
return result; |
2064 |
} |
2065 |
|
2066 |
[OperationContract] |
2067 |
public string GetProjectName(string project_no) |
2068 |
{ |
2069 |
string result = null; |
2070 |
|
2071 |
try |
2072 |
{ |
2073 |
using (KCOMDataModel.DataModel.KCOMEntities Entity = new KCOMDataModel.DataModel.KCOMEntities(KCOMDataModel.Common.ConnectStringBuilder.KCOMConnectionString().ToString())) |
2074 |
{ |
2075 |
result = Entity.RUN_PROJECTS.Where(i => i.PROJECT_NO == project_no).FirstOrDefault().PROJECT_NAME.ToString(); |
2076 |
} |
2077 |
} |
2078 |
catch (Exception) |
2079 |
{ |
2080 |
return null; |
2081 |
} |
2082 |
return result; |
2083 |
} |
2084 |
|
2085 |
[OperationContract] |
2086 |
public List<DOCUMENT_ITEM> GetPreRevSelect(string project_no, string doc_no, string current_rev) |
2087 |
{ |
2088 |
List<DOCUMENT_ITEM> result = new List<DOCUMENT_ITEM>(); |
2089 |
|
2090 |
try |
2091 |
{ |
2092 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
2093 |
{ |
2094 |
result = Entity.DOCUMENT_ITEM.Where(i => i.PROJECT_NO == project_no |
2095 |
&& i.DOCUMENT_NO == doc_no |
2096 |
&& i.REVISION != current_rev).OrderByDescending(i => i.GROUP_NO).ToList(); |
2097 |
} |
2098 |
} |
2099 |
catch (Exception) |
2100 |
{ |
2101 |
return null; |
2102 |
} |
2103 |
return result; |
2104 |
} |
2105 |
|
2106 |
[OperationContract] |
2107 |
public DOCINFO GetDocInfoOneSelect(string project_no, string doc_id) |
2108 |
{ |
2109 |
DOCINFO docinfo = null; |
2110 |
|
2111 |
try |
2112 |
{ |
2113 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
2114 |
{ |
2115 |
docinfo = (from info in Entity.DOCINFO |
2116 |
where info.DOCUMENT_ID == doc_id |
2117 |
&& info.PROJECT_NO == project_no |
2118 |
select info).First(); |
2119 |
} |
2120 |
} |
2121 |
catch (Exception) |
2122 |
{ |
2123 |
return null; |
2124 |
} |
2125 |
return docinfo; |
2126 |
} |
2127 |
|
2128 |
[OperationContract] |
2129 |
public List<MarkupInfoItem> GetPrintDocItemList(string project_no, string doc_id, List<MarkupInfoItem> _markupInfoList) |
2130 |
{ |
2131 |
MarkupInfoItem _result = null; |
2132 |
List<MarkupInfoItem> markupinfo = new List<MarkupInfoItem>(); |
2133 |
try |
2134 |
{ |
2135 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
2136 |
{ |
2137 |
var docitem = (from info in Entity.DOCINFO |
2138 |
where info.DOCUMENT_ID == doc_id |
2139 |
&& info.PROJECT_NO == project_no |
2140 |
select info).First(); |
2141 |
|
2142 |
foreach (MARKUP_INFO markinfo in docitem.MARKUP_INFO) |
2143 |
{ |
2144 |
var member = (from mem in Entity.MEMBER |
2145 |
where mem.ID == markinfo.USER_ID |
2146 |
select mem).First(); |
2147 |
string displaycolor = null; |
2148 |
try |
2149 |
{ |
2150 |
displaycolor = _markupInfoList.Where(info => info.MarkupInfoID == markinfo.ID).First().DisplayColor; |
2151 |
} |
2152 |
catch(Exception) |
2153 |
{ |
2154 |
displaycolor = "#FFFFFF"; |
2155 |
} |
2156 |
|
2157 |
_result = new MarkupInfoItem |
2158 |
{ |
2159 |
MarkupInfoID = markinfo.ID, |
2160 |
Consolidate = markinfo.CONSOLIDATE, |
2161 |
CreateTime = markinfo.UPDATE_TIME.HasValue ? markinfo.UPDATE_TIME.Value : markinfo.CREATE_TIME, |
2162 |
DisplayColor = displaycolor, |
2163 |
UserID = markinfo.USER_ID, |
2164 |
UserName = member.NAME, |
2165 |
Depatment = member.DEPARTMENT, |
2166 |
}; |
2167 |
|
2168 |
_result.MarkupList = new List<IKCOM.MarkupItem>(); |
2169 |
var markup_Version = markinfo.MARKUP_INFO_VERSION.OrderByDescending(p => p.CREATE_DATE).First(); |
2170 |
|
2171 |
foreach (MARKUP_DATA markdata in markup_Version.MARKUP_DATA) |
2172 |
{ |
2173 |
MarkupItem markitem = new MarkupItem() |
2174 |
{ |
2175 |
ID = markdata.ID, |
2176 |
PageNumber = markdata.PAGENUMBER, |
2177 |
}; |
2178 |
_result.MarkupList.Add(markitem); |
2179 |
} |
2180 |
|
2181 |
_result.PageCount = _result.MarkupList.GroupBy(i => i.PageNumber).Count(); |
2182 |
|
2183 |
markupinfo.Add(_result); |
2184 |
} |
2185 |
} |
2186 |
} |
2187 |
catch (Exception) |
2188 |
{ |
2189 |
return null; |
2190 |
} |
2191 |
return markupinfo; |
2192 |
} |
2193 |
|
2194 |
[OperationContract] |
2195 |
public bool AddMessage(string project_no, TALK value) |
2196 |
{ |
2197 |
try |
2198 |
{ |
2199 |
using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
2200 |
{ |
2201 |
entity.TALK.AddObject(value); |
2202 |
entity.SaveChanges(); |
2203 |
} |
2204 |
} |
2205 |
catch (Exception) |
2206 |
{ |
2207 |
return false; |
2208 |
} |
2209 |
return true; |
2210 |
} |
2211 |
|
2212 |
[OperationContract] |
2213 |
public List<TALK> GetMessage(string project_no, string doc_id) |
2214 |
{ |
2215 |
List<TALK> result = new List<TALK>(); |
2216 |
try |
2217 |
{ |
2218 |
using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
2219 |
{ |
2220 |
result = entity.TALK.Where(data => data.DOCUMENT_ID == doc_id).ToList(); |
2221 |
} |
2222 |
} |
2223 |
catch (Exception) |
2224 |
{ |
2225 |
return result; |
2226 |
} |
2227 |
return result; |
2228 |
} |
2229 |
} |
2230 |
} |