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 => Convert.ToInt32(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
|
//foreach (var item in markupListData)
|
522
|
//{
|
523
|
// if (!item.AVOID_CONSOLIDATE.HasValue)
|
524
|
// {
|
525
|
// item.AVOID_CONSOLIDATE = 0;
|
526
|
// }
|
527
|
//}
|
528
|
|
529
|
var markupList = from markup in markupListData
|
530
|
orderby markup.CREATE_TIME descending
|
531
|
select new MarkupInfoItem
|
532
|
{
|
533
|
MarkupInfoID = markup.ID,
|
534
|
UserID = markup.USER_ID,
|
535
|
MarkupVersionID = markup.MARKUP_INFO_VERSION.Count() == 0 ? null : markup.MARKUP_INFO_VERSION.OrderByDescending(data => data.CREATE_DATE).FirstOrDefault().ID,
|
536
|
CreateTime = markup.CREATE_TIME,
|
537
|
Consolidate = markup.CONSOLIDATE,
|
538
|
Description = markup.DESCRIPTION,
|
539
|
AvoidConsolidate = markup.AVOID_CONSOLIDATE,
|
540
|
PartConsolidate = markup.PART_CONSOLIDATE,
|
541
|
UpdateTime = DateTime.Parse(markup.UPDATE_TIME.ToString()),
|
542
|
};
|
543
|
|
544
|
|
545
|
|
546
|
if (markupList.Count() > 0)
|
547
|
{
|
548
|
_result = markupList.ToList();
|
549
|
}
|
550
|
|
551
|
|
552
|
|
553
|
_result.ForEach(r =>
|
554
|
{
|
555
|
|
556
|
r.MarkupList = (from markupData in entity.MARKUP_DATA
|
557
|
where markupData.MARKUPINFO_VERSION_ID == r.MarkupVersionID
|
558
|
orderby markupData.PAGENUMBER
|
559
|
select new MarkupItem { ID = markupData.ID, PageNumber = markupData.PAGENUMBER, Data = markupData.DATA, Data_Type = markupData.DATA_TYPE, Symbol_ID = markupData.SYMBOL_ID }).ToList();
|
560
|
});
|
561
|
|
562
|
List<PROPERTIES> _ColorsProperties = new List<PROPERTIES>();
|
563
|
Random random = new Random();
|
564
|
|
565
|
using (KCOMEntities kcomEntity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
|
566
|
{
|
567
|
_ColorsProperties = (from property in kcomEntity.PROPERTIES
|
568
|
where property.TYPE == "DisplayColor"
|
569
|
select property).ToList();
|
570
|
}
|
571
|
|
572
|
foreach (var item in _result)
|
573
|
{
|
574
|
var _member = entity.MEMBER.Where(member => member.ID == item.UserID);
|
575
|
|
576
|
if (_member.Count() > 0)
|
577
|
{
|
578
|
item.UserName = _member.First().NAME;
|
579
|
item.Depatment = _member.First().DEPARTMENT;
|
580
|
}
|
581
|
|
582
|
if (_ColorsProperties.Count > 0)
|
583
|
{
|
584
|
int colorIdx = random.Next(1, _ColorsProperties.Count());
|
585
|
#region 부서별로 색상을 지정하고자 할때
|
586
|
/// 일단 의견을 들어보자구!
|
587
|
#endregion
|
588
|
item.DisplayColor = "#FF" + _ColorsProperties[colorIdx].VALUE;
|
589
|
_ColorsProperties.Remove(_ColorsProperties[colorIdx]);
|
590
|
//item.DisplayColor = "#FF" + _Colors.First();
|
591
|
//_Colors.Remove(_Colors.First());
|
592
|
}
|
593
|
else
|
594
|
{
|
595
|
item.DisplayColor = String.Format("#FF{0:X6}", random.Next(0x1000000));
|
596
|
}
|
597
|
}
|
598
|
}
|
599
|
}
|
600
|
catch (Exception EX)
|
601
|
{
|
602
|
System.Diagnostics.Debug.WriteLine(this.GetType().ToString() + " " + EX);
|
603
|
return _result;
|
604
|
}
|
605
|
finally
|
606
|
{
|
607
|
GC.Collect(2);
|
608
|
}
|
609
|
|
610
|
return _result;
|
611
|
}
|
612
|
|
613
|
[OperationContract]
|
614
|
public List<MarkupInfoItem> GetSyncMarkupInfoItems(string ProjectNo, string DocInfoId, string currentUser)
|
615
|
{
|
616
|
List<MarkupInfoItem> _result = new List<MarkupInfoItem>();
|
617
|
try
|
618
|
{
|
619
|
using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString()))
|
620
|
{
|
621
|
var docItem = entity.DOCINFO.Where(data => data.DOCUMENT_ID == DocInfoId).FirstOrDefault();
|
622
|
if (docItem == null)
|
623
|
{
|
624
|
return null;
|
625
|
}
|
626
|
var markupListData = entity.MARKUP_INFO.Where(data => data.DOCINFO_ID == docItem.ID).ToList();
|
627
|
|
628
|
var markupList = from markup in markupListData
|
629
|
where markup.USER_ID == currentUser || markup.CONSOLIDATE == 1
|
630
|
orderby markup.CREATE_TIME descending
|
631
|
select new MarkupInfoItem
|
632
|
{
|
633
|
MarkupInfoID = markup.ID,
|
634
|
UserID = markup.USER_ID,
|
635
|
MarkupVersionID = markup.MARKUP_INFO_VERSION.Count() == 0 ? null : markup.MARKUP_INFO_VERSION.OrderByDescending(data => data.CREATE_DATE).FirstOrDefault().ID,
|
636
|
CreateTime = markup.CREATE_TIME,
|
637
|
Consolidate = markup.CONSOLIDATE,
|
638
|
Description = markup.DESCRIPTION,
|
639
|
AvoidConsolidate = markup.AVOID_CONSOLIDATE,
|
640
|
PartConsolidate = markup.PART_CONSOLIDATE,
|
641
|
};
|
642
|
|
643
|
|
644
|
|
645
|
if (markupList.Count() > 0)
|
646
|
{
|
647
|
_result = markupList.ToList();
|
648
|
}
|
649
|
|
650
|
|
651
|
|
652
|
_result.ForEach(r =>
|
653
|
{
|
654
|
|
655
|
r.MarkupList = (from markupData in entity.MARKUP_DATA
|
656
|
where markupData.MARKUPINFO_VERSION_ID == r.MarkupVersionID
|
657
|
orderby markupData.PAGENUMBER
|
658
|
select new MarkupItem { ID = markupData.ID, PageNumber = markupData.PAGENUMBER, Data = markupData.DATA, Data_Type = markupData.DATA_TYPE, Symbol_ID = markupData.SYMBOL_ID }).ToList();
|
659
|
});
|
660
|
|
661
|
List<PROPERTIES> _ColorsProperties = new List<PROPERTIES>();
|
662
|
Random random = new Random();
|
663
|
|
664
|
using (KCOMEntities kcomEntity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
|
665
|
{
|
666
|
_ColorsProperties = (from property in kcomEntity.PROPERTIES
|
667
|
where property.TYPE == "DisplayColor"
|
668
|
select property).ToList();
|
669
|
}
|
670
|
|
671
|
foreach (var item in _result)
|
672
|
{
|
673
|
var _member = entity.MEMBER.Where(member => member.ID == item.UserID);
|
674
|
|
675
|
if (_member.Count() > 0)
|
676
|
{
|
677
|
item.UserName = _member.First().NAME;
|
678
|
item.Depatment = _member.First().DEPARTMENT;
|
679
|
}
|
680
|
|
681
|
if (_ColorsProperties.Count > 0)
|
682
|
{
|
683
|
int colorIdx = random.Next(1, _ColorsProperties.Count());
|
684
|
#region 부서별로 색상을 지정하고자 할때
|
685
|
/// 일단 의견을 들어보자구!
|
686
|
#endregion
|
687
|
item.DisplayColor = "#FF" + _ColorsProperties[colorIdx].VALUE;
|
688
|
_ColorsProperties.Remove(_ColorsProperties[colorIdx]);
|
689
|
//item.DisplayColor = "#FF" + _Colors.First();
|
690
|
//_Colors.Remove(_Colors.First());
|
691
|
}
|
692
|
else
|
693
|
{
|
694
|
item.DisplayColor = String.Format("#FF{0:X6}", random.Next(0x1000000));
|
695
|
}
|
696
|
}
|
697
|
}
|
698
|
}
|
699
|
catch (Exception EX)
|
700
|
{
|
701
|
System.Diagnostics.Debug.WriteLine(this.GetType().ToString() + " " + EX);
|
702
|
return _result;
|
703
|
}
|
704
|
finally
|
705
|
{
|
706
|
GC.Collect(2);
|
707
|
}
|
708
|
|
709
|
return _result;
|
710
|
}
|
711
|
|
712
|
|
713
|
//[OperationContract]
|
714
|
//[ServiceKnownType(typeof(MEMBER))]
|
715
|
//public List<MEMBER> GetUserData(string ProjectNo, string UserID)
|
716
|
//{
|
717
|
// List<MEMBER> _result = new List<MEMBER>();
|
718
|
|
719
|
// using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString()))
|
720
|
// {
|
721
|
// var _UserList = from member in entity.MEMBER
|
722
|
// where member.ID == UserID
|
723
|
// select member;
|
724
|
// _result = _UserList.ToList();
|
725
|
// }
|
726
|
// //GC.Collect(2);
|
727
|
// return _result;
|
728
|
//}
|
729
|
|
730
|
[OperationContract]
|
731
|
[ServiceKnownType(typeof(MEMBER))]
|
732
|
public List<MEMBER> GetUserData(string ProjectNo, string UserID)
|
733
|
{
|
734
|
List<MEMBER> _result = new List<MEMBER>();
|
735
|
|
736
|
using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString()))
|
737
|
{
|
738
|
var _UserList = from member in entity.MEMBER
|
739
|
where member.ID == UserID
|
740
|
select member;
|
741
|
_result = _UserList.ToList();
|
742
|
}
|
743
|
//GC.Collect(2);
|
744
|
return _result;
|
745
|
}
|
746
|
|
747
|
|
748
|
[OperationContract]
|
749
|
public List<string> GetDeptData(string UserDept) //그룹 추가 옵션 부여 예정
|
750
|
{
|
751
|
List<string> _result = new List<string>();
|
752
|
|
753
|
try
|
754
|
{
|
755
|
KCOMEntities entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString());
|
756
|
var YourEnginner = (from dept in entity.PROPERTIES
|
757
|
where dept.TYPE == "DeptName" && UserDept.Contains(dept.VALUE)
|
758
|
select dept).FirstOrDefault();
|
759
|
|
760
|
if (YourEnginner != null)
|
761
|
{
|
762
|
_result = (from dept in entity.PROPERTIES
|
763
|
where dept.PROPERTY == YourEnginner.PROPERTY
|
764
|
select dept.VALUE).ToList();
|
765
|
return _result;
|
766
|
}
|
767
|
else
|
768
|
{
|
769
|
return null;
|
770
|
}
|
771
|
}
|
772
|
catch (Exception ex)
|
773
|
{
|
774
|
System.Diagnostics.Debug.WriteLine(ex.Message);
|
775
|
}
|
776
|
finally
|
777
|
{
|
778
|
GC.Collect(2);
|
779
|
}
|
780
|
return _result;
|
781
|
}
|
782
|
|
783
|
[OperationContract]
|
784
|
public bool DeleteMarkup(string ProjectNo, string MarkupInfoID)
|
785
|
{
|
786
|
bool _result = false;
|
787
|
try
|
788
|
{
|
789
|
using (KCOMDataModel.DataModel.CIEntities Entity = new KCOMDataModel.DataModel.CIEntities(KCOMDataModel.Common.ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString()))
|
790
|
{
|
791
|
|
792
|
MARKUP_INFO instance = Entity.MARKUP_INFO.Where(root => root.ID == MarkupInfoID).FirstOrDefault();
|
793
|
|
794
|
if (instance == null)
|
795
|
{
|
796
|
return false;
|
797
|
}
|
798
|
MARKUP_INFO_VERSION version = instance.MARKUP_INFO_VERSION.FirstOrDefault();
|
799
|
|
800
|
|
801
|
version.MARKUP_DATA.ToList().ForEach(data =>
|
802
|
{
|
803
|
Entity.MARKUP_DATA.DeleteObject(data);
|
804
|
Entity.SaveChanges();
|
805
|
});
|
806
|
|
807
|
Entity.MARKUP_INFO_VERSION.DeleteObject(version);
|
808
|
Entity.SaveChanges();
|
809
|
|
810
|
Entity.MARKUP_INFO.DeleteObject(instance);
|
811
|
Entity.SaveChanges();
|
812
|
|
813
|
}
|
814
|
_result = true;
|
815
|
}
|
816
|
catch (Exception ex)
|
817
|
{
|
818
|
System.Diagnostics.Trace.WriteLine(ex, "SaveMarkup");
|
819
|
}
|
820
|
finally
|
821
|
{
|
822
|
GC.Collect(2);
|
823
|
}
|
824
|
return _result;
|
825
|
}
|
826
|
|
827
|
#region Favorite
|
828
|
[OperationContract]
|
829
|
public bool SetFavoriteVP(string prjNo, string userID, string groupNo, string docNo, string rev, int SavePageNo, string documentItemID, string VPDescription, IKCOM.FAVORITE_FLAG flag)
|
830
|
{
|
831
|
|
832
|
using (KCOMEntities entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
|
833
|
{
|
834
|
try
|
835
|
{
|
836
|
entity.FAVORITE_DOC.AddObject(new FAVORITE_DOC
|
837
|
{
|
838
|
ID = shortGuid(),
|
839
|
PROJECT_NO = prjNo,
|
840
|
DOCUMENT_ID = documentItemID,
|
841
|
GROUP_NO = groupNo,
|
842
|
DOCUMENT_NO = docNo,
|
843
|
MEMBER_USER_ID = userID,
|
844
|
DESCRIPTION = VPDescription,
|
845
|
CREATE_TIME = DateTime.Now,
|
846
|
REVISION = rev,
|
847
|
FLAG = (int)flag,
|
848
|
PAGE_NO = SavePageNo,
|
849
|
});
|
850
|
entity.SaveChanges();
|
851
|
}
|
852
|
catch (Exception)
|
853
|
{
|
854
|
return false;
|
855
|
}
|
856
|
|
857
|
return true;
|
858
|
}
|
859
|
}
|
860
|
|
861
|
//[OperationContract]
|
862
|
//public List<FAVORITE_DOC> GetFavoriteVP(string PrjNo, string userID, string sharepointItemID)
|
863
|
//{
|
864
|
// using (KCOMEntities entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
|
865
|
// {
|
866
|
|
867
|
// int flagString = Convert.ToInt32(IKCOM.FAVORITE_FLAG.Personal);
|
868
|
// List<FAVORITE_DOC> favoriteListSet = new List<FAVORITE_DOC>();
|
869
|
// entity.FAVORITE_DOC.Where(data => data.PROJECT_NO == PrjNo && data.DOCUMENT_ID == sharepointItemID && data.FLAG !=
|
870
|
// flagString).ToList().ForEach(data => favoriteListSet.Add(data));
|
871
|
// entity.FAVORITE_DOC.Where(data => data.PROJECT_NO == PrjNo && data.MEMBER_USER_ID == userID).ToList().ForEach(data => favoriteListSet.Add(data));
|
872
|
// favoriteListSet = favoriteListSet.Distinct().ToList();
|
873
|
// return favoriteListSet;
|
874
|
// }
|
875
|
//}
|
876
|
//[OperationContract]
|
877
|
//public bool EditFavoriteVP(string prjNo, string userID, int SavePageNo, string sharepointItemID, DateTime createTime, int state, string description)
|
878
|
//{
|
879
|
// using (DeepViewEntities dc = new DeepViewEntities(ConnectStringBuilder.DeepViewConnectionString().ToString()))
|
880
|
// {
|
881
|
// List<FavoriteVP> favoriteSet = dc.FavoriteVP.Where(data => data.ProjectNo == prjNo && data.CreateUserID == userID
|
882
|
// && data.PageNo == SavePageNo && data.CreateTime == createTime).ToList();
|
883
|
|
884
|
// try
|
885
|
// {
|
886
|
|
887
|
|
888
|
// if (favoriteSet.Count > 0)
|
889
|
// {
|
890
|
// var FavoriteVP_Instance = favoriteSet.First();
|
891
|
|
892
|
// FavoriteVP_Instance.Description = description;
|
893
|
// FavoriteVP_Instance.Flag = state;
|
894
|
|
895
|
// dc.SaveChanges();
|
896
|
|
897
|
// return true;
|
898
|
// }
|
899
|
// else
|
900
|
// {
|
901
|
// return false;
|
902
|
// }
|
903
|
// }
|
904
|
// catch (Exception)
|
905
|
// {
|
906
|
// return false;
|
907
|
// }
|
908
|
// }
|
909
|
//}
|
910
|
//[OperationContract]
|
911
|
//public bool DelFavoriteVP(string prjNo, string userID, int SavePageNo, string sharepointItemID, DateTime createTime)
|
912
|
//{
|
913
|
|
914
|
// using (DeepViewEntities dc = new DeepViewEntities(ConnectStringBuilder.DeepViewConnectionString().ToString()))
|
915
|
// {
|
916
|
// List<FavoriteVP> favoriteSet = dc.FavoriteVP.Where(data => data.ProjectNo == prjNo && data.CreateUserID == userID
|
917
|
// && data.PageNo == SavePageNo && data.CreateTime == createTime).ToList();
|
918
|
|
919
|
// try
|
920
|
// {
|
921
|
|
922
|
|
923
|
// if (favoriteSet.Count > 0)
|
924
|
// {
|
925
|
// favoriteSet.ForEach(data => dc.FavoriteVP.DeleteObject(data));
|
926
|
// dc.SaveChanges();
|
927
|
// return true;
|
928
|
// }
|
929
|
// else
|
930
|
// {
|
931
|
// return false;
|
932
|
// }
|
933
|
// }
|
934
|
// catch (Exception)
|
935
|
// {
|
936
|
// return false;
|
937
|
// }
|
938
|
// }
|
939
|
//}
|
940
|
#endregion
|
941
|
|
942
|
[OperationContract]
|
943
|
public bool SaveMarkupData(MarkupInfoItem UserState,string project_no,string doc_id, string user_id, List<MARKUP_DATA> mlmarkup_data)
|
944
|
{
|
945
|
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
|
946
|
{
|
947
|
#region Docinfo 정보 가져오기
|
948
|
|
949
|
string docinfoid_ = (from info in Entity.DOCINFO
|
950
|
where info.DOCUMENT_ID == doc_id
|
951
|
&& info.PROJECT_NO == project_no
|
952
|
select info.ID
|
953
|
).First().ToString();
|
954
|
#endregion
|
955
|
|
956
|
#region Markup_Info 저장
|
957
|
|
958
|
MARKUP_INFO markup_info = new MARKUP_INFO();
|
959
|
try
|
960
|
{
|
961
|
markup_info = (from info in Entity.MARKUP_INFO
|
962
|
where info.ID == UserState.MarkupInfoID && info.USER_ID == user_id
|
963
|
select info).FirstOrDefault();
|
964
|
}
|
965
|
catch (Exception)
|
966
|
{
|
967
|
markup_info = null;
|
968
|
}
|
969
|
|
970
|
//markup_info가 없을 경우 생성
|
971
|
if (markup_info == null)
|
972
|
{
|
973
|
//MarkupInfo 저장
|
974
|
markup_info = new MARKUP_INFO
|
975
|
{
|
976
|
ID = UserState.MarkupInfoID,
|
977
|
DOCINFO_ID = docinfoid_,
|
978
|
USER_ID = user_id,
|
979
|
CREATE_TIME = DateTime.Now,
|
980
|
CONSOLIDATE = UserState.Consolidate,
|
981
|
AVOID_CONSOLIDATE = UserState.AvoidConsolidate,
|
982
|
PART_CONSOLIDATE = UserState.PartConsolidate,
|
983
|
DESCRIPTION = UserState.Description,
|
984
|
UPDATE_TIME = DateTime.Now
|
985
|
};
|
986
|
Entity.MARKUP_INFO.AddObject(markup_info);
|
987
|
}
|
988
|
//markup_info가 있을 경우 업데이트
|
989
|
else
|
990
|
{
|
991
|
markup_info.UPDATE_TIME = DateTime.Now;
|
992
|
}
|
993
|
Entity.SaveChanges();
|
994
|
#endregion
|
995
|
|
996
|
#region Markup_Info_Version 저장
|
997
|
|
998
|
MARKUP_INFO_VERSION markup_info_version = new MARKUP_INFO_VERSION();
|
999
|
|
1000
|
try
|
1001
|
{
|
1002
|
markup_info_version = (from info in Entity.MARKUP_INFO_VERSION
|
1003
|
where info.MARKUPINFO_ID == markup_info.ID
|
1004
|
select info).FirstOrDefault();
|
1005
|
}
|
1006
|
catch (Exception)
|
1007
|
{
|
1008
|
markup_info_version = null;
|
1009
|
}
|
1010
|
|
1011
|
//markup_info_version 없을 경우 생성
|
1012
|
if (markup_info_version == null)
|
1013
|
{
|
1014
|
//MarkupInfo_version 저장
|
1015
|
markup_info_version = new MARKUP_INFO_VERSION()
|
1016
|
{
|
1017
|
ID = UserState.MarkupVersionID,
|
1018
|
MARKUPINFO_ID = markup_info.ID,
|
1019
|
CREATE_DATE = DateTime.Now
|
1020
|
};
|
1021
|
Entity.MARKUP_INFO_VERSION.AddObject(markup_info_version);
|
1022
|
Entity.SaveChanges();
|
1023
|
}
|
1024
|
#endregion
|
1025
|
|
1026
|
|
1027
|
Entity.MARKUP_DATA.Where(data => data.MARKUPINFO_VERSION_ID == markup_info_version.ID).ToList().ForEach(item =>
|
1028
|
{
|
1029
|
Entity.MARKUP_DATA.DeleteObject(item);
|
1030
|
});
|
1031
|
Entity.SaveChanges();
|
1032
|
|
1033
|
try
|
1034
|
{
|
1035
|
mlmarkup_data.ForEach(value =>
|
1036
|
{
|
1037
|
Entity.MARKUP_DATA.AddObject(new MARKUP_DATA
|
1038
|
{
|
1039
|
ID = value.ID,
|
1040
|
DATA = value.DATA,
|
1041
|
DATA_TYPE = value.DATA_TYPE,
|
1042
|
PAGENUMBER = value.PAGENUMBER,
|
1043
|
MARKUPINFO_VERSION_ID = markup_info_version.ID,
|
1044
|
SYMBOL_ID = value.SYMBOL_ID
|
1045
|
});
|
1046
|
});
|
1047
|
Entity.SaveChanges();
|
1048
|
}
|
1049
|
catch (Exception)
|
1050
|
{
|
1051
|
return false;
|
1052
|
}
|
1053
|
}
|
1054
|
return true;
|
1055
|
}
|
1056
|
|
1057
|
|
1058
|
[OperationContract]
|
1059
|
public bool SaveSymbol(SYMBOL_PRIVATE symbol_private)
|
1060
|
{
|
1061
|
try
|
1062
|
{
|
1063
|
using (KCOMDataModel.DataModel.KCOMEntities uc = new KCOMDataModel.DataModel.KCOMEntities(KCOMDataModel.Common.ConnectStringBuilder.KCOMConnectionString().ToString()))
|
1064
|
{
|
1065
|
uc.AddToSYMBOL_PRIVATE(symbol_private);
|
1066
|
uc.SaveChanges();
|
1067
|
}
|
1068
|
}
|
1069
|
catch(Exception)
|
1070
|
{
|
1071
|
return false;
|
1072
|
}
|
1073
|
return true;
|
1074
|
}
|
1075
|
|
1076
|
[OperationContract]
|
1077
|
public bool DeleteSymbol(string symbol_id)
|
1078
|
{
|
1079
|
try
|
1080
|
{
|
1081
|
using (KCOMEntities Entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
|
1082
|
{
|
1083
|
string delItem_ID = symbol_id;
|
1084
|
var delitem = Entity.SYMBOL_PRIVATE.Where(data => data.ID == delItem_ID).FirstOrDefault();
|
1085
|
Entity.SYMBOL_PRIVATE.DeleteObject(delitem);
|
1086
|
Entity.SaveChanges();
|
1087
|
}
|
1088
|
}
|
1089
|
catch(Exception)
|
1090
|
{
|
1091
|
return false;
|
1092
|
}
|
1093
|
return true;
|
1094
|
}
|
1095
|
|
1096
|
[OperationContract]
|
1097
|
public bool RenameSymbol(string symbol_id, string name)
|
1098
|
{
|
1099
|
try
|
1100
|
{
|
1101
|
using (KCOMEntities Entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
|
1102
|
{
|
1103
|
var UpdateItem = Entity.SYMBOL_PRIVATE.Where(info => info.ID == symbol_id).FirstOrDefault();
|
1104
|
UpdateItem.NAME = name;
|
1105
|
Entity.SaveChanges();
|
1106
|
}
|
1107
|
}
|
1108
|
catch (Exception)
|
1109
|
{
|
1110
|
return false;
|
1111
|
}
|
1112
|
return true;
|
1113
|
}
|
1114
|
|
1115
|
[OperationContract]
|
1116
|
public bool AddCheckListHistory(string project_no, CHECK_LIST_HISTORY Check_History)
|
1117
|
{
|
1118
|
try
|
1119
|
{
|
1120
|
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
|
1121
|
{
|
1122
|
Entity.CHECK_LIST_HISTORY.AddObject(Check_History);
|
1123
|
Entity.SaveChanges();
|
1124
|
}
|
1125
|
}
|
1126
|
catch (Exception)
|
1127
|
{
|
1128
|
return false;
|
1129
|
}
|
1130
|
return true;
|
1131
|
}
|
1132
|
[OperationContract]
|
1133
|
public bool SaveCheckListHistory(string project_no, string rev, CHECK_LIST_HISTORY Check_History)
|
1134
|
{
|
1135
|
try
|
1136
|
{
|
1137
|
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
|
1138
|
{
|
1139
|
var item = Entity.CHECK_LIST_HISTORY.Where(info => info.REVISION == rev).FirstOrDefault();
|
1140
|
item = Check_History;
|
1141
|
Entity.SaveChanges();
|
1142
|
}
|
1143
|
}
|
1144
|
catch (Exception)
|
1145
|
{
|
1146
|
return false;
|
1147
|
}
|
1148
|
return true;
|
1149
|
}
|
1150
|
[OperationContract]
|
1151
|
public bool SaveCheckList(string project_no, string _id, CHECK_LIST Check_value)
|
1152
|
{
|
1153
|
try
|
1154
|
{
|
1155
|
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
|
1156
|
{
|
1157
|
var item = Entity.CHECK_LIST.Where(info => info.ID == _id).FirstOrDefault();
|
1158
|
item.TODOLIST = Check_value.TODOLIST;
|
1159
|
item.REMARK = Check_value.REMARK;
|
1160
|
item.STATUS = Check_value.STATUS;
|
1161
|
item.VENDOR = Check_value.VENDOR;
|
1162
|
item.REPLY = Check_value.REPLY;
|
1163
|
item.IMAGE_URL = Check_value.IMAGE_URL;
|
1164
|
item.IMAGE_ANCHOR = Check_value.IMAGE_ANCHOR;
|
1165
|
item.UPDATE_TIME = Check_value.UPDATE_TIME;
|
1166
|
Entity.SaveChanges();
|
1167
|
}
|
1168
|
}
|
1169
|
catch (Exception)
|
1170
|
{
|
1171
|
return false;
|
1172
|
}
|
1173
|
return true;
|
1174
|
}
|
1175
|
[OperationContract]
|
1176
|
public bool AddCheckList(string project_no, CHECK_LIST Check_value)
|
1177
|
{
|
1178
|
try
|
1179
|
{
|
1180
|
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
|
1181
|
{
|
1182
|
Entity.CHECK_LIST.AddObject(Check_value);
|
1183
|
Entity.SaveChanges();
|
1184
|
}
|
1185
|
}
|
1186
|
catch (Exception)
|
1187
|
{
|
1188
|
return false;
|
1189
|
}
|
1190
|
return true;
|
1191
|
}
|
1192
|
|
1193
|
[OperationContract]
|
1194
|
public CHECK_LIST GetCheckList(string project_no, string _id)
|
1195
|
{
|
1196
|
CHECK_LIST Check_value = new CHECK_LIST();
|
1197
|
try
|
1198
|
{
|
1199
|
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
|
1200
|
{
|
1201
|
Check_value = Entity.CHECK_LIST.Where(info => info.ID == _id).FirstOrDefault();
|
1202
|
}
|
1203
|
}
|
1204
|
catch (Exception)
|
1205
|
{
|
1206
|
return null;
|
1207
|
}
|
1208
|
return Check_value;
|
1209
|
}
|
1210
|
[OperationContract]
|
1211
|
public List<CHECK_LIST> GetUserCheckList(string project_no, string user_id, string doc_no)
|
1212
|
{
|
1213
|
List<CHECK_LIST> list = new List<CHECK_LIST>();
|
1214
|
try
|
1215
|
{
|
1216
|
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
|
1217
|
{
|
1218
|
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();
|
1219
|
}
|
1220
|
}
|
1221
|
catch (Exception)
|
1222
|
{
|
1223
|
return null;
|
1224
|
}
|
1225
|
return list;
|
1226
|
}
|
1227
|
[OperationContract]
|
1228
|
public List<CHECK_LIST_HISTORY> GetCheckListHistory(string project_no, string _id)
|
1229
|
{
|
1230
|
List<CHECK_LIST_HISTORY> history = new List<CHECK_LIST_HISTORY>();
|
1231
|
try
|
1232
|
{
|
1233
|
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
|
1234
|
{
|
1235
|
history = Entity.CHECK_LIST_HISTORY.Where(data => data.CHECKLIST_ID == _id).ToList();
|
1236
|
}
|
1237
|
}
|
1238
|
catch (Exception)
|
1239
|
{
|
1240
|
return null;
|
1241
|
}
|
1242
|
return history;
|
1243
|
}
|
1244
|
[OperationContract]
|
1245
|
public CHECK_LIST_HISTORY GetCheckListHistoryFirstOrDefault(string project_no, string checklist_id, string rev)
|
1246
|
{
|
1247
|
CHECK_LIST_HISTORY Check_Item = new CHECK_LIST_HISTORY();
|
1248
|
try
|
1249
|
{
|
1250
|
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
|
1251
|
{
|
1252
|
Check_Item = Entity.CHECK_LIST_HISTORY.Where(info => info.CHECKLIST_ID == checklist_id && info.REVISION == rev).FirstOrDefault();
|
1253
|
}
|
1254
|
}
|
1255
|
catch (Exception)
|
1256
|
{
|
1257
|
return null;
|
1258
|
}
|
1259
|
return Check_Item;
|
1260
|
}
|
1261
|
[OperationContract]
|
1262
|
public bool SavePageAngle(string project_no, List<DOCPAGE> _mldocpage)
|
1263
|
{
|
1264
|
try
|
1265
|
{
|
1266
|
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
|
1267
|
{
|
1268
|
KCOMDataModel.DataModel.DOCPAGE _docpage = new KCOMDataModel.DataModel.DOCPAGE();
|
1269
|
_mldocpage.ForEach(data =>
|
1270
|
{
|
1271
|
_docpage = (from info in Entity.DOCPAGE
|
1272
|
where info.ID == data.ID
|
1273
|
select info).FirstOrDefault();
|
1274
|
|
1275
|
if (_docpage.PAGE_ANGLE != data.PAGE_ANGLE)
|
1276
|
{
|
1277
|
_docpage.PAGE_ANGLE = data.PAGE_ANGLE;
|
1278
|
}
|
1279
|
});
|
1280
|
|
1281
|
Entity.SaveChanges();
|
1282
|
}
|
1283
|
}
|
1284
|
catch (Exception)
|
1285
|
{
|
1286
|
return false;
|
1287
|
}
|
1288
|
return true;
|
1289
|
}
|
1290
|
|
1291
|
[OperationContract]
|
1292
|
public MARKUP_INFO GetMarkupInfo(string project_no, string _id)
|
1293
|
{
|
1294
|
MARKUP_INFO markupInfo = new MARKUP_INFO();
|
1295
|
|
1296
|
try
|
1297
|
{
|
1298
|
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
|
1299
|
{
|
1300
|
markupInfo = Entity.MARKUP_INFO.Where(entity => entity.DOCINFO_ID == _id).OrderByDescending(i => i.CONSOLIDATE).OrderByDescending(j => j.CREATE_TIME).FirstOrDefault();
|
1301
|
}
|
1302
|
}
|
1303
|
catch (Exception)
|
1304
|
{
|
1305
|
return null;
|
1306
|
}
|
1307
|
return markupInfo;
|
1308
|
}
|
1309
|
|
1310
|
[OperationContract]
|
1311
|
public List<string> GetMarkupDataListperPage(string project_no, string _markupinfoid, int _pageNo)
|
1312
|
{
|
1313
|
List<string> markupdata = new List<string>();
|
1314
|
MARKUP_INFO_VERSION markup_info_version = new MARKUP_INFO_VERSION();
|
1315
|
try
|
1316
|
{
|
1317
|
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
|
1318
|
{
|
1319
|
markup_info_version = (from version in Entity.MARKUP_INFO_VERSION
|
1320
|
where version.MARKUPINFO_ID == _markupinfoid
|
1321
|
orderby version.CREATE_DATE descending
|
1322
|
select version).First();
|
1323
|
markupdata = (from data in Entity.MARKUP_DATA
|
1324
|
where data.MARKUPINFO_VERSION_ID == markup_info_version.ID && data.PAGENUMBER == _pageNo
|
1325
|
select data.DATA).ToList();
|
1326
|
}
|
1327
|
}
|
1328
|
catch (Exception)
|
1329
|
{
|
1330
|
return null;
|
1331
|
}
|
1332
|
return markupdata;
|
1333
|
}
|
1334
|
|
1335
|
[OperationContract]
|
1336
|
public bool AddMarkupInfo(string project_no, MARKUP_INFO value)
|
1337
|
{
|
1338
|
try
|
1339
|
{
|
1340
|
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
|
1341
|
{
|
1342
|
Entity.MARKUP_INFO.AddObject(value);
|
1343
|
Entity.SaveChanges();
|
1344
|
}
|
1345
|
}
|
1346
|
catch (Exception)
|
1347
|
{
|
1348
|
return false;
|
1349
|
}
|
1350
|
return true;
|
1351
|
}
|
1352
|
|
1353
|
[OperationContract]
|
1354
|
public bool AddMarkupInfoVersion(string project_no, MARKUP_INFO_VERSION value)
|
1355
|
{
|
1356
|
try
|
1357
|
{
|
1358
|
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
|
1359
|
{
|
1360
|
Entity.MARKUP_INFO_VERSION.AddObject(value);
|
1361
|
Entity.SaveChanges();
|
1362
|
}
|
1363
|
}
|
1364
|
catch (Exception)
|
1365
|
{
|
1366
|
return false;
|
1367
|
}
|
1368
|
return true;
|
1369
|
}
|
1370
|
|
1371
|
[OperationContract]
|
1372
|
public bool AddMarkupData(string project_no, MARKUP_DATA value)
|
1373
|
{
|
1374
|
try
|
1375
|
{
|
1376
|
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
|
1377
|
{
|
1378
|
Entity.MARKUP_DATA.AddObject(value);
|
1379
|
Entity.SaveChanges();
|
1380
|
}
|
1381
|
}
|
1382
|
catch (Exception)
|
1383
|
{
|
1384
|
return false;
|
1385
|
}
|
1386
|
return true;
|
1387
|
}
|
1388
|
|
1389
|
[OperationContract]
|
1390
|
public bool AvoidMarkupInfo(string project_no, string _doc_id)
|
1391
|
{
|
1392
|
try
|
1393
|
{
|
1394
|
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
|
1395
|
{
|
1396
|
var item = Entity.MARKUP_INFO.Where(entity => entity.DOCINFO_ID == _doc_id).OrderByDescending(i => i.CONSOLIDATE).OrderByDescending(j => j.CREATE_TIME).FirstOrDefault();
|
1397
|
item.AVOID_CONSOLIDATE = 1;
|
1398
|
Entity.SaveChanges();
|
1399
|
}
|
1400
|
}
|
1401
|
catch (Exception)
|
1402
|
{
|
1403
|
return false;
|
1404
|
}
|
1405
|
return true;
|
1406
|
}
|
1407
|
|
1408
|
[OperationContract]
|
1409
|
public bool SaveMarkupInfo(string project_no, string _id, MARKUP_INFO value)
|
1410
|
{
|
1411
|
try
|
1412
|
{
|
1413
|
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
|
1414
|
{
|
1415
|
var item = Entity.MARKUP_INFO.Where(info => info.ID == _id).FirstOrDefault();
|
1416
|
item = value;
|
1417
|
Entity.SaveChanges();
|
1418
|
}
|
1419
|
}
|
1420
|
catch (Exception)
|
1421
|
{
|
1422
|
return false;
|
1423
|
}
|
1424
|
return true;
|
1425
|
}
|
1426
|
[OperationContract]
|
1427
|
public List<MARKUP_DATA> GetMarkupDataList(string project_no, string _versionid)
|
1428
|
{
|
1429
|
List<MARKUP_DATA> mlresult = new List<MARKUP_DATA>();
|
1430
|
|
1431
|
try
|
1432
|
{
|
1433
|
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
|
1434
|
{
|
1435
|
mlresult = Entity.MARKUP_DATA.Where(data => data.MARKUPINFO_VERSION_ID == _versionid).ToList();
|
1436
|
}
|
1437
|
}
|
1438
|
catch (Exception)
|
1439
|
{
|
1440
|
return null;
|
1441
|
}
|
1442
|
return mlresult;
|
1443
|
}
|
1444
|
|
1445
|
[OperationContract]
|
1446
|
public bool Consolidate(string project_no, string _user_id, string _doc_id, List<MarkupInfoItem> markupInfoItems)
|
1447
|
{
|
1448
|
try
|
1449
|
{
|
1450
|
List<KCOMDataModel.DataModel.MARKUP_DATA> instanceDataSet = new List<KCOMDataModel.DataModel.MARKUP_DATA>();
|
1451
|
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
|
1452
|
{
|
1453
|
var markupInfo = Entity.MARKUP_INFO.Where(entity => entity.DOCINFO_ID == _doc_id).OrderByDescending(i => i.CONSOLIDATE).OrderByDescending(j => j.CREATE_TIME).FirstOrDefault();
|
1454
|
if (markupInfo.CONSOLIDATE == 1)
|
1455
|
{
|
1456
|
markupInfo.AVOID_CONSOLIDATE = 1;
|
1457
|
}
|
1458
|
|
1459
|
foreach (MarkupInfoItem item in markupInfoItems)
|
1460
|
{
|
1461
|
Entity.MARKUP_DATA.Where(data => data.MARKUPINFO_VERSION_ID == item.MarkupVersionID).ToList().ForEach(d =>
|
1462
|
{
|
1463
|
instanceDataSet.Add(d);
|
1464
|
});
|
1465
|
}
|
1466
|
|
1467
|
KCOMDataModel.DataModel.MARKUP_INFO info = new KCOMDataModel.DataModel.MARKUP_INFO();
|
1468
|
info.ID = shortGuid();
|
1469
|
info.CONSOLIDATE = 1;
|
1470
|
info.CREATE_TIME = DateTime.Now;
|
1471
|
info.DOCINFO_ID = _doc_id;
|
1472
|
info.UPDATE_TIME = DateTime.Now;
|
1473
|
info.USER_ID = _user_id;
|
1474
|
info.AVOID_CONSOLIDATE = 0;
|
1475
|
|
1476
|
Entity.MARKUP_INFO.AddObject(info);
|
1477
|
Entity.SaveChanges();
|
1478
|
|
1479
|
|
1480
|
KCOMDataModel.DataModel.MARKUP_INFO_VERSION info2 = new KCOMDataModel.DataModel.MARKUP_INFO_VERSION
|
1481
|
{
|
1482
|
ID = shortGuid(),
|
1483
|
CREATE_DATE = DateTime.Now,
|
1484
|
MARKUP_INFO = info,
|
1485
|
};
|
1486
|
Entity.SaveChanges();
|
1487
|
|
1488
|
foreach (var item in instanceDataSet)
|
1489
|
{
|
1490
|
Entity.MARKUP_DATA.AddObject(new KCOMDataModel.DataModel.MARKUP_DATA
|
1491
|
{
|
1492
|
ID = shortGuid(),
|
1493
|
DATA = item.DATA,
|
1494
|
DATA_TYPE = item.DATA_TYPE,
|
1495
|
PAGENUMBER = item.PAGENUMBER,
|
1496
|
MARKUP_INFO_VERSION = info2,
|
1497
|
SYMBOL_ID = item.SYMBOL_ID
|
1498
|
});
|
1499
|
}
|
1500
|
Entity.SaveChanges();
|
1501
|
|
1502
|
|
1503
|
}
|
1504
|
}
|
1505
|
catch (Exception)
|
1506
|
{
|
1507
|
return false;
|
1508
|
}
|
1509
|
return true;
|
1510
|
}
|
1511
|
|
1512
|
[OperationContract]
|
1513
|
public bool TeamConsolidate(string project_no, string _user_id, string _doc_id, List<MarkupInfoItem> markupInfoItems)
|
1514
|
{
|
1515
|
try
|
1516
|
{
|
1517
|
List<KCOMDataModel.DataModel.MARKUP_DATA> instanceDataSet = new List<KCOMDataModel.DataModel.MARKUP_DATA>();
|
1518
|
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
|
1519
|
{
|
1520
|
var markupInfo = Entity.MARKUP_INFO.Where(entity => entity.DOCINFO_ID == _doc_id).OrderByDescending(i => i.CONSOLIDATE).OrderByDescending(j => j.CREATE_TIME).FirstOrDefault();
|
1521
|
if (markupInfo.PART_CONSOLIDATE == 1)
|
1522
|
{
|
1523
|
markupInfo.AVOID_CONSOLIDATE = 1;
|
1524
|
}
|
1525
|
|
1526
|
foreach (MarkupInfoItem item in markupInfoItems)
|
1527
|
{
|
1528
|
Entity.MARKUP_DATA.Where(data => data.MARKUPINFO_VERSION_ID == item.MarkupVersionID).ToList().ForEach(d =>
|
1529
|
{
|
1530
|
instanceDataSet.Add(d);
|
1531
|
});
|
1532
|
}
|
1533
|
|
1534
|
KCOMDataModel.DataModel.MARKUP_INFO info = new KCOMDataModel.DataModel.MARKUP_INFO();
|
1535
|
info.ID = shortGuid();
|
1536
|
info.PART_CONSOLIDATE = 1;
|
1537
|
info.CREATE_TIME = DateTime.Now;
|
1538
|
info.DOCINFO_ID = _doc_id;
|
1539
|
info.UPDATE_TIME = DateTime.Now;
|
1540
|
info.USER_ID = _user_id;
|
1541
|
info.AVOID_CONSOLIDATE = 0;
|
1542
|
|
1543
|
Entity.MARKUP_INFO.AddObject(info);
|
1544
|
Entity.SaveChanges();
|
1545
|
|
1546
|
|
1547
|
KCOMDataModel.DataModel.MARKUP_INFO_VERSION info2 = new KCOMDataModel.DataModel.MARKUP_INFO_VERSION
|
1548
|
{
|
1549
|
ID = shortGuid(),
|
1550
|
CREATE_DATE = DateTime.Now,
|
1551
|
MARKUP_INFO = info,
|
1552
|
};
|
1553
|
Entity.SaveChanges();
|
1554
|
|
1555
|
foreach (var item in instanceDataSet)
|
1556
|
{
|
1557
|
Entity.MARKUP_DATA.AddObject(new KCOMDataModel.DataModel.MARKUP_DATA
|
1558
|
{
|
1559
|
ID = shortGuid(),
|
1560
|
DATA = item.DATA,
|
1561
|
DATA_TYPE = item.DATA_TYPE,
|
1562
|
PAGENUMBER = item.PAGENUMBER,
|
1563
|
MARKUP_INFO_VERSION = info2,
|
1564
|
SYMBOL_ID = item.SYMBOL_ID
|
1565
|
});
|
1566
|
}
|
1567
|
Entity.SaveChanges();
|
1568
|
|
1569
|
|
1570
|
}
|
1571
|
}
|
1572
|
catch (Exception)
|
1573
|
{
|
1574
|
return false;
|
1575
|
}
|
1576
|
return true;
|
1577
|
}
|
1578
|
|
1579
|
[OperationContract]
|
1580
|
[ServiceKnownType(typeof(MEMBER))]
|
1581
|
public MEMBER GetMember(string project_no, string user_id)
|
1582
|
{
|
1583
|
MEMBER rstmember = new MEMBER();
|
1584
|
try
|
1585
|
{
|
1586
|
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
|
1587
|
{
|
1588
|
var tmp = (from member in Entity.MEMBER
|
1589
|
where member.ID == user_id
|
1590
|
select member).FirstOrDefault();
|
1591
|
rstmember.DEPARTMENT = tmp.DEPARTMENT;
|
1592
|
rstmember.ID = tmp.ID;
|
1593
|
rstmember.NAME = tmp.NAME;
|
1594
|
}
|
1595
|
}
|
1596
|
catch (Exception)
|
1597
|
{
|
1598
|
return null;
|
1599
|
}
|
1600
|
return rstmember;
|
1601
|
}
|
1602
|
|
1603
|
[OperationContract]
|
1604
|
public List<SYMBOL_PRIVATE> GetSymbolList(string user_id)
|
1605
|
{
|
1606
|
List<SYMBOL_PRIVATE> Custom_List = new List<SYMBOL_PRIVATE>();
|
1607
|
try
|
1608
|
{
|
1609
|
using (KCOMEntities Entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
|
1610
|
{
|
1611
|
Custom_List = Entity.SYMBOL_PRIVATE.Where(data => data.MEMBER_USER_ID == user_id).ToList();
|
1612
|
}
|
1613
|
}
|
1614
|
catch (Exception)
|
1615
|
{
|
1616
|
return null;
|
1617
|
}
|
1618
|
return Custom_List;
|
1619
|
}
|
1620
|
[OperationContract]
|
1621
|
public List<string> GetPublicSymbolDeptList()
|
1622
|
{
|
1623
|
List<string> Custom_List = new List<string>();
|
1624
|
try
|
1625
|
{
|
1626
|
using (KCOMEntities Entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
|
1627
|
{
|
1628
|
Custom_List = Entity.SYMBOL_PUBLIC.Select(data => data.DEPARTMENT).ToList();
|
1629
|
}
|
1630
|
}
|
1631
|
catch (Exception)
|
1632
|
{
|
1633
|
return null;
|
1634
|
}
|
1635
|
return Custom_List;
|
1636
|
}
|
1637
|
[OperationContract]
|
1638
|
public List<SYMBOL_PUBLIC> GetPublicSymbolList(string dept)
|
1639
|
{
|
1640
|
List<SYMBOL_PUBLIC> Custom_List = new List<SYMBOL_PUBLIC>();
|
1641
|
try
|
1642
|
{
|
1643
|
using (KCOMEntities Entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
|
1644
|
{
|
1645
|
if(!string.IsNullOrEmpty(dept))
|
1646
|
{
|
1647
|
Custom_List = Entity.SYMBOL_PUBLIC.Where(data => data.DEPARTMENT == dept).ToList();
|
1648
|
}
|
1649
|
else
|
1650
|
{
|
1651
|
Custom_List = Entity.SYMBOL_PUBLIC.ToList();
|
1652
|
}
|
1653
|
|
1654
|
}
|
1655
|
}
|
1656
|
catch (Exception)
|
1657
|
{
|
1658
|
return null;
|
1659
|
}
|
1660
|
return Custom_List;
|
1661
|
}
|
1662
|
|
1663
|
/// <summary>
|
1664
|
///
|
1665
|
/// </summary>
|
1666
|
/// <param name="id">symbol id</param>
|
1667
|
/// <param name="type"> 0 : PRIVATE, 1 : PUBLIC</param>
|
1668
|
/// <returns></returns>
|
1669
|
[OperationContract]
|
1670
|
public string GetSymbolData(string id, int type)
|
1671
|
{
|
1672
|
string result;
|
1673
|
try
|
1674
|
{
|
1675
|
using (KCOMEntities Entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
|
1676
|
{
|
1677
|
if(type == 0)
|
1678
|
{
|
1679
|
result = Entity.SYMBOL_PRIVATE.Where(data => data.ID == id).FirstOrDefault().DATA;
|
1680
|
}
|
1681
|
else
|
1682
|
{
|
1683
|
result = Entity.SYMBOL_PUBLIC.Where(data => data.ID == id).FirstOrDefault().DATA;
|
1684
|
}
|
1685
|
}
|
1686
|
}
|
1687
|
catch (Exception)
|
1688
|
{
|
1689
|
return null;
|
1690
|
}
|
1691
|
return result;
|
1692
|
}
|
1693
|
|
1694
|
[OperationContract]
|
1695
|
public string GetSignData(string project_no, string user_id)
|
1696
|
{
|
1697
|
string result = null;
|
1698
|
try
|
1699
|
{
|
1700
|
var ModelWFConnectionString = ConnectStringBuilder.ProjectCIConnectString(project_no).ToString();
|
1701
|
if (null != ModelWFConnectionString)
|
1702
|
{
|
1703
|
using (CIEntities entity = new CIEntities(ModelWFConnectionString))
|
1704
|
{
|
1705
|
var _sign = entity.SIGN_INFO.Where(sin => sin.MEMBER_USER_ID == user_id);
|
1706
|
if (_sign.Count() > 0)
|
1707
|
{
|
1708
|
result = _sign.First().SIGN_STR;
|
1709
|
}
|
1710
|
else
|
1711
|
{
|
1712
|
return null;
|
1713
|
}
|
1714
|
}
|
1715
|
}
|
1716
|
}
|
1717
|
catch (Exception)
|
1718
|
{
|
1719
|
return null;
|
1720
|
}
|
1721
|
return result;
|
1722
|
}
|
1723
|
|
1724
|
[OperationContract]
|
1725
|
public string GetProjectName(string project_no)
|
1726
|
{
|
1727
|
string result = null;
|
1728
|
|
1729
|
try
|
1730
|
{
|
1731
|
using (KCOMDataModel.DataModel.KCOMEntities Entity = new KCOMDataModel.DataModel.KCOMEntities(KCOMDataModel.Common.ConnectStringBuilder.KCOMConnectionString().ToString()))
|
1732
|
{
|
1733
|
result = Entity.RUN_PROJECTS.Where(i => i.PROJECT_NO == project_no).FirstOrDefault().PROJECT_NAME.ToString();
|
1734
|
}
|
1735
|
}
|
1736
|
catch (Exception)
|
1737
|
{
|
1738
|
return null;
|
1739
|
}
|
1740
|
return result;
|
1741
|
}
|
1742
|
|
1743
|
[OperationContract]
|
1744
|
public List<DOCUMENT_ITEM> GetPreRevSelect(string project_no, string doc_no, string current_rev)
|
1745
|
{
|
1746
|
List<DOCUMENT_ITEM> result = new List<DOCUMENT_ITEM>();
|
1747
|
|
1748
|
try
|
1749
|
{
|
1750
|
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
|
1751
|
{
|
1752
|
result = Entity.DOCUMENT_ITEM.Where(i => i.PROJECT_NO == project_no
|
1753
|
&& i.DOCUMENT_NO == doc_no
|
1754
|
&& i.REVISION != current_rev).OrderByDescending(i => i.GROUP_NO).ToList();
|
1755
|
}
|
1756
|
}
|
1757
|
catch (Exception)
|
1758
|
{
|
1759
|
return null;
|
1760
|
}
|
1761
|
return result;
|
1762
|
}
|
1763
|
|
1764
|
[OperationContract]
|
1765
|
public DOCINFO GetDocInfoOneSelect(string project_no, string doc_id)
|
1766
|
{
|
1767
|
DOCINFO docinfo = null;
|
1768
|
|
1769
|
try
|
1770
|
{
|
1771
|
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
|
1772
|
{
|
1773
|
docinfo = (from info in Entity.DOCINFO
|
1774
|
where info.DOCUMENT_ID == doc_id
|
1775
|
&& info.PROJECT_NO == project_no
|
1776
|
select info).First();
|
1777
|
}
|
1778
|
}
|
1779
|
catch (Exception)
|
1780
|
{
|
1781
|
return null;
|
1782
|
}
|
1783
|
return docinfo;
|
1784
|
}
|
1785
|
|
1786
|
[OperationContract]
|
1787
|
public List<MarkupInfoItem> GetPrintDocItemList(string project_no, string doc_id, List<MarkupInfoItem> _markupInfoList)
|
1788
|
{
|
1789
|
MarkupInfoItem _result = null;
|
1790
|
List<MarkupInfoItem> markupinfo = new List<MarkupInfoItem>();
|
1791
|
try
|
1792
|
{
|
1793
|
using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
|
1794
|
{
|
1795
|
var docitem = (from info in Entity.DOCINFO
|
1796
|
where info.DOCUMENT_ID == doc_id
|
1797
|
&& info.PROJECT_NO == project_no
|
1798
|
select info).First();
|
1799
|
|
1800
|
foreach (MARKUP_INFO markinfo in docitem.MARKUP_INFO)
|
1801
|
{
|
1802
|
var member = (from mem in Entity.MEMBER
|
1803
|
where mem.ID == markinfo.USER_ID
|
1804
|
select mem).First();
|
1805
|
string displaycolor = null;
|
1806
|
try
|
1807
|
{
|
1808
|
displaycolor = _markupInfoList.Where(info => info.MarkupInfoID == markinfo.ID).First().DisplayColor;
|
1809
|
}
|
1810
|
catch(Exception)
|
1811
|
{
|
1812
|
displaycolor = "#FFFFFF";
|
1813
|
}
|
1814
|
|
1815
|
_result = new MarkupInfoItem
|
1816
|
{
|
1817
|
MarkupInfoID = markinfo.ID,
|
1818
|
Consolidate = markinfo.CONSOLIDATE,
|
1819
|
CreateTime = markinfo.UPDATE_TIME.HasValue ? markinfo.UPDATE_TIME.Value : markinfo.CREATE_TIME,
|
1820
|
DisplayColor = displaycolor,
|
1821
|
UserID = markinfo.USER_ID,
|
1822
|
UserName = member.NAME,
|
1823
|
Depatment = member.DEPARTMENT,
|
1824
|
};
|
1825
|
|
1826
|
_result.MarkupList = new List<IKCOM.MarkupItem>();
|
1827
|
var markup_Version = markinfo.MARKUP_INFO_VERSION.OrderByDescending(p => p.CREATE_DATE).First();
|
1828
|
|
1829
|
foreach (MARKUP_DATA markdata in markup_Version.MARKUP_DATA)
|
1830
|
{
|
1831
|
MarkupItem markitem = new MarkupItem()
|
1832
|
{
|
1833
|
ID = markdata.ID,
|
1834
|
PageNumber = markdata.PAGENUMBER,
|
1835
|
};
|
1836
|
_result.MarkupList.Add(markitem);
|
1837
|
}
|
1838
|
|
1839
|
_result.PageCount = _result.MarkupList.GroupBy(i => i.PageNumber).Count();
|
1840
|
|
1841
|
markupinfo.Add(_result);
|
1842
|
}
|
1843
|
}
|
1844
|
}
|
1845
|
catch (Exception)
|
1846
|
{
|
1847
|
return null;
|
1848
|
}
|
1849
|
return markupinfo;
|
1850
|
}
|
1851
|
|
1852
|
[OperationContract]
|
1853
|
public bool AddMessage(string project_no, TALK value)
|
1854
|
{
|
1855
|
try
|
1856
|
{
|
1857
|
using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
|
1858
|
{
|
1859
|
entity.TALK.AddObject(value);
|
1860
|
entity.SaveChanges();
|
1861
|
}
|
1862
|
}
|
1863
|
catch (Exception)
|
1864
|
{
|
1865
|
return false;
|
1866
|
}
|
1867
|
return true;
|
1868
|
}
|
1869
|
|
1870
|
[OperationContract]
|
1871
|
public List<TALK> GetMessage(string project_no, string doc_id)
|
1872
|
{
|
1873
|
List<TALK> result = new List<TALK>();
|
1874
|
try
|
1875
|
{
|
1876
|
using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
|
1877
|
{
|
1878
|
result = entity.TALK.Where(data => data.DOCUMENT_ID == doc_id).ToList();
|
1879
|
}
|
1880
|
}
|
1881
|
catch (Exception)
|
1882
|
{
|
1883
|
return result;
|
1884
|
}
|
1885
|
return result;
|
1886
|
}
|
1887
|
}
|
1888
|
}
|