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