markus / KCOM_API / ServiceDeepView.svc.cs @ 811712ec
이력 | 보기 | 이력해설 | 다운로드 (101 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, Group_ID = markupData.GROUP_ID ?? 0 }).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 |
/* |
643 |
[OperationContract] |
644 |
public List<MarkupInfoItem> GetMarkupInfoItems(string ProjectNo, string DocInfoId) |
645 |
{ |
646 |
List<MarkupInfoItem> _result = new List<MarkupInfoItem>(); |
647 |
try |
648 |
{ |
649 |
using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString())) |
650 |
{ |
651 |
var markupListData = entity.MARKUP_INFO.Where(data => data.DOCINFO_ID == DocInfoId).ToList(); |
652 |
|
653 |
var markupList = from markup in markupListData |
654 |
orderby markup.CREATE_TIME descending |
655 |
select new MarkupInfoItem |
656 |
{ |
657 |
MarkupInfoID = markup.ID, |
658 |
UserID = markup.USER_ID, |
659 |
MarkupVersionID = markup.MARKUP_INFO_VERSION.Count() == 0 ? null : markup.MARKUP_INFO_VERSION.OrderByDescending(data => data.CREATE_DATE).FirstOrDefault().ID, |
660 |
CreateTime = markup.CREATE_TIME, |
661 |
Consolidate = markup.CONSOLIDATE, |
662 |
Description = markup.DESCRIPTION, |
663 |
AvoidConsolidate = markup.AVOID_CONSOLIDATE, |
664 |
PartConsolidate = markup.PART_CONSOLIDATE, |
665 |
UpdateTime = DateTime.Parse(markup.UPDATE_TIME.ToString()), |
666 |
}; |
667 |
|
668 |
if (markupList.Count() > 0) |
669 |
{ |
670 |
_result = markupList.ToList(); |
671 |
} |
672 |
|
673 |
_result.ForEach(r => |
674 |
{ |
675 |
|
676 |
r.MarkupList = (from markupData in entity.MARKUP_DATA |
677 |
where markupData.MARKUPINFO_VERSION_ID == r.MarkupVersionID |
678 |
orderby markupData.PAGENUMBER |
679 |
select new MarkupItem { ID = markupData.ID, PageNumber = markupData.PAGENUMBER, Data = markupData.DATA, Data_Type = markupData.DATA_TYPE, Symbol_ID = markupData.SYMBOL_ID }).ToList(); |
680 |
}); |
681 |
|
682 |
Random random = new Random(); |
683 |
|
684 |
_MemberDeptColors memberDeptColors = new _MemberDeptColors(); |
685 |
_MemberDeptColorsInfo memberDeptColorsInfo = new _MemberDeptColorsInfo(); |
686 |
|
687 |
|
688 |
memberDeptColors._memberDeptColors = (from memberdeptcolor in entity.MEMBER_DEPT_COLOR |
689 |
//where memberdeptcolor.DEPARTMENT == "DisplayColor" |
690 |
select memberdeptcolor).ToList(); |
691 |
memberDeptColorsInfo._memberDeptColorsInfo = (from memberdeptcolorinfo in entity.MEMBER_DEPT_COLORINFO |
692 |
//where memberdeptcolor.DEPARTMENT == "DisplayColor" |
693 |
select memberdeptcolorinfo).ToList(); |
694 |
|
695 |
|
696 |
foreach (var item in _result) |
697 |
{ |
698 |
var _member = entity.MEMBER.Where(member => member.ID == item.UserID); |
699 |
|
700 |
if (_member.Count() > 0) |
701 |
{ |
702 |
item.UserName = _member.First().NAME; |
703 |
item.Depatment = _member.First().DEPARTMENT; |
704 |
} |
705 |
|
706 |
foreach (var dept in memberDeptColors._memberDeptColors) |
707 |
{//dept 지정 색상 |
708 |
if (dept.DEPARTMENT == item.Depatment) |
709 |
{ |
710 |
var colorlist = memberDeptColorsInfo._memberDeptColorsInfo.Where(d => d.COLORID == dept.COLORID).ToList(); |
711 |
|
712 |
int colorIdx = random.Next(1, colorlist.Count()); |
713 |
if (colorlist.Count > 0) |
714 |
{ |
715 |
item.DisplayColor = "#FF" + colorlist[colorIdx].DISPLAYCOLOR; |
716 |
memberDeptColorsInfo._memberDeptColorsInfo.Remove(colorlist[colorIdx]); |
717 |
break; |
718 |
} |
719 |
else |
720 |
{ |
721 |
item.DisplayColor = String.Format("#FF{0:X6}", random.Next(0x1000000)); |
722 |
break; |
723 |
} |
724 |
} |
725 |
} |
726 |
|
727 |
|
728 |
if (item.DisplayColor == null) |
729 |
{ |
730 |
foreach (var dept in memberDeptColors._memberDeptColors) |
731 |
{ |
732 |
if (dept.DEPARTMENT == null) |
733 |
{ |
734 |
dept.DEPARTMENT = item.Depatment; |
735 |
var colorlist = memberDeptColorsInfo._memberDeptColorsInfo.Where(d => d.COLORID == dept.COLORID).ToList(); |
736 |
int colorIdx = random.Next(1, colorlist.Count()); |
737 |
if (colorlist.Count > 0) |
738 |
{ |
739 |
item.DisplayColor = "#FF" + colorlist[colorIdx].DISPLAYCOLOR; |
740 |
memberDeptColorsInfo._memberDeptColorsInfo.Remove(colorlist[colorIdx]); |
741 |
break; |
742 |
} |
743 |
else |
744 |
{ |
745 |
item.DisplayColor = String.Format("#FF{0:X6}", random.Next(0x1000000)); |
746 |
break; |
747 |
} |
748 |
} |
749 |
} |
750 |
} |
751 |
|
752 |
if (item.DisplayColor == null) |
753 |
{ |
754 |
item.DisplayColor = String.Format("#FF{0:X6}", random.Next(0x1000000)); |
755 |
} |
756 |
} |
757 |
} |
758 |
} |
759 |
catch (Exception EX) |
760 |
{ |
761 |
System.Diagnostics.Debug.WriteLine(this.GetType().ToString() + " " + EX); |
762 |
return _result; |
763 |
} |
764 |
finally |
765 |
{ |
766 |
GC.Collect(2); |
767 |
} |
768 |
|
769 |
return _result; |
770 |
} |
771 |
|
772 |
/* |
773 |
[OperationContract] |
774 |
public List<MarkupInfoItem> GetMarkupInfoItems(string ProjectNo, string DocInfoId) |
775 |
{ |
776 |
List<MarkupInfoItem> _result = new List<MarkupInfoItem>(); |
777 |
try |
778 |
{ |
779 |
using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString())) |
780 |
{ |
781 |
var markupListData = entity.MARKUP_INFO.Where(data => data.DOCINFO_ID == DocInfoId).ToList(); |
782 |
//foreach (var item in markupListData) |
783 |
//{ |
784 |
// if (!item.AVOID_CONSOLIDATE.HasValue) |
785 |
// { |
786 |
// item.AVOID_CONSOLIDATE = 0; |
787 |
// } |
788 |
//} |
789 |
|
790 |
var markupList = from markup in markupListData |
791 |
orderby markup.CREATE_TIME descending |
792 |
select new MarkupInfoItem |
793 |
{ |
794 |
MarkupInfoID = markup.ID, |
795 |
UserID = markup.USER_ID, |
796 |
MarkupVersionID = markup.MARKUP_INFO_VERSION.Count() == 0 ? null : markup.MARKUP_INFO_VERSION.OrderByDescending(data => data.CREATE_DATE).FirstOrDefault().ID, |
797 |
CreateTime = markup.CREATE_TIME, |
798 |
Consolidate = markup.CONSOLIDATE, |
799 |
Description = markup.DESCRIPTION, |
800 |
AvoidConsolidate = markup.AVOID_CONSOLIDATE, |
801 |
PartConsolidate = markup.PART_CONSOLIDATE, |
802 |
UpdateTime = DateTime.Parse(markup.UPDATE_TIME.ToString()), |
803 |
}; |
804 |
|
805 |
|
806 |
|
807 |
if (markupList.Count() > 0) |
808 |
{ |
809 |
_result = markupList.ToList(); |
810 |
} |
811 |
|
812 |
|
813 |
|
814 |
_result.ForEach(r => |
815 |
{ |
816 |
|
817 |
r.MarkupList = (from markupData in entity.MARKUP_DATA |
818 |
where markupData.MARKUPINFO_VERSION_ID == r.MarkupVersionID |
819 |
orderby markupData.PAGENUMBER |
820 |
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(); |
821 |
}); |
822 |
|
823 |
_ColorsProperties colors = new _ColorsProperties(); |
824 |
Random random = new Random(); |
825 |
|
826 |
using (KCOMEntities kcomEntity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
827 |
{ |
828 |
colors._colorsProperties = (from property in kcomEntity.PROPERTIES |
829 |
where property.TYPE == "DisplayColor" |
830 |
select property).ToList(); |
831 |
} |
832 |
List<DeptColor> deptColor = new List<DeptColor>(); |
833 |
|
834 |
List<DeptColor> listTest = new List<DeptColor>(); |
835 |
//Dictionary<string, string> d = new Dictionary<string, string>(); |
836 |
var list = new List<KeyValuePair<string, string>>(); |
837 |
foreach (var test in colors._colorsProperties) |
838 |
{ |
839 |
list.Add(new KeyValuePair<string, string>(test.PROPERTY, test.VALUE)); |
840 |
//d.Add(test.PROPERTY, test.VALUE); |
841 |
listTest.Add(new DeptColor { Property = test.PROPERTY,DisplayColor = test.VALUE}); |
842 |
} |
843 |
|
844 |
|
845 |
foreach (var item in _result) |
846 |
{ |
847 |
var _member = entity.MEMBER.Where(member => member.ID == item.UserID); |
848 |
|
849 |
if (_member.Count() > 0) |
850 |
{ |
851 |
item.UserName = _member.First().NAME; |
852 |
item.Depatment = _member.First().DEPARTMENT; |
853 |
} |
854 |
|
855 |
if (colors._colorsProperties.Count > 0) |
856 |
{ |
857 |
int colorIdx = random.Next(1, colors._colorsProperties.Count()); |
858 |
#region 부서별로 색상을 지정하고자 할때 |
859 |
|
860 |
if(deptColor.Count > 0) |
861 |
{ |
862 |
foreach (var dept in deptColor) |
863 |
{ |
864 |
if (dept.Depatment == item.Depatment) |
865 |
{ |
866 |
//list에서 deptColor.Property의 값 중 상위의 데이터를 뽑아서 지정하고 list에서 삭제 |
867 |
item.DisplayColor = "#FF" + list.Where(p => p.Key == dept.Property).FirstOrDefault().Value; |
868 |
list.Remove(new KeyValuePair<string, string>(dept.Property, dept.DisplayColor)); |
869 |
break; |
870 |
} |
871 |
else |
872 |
{ |
873 |
item.DisplayColor = "#FF" + colors._colorsProperties[colorIdx].VALUE; |
874 |
deptColor.Add(new DeptColor { DisplayColor = item.DisplayColor, Depatment = item.Depatment, Property = colors._colorsProperties[colorIdx].PROPERTY }); |
875 |
colors._colorsProperties.RemoveAll(p => p.PROPERTY.Equals(colors._colorsProperties[colorIdx].PROPERTY)); //같은 계열의 색상은 지운다 |
876 |
break; |
877 |
} |
878 |
} |
879 |
} |
880 |
else |
881 |
{ |
882 |
item.DisplayColor = "#FF" + colors._colorsProperties[colorIdx].VALUE; |
883 |
deptColor.Add(new DeptColor { DisplayColor = item.DisplayColor, Depatment = item.Depatment, Property = colors._colorsProperties[colorIdx].PROPERTY }); |
884 |
colors._colorsProperties.RemoveAll(p => p.PROPERTY.Equals(colors._colorsProperties[colorIdx].PROPERTY)); //같은 계열의 색상은 지운다 |
885 |
} |
886 |
#endregion |
887 |
} |
888 |
else |
889 |
{ |
890 |
item.DisplayColor = String.Format("#FF{0:X6}", random.Next(0x1000000)); |
891 |
} |
892 |
} |
893 |
} |
894 |
} |
895 |
catch (Exception EX) |
896 |
{ |
897 |
System.Diagnostics.Debug.WriteLine(this.GetType().ToString() + " " + EX); |
898 |
return _result; |
899 |
} |
900 |
finally |
901 |
{ |
902 |
GC.Collect(2); |
903 |
} |
904 |
|
905 |
return _result; |
906 |
} |
907 |
*/ |
908 |
[OperationContract] |
909 |
public List<MarkupInfoItem> GetSyncMarkupInfoItems(string ProjectNo, string DocInfoId, string currentUser) |
910 |
{ |
911 |
List<MarkupInfoItem> _result = new List<MarkupInfoItem>(); |
912 |
try |
913 |
{ |
914 |
using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString())) |
915 |
{ |
916 |
var docItem = entity.DOCINFO.Where(data => data.DOCUMENT_ID == DocInfoId).FirstOrDefault(); |
917 |
if (docItem == null) |
918 |
{ |
919 |
return null; |
920 |
} |
921 |
var markupListData = entity.MARKUP_INFO.Where(data => data.DOCINFO_ID == docItem.ID).ToList(); |
922 |
|
923 |
var markupList = from markup in markupListData |
924 |
where markup.USER_ID == currentUser || markup.CONSOLIDATE == 1 |
925 |
orderby markup.CREATE_TIME descending |
926 |
select new MarkupInfoItem |
927 |
{ |
928 |
MarkupInfoID = markup.ID, |
929 |
UserID = markup.USER_ID, |
930 |
MarkupVersionID = markup.MARKUP_INFO_VERSION.Count() == 0 ? null : markup.MARKUP_INFO_VERSION.OrderByDescending(data => data.CREATE_DATE).FirstOrDefault().ID, |
931 |
CreateTime = markup.CREATE_TIME, |
932 |
Consolidate = markup.CONSOLIDATE, |
933 |
Description = markup.DESCRIPTION, |
934 |
AvoidConsolidate = markup.AVOID_CONSOLIDATE, |
935 |
PartConsolidate = markup.PART_CONSOLIDATE, |
936 |
}; |
937 |
|
938 |
|
939 |
|
940 |
if (markupList.Count() > 0) |
941 |
{ |
942 |
_result = markupList.ToList(); |
943 |
} |
944 |
|
945 |
|
946 |
|
947 |
_result.ForEach(r => |
948 |
{ |
949 |
|
950 |
r.MarkupList = (from markupData in entity.MARKUP_DATA |
951 |
where markupData.MARKUPINFO_VERSION_ID == r.MarkupVersionID |
952 |
orderby markupData.PAGENUMBER |
953 |
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(); |
954 |
}); |
955 |
|
956 |
List<PROPERTIES> _ColorsProperties = new List<PROPERTIES>(); |
957 |
Random random = new Random(); |
958 |
|
959 |
using (KCOMEntities kcomEntity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
960 |
{ |
961 |
_ColorsProperties = (from property in kcomEntity.PROPERTIES |
962 |
where property.TYPE == "DisplayColor" |
963 |
select property).ToList(); |
964 |
} |
965 |
|
966 |
foreach (var item in _result) |
967 |
{ |
968 |
var _member = entity.MEMBER.Where(member => member.ID == item.UserID); |
969 |
|
970 |
if (_member.Count() > 0) |
971 |
{ |
972 |
item.UserName = _member.First().NAME; |
973 |
item.Depatment = _member.First().DEPARTMENT; |
974 |
} |
975 |
|
976 |
if (_ColorsProperties.Count > 0) |
977 |
{ |
978 |
int colorIdx = random.Next(1, _ColorsProperties.Count()); |
979 |
#region 부서별로 색상을 지정하고자 할때 |
980 |
/// 일단 의견을 들어보자구! |
981 |
#endregion |
982 |
item.DisplayColor = "#FF" + _ColorsProperties[colorIdx].VALUE; |
983 |
_ColorsProperties.Remove(_ColorsProperties[colorIdx]); |
984 |
//item.DisplayColor = "#FF" + _Colors.First(); |
985 |
//_Colors.Remove(_Colors.First()); |
986 |
} |
987 |
else |
988 |
{ |
989 |
item.DisplayColor = String.Format("#FF{0:X6}", random.Next(0x1000000)); |
990 |
} |
991 |
} |
992 |
} |
993 |
} |
994 |
catch (Exception EX) |
995 |
{ |
996 |
System.Diagnostics.Debug.WriteLine(this.GetType().ToString() + " " + EX); |
997 |
return _result; |
998 |
} |
999 |
finally |
1000 |
{ |
1001 |
GC.Collect(2); |
1002 |
} |
1003 |
|
1004 |
return _result; |
1005 |
} |
1006 |
|
1007 |
|
1008 |
//[OperationContract] |
1009 |
//[ServiceKnownType(typeof(MEMBER))] |
1010 |
//public List<MEMBER> GetUserData(string ProjectNo, string UserID) |
1011 |
//{ |
1012 |
// List<MEMBER> _result = new List<MEMBER>(); |
1013 |
|
1014 |
// using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString())) |
1015 |
// { |
1016 |
// var _UserList = from member in entity.MEMBER |
1017 |
// where member.ID == UserID |
1018 |
// select member; |
1019 |
// _result = _UserList.ToList(); |
1020 |
// } |
1021 |
// //GC.Collect(2); |
1022 |
// return _result; |
1023 |
//} |
1024 |
|
1025 |
[OperationContract] |
1026 |
[ServiceKnownType(typeof(MEMBER))] |
1027 |
public List<MEMBER> GetUserData(string ProjectNo, string UserID) |
1028 |
{ |
1029 |
List<MEMBER> _result = new List<MEMBER>(); |
1030 |
|
1031 |
using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString())) |
1032 |
{ |
1033 |
var _UserList = from member in entity.MEMBER |
1034 |
where member.ID == UserID |
1035 |
select member; |
1036 |
_result = _UserList.ToList(); |
1037 |
} |
1038 |
//GC.Collect(2); |
1039 |
return _result; |
1040 |
} |
1041 |
|
1042 |
|
1043 |
[OperationContract] |
1044 |
public List<string> GetDeptData(string UserDept) //그룹 추가 옵션 부여 예정 |
1045 |
{ |
1046 |
List<string> _result = new List<string>(); |
1047 |
|
1048 |
try |
1049 |
{ |
1050 |
KCOMEntities entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()); |
1051 |
var YourEnginner = (from dept in entity.PROPERTIES |
1052 |
where dept.TYPE == "DeptName" && UserDept.Contains(dept.VALUE) |
1053 |
select dept).FirstOrDefault(); |
1054 |
|
1055 |
if (YourEnginner != null) |
1056 |
{ |
1057 |
_result = (from dept in entity.PROPERTIES |
1058 |
where dept.PROPERTY == YourEnginner.PROPERTY |
1059 |
select dept.VALUE).ToList(); |
1060 |
return _result; |
1061 |
} |
1062 |
else |
1063 |
{ |
1064 |
return null; |
1065 |
} |
1066 |
} |
1067 |
catch (Exception ex) |
1068 |
{ |
1069 |
System.Diagnostics.Debug.WriteLine(ex.Message); |
1070 |
} |
1071 |
finally |
1072 |
{ |
1073 |
GC.Collect(2); |
1074 |
} |
1075 |
return _result; |
1076 |
} |
1077 |
|
1078 |
[OperationContract] |
1079 |
public bool DeleteMarkup(string ProjectNo, string MarkupInfoID) |
1080 |
{ |
1081 |
bool _result = false; |
1082 |
try |
1083 |
{ |
1084 |
using (KCOMDataModel.DataModel.CIEntities Entity = new KCOMDataModel.DataModel.CIEntities(KCOMDataModel.Common.ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString())) |
1085 |
{ |
1086 |
|
1087 |
MARKUP_INFO instance = Entity.MARKUP_INFO.Where(root => root.ID == MarkupInfoID).FirstOrDefault(); |
1088 |
|
1089 |
if (instance == null) |
1090 |
{ |
1091 |
return false; |
1092 |
} |
1093 |
MARKUP_INFO_VERSION version = instance.MARKUP_INFO_VERSION.FirstOrDefault(); |
1094 |
|
1095 |
|
1096 |
version.MARKUP_DATA.ToList().ForEach(data => |
1097 |
{ |
1098 |
Entity.MARKUP_DATA.DeleteObject(data); |
1099 |
Entity.SaveChanges(); |
1100 |
}); |
1101 |
|
1102 |
Entity.MARKUP_INFO_VERSION.DeleteObject(version); |
1103 |
Entity.SaveChanges(); |
1104 |
|
1105 |
Entity.MARKUP_INFO.DeleteObject(instance); |
1106 |
Entity.SaveChanges(); |
1107 |
|
1108 |
} |
1109 |
_result = true; |
1110 |
} |
1111 |
catch (Exception ex) |
1112 |
{ |
1113 |
System.Diagnostics.Trace.WriteLine(ex, "SaveMarkup"); |
1114 |
} |
1115 |
finally |
1116 |
{ |
1117 |
GC.Collect(2); |
1118 |
} |
1119 |
return _result; |
1120 |
} |
1121 |
|
1122 |
#region Favorite |
1123 |
[OperationContract] |
1124 |
public bool SetFavoriteVP(string prjNo, string userID, string groupNo, string docNo, string rev, int SavePageNo, string documentItemID, string VPDescription, IKCOM.FAVORITE_FLAG flag) |
1125 |
{ |
1126 |
|
1127 |
using (KCOMEntities entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
1128 |
{ |
1129 |
try |
1130 |
{ |
1131 |
entity.FAVORITE_DOC.AddObject(new FAVORITE_DOC |
1132 |
{ |
1133 |
ID = shortGuid(), |
1134 |
PROJECT_NO = prjNo, |
1135 |
DOCUMENT_ID = documentItemID, |
1136 |
GROUP_NO = groupNo, |
1137 |
DOCUMENT_NO = docNo, |
1138 |
MEMBER_USER_ID = userID, |
1139 |
DESCRIPTION = VPDescription, |
1140 |
CREATE_TIME = DateTime.Now, |
1141 |
REVISION = rev, |
1142 |
FLAG = (int)flag, |
1143 |
PAGE_NO = SavePageNo, |
1144 |
}); |
1145 |
entity.SaveChanges(); |
1146 |
} |
1147 |
catch (Exception) |
1148 |
{ |
1149 |
return false; |
1150 |
} |
1151 |
|
1152 |
return true; |
1153 |
} |
1154 |
} |
1155 |
|
1156 |
//[OperationContract] |
1157 |
//public List<FAVORITE_DOC> GetFavoriteVP(string PrjNo, string userID, string sharepointItemID) |
1158 |
//{ |
1159 |
// using (KCOMEntities entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
1160 |
// { |
1161 |
|
1162 |
// int flagString = Convert.ToInt32(IKCOM.FAVORITE_FLAG.Personal); |
1163 |
// List<FAVORITE_DOC> favoriteListSet = new List<FAVORITE_DOC>(); |
1164 |
// entity.FAVORITE_DOC.Where(data => data.PROJECT_NO == PrjNo && data.DOCUMENT_ID == sharepointItemID && data.FLAG != |
1165 |
// flagString).ToList().ForEach(data => favoriteListSet.Add(data)); |
1166 |
// entity.FAVORITE_DOC.Where(data => data.PROJECT_NO == PrjNo && data.MEMBER_USER_ID == userID).ToList().ForEach(data => favoriteListSet.Add(data)); |
1167 |
// favoriteListSet = favoriteListSet.Distinct().ToList(); |
1168 |
// return favoriteListSet; |
1169 |
// } |
1170 |
//} |
1171 |
//[OperationContract] |
1172 |
//public bool EditFavoriteVP(string prjNo, string userID, int SavePageNo, string sharepointItemID, DateTime createTime, int state, string description) |
1173 |
//{ |
1174 |
// using (DeepViewEntities dc = new DeepViewEntities(ConnectStringBuilder.DeepViewConnectionString().ToString())) |
1175 |
// { |
1176 |
// List<FavoriteVP> favoriteSet = dc.FavoriteVP.Where(data => data.ProjectNo == prjNo && data.CreateUserID == userID |
1177 |
// && data.PageNo == SavePageNo && data.CreateTime == createTime).ToList(); |
1178 |
|
1179 |
// try |
1180 |
// { |
1181 |
|
1182 |
|
1183 |
// if (favoriteSet.Count > 0) |
1184 |
// { |
1185 |
// var FavoriteVP_Instance = favoriteSet.First(); |
1186 |
|
1187 |
// FavoriteVP_Instance.Description = description; |
1188 |
// FavoriteVP_Instance.Flag = state; |
1189 |
|
1190 |
// dc.SaveChanges(); |
1191 |
|
1192 |
// return true; |
1193 |
// } |
1194 |
// else |
1195 |
// { |
1196 |
// return false; |
1197 |
// } |
1198 |
// } |
1199 |
// catch (Exception) |
1200 |
// { |
1201 |
// return false; |
1202 |
// } |
1203 |
// } |
1204 |
//} |
1205 |
//[OperationContract] |
1206 |
//public bool DelFavoriteVP(string prjNo, string userID, int SavePageNo, string sharepointItemID, DateTime createTime) |
1207 |
//{ |
1208 |
|
1209 |
// using (DeepViewEntities dc = new DeepViewEntities(ConnectStringBuilder.DeepViewConnectionString().ToString())) |
1210 |
// { |
1211 |
// List<FavoriteVP> favoriteSet = dc.FavoriteVP.Where(data => data.ProjectNo == prjNo && data.CreateUserID == userID |
1212 |
// && data.PageNo == SavePageNo && data.CreateTime == createTime).ToList(); |
1213 |
|
1214 |
// try |
1215 |
// { |
1216 |
|
1217 |
|
1218 |
// if (favoriteSet.Count > 0) |
1219 |
// { |
1220 |
// favoriteSet.ForEach(data => dc.FavoriteVP.DeleteObject(data)); |
1221 |
// dc.SaveChanges(); |
1222 |
// return true; |
1223 |
// } |
1224 |
// else |
1225 |
// { |
1226 |
// return false; |
1227 |
// } |
1228 |
// } |
1229 |
// catch (Exception) |
1230 |
// { |
1231 |
// return false; |
1232 |
// } |
1233 |
// } |
1234 |
//} |
1235 |
#endregion |
1236 |
|
1237 |
[OperationContract] |
1238 |
public bool SaveMarkupData(MarkupInfoItem UserState,string project_no,string doc_id, string user_id, List<MARKUP_DATA> mlmarkup_data) |
1239 |
{ |
1240 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
1241 |
{ |
1242 |
#region Docinfo 정보 가져오기 |
1243 |
|
1244 |
string docinfoid_ = (from info in Entity.DOCINFO |
1245 |
where info.DOCUMENT_ID == doc_id |
1246 |
&& info.PROJECT_NO == project_no |
1247 |
select info.ID |
1248 |
).First().ToString(); |
1249 |
#endregion |
1250 |
|
1251 |
#region Markup_Info 저장 |
1252 |
|
1253 |
MARKUP_INFO markup_info = new MARKUP_INFO(); |
1254 |
try |
1255 |
{ |
1256 |
markup_info = (from info in Entity.MARKUP_INFO |
1257 |
where info.ID == UserState.MarkupInfoID && info.USER_ID == user_id |
1258 |
select info).FirstOrDefault(); |
1259 |
} |
1260 |
catch (Exception) |
1261 |
{ |
1262 |
markup_info = null; |
1263 |
} |
1264 |
|
1265 |
//markup_info가 없을 경우 생성 |
1266 |
if (markup_info == null) |
1267 |
{ |
1268 |
//MarkupInfo 저장 |
1269 |
markup_info = new MARKUP_INFO |
1270 |
{ |
1271 |
ID = UserState.MarkupInfoID, |
1272 |
DOCINFO_ID = docinfoid_, |
1273 |
USER_ID = user_id, |
1274 |
CREATE_TIME = DateTime.Now, |
1275 |
CONSOLIDATE = UserState.Consolidate, |
1276 |
AVOID_CONSOLIDATE = UserState.AvoidConsolidate, |
1277 |
PART_CONSOLIDATE = UserState.PartConsolidate, |
1278 |
DESCRIPTION = UserState.Description, |
1279 |
UPDATE_TIME = DateTime.Now |
1280 |
}; |
1281 |
Entity.MARKUP_INFO.AddObject(markup_info); |
1282 |
} |
1283 |
//markup_info가 있을 경우 업데이트 |
1284 |
else |
1285 |
{ |
1286 |
markup_info.UPDATE_TIME = DateTime.Now; |
1287 |
} |
1288 |
Entity.SaveChanges(); |
1289 |
#endregion |
1290 |
|
1291 |
#region Markup_Info_Version 저장 |
1292 |
|
1293 |
MARKUP_INFO_VERSION markup_info_version = new MARKUP_INFO_VERSION(); |
1294 |
|
1295 |
try |
1296 |
{ |
1297 |
markup_info_version = (from info in Entity.MARKUP_INFO_VERSION |
1298 |
where info.MARKUPINFO_ID == markup_info.ID |
1299 |
select info).FirstOrDefault(); |
1300 |
} |
1301 |
catch (Exception) |
1302 |
{ |
1303 |
markup_info_version = null; |
1304 |
} |
1305 |
|
1306 |
//markup_info_version 없을 경우 생성 |
1307 |
if (markup_info_version == null) |
1308 |
{ |
1309 |
//MarkupInfo_version 저장 |
1310 |
markup_info_version = new MARKUP_INFO_VERSION() |
1311 |
{ |
1312 |
ID = UserState.MarkupVersionID, |
1313 |
MARKUPINFO_ID = markup_info.ID, |
1314 |
CREATE_DATE = DateTime.Now |
1315 |
}; |
1316 |
Entity.MARKUP_INFO_VERSION.AddObject(markup_info_version); |
1317 |
Entity.SaveChanges(); |
1318 |
} |
1319 |
#endregion |
1320 |
|
1321 |
|
1322 |
Entity.MARKUP_DATA.Where(data => data.MARKUPINFO_VERSION_ID == markup_info_version.ID).ToList().ForEach(item => |
1323 |
{ |
1324 |
Entity.MARKUP_DATA.DeleteObject(item); |
1325 |
}); |
1326 |
Entity.SaveChanges(); |
1327 |
|
1328 |
try |
1329 |
{ |
1330 |
mlmarkup_data.ForEach(value => |
1331 |
{ |
1332 |
Entity.MARKUP_DATA.AddObject(new MARKUP_DATA |
1333 |
{ |
1334 |
ID = value.ID, |
1335 |
DATA = value.DATA, |
1336 |
DATA_TYPE = value.DATA_TYPE, |
1337 |
PAGENUMBER = value.PAGENUMBER, |
1338 |
MARKUPINFO_VERSION_ID = markup_info_version.ID, |
1339 |
SYMBOL_ID = value.SYMBOL_ID, |
1340 |
GROUP_ID = value.GROUP_ID |
1341 |
}); |
1342 |
}); |
1343 |
Entity.SaveChanges(); |
1344 |
} |
1345 |
catch (Exception) |
1346 |
{ |
1347 |
return false; |
1348 |
} |
1349 |
} |
1350 |
return true; |
1351 |
} |
1352 |
|
1353 |
[OperationContract] |
1354 |
public long AddMarkupDataGroup(MARKUP_DATA_GROUP mARKUP_DATA_GROUP, string ProjectNo) |
1355 |
{ |
1356 |
try |
1357 |
{ |
1358 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString())) |
1359 |
{ |
1360 |
Entity.AddToMARKUP_DATA_GROUP(mARKUP_DATA_GROUP); |
1361 |
//MARKUP_DATA_GROUP tt = Entity.MARKUP_DATA_GROUP.Where(info => info.ID == id).FirstOrDefault(); |
1362 |
Entity.SaveChanges(); |
1363 |
|
1364 |
return Entity.MARKUP_DATA_GROUP.ToList().LastOrDefault().ID; |
1365 |
} |
1366 |
} |
1367 |
catch (Exception) |
1368 |
{ |
1369 |
return 0; |
1370 |
} |
1371 |
} |
1372 |
[OperationContract] |
1373 |
public bool UpdateMarkupDataGroup(long Group_ID, string ProjectNo) |
1374 |
{ |
1375 |
try |
1376 |
{ |
1377 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString())) |
1378 |
{ |
1379 |
var UpdateItem = Entity.MARKUP_DATA_GROUP.Where(info => info.ID == Group_ID).FirstOrDefault(); |
1380 |
UpdateItem.STATE = 1; |
1381 |
Entity.SaveChanges(); |
1382 |
} |
1383 |
} |
1384 |
catch (Exception) |
1385 |
{ |
1386 |
return false; |
1387 |
} |
1388 |
return true; |
1389 |
} |
1390 |
[OperationContract] |
1391 |
public bool UpdateMarkupData(string CommentID, long Group_ID, string ProjectNo) |
1392 |
{ |
1393 |
try |
1394 |
{ |
1395 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString())) |
1396 |
{ |
1397 |
var UpdateItem = Entity.MARKUP_DATA.Where(info => info.ID == CommentID).FirstOrDefault(); |
1398 |
UpdateItem.GROUP_ID = Group_ID; |
1399 |
Entity.SaveChanges(); |
1400 |
} |
1401 |
} |
1402 |
catch (Exception) |
1403 |
{ |
1404 |
return false; |
1405 |
} |
1406 |
return true; |
1407 |
} |
1408 |
|
1409 |
[OperationContract] |
1410 |
public bool SaveSymbol(SYMBOL_PRIVATE symbol_private) |
1411 |
{ |
1412 |
try |
1413 |
{ |
1414 |
using (KCOMDataModel.DataModel.KCOMEntities uc = new KCOMDataModel.DataModel.KCOMEntities(KCOMDataModel.Common.ConnectStringBuilder.KCOMConnectionString().ToString())) |
1415 |
{ |
1416 |
uc.AddToSYMBOL_PRIVATE(symbol_private); |
1417 |
uc.SaveChanges(); |
1418 |
} |
1419 |
} |
1420 |
catch(Exception) |
1421 |
{ |
1422 |
return false; |
1423 |
} |
1424 |
return true; |
1425 |
} |
1426 |
[OperationContract] |
1427 |
public bool AddPublicSymbol(SYMBOL_PUBLIC symbol) |
1428 |
{ |
1429 |
try |
1430 |
{ |
1431 |
using (KCOMDataModel.DataModel.KCOMEntities uc = new KCOMDataModel.DataModel.KCOMEntities(KCOMDataModel.Common.ConnectStringBuilder.KCOMConnectionString().ToString())) |
1432 |
{ |
1433 |
uc.AddToSYMBOL_PUBLIC(symbol); |
1434 |
uc.SaveChanges(); |
1435 |
} |
1436 |
} |
1437 |
catch (Exception) |
1438 |
{ |
1439 |
return false; |
1440 |
} |
1441 |
return true; |
1442 |
} |
1443 |
[OperationContract] |
1444 |
public bool DeleteSymbol(string symbol_id, int type) |
1445 |
{ |
1446 |
try |
1447 |
{ |
1448 |
using (KCOMEntities Entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
1449 |
{ |
1450 |
if (type == 0) |
1451 |
{ |
1452 |
string delItem_ID = symbol_id; |
1453 |
var delitem = Entity.SYMBOL_PRIVATE.Where(data => data.ID == delItem_ID).FirstOrDefault(); |
1454 |
Entity.SYMBOL_PRIVATE.DeleteObject(delitem); |
1455 |
Entity.SaveChanges(); |
1456 |
} |
1457 |
else |
1458 |
{ |
1459 |
string delItem_ID = symbol_id; |
1460 |
var delitem = Entity.SYMBOL_PUBLIC.Where(data => data.ID == delItem_ID).FirstOrDefault(); |
1461 |
Entity.SYMBOL_PUBLIC.DeleteObject(delitem); |
1462 |
Entity.SaveChanges(); |
1463 |
} |
1464 |
} |
1465 |
} |
1466 |
catch(Exception) |
1467 |
{ |
1468 |
return false; |
1469 |
} |
1470 |
return true; |
1471 |
} |
1472 |
|
1473 |
[OperationContract] |
1474 |
public bool RenameSymbol(string symbol_id, string name, int type) |
1475 |
{ |
1476 |
try |
1477 |
{ |
1478 |
using (KCOMEntities Entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
1479 |
{ |
1480 |
if (type == 0) |
1481 |
{ |
1482 |
var UpdateItem = Entity.SYMBOL_PRIVATE.Where(info => info.ID == symbol_id).FirstOrDefault(); |
1483 |
UpdateItem.NAME = name; |
1484 |
Entity.SaveChanges(); |
1485 |
} |
1486 |
else |
1487 |
{ |
1488 |
var UpdateItem = Entity.SYMBOL_PUBLIC.Where(info => info.ID == symbol_id).FirstOrDefault(); |
1489 |
UpdateItem.NAME = name; |
1490 |
Entity.SaveChanges(); |
1491 |
} |
1492 |
} |
1493 |
} |
1494 |
catch (Exception) |
1495 |
{ |
1496 |
return false; |
1497 |
} |
1498 |
return true; |
1499 |
} |
1500 |
|
1501 |
[OperationContract] |
1502 |
public bool AddCheckListHistory(string project_no, CHECK_LIST_HISTORY Check_History) |
1503 |
{ |
1504 |
try |
1505 |
{ |
1506 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
1507 |
{ |
1508 |
Entity.CHECK_LIST_HISTORY.AddObject(Check_History); |
1509 |
Entity.SaveChanges(); |
1510 |
} |
1511 |
} |
1512 |
catch (Exception) |
1513 |
{ |
1514 |
return false; |
1515 |
} |
1516 |
return true; |
1517 |
} |
1518 |
[OperationContract] |
1519 |
public bool SaveCheckListHistory(string project_no, string rev, CHECK_LIST_HISTORY Check_History) |
1520 |
{ |
1521 |
try |
1522 |
{ |
1523 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
1524 |
{ |
1525 |
var item = Entity.CHECK_LIST_HISTORY.Where(info => info.REVISION == rev).FirstOrDefault(); |
1526 |
item = Check_History; |
1527 |
Entity.SaveChanges(); |
1528 |
} |
1529 |
} |
1530 |
catch (Exception) |
1531 |
{ |
1532 |
return false; |
1533 |
} |
1534 |
return true; |
1535 |
} |
1536 |
[OperationContract] |
1537 |
public bool SaveCheckList(string project_no, string _id, CHECK_LIST Check_value) |
1538 |
{ |
1539 |
try |
1540 |
{ |
1541 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
1542 |
{ |
1543 |
var item = Entity.CHECK_LIST.Where(info => info.ID == _id).FirstOrDefault(); |
1544 |
item.TODOLIST = Check_value.TODOLIST; |
1545 |
item.REMARK = Check_value.REMARK; |
1546 |
item.STATUS = Check_value.STATUS; |
1547 |
item.VENDOR = Check_value.VENDOR; |
1548 |
item.REPLY = Check_value.REPLY; |
1549 |
item.IMAGE_URL = Check_value.IMAGE_URL; |
1550 |
item.IMAGE_ANCHOR = Check_value.IMAGE_ANCHOR; |
1551 |
item.UPDATE_TIME = Check_value.UPDATE_TIME; |
1552 |
if(Check_value.STATUS == "False") |
1553 |
{ |
1554 |
item.STATUS_DESC_OPEN = Check_value.STATUS_DESC_OPEN; |
1555 |
} |
1556 |
else |
1557 |
{ |
1558 |
item.STATUS_DESC_CLOSE = Check_value.STATUS_DESC_CLOSE; |
1559 |
} |
1560 |
Entity.SaveChanges(); |
1561 |
} |
1562 |
} |
1563 |
catch (Exception) |
1564 |
{ |
1565 |
return false; |
1566 |
} |
1567 |
return true; |
1568 |
} |
1569 |
[OperationContract] |
1570 |
public bool AddCheckList(string project_no, CHECK_LIST Check_value) |
1571 |
{ |
1572 |
try |
1573 |
{ |
1574 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
1575 |
{ |
1576 |
Entity.CHECK_LIST.AddObject(Check_value); |
1577 |
Entity.SaveChanges(); |
1578 |
} |
1579 |
} |
1580 |
catch (Exception) |
1581 |
{ |
1582 |
return false; |
1583 |
} |
1584 |
return true; |
1585 |
} |
1586 |
|
1587 |
[OperationContract] |
1588 |
public CHECK_LIST GetCheckList(string project_no, string _id) |
1589 |
{ |
1590 |
CHECK_LIST Check_value = new CHECK_LIST(); |
1591 |
try |
1592 |
{ |
1593 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
1594 |
{ |
1595 |
Check_value = Entity.CHECK_LIST.Where(info => info.ID == _id).FirstOrDefault(); |
1596 |
} |
1597 |
} |
1598 |
catch (Exception) |
1599 |
{ |
1600 |
return null; |
1601 |
} |
1602 |
return Check_value; |
1603 |
} |
1604 |
[OperationContract] |
1605 |
public List<CHECK_LIST> GetUserCheckList(string project_no, string user_id, string doc_no) |
1606 |
{ |
1607 |
List<CHECK_LIST> list = new List<CHECK_LIST>(); |
1608 |
try |
1609 |
{ |
1610 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
1611 |
{ |
1612 |
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(); |
1613 |
} |
1614 |
} |
1615 |
catch (Exception) |
1616 |
{ |
1617 |
return null; |
1618 |
} |
1619 |
return list; |
1620 |
} |
1621 |
[OperationContract] |
1622 |
public List<CHECK_LIST_HISTORY> GetCheckListHistory(string project_no, string _id) |
1623 |
{ |
1624 |
List<CHECK_LIST_HISTORY> history = new List<CHECK_LIST_HISTORY>(); |
1625 |
try |
1626 |
{ |
1627 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
1628 |
{ |
1629 |
history = Entity.CHECK_LIST_HISTORY.Where(data => data.CHECKLIST_ID == _id).ToList(); |
1630 |
} |
1631 |
} |
1632 |
catch (Exception) |
1633 |
{ |
1634 |
return null; |
1635 |
} |
1636 |
return history; |
1637 |
} |
1638 |
[OperationContract] |
1639 |
public CHECK_LIST_HISTORY GetCheckListHistoryFirstOrDefault(string project_no, string checklist_id, string rev) |
1640 |
{ |
1641 |
CHECK_LIST_HISTORY Check_Item = new CHECK_LIST_HISTORY(); |
1642 |
try |
1643 |
{ |
1644 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
1645 |
{ |
1646 |
Check_Item = Entity.CHECK_LIST_HISTORY.Where(info => info.CHECKLIST_ID == checklist_id && info.REVISION == rev).FirstOrDefault(); |
1647 |
} |
1648 |
} |
1649 |
catch (Exception) |
1650 |
{ |
1651 |
return null; |
1652 |
} |
1653 |
return Check_Item; |
1654 |
} |
1655 |
[OperationContract] |
1656 |
public bool SavePageAngle(string project_no, List<DOCPAGE> _mldocpage) |
1657 |
{ |
1658 |
try |
1659 |
{ |
1660 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
1661 |
{ |
1662 |
KCOMDataModel.DataModel.DOCPAGE _docpage = new KCOMDataModel.DataModel.DOCPAGE(); |
1663 |
_mldocpage.ForEach(data => |
1664 |
{ |
1665 |
_docpage = (from info in Entity.DOCPAGE |
1666 |
where info.ID == data.ID |
1667 |
select info).FirstOrDefault(); |
1668 |
|
1669 |
if (_docpage.PAGE_ANGLE != data.PAGE_ANGLE) |
1670 |
{ |
1671 |
_docpage.PAGE_ANGLE = data.PAGE_ANGLE; |
1672 |
} |
1673 |
}); |
1674 |
|
1675 |
Entity.SaveChanges(); |
1676 |
} |
1677 |
} |
1678 |
catch (Exception) |
1679 |
{ |
1680 |
return false; |
1681 |
} |
1682 |
return true; |
1683 |
} |
1684 |
|
1685 |
[OperationContract] |
1686 |
public MARKUP_INFO GetMarkupInfo(string project_no, string _id) |
1687 |
{ |
1688 |
MARKUP_INFO markupInfo = new MARKUP_INFO(); |
1689 |
|
1690 |
try |
1691 |
{ |
1692 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
1693 |
{ |
1694 |
markupInfo = Entity.MARKUP_INFO.Where(entity => entity.DOCINFO_ID == _id).OrderByDescending(i => i.CONSOLIDATE).OrderByDescending(j => j.CREATE_TIME).FirstOrDefault(); |
1695 |
} |
1696 |
} |
1697 |
catch (Exception) |
1698 |
{ |
1699 |
return null; |
1700 |
} |
1701 |
return markupInfo; |
1702 |
} |
1703 |
|
1704 |
[OperationContract] |
1705 |
public List<string> GetMarkupDataListperPage(string project_no, string _markupinfoid, int _pageNo) |
1706 |
{ |
1707 |
List<string> markupdata = new List<string>(); |
1708 |
MARKUP_INFO_VERSION markup_info_version = new MARKUP_INFO_VERSION(); |
1709 |
try |
1710 |
{ |
1711 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
1712 |
{ |
1713 |
markup_info_version = (from version in Entity.MARKUP_INFO_VERSION |
1714 |
where version.MARKUPINFO_ID == _markupinfoid |
1715 |
orderby version.CREATE_DATE descending |
1716 |
select version).First(); |
1717 |
markupdata = (from data in Entity.MARKUP_DATA |
1718 |
where data.MARKUPINFO_VERSION_ID == markup_info_version.ID && data.PAGENUMBER == _pageNo |
1719 |
select data.DATA).ToList(); |
1720 |
} |
1721 |
} |
1722 |
catch (Exception) |
1723 |
{ |
1724 |
return null; |
1725 |
} |
1726 |
return markupdata; |
1727 |
} |
1728 |
|
1729 |
[OperationContract] |
1730 |
public bool AddMarkupInfo(string project_no, MARKUP_INFO value) |
1731 |
{ |
1732 |
try |
1733 |
{ |
1734 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
1735 |
{ |
1736 |
Entity.MARKUP_INFO.AddObject(value); |
1737 |
Entity.SaveChanges(); |
1738 |
} |
1739 |
} |
1740 |
catch (Exception) |
1741 |
{ |
1742 |
return false; |
1743 |
} |
1744 |
return true; |
1745 |
} |
1746 |
|
1747 |
[OperationContract] |
1748 |
public bool AddMarkupInfoVersion(string project_no, MARKUP_INFO_VERSION value) |
1749 |
{ |
1750 |
try |
1751 |
{ |
1752 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
1753 |
{ |
1754 |
Entity.MARKUP_INFO_VERSION.AddObject(value); |
1755 |
Entity.SaveChanges(); |
1756 |
} |
1757 |
} |
1758 |
catch (Exception) |
1759 |
{ |
1760 |
return false; |
1761 |
} |
1762 |
return true; |
1763 |
} |
1764 |
|
1765 |
[OperationContract] |
1766 |
public bool AddMarkupData(string project_no, MARKUP_DATA value) |
1767 |
{ |
1768 |
try |
1769 |
{ |
1770 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
1771 |
{ |
1772 |
Entity.MARKUP_DATA.AddObject(value); |
1773 |
Entity.SaveChanges(); |
1774 |
} |
1775 |
} |
1776 |
catch (Exception) |
1777 |
{ |
1778 |
return false; |
1779 |
} |
1780 |
return true; |
1781 |
} |
1782 |
|
1783 |
[OperationContract] |
1784 |
public bool AvoidMarkupInfo(string project_no, string _doc_id) |
1785 |
{ |
1786 |
try |
1787 |
{ |
1788 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
1789 |
{ |
1790 |
var item = Entity.MARKUP_INFO.Where(entity => entity.DOCINFO_ID == _doc_id).OrderByDescending(i => i.CONSOLIDATE).OrderByDescending(j => j.CREATE_TIME).FirstOrDefault(); |
1791 |
item.AVOID_CONSOLIDATE = 1; |
1792 |
Entity.SaveChanges(); |
1793 |
} |
1794 |
} |
1795 |
catch (Exception) |
1796 |
{ |
1797 |
return false; |
1798 |
} |
1799 |
return true; |
1800 |
} |
1801 |
|
1802 |
[OperationContract] |
1803 |
public bool SaveMarkupInfo(string project_no, string _id, MARKUP_INFO value) |
1804 |
{ |
1805 |
try |
1806 |
{ |
1807 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
1808 |
{ |
1809 |
var item = Entity.MARKUP_INFO.Where(info => info.ID == _id).FirstOrDefault(); |
1810 |
item = value; |
1811 |
Entity.SaveChanges(); |
1812 |
} |
1813 |
} |
1814 |
catch (Exception) |
1815 |
{ |
1816 |
return false; |
1817 |
} |
1818 |
return true; |
1819 |
} |
1820 |
[OperationContract] |
1821 |
public List<MARKUP_DATA> GetMarkupDataList(string project_no, string _versionid) |
1822 |
{ |
1823 |
List<MARKUP_DATA> mlresult = new List<MARKUP_DATA>(); |
1824 |
|
1825 |
try |
1826 |
{ |
1827 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
1828 |
{ |
1829 |
mlresult = Entity.MARKUP_DATA.Where(data => data.MARKUPINFO_VERSION_ID == _versionid).ToList(); |
1830 |
} |
1831 |
} |
1832 |
catch (Exception) |
1833 |
{ |
1834 |
return null; |
1835 |
} |
1836 |
return mlresult; |
1837 |
} |
1838 |
|
1839 |
[OperationContract] |
1840 |
public bool Consolidate(string project_no, string _user_id, string _doc_id, List<MarkupInfoItem> markupInfoItems) |
1841 |
{ |
1842 |
try |
1843 |
{ |
1844 |
List<KCOMDataModel.DataModel.MARKUP_DATA> instanceDataSet = new List<KCOMDataModel.DataModel.MARKUP_DATA>(); |
1845 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
1846 |
{ |
1847 |
var markupInfo = Entity.MARKUP_INFO.Where(entity => entity.DOCINFO_ID == _doc_id).OrderByDescending(i => i.CONSOLIDATE).OrderByDescending(j => j.CREATE_TIME).FirstOrDefault(); |
1848 |
if (markupInfo.CONSOLIDATE == 1) |
1849 |
{ |
1850 |
markupInfo.AVOID_CONSOLIDATE = 1; |
1851 |
} |
1852 |
|
1853 |
foreach (MarkupInfoItem item in markupInfoItems) |
1854 |
{ |
1855 |
Entity.MARKUP_DATA.Where(data => data.MARKUPINFO_VERSION_ID == item.MarkupVersionID).ToList().ForEach(d => |
1856 |
{ |
1857 |
instanceDataSet.Add(d); |
1858 |
}); |
1859 |
} |
1860 |
|
1861 |
KCOMDataModel.DataModel.MARKUP_INFO info = new KCOMDataModel.DataModel.MARKUP_INFO(); |
1862 |
info.ID = shortGuid(); |
1863 |
info.CONSOLIDATE = 1; |
1864 |
info.CREATE_TIME = DateTime.Now; |
1865 |
info.DOCINFO_ID = _doc_id; |
1866 |
info.UPDATE_TIME = DateTime.Now; |
1867 |
info.USER_ID = _user_id; |
1868 |
info.AVOID_CONSOLIDATE = 0; |
1869 |
|
1870 |
Entity.MARKUP_INFO.AddObject(info); |
1871 |
Entity.SaveChanges(); |
1872 |
|
1873 |
|
1874 |
KCOMDataModel.DataModel.MARKUP_INFO_VERSION info2 = new KCOMDataModel.DataModel.MARKUP_INFO_VERSION |
1875 |
{ |
1876 |
ID = shortGuid(), |
1877 |
CREATE_DATE = DateTime.Now, |
1878 |
MARKUP_INFO = info, |
1879 |
}; |
1880 |
Entity.SaveChanges(); |
1881 |
|
1882 |
foreach (var item in instanceDataSet) |
1883 |
{ |
1884 |
Entity.MARKUP_DATA.AddObject(new KCOMDataModel.DataModel.MARKUP_DATA |
1885 |
{ |
1886 |
ID = shortGuid(), |
1887 |
DATA = item.DATA, |
1888 |
DATA_TYPE = item.DATA_TYPE, |
1889 |
PAGENUMBER = item.PAGENUMBER, |
1890 |
MARKUP_INFO_VERSION = info2, |
1891 |
SYMBOL_ID = item.SYMBOL_ID, |
1892 |
GROUP_ID = item.GROUP_ID |
1893 |
}); |
1894 |
} |
1895 |
Entity.SaveChanges(); |
1896 |
|
1897 |
|
1898 |
} |
1899 |
} |
1900 |
catch (Exception) |
1901 |
{ |
1902 |
return false; |
1903 |
} |
1904 |
return true; |
1905 |
} |
1906 |
|
1907 |
|
1908 |
[OperationContract] |
1909 |
public FinalPDFResult ConsolidateMergedPDF(string project_no, string _user_id, string _doc_id, List<MarkupInfoItem> markupInfoItems, string ProjectNo, string DocInfoID, string CreateUserID) |
1910 |
{ |
1911 |
bool consolidate = false; |
1912 |
try |
1913 |
{ |
1914 |
List<KCOMDataModel.DataModel.MARKUP_DATA> instanceDataSet = new List<KCOMDataModel.DataModel.MARKUP_DATA>(); |
1915 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
1916 |
{ |
1917 |
var markupInfo = Entity.MARKUP_INFO.Where(entity => entity.DOCINFO_ID == _doc_id).OrderByDescending(i => i.CONSOLIDATE).OrderByDescending(j => j.CREATE_TIME).FirstOrDefault(); |
1918 |
if (markupInfo.CONSOLIDATE == 1) |
1919 |
{ |
1920 |
markupInfo.AVOID_CONSOLIDATE = 1; |
1921 |
} |
1922 |
|
1923 |
foreach (MarkupInfoItem item in markupInfoItems) |
1924 |
{ |
1925 |
Entity.MARKUP_DATA.Where(data => data.MARKUPINFO_VERSION_ID == item.MarkupVersionID).ToList().ForEach(d => |
1926 |
{ |
1927 |
instanceDataSet.Add(d); |
1928 |
}); |
1929 |
} |
1930 |
|
1931 |
KCOMDataModel.DataModel.MARKUP_INFO info = new KCOMDataModel.DataModel.MARKUP_INFO(); |
1932 |
info.ID = shortGuid(); |
1933 |
info.CONSOLIDATE = 1; |
1934 |
info.CREATE_TIME = DateTime.Now; |
1935 |
info.DOCINFO_ID = _doc_id; |
1936 |
info.UPDATE_TIME = DateTime.Now; |
1937 |
info.USER_ID = _user_id; |
1938 |
info.AVOID_CONSOLIDATE = 0; |
1939 |
|
1940 |
Entity.MARKUP_INFO.AddObject(info); |
1941 |
Entity.SaveChanges(); |
1942 |
|
1943 |
|
1944 |
KCOMDataModel.DataModel.MARKUP_INFO_VERSION info2 = new KCOMDataModel.DataModel.MARKUP_INFO_VERSION |
1945 |
{ |
1946 |
ID = shortGuid(), |
1947 |
CREATE_DATE = DateTime.Now, |
1948 |
MARKUP_INFO = info, |
1949 |
}; |
1950 |
Entity.SaveChanges(); |
1951 |
|
1952 |
foreach (var item in instanceDataSet) |
1953 |
{ |
1954 |
Entity.MARKUP_DATA.AddObject(new KCOMDataModel.DataModel.MARKUP_DATA |
1955 |
{ |
1956 |
ID = shortGuid(), |
1957 |
DATA = item.DATA, |
1958 |
DATA_TYPE = item.DATA_TYPE, |
1959 |
PAGENUMBER = item.PAGENUMBER, |
1960 |
MARKUP_INFO_VERSION = info2, |
1961 |
SYMBOL_ID = item.SYMBOL_ID, |
1962 |
GROUP_ID = item.GROUP_ID |
1963 |
}); |
1964 |
} |
1965 |
Entity.SaveChanges(); |
1966 |
|
1967 |
|
1968 |
} |
1969 |
consolidate = true; |
1970 |
} |
1971 |
catch (Exception) |
1972 |
{ |
1973 |
consolidate = false; |
1974 |
} |
1975 |
FinalPDFResult _result = new FinalPDFResult(); |
1976 |
if (consolidate == true) |
1977 |
{ |
1978 |
RemFinalPDFObject remObj = null; |
1979 |
try |
1980 |
{ |
1981 |
string _finalID = shortGuid(); |
1982 |
int _DocTotalPages = -1; |
1983 |
string docItemId; |
1984 |
|
1985 |
|
1986 |
using (CIEntities _ci = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString())) |
1987 |
{ |
1988 |
var _doc = _ci.DOCINFO.Where(info => info.ID == DocInfoID); |
1989 |
|
1990 |
if (_doc.Count() > 0) |
1991 |
{ |
1992 |
_DocTotalPages = _doc.First().PAGE_COUNT; |
1993 |
docItemId = _doc.First().DOCUMENT_ID; |
1994 |
} |
1995 |
else |
1996 |
{ |
1997 |
_result.Status = FinalStatus.Error; |
1998 |
_result.Exception = "페이지 정보를 가져올 수 없습니다."; |
1999 |
return _result; |
2000 |
} |
2001 |
} |
2002 |
|
2003 |
var Items = GetMarkupInfoItems(ProjectNo, DocInfoID); |
2004 |
if (_DocTotalPages > 0) |
2005 |
{ |
2006 |
var item2 = Items.Cast<MarkupInfoItem>().Where(d => d.Consolidate == 1 && d.AvoidConsolidate == 0).FirstOrDefault(); |
2007 |
FINAL_PDF fm = new FINAL_PDF() |
2008 |
{ |
2009 |
ID = _finalID, |
2010 |
PROJECT_NO = ProjectNo, |
2011 |
DOCINFO_ID = DocInfoID, |
2012 |
DOCUMENT_ID = docItemId, |
2013 |
MARKUPINFO_ID = item2.MarkupInfoID, |
2014 |
CREATE_USER_ID = CreateUserID, |
2015 |
TOTAL_PAGE = _DocTotalPages, |
2016 |
CREATE_DATETIME = DateTime.Now, |
2017 |
STATUS = (int)IFinalPDF.FinalStatus.Insert |
2018 |
}; |
2019 |
using (KCOMEntities _entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
2020 |
{ |
2021 |
_entity.AddToFINAL_PDF(fm); |
2022 |
_entity.SaveChanges(System.Data.Objects.SaveOptions.AcceptAllChangesAfterSave); |
2023 |
}; |
2024 |
|
2025 |
System.Runtime.Remoting.Channels.IChannel _ch = System.Runtime.Remoting.Channels.ChannelServices.GetChannel("tcp"); |
2026 |
if (_ch == null) |
2027 |
{ |
2028 |
chan = new TcpChannel(); |
2029 |
_ChanID = chan.ChannelName; |
2030 |
System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(chan, false); |
2031 |
// Create an instance of the remote object |
2032 |
|
2033 |
|
2034 |
using (KCOMEntities ec = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
2035 |
{ |
2036 |
|
2037 |
//remObj = (RemFinalPDFObject)Activator.GetObject(typeof(RemFinalPDFObject), |
2038 |
// "tcp://localhost:9092/remFinalPDF"); |
2039 |
remObj = (RemFinalPDFObject)Activator.GetObject(typeof(RemFinalPDFObject), |
2040 |
//"tcp://192.168.0.67:9092/remFinalPDF"); |
2041 |
"tcp://192.168.0.67:9092/remFinalPDF"); |
2042 |
} |
2043 |
|
2044 |
//"tcp://localhost:8080/remFinalPDF"); |
2045 |
|
2046 |
_result = remObj.SetFinalPDF(ProjectNo, _finalID); |
2047 |
_result.FinalID = _finalID; |
2048 |
_result.Status = FinalStatus.Success; |
2049 |
|
2050 |
//MarkupToPDF.MarkupToPDF fa = new MarkupToPDF.MarkupToPDF(); |
2051 |
//fa.MakeFinalPDF(fm); |
2052 |
} |
2053 |
else |
2054 |
{ |
2055 |
_ChanID = _ch.ChannelName; |
2056 |
} |
2057 |
} |
2058 |
} |
2059 |
catch (Exception ex) |
2060 |
{ |
2061 |
_result.Status = FinalStatus.Error; |
2062 |
|
2063 |
if (ex.GetType() == typeof(System.Net.Sockets.SocketException)) |
2064 |
_result.Exception = "Final Server Not Connection"; |
2065 |
} |
2066 |
finally |
2067 |
{ |
2068 |
remObj = null; |
2069 |
if (System.Runtime.Remoting.Channels.ChannelServices.GetChannel("tcp") != null) |
2070 |
System.Runtime.Remoting.Channels.ChannelServices.UnregisterChannel(chan); |
2071 |
|
2072 |
GC.Collect(2); |
2073 |
} |
2074 |
} |
2075 |
return _result; |
2076 |
} |
2077 |
[OperationContract] |
2078 |
public bool TeamConsolidate(string project_no, string _user_id, string _doc_id, List<MarkupInfoItem> markupInfoItems) |
2079 |
{ |
2080 |
try |
2081 |
{ |
2082 |
List<KCOMDataModel.DataModel.MARKUP_DATA> instanceDataSet = new List<KCOMDataModel.DataModel.MARKUP_DATA>(); |
2083 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
2084 |
{ |
2085 |
var markupInfo = Entity.MARKUP_INFO.Where(entity => entity.DOCINFO_ID == _doc_id).OrderByDescending(i => i.CONSOLIDATE).OrderByDescending(j => j.CREATE_TIME).FirstOrDefault(); |
2086 |
if (markupInfo.PART_CONSOLIDATE == 1) |
2087 |
{ |
2088 |
markupInfo.AVOID_CONSOLIDATE = 1; |
2089 |
} |
2090 |
|
2091 |
foreach (MarkupInfoItem item in markupInfoItems) |
2092 |
{ |
2093 |
Entity.MARKUP_DATA.Where(data => data.MARKUPINFO_VERSION_ID == item.MarkupVersionID).ToList().ForEach(d => |
2094 |
{ |
2095 |
instanceDataSet.Add(d); |
2096 |
}); |
2097 |
} |
2098 |
|
2099 |
KCOMDataModel.DataModel.MARKUP_INFO info = new KCOMDataModel.DataModel.MARKUP_INFO(); |
2100 |
info.ID = shortGuid(); |
2101 |
info.PART_CONSOLIDATE = 1; |
2102 |
info.CREATE_TIME = DateTime.Now; |
2103 |
info.DOCINFO_ID = _doc_id; |
2104 |
info.UPDATE_TIME = DateTime.Now; |
2105 |
info.USER_ID = _user_id; |
2106 |
info.AVOID_CONSOLIDATE = 0; |
2107 |
|
2108 |
Entity.MARKUP_INFO.AddObject(info); |
2109 |
Entity.SaveChanges(); |
2110 |
|
2111 |
|
2112 |
KCOMDataModel.DataModel.MARKUP_INFO_VERSION info2 = new KCOMDataModel.DataModel.MARKUP_INFO_VERSION |
2113 |
{ |
2114 |
ID = shortGuid(), |
2115 |
CREATE_DATE = DateTime.Now, |
2116 |
MARKUP_INFO = info, |
2117 |
}; |
2118 |
Entity.SaveChanges(); |
2119 |
|
2120 |
foreach (var item in instanceDataSet) |
2121 |
{ |
2122 |
Entity.MARKUP_DATA.AddObject(new KCOMDataModel.DataModel.MARKUP_DATA |
2123 |
{ |
2124 |
ID = shortGuid(), |
2125 |
DATA = item.DATA, |
2126 |
DATA_TYPE = item.DATA_TYPE, |
2127 |
PAGENUMBER = item.PAGENUMBER, |
2128 |
MARKUP_INFO_VERSION = info2, |
2129 |
SYMBOL_ID = item.SYMBOL_ID, |
2130 |
GROUP_ID = item.GROUP_ID |
2131 |
}); |
2132 |
} |
2133 |
Entity.SaveChanges(); |
2134 |
|
2135 |
|
2136 |
} |
2137 |
} |
2138 |
catch (Exception) |
2139 |
{ |
2140 |
return false; |
2141 |
} |
2142 |
return true; |
2143 |
} |
2144 |
|
2145 |
[OperationContract] |
2146 |
[ServiceKnownType(typeof(MEMBER))] |
2147 |
public MEMBER GetMember(string project_no, string user_id) |
2148 |
{ |
2149 |
MEMBER rstmember = new MEMBER(); |
2150 |
try |
2151 |
{ |
2152 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
2153 |
{ |
2154 |
var tmp = (from member in Entity.MEMBER |
2155 |
where member.ID == user_id |
2156 |
select member).FirstOrDefault(); |
2157 |
rstmember.DEPARTMENT = tmp.DEPARTMENT; |
2158 |
rstmember.ID = tmp.ID; |
2159 |
rstmember.NAME = tmp.NAME; |
2160 |
} |
2161 |
} |
2162 |
catch (Exception) |
2163 |
{ |
2164 |
return null; |
2165 |
} |
2166 |
return rstmember; |
2167 |
} |
2168 |
|
2169 |
[OperationContract] |
2170 |
public List<SYMBOL_PRIVATE> GetSymbolList(string user_id) |
2171 |
{ |
2172 |
List<SYMBOL_PRIVATE> Custom_List = new List<SYMBOL_PRIVATE>(); |
2173 |
try |
2174 |
{ |
2175 |
using (KCOMEntities Entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
2176 |
{ |
2177 |
Custom_List = Entity.SYMBOL_PRIVATE.Where(data => data.MEMBER_USER_ID == user_id).ToList(); |
2178 |
} |
2179 |
} |
2180 |
catch (Exception) |
2181 |
{ |
2182 |
return null; |
2183 |
} |
2184 |
return Custom_List; |
2185 |
} |
2186 |
[OperationContract] |
2187 |
public List<string> GetPublicSymbolDeptList() |
2188 |
{ |
2189 |
List<string> Custom_List = new List<string>(); |
2190 |
try |
2191 |
{ |
2192 |
using (KCOMEntities Entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
2193 |
{ |
2194 |
Custom_List = Entity.SYMBOL_PUBLIC.Select(data => data.DEPARTMENT).ToList(); |
2195 |
} |
2196 |
} |
2197 |
catch (Exception) |
2198 |
{ |
2199 |
return null; |
2200 |
} |
2201 |
return Custom_List; |
2202 |
} |
2203 |
[OperationContract] |
2204 |
public List<SYMBOL_PUBLIC> GetPublicSymbolList(string dept) |
2205 |
{ |
2206 |
List<SYMBOL_PUBLIC> Custom_List = new List<SYMBOL_PUBLIC>(); |
2207 |
try |
2208 |
{ |
2209 |
using (KCOMEntities Entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
2210 |
{ |
2211 |
if(!string.IsNullOrEmpty(dept)) |
2212 |
{ |
2213 |
Custom_List = Entity.SYMBOL_PUBLIC.Where(data => data.DEPARTMENT == dept).ToList(); |
2214 |
} |
2215 |
else |
2216 |
{ |
2217 |
Custom_List = Entity.SYMBOL_PUBLIC.ToList(); |
2218 |
} |
2219 |
|
2220 |
} |
2221 |
} |
2222 |
catch (Exception) |
2223 |
{ |
2224 |
return null; |
2225 |
} |
2226 |
return Custom_List; |
2227 |
} |
2228 |
|
2229 |
/// <summary> |
2230 |
/// |
2231 |
/// </summary> |
2232 |
/// <param name="id">symbol id</param> |
2233 |
/// <param name="type"> 0 : PRIVATE, 1 : PUBLIC</param> |
2234 |
/// <returns></returns> |
2235 |
[OperationContract] |
2236 |
public string GetSymbolData(string id, int type) |
2237 |
{ |
2238 |
string result; |
2239 |
try |
2240 |
{ |
2241 |
using (KCOMEntities Entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
2242 |
{ |
2243 |
if(type == 0) |
2244 |
{ |
2245 |
result = Entity.SYMBOL_PRIVATE.Where(data => data.ID == id).FirstOrDefault().DATA; |
2246 |
} |
2247 |
else |
2248 |
{ |
2249 |
result = Entity.SYMBOL_PUBLIC.Where(data => data.ID == id).FirstOrDefault().DATA; |
2250 |
} |
2251 |
} |
2252 |
} |
2253 |
catch (Exception) |
2254 |
{ |
2255 |
return null; |
2256 |
} |
2257 |
return result; |
2258 |
} |
2259 |
[OperationContract] |
2260 |
public string GetSymbolImageURL(string id, int type) |
2261 |
{ |
2262 |
string result; |
2263 |
try |
2264 |
{ |
2265 |
using (KCOMEntities Entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString())) |
2266 |
{ |
2267 |
if (type == 0) |
2268 |
{ |
2269 |
result = Entity.SYMBOL_PRIVATE.Where(data => data.ID == id).FirstOrDefault().IMAGE_URL; |
2270 |
} |
2271 |
else |
2272 |
{ |
2273 |
result = Entity.SYMBOL_PUBLIC.Where(data => data.ID == id).FirstOrDefault().IMAGE_URL; |
2274 |
} |
2275 |
} |
2276 |
} |
2277 |
catch (Exception) |
2278 |
{ |
2279 |
return null; |
2280 |
} |
2281 |
return result; |
2282 |
} |
2283 |
[OperationContract] |
2284 |
public string GetSignData(string project_no, string user_id) |
2285 |
{ |
2286 |
string result = null; |
2287 |
try |
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 |
catch (Exception) |
2307 |
{ |
2308 |
return null; |
2309 |
} |
2310 |
return result; |
2311 |
} |
2312 |
|
2313 |
[OperationContract] |
2314 |
public string GetProjectName(string project_no) |
2315 |
{ |
2316 |
string result = null; |
2317 |
|
2318 |
try |
2319 |
{ |
2320 |
using (KCOMDataModel.DataModel.KCOMEntities Entity = new KCOMDataModel.DataModel.KCOMEntities(KCOMDataModel.Common.ConnectStringBuilder.KCOMConnectionString().ToString())) |
2321 |
{ |
2322 |
result = Entity.RUN_PROJECTS.Where(i => i.PROJECT_NO == project_no).FirstOrDefault().PROJECT_NAME.ToString(); |
2323 |
} |
2324 |
} |
2325 |
catch (Exception) |
2326 |
{ |
2327 |
return null; |
2328 |
} |
2329 |
return result; |
2330 |
} |
2331 |
|
2332 |
[OperationContract] |
2333 |
public List<DOCUMENT_ITEM> GetPreRevSelect(string project_no, string doc_no, string current_rev) |
2334 |
{ |
2335 |
List<DOCUMENT_ITEM> result = new List<DOCUMENT_ITEM>(); |
2336 |
|
2337 |
try |
2338 |
{ |
2339 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
2340 |
{ |
2341 |
result = Entity.DOCUMENT_ITEM.Where(i => i.PROJECT_NO == project_no |
2342 |
&& i.DOCUMENT_NO == doc_no |
2343 |
&& i.REVISION != current_rev).OrderByDescending(i => i.GROUP_NO).ToList(); |
2344 |
} |
2345 |
} |
2346 |
catch (Exception) |
2347 |
{ |
2348 |
return null; |
2349 |
} |
2350 |
return result; |
2351 |
} |
2352 |
|
2353 |
[OperationContract] |
2354 |
public DOCINFO GetDocInfoOneSelect(string project_no, string doc_id) |
2355 |
{ |
2356 |
DOCINFO docinfo = null; |
2357 |
|
2358 |
try |
2359 |
{ |
2360 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
2361 |
{ |
2362 |
docinfo = (from info in Entity.DOCINFO |
2363 |
where info.DOCUMENT_ID == doc_id |
2364 |
&& info.PROJECT_NO == project_no |
2365 |
select info).First(); |
2366 |
} |
2367 |
} |
2368 |
catch (Exception) |
2369 |
{ |
2370 |
return null; |
2371 |
} |
2372 |
return docinfo; |
2373 |
} |
2374 |
|
2375 |
[OperationContract] |
2376 |
public List<MarkupInfoItem> GetPrintDocItemList(string project_no, string doc_id, List<MarkupInfoItem> _markupInfoList) |
2377 |
{ |
2378 |
MarkupInfoItem _result = null; |
2379 |
List<MarkupInfoItem> markupinfo = new List<MarkupInfoItem>(); |
2380 |
try |
2381 |
{ |
2382 |
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
2383 |
{ |
2384 |
var docitem = (from info in Entity.DOCINFO |
2385 |
where info.DOCUMENT_ID == doc_id |
2386 |
&& info.PROJECT_NO == project_no |
2387 |
select info).First(); |
2388 |
|
2389 |
foreach (MARKUP_INFO markinfo in docitem.MARKUP_INFO) |
2390 |
{ |
2391 |
var member = (from mem in Entity.MEMBER |
2392 |
where mem.ID == markinfo.USER_ID |
2393 |
select mem).First(); |
2394 |
string displaycolor = null; |
2395 |
try |
2396 |
{ |
2397 |
displaycolor = _markupInfoList.Where(info => info.MarkupInfoID == markinfo.ID).First().DisplayColor; |
2398 |
} |
2399 |
catch(Exception) |
2400 |
{ |
2401 |
displaycolor = "#FFFFFF"; |
2402 |
} |
2403 |
|
2404 |
_result = new MarkupInfoItem |
2405 |
{ |
2406 |
MarkupInfoID = markinfo.ID, |
2407 |
Consolidate = markinfo.CONSOLIDATE, |
2408 |
CreateTime = markinfo.UPDATE_TIME.HasValue ? markinfo.UPDATE_TIME.Value : markinfo.CREATE_TIME, |
2409 |
DisplayColor = displaycolor, |
2410 |
UserID = markinfo.USER_ID, |
2411 |
UserName = member.NAME, |
2412 |
Depatment = member.DEPARTMENT, |
2413 |
}; |
2414 |
|
2415 |
_result.MarkupList = new List<IKCOM.MarkupItem>(); |
2416 |
var markup_Version = markinfo.MARKUP_INFO_VERSION.OrderByDescending(p => p.CREATE_DATE).First(); |
2417 |
|
2418 |
foreach (MARKUP_DATA markdata in markup_Version.MARKUP_DATA) |
2419 |
{ |
2420 |
MarkupItem markitem = new MarkupItem() |
2421 |
{ |
2422 |
ID = markdata.ID, |
2423 |
PageNumber = markdata.PAGENUMBER, |
2424 |
}; |
2425 |
_result.MarkupList.Add(markitem); |
2426 |
} |
2427 |
|
2428 |
_result.PageCount = _result.MarkupList.GroupBy(i => i.PageNumber).Count(); |
2429 |
|
2430 |
markupinfo.Add(_result); |
2431 |
} |
2432 |
} |
2433 |
} |
2434 |
catch (Exception) |
2435 |
{ |
2436 |
return null; |
2437 |
} |
2438 |
return markupinfo; |
2439 |
} |
2440 |
|
2441 |
[OperationContract] |
2442 |
public bool AddMessage(string project_no, TALK value) |
2443 |
{ |
2444 |
try |
2445 |
{ |
2446 |
using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
2447 |
{ |
2448 |
entity.TALK.AddObject(value); |
2449 |
entity.SaveChanges(); |
2450 |
} |
2451 |
} |
2452 |
catch (Exception) |
2453 |
{ |
2454 |
return false; |
2455 |
} |
2456 |
return true; |
2457 |
} |
2458 |
|
2459 |
[OperationContract] |
2460 |
public List<TALK> GetMessage(string project_no, string doc_id) |
2461 |
{ |
2462 |
List<TALK> result = new List<TALK>(); |
2463 |
try |
2464 |
{ |
2465 |
using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString())) |
2466 |
{ |
2467 |
result = entity.TALK.Where(data => data.DOCUMENT_ID == doc_id).ToList(); |
2468 |
} |
2469 |
} |
2470 |
catch (Exception) |
2471 |
{ |
2472 |
return result; |
2473 |
} |
2474 |
return result; |
2475 |
} |
2476 |
} |
2477 |
} |