프로젝트

일반

사용자정보

통계
| 브랜치(Branch): | 개정판:

markus / KCOM_API / ServiceDeepView.svc.cs @ 40b3ce25

이력 | 보기 | 이력해설 | 다운로드 (72.8 KB)

1 787a4489 KangIngu
using IFinalPDF;
2
using IKCOM;
3
using KCOMDataModel.Common;
4
using KCOMDataModel.DataModel;
5 992a98b4 KangIngu
using MARKUS;
6 787a4489 KangIngu
using System;
7
using System.Collections.Generic;
8 2ab012e8 djkim
using System.Collections.ObjectModel;
9 787a4489 KangIngu
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 9a1ce1db KangIngu
56
                    url = uc.PROPERTIES.Where(data => data.TYPE == "STAMP").FirstOrDefault();
57
                    if(url != null)
58
                    {
59
                        sysInfo.STAMP = url.VALUE;
60
                    }
61 787a4489 KangIngu
                    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 992a98b4 KangIngu
        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 d9cf7d6e djkim
        public List<Rect> GetCompareRect(string projectNo, string originDocItem_ID, string targetDocItem_ID, string originPageNo, string targetPageNo, string isInternalAddress)
178 787a4489 KangIngu
        {
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 a874198d humkyung
182
            string originFile = "";
183
            string targetFile = "";
184
185 d9cf7d6e djkim
            if (Boolean.Parse(isInternalAddress))
186 a874198d humkyung
            {
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 787a4489 KangIngu
196 992a98b4 KangIngu
            CompareLib compareLib = new CompareLib();
197 787a4489 KangIngu
            //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 c91f45f3 djkim
                                       DocNo = docitem.DOCUMENT_NO,
372 787a4489 KangIngu
                                       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 2ab012e8 djkim
        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 787a4489 KangIngu
        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 992a98b4 KangIngu
                                         UpdateTime = DateTime.Parse(markup.UPDATE_TIME.ToString()),
542 787a4489 KangIngu
                                     };
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 }).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 }).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 2ab012e8 djkim
        [OperationContract]
731
        [ServiceKnownType(typeof(MEMBER))]
732
        public List<MEMBER> GetUserData(string ProjectNo, string UserID)
733
        {
734
            List<MEMBER> _result = new List<MEMBER>();
735 787a4489 KangIngu
736 2ab012e8 djkim
            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 787a4489 KangIngu
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 992a98b4 KangIngu
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 2ab012e8 djkim
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
                        });
1045
                    });
1046
                    Entity.SaveChanges();
1047
                }
1048
                catch (Exception)
1049
                {
1050
                    return false;
1051
                }
1052
            }
1053
            return true;
1054
        }
1055
1056
1057
        [OperationContract]
1058
        public bool SaveSymbol(SYMBOL_PRIVATE symbol_private)
1059
        {
1060
            try
1061
            {
1062
                using (KCOMDataModel.DataModel.KCOMEntities uc = new KCOMDataModel.DataModel.KCOMEntities(KCOMDataModel.Common.ConnectStringBuilder.KCOMConnectionString().ToString()))
1063
                {
1064
                    uc.AddToSYMBOL_PRIVATE(symbol_private);
1065
                    uc.SaveChanges();
1066
                }
1067
            }
1068
            catch(Exception)
1069
            {
1070
                return false;
1071
            }
1072
            return true;
1073
        }
1074
1075
        [OperationContract]
1076
        public bool DeleteSymbol(string symbol_id)
1077
        {
1078
            try
1079
            {
1080
                using (KCOMEntities Entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
1081
                {
1082
                    string delItem_ID = symbol_id;
1083
                    var delitem = Entity.SYMBOL_PRIVATE.Where(data => data.ID == delItem_ID).FirstOrDefault();
1084
                    Entity.SYMBOL_PRIVATE.DeleteObject(delitem);
1085
                    Entity.SaveChanges();
1086
                }
1087
            }
1088
            catch(Exception)
1089
            {
1090
                return false;
1091
            }
1092
            return true;
1093
        }
1094
1095
        [OperationContract]
1096
        public bool RenameSymbol(string symbol_id, string name)
1097
        {
1098
            try
1099
            {
1100
                using (KCOMEntities Entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
1101
                {
1102
                    var UpdateItem = Entity.SYMBOL_PRIVATE.Where(info => info.ID == symbol_id).FirstOrDefault();
1103
                    UpdateItem.NAME = name;
1104
                    Entity.SaveChanges();
1105
                }
1106
            }
1107
            catch (Exception)
1108
            {
1109
                return false;
1110
            }
1111
            return true;
1112
        }
1113
1114
        [OperationContract]
1115
        public bool AddCheckListHistory(string project_no, CHECK_LIST_HISTORY Check_History)
1116
        {
1117
            try
1118
            {                
1119
                using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
1120
                {
1121
                    Entity.CHECK_LIST_HISTORY.AddObject(Check_History);
1122
                    Entity.SaveChanges();  
1123
                }
1124
            }
1125
            catch (Exception)
1126
            {
1127
                return false;
1128
            }
1129
            return true;
1130
        }
1131
        [OperationContract]
1132
        public bool SaveCheckListHistory(string project_no, string rev, CHECK_LIST_HISTORY Check_History)
1133
        {
1134
            try
1135
            {
1136
                using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
1137
                {
1138
                    var item = Entity.CHECK_LIST_HISTORY.Where(info => info.REVISION == rev).FirstOrDefault();
1139
                    item = Check_History;
1140
                    Entity.SaveChanges();
1141
                }
1142
            }
1143
            catch (Exception)
1144
            {
1145
                return false;
1146
            }
1147
            return true;
1148
        }
1149
        [OperationContract]
1150
        public bool SaveCheckList(string project_no, string _id, CHECK_LIST Check_value)
1151
        {
1152
            try
1153
            {
1154
                using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
1155
                {
1156
                    var item = Entity.CHECK_LIST.Where(info => info.ID == _id).FirstOrDefault();
1157
                    item.TODOLIST = Check_value.TODOLIST;
1158
                    item.REMARK = Check_value.REMARK;
1159
                    item.STATUS = Check_value.STATUS;
1160
                    item.VENDOR = Check_value.VENDOR;
1161
                    item.REPLY = Check_value.REPLY;
1162
                    item.IMAGE_URL = Check_value.IMAGE_URL;
1163
                    item.IMAGE_ANCHOR = Check_value.IMAGE_ANCHOR;
1164
                    item.UPDATE_TIME = Check_value.UPDATE_TIME;
1165
                    Entity.SaveChanges();
1166
                }
1167
            }
1168
            catch (Exception)
1169
            {
1170
                return false;
1171
            }
1172
            return true;
1173
        }
1174
        [OperationContract]
1175
        public bool AddCheckList(string project_no, CHECK_LIST Check_value)
1176
        {
1177
            try
1178
            {
1179
                using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
1180
                {
1181
                    Entity.CHECK_LIST.AddObject(Check_value);
1182
                    Entity.SaveChanges();
1183
                }
1184
            }
1185
            catch (Exception)
1186
            {
1187
                return false;
1188
            }
1189
            return true;
1190
        }
1191
1192
        [OperationContract]
1193
        public CHECK_LIST GetCheckList(string project_no, string _id)
1194
        {
1195
            CHECK_LIST Check_value = new CHECK_LIST();
1196
            try
1197
            {
1198
                using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
1199
                {
1200
                    Check_value = Entity.CHECK_LIST.Where(info => info.ID == _id).FirstOrDefault();
1201
                }
1202
            }
1203
            catch (Exception)
1204
            {
1205
                return null;
1206
            }
1207
            return Check_value;
1208
        }
1209
        [OperationContract]
1210
        public List<CHECK_LIST> GetUserCheckList(string project_no, string user_id, string doc_no)
1211
        {
1212
            List<CHECK_LIST> list = new List<CHECK_LIST>();
1213
            try
1214
            {
1215
                using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
1216
                {
1217
                    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();
1218
                }
1219
            }
1220
            catch (Exception)
1221
            {
1222
                return null;
1223
            }
1224
            return list;
1225
        }
1226
        [OperationContract]
1227
        public List<CHECK_LIST_HISTORY> GetCheckListHistory(string project_no, string _id)
1228
        {
1229
            List<CHECK_LIST_HISTORY> history = new List<CHECK_LIST_HISTORY>();
1230
            try
1231
            {
1232
                using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
1233
                {
1234
                    history = Entity.CHECK_LIST_HISTORY.Where(data => data.CHECKLIST_ID == _id).ToList();
1235
                }
1236
            }
1237
            catch (Exception)
1238
            {
1239
                return null;
1240
            }
1241
            return history;
1242
        }
1243
        [OperationContract]
1244
        public CHECK_LIST_HISTORY GetCheckListHistoryFirstOrDefault(string project_no, string checklist_id, string rev)
1245
        {
1246
            CHECK_LIST_HISTORY Check_Item = new CHECK_LIST_HISTORY();
1247
            try
1248
            {
1249
                using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
1250
                {   
1251
                    Check_Item = Entity.CHECK_LIST_HISTORY.Where(info => info.CHECKLIST_ID == checklist_id && info.REVISION == rev).FirstOrDefault();
1252
                }
1253
            }
1254
            catch (Exception)
1255
            {
1256
                return null;
1257
            }
1258
            return Check_Item;
1259
        }
1260
        [OperationContract]
1261
        public bool SavePageAngle(string project_no, List<DOCPAGE> _mldocpage)
1262
        {
1263
            try
1264
            {
1265
                using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
1266
                {
1267
                    KCOMDataModel.DataModel.DOCPAGE _docpage = new KCOMDataModel.DataModel.DOCPAGE();
1268
                    _mldocpage.ForEach(data =>
1269
                    {
1270
                        _docpage = (from info in Entity.DOCPAGE
1271
                                    where info.ID == data.ID
1272
                                    select info).FirstOrDefault();
1273
1274
                        if (_docpage.PAGE_ANGLE != data.PAGE_ANGLE)
1275
                        {
1276
                            _docpage.PAGE_ANGLE = data.PAGE_ANGLE;
1277
                        }
1278
                    });
1279
1280
                    Entity.SaveChanges();
1281
                }
1282
            }
1283
            catch (Exception)
1284
            {
1285
                return false;
1286
            }
1287
            return true;
1288
        }
1289
1290
        [OperationContract]
1291
        public MARKUP_INFO GetMarkupInfo(string project_no, string _id)
1292
        {
1293
            MARKUP_INFO markupInfo = new MARKUP_INFO();
1294
1295
            try
1296
            {
1297
                using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
1298
                {
1299
                    markupInfo = Entity.MARKUP_INFO.Where(entity => entity.DOCINFO_ID == _id).OrderByDescending(i => i.CONSOLIDATE).OrderByDescending(j => j.CREATE_TIME).FirstOrDefault();
1300
                }
1301
            }
1302
            catch (Exception)
1303
            {
1304
                return null;
1305
            }
1306
            return markupInfo;
1307
        }
1308
1309
        [OperationContract]
1310
        public List<string> GetMarkupDataListperPage(string project_no, string _markupinfoid, int _pageNo)
1311
        {
1312
            List<string> markupdata = new List<string>();
1313
            MARKUP_INFO_VERSION markup_info_version = new MARKUP_INFO_VERSION();
1314
            try
1315
            {
1316
                using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
1317
                {
1318
                    markup_info_version = (from version in Entity.MARKUP_INFO_VERSION
1319
                                           where version.MARKUPINFO_ID == _markupinfoid
1320
                                           orderby version.CREATE_DATE descending
1321
                                           select version).First();
1322
                    markupdata = (from data in Entity.MARKUP_DATA
1323
                                  where data.MARKUPINFO_VERSION_ID == markup_info_version.ID && data.PAGENUMBER == _pageNo
1324
                                  select data.DATA).ToList();
1325
                }
1326
            }
1327
            catch (Exception)
1328
            {
1329
                return null;
1330
            }
1331
            return markupdata;
1332
        }
1333
1334
        [OperationContract]
1335
        public bool AddMarkupInfo(string project_no, MARKUP_INFO value)
1336
        {
1337
            try
1338
            {
1339
                using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
1340
                {
1341
                    Entity.MARKUP_INFO.AddObject(value);
1342
                    Entity.SaveChanges();
1343
                }
1344
            }
1345
            catch (Exception)
1346
            {
1347
                return false;
1348
            }
1349
            return true;
1350
        }
1351
1352
        [OperationContract]
1353
        public bool AddMarkupInfoVersion(string project_no, MARKUP_INFO_VERSION value)
1354
        {
1355
            try
1356
            {
1357
                using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
1358
                {
1359
                    Entity.MARKUP_INFO_VERSION.AddObject(value);
1360
                    Entity.SaveChanges();
1361
                }
1362
            }
1363
            catch (Exception)
1364
            {
1365
                return false;
1366
            }
1367
            return true;
1368
        }
1369
1370
        [OperationContract]
1371
        public bool AddMarkupData(string project_no, MARKUP_DATA value)
1372
        {
1373
            try
1374
            {
1375
                using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
1376
                {
1377
                    Entity.MARKUP_DATA.AddObject(value);
1378
                    Entity.SaveChanges();
1379
                }
1380
            }
1381
            catch (Exception)
1382
            {
1383
                return false;
1384
            }
1385
            return true;
1386
        }
1387
1388
        [OperationContract]
1389
        public bool AvoidMarkupInfo(string project_no, string _doc_id)
1390
        {
1391
            try
1392
            {
1393
                using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
1394
                {
1395
                    var item = Entity.MARKUP_INFO.Where(entity => entity.DOCINFO_ID == _doc_id).OrderByDescending(i => i.CONSOLIDATE).OrderByDescending(j => j.CREATE_TIME).FirstOrDefault();
1396
                    item.AVOID_CONSOLIDATE = 1;
1397
                    Entity.SaveChanges();
1398
                }
1399
            }
1400
            catch (Exception)
1401
            {
1402
                return false;
1403
            }
1404
            return true;
1405
        }
1406
1407
        [OperationContract]
1408
        public bool SaveMarkupInfo(string project_no, string _id, MARKUP_INFO value)
1409
        {
1410
            try
1411
            {
1412
                using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
1413
                {
1414
                    var item = Entity.MARKUP_INFO.Where(info => info.ID == _id).FirstOrDefault();
1415
                    item = value;                    
1416
                    Entity.SaveChanges();
1417
                }
1418
            }
1419
            catch (Exception)
1420
            {
1421
                return false;
1422
            }
1423
            return true;
1424
        }
1425
        [OperationContract]
1426
        public List<MARKUP_DATA> GetMarkupDataList(string project_no, string _versionid)
1427
        {
1428
            List<MARKUP_DATA> mlresult = new List<MARKUP_DATA>();
1429
1430
            try
1431
            {
1432
                using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
1433
                {
1434
                    mlresult = Entity.MARKUP_DATA.Where(data => data.MARKUPINFO_VERSION_ID == _versionid).ToList();
1435
                }
1436
            }
1437
            catch (Exception)
1438
            {
1439
                return null;
1440
            }
1441
            return mlresult;
1442
        }
1443
1444
        [OperationContract]
1445
        public bool Consolidate(string project_no, string _user_id, string _doc_id, List<MarkupInfoItem> markupInfoItems)
1446
        {
1447
            try
1448
            {
1449
                List<KCOMDataModel.DataModel.MARKUP_DATA> instanceDataSet = new List<KCOMDataModel.DataModel.MARKUP_DATA>();
1450
                using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
1451
                {
1452
                    var markupInfo = Entity.MARKUP_INFO.Where(entity => entity.DOCINFO_ID == _doc_id).OrderByDescending(i => i.CONSOLIDATE).OrderByDescending(j => j.CREATE_TIME).FirstOrDefault();
1453
                    if (markupInfo.CONSOLIDATE == 1)
1454
                    {
1455
                        markupInfo.AVOID_CONSOLIDATE = 1;
1456
                    }
1457
1458
                    foreach (MarkupInfoItem item in markupInfoItems)
1459
                    {
1460
                        Entity.MARKUP_DATA.Where(data => data.MARKUPINFO_VERSION_ID == item.MarkupVersionID).ToList().ForEach(d =>
1461
                        {
1462
                            instanceDataSet.Add(d);
1463
                        });
1464
                    }
1465
1466
                    KCOMDataModel.DataModel.MARKUP_INFO info = new KCOMDataModel.DataModel.MARKUP_INFO();
1467
                    info.ID = shortGuid();
1468
                    info.CONSOLIDATE = 1;
1469
                    info.CREATE_TIME = DateTime.Now;
1470
                    info.DOCINFO_ID = _doc_id;
1471
                    info.UPDATE_TIME = DateTime.Now;
1472
                    info.USER_ID = _user_id;
1473
                    info.AVOID_CONSOLIDATE = 0;
1474
1475
                    Entity.MARKUP_INFO.AddObject(info);
1476
                    Entity.SaveChanges();
1477
1478
1479
                    KCOMDataModel.DataModel.MARKUP_INFO_VERSION info2 = new KCOMDataModel.DataModel.MARKUP_INFO_VERSION
1480
                    {
1481
                        ID = shortGuid(),
1482
                        CREATE_DATE = DateTime.Now,
1483
                        MARKUP_INFO = info,
1484
                    };
1485
                    Entity.SaveChanges();
1486
1487
                    foreach (var item in instanceDataSet)
1488
                    {
1489
                        Entity.MARKUP_DATA.AddObject(new KCOMDataModel.DataModel.MARKUP_DATA
1490
                        {
1491
                            ID = shortGuid(),
1492
                            DATA = item.DATA,
1493
                            DATA_TYPE = item.DATA_TYPE,
1494
                            PAGENUMBER = item.PAGENUMBER,
1495
                            MARKUP_INFO_VERSION = info2
1496
                        });
1497
                    }
1498
                    Entity.SaveChanges();
1499
1500
1501
                }
1502
            }
1503
            catch (Exception)
1504
            {
1505
                return false;
1506
            }
1507
            return true;
1508
        }
1509
1510
        [OperationContract]
1511 04a7385a djkim
        public bool TeamConsolidate(string project_no, string _user_id, string _doc_id, List<MarkupInfoItem> markupInfoItems)
1512
        {
1513
            try
1514
            {
1515
                List<KCOMDataModel.DataModel.MARKUP_DATA> instanceDataSet = new List<KCOMDataModel.DataModel.MARKUP_DATA>();
1516
                using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
1517
                {
1518
                    var markupInfo = Entity.MARKUP_INFO.Where(entity => entity.DOCINFO_ID == _doc_id).OrderByDescending(i => i.CONSOLIDATE).OrderByDescending(j => j.CREATE_TIME).FirstOrDefault();
1519
                    if (markupInfo.PART_CONSOLIDATE == 1)
1520
                    {
1521
                        markupInfo.AVOID_CONSOLIDATE = 1;
1522
                    }
1523
1524
                    foreach (MarkupInfoItem item in markupInfoItems)
1525
                    {
1526
                        Entity.MARKUP_DATA.Where(data => data.MARKUPINFO_VERSION_ID == item.MarkupVersionID).ToList().ForEach(d =>
1527
                        {
1528
                            instanceDataSet.Add(d);
1529
                        });
1530
                    }
1531
1532
                    KCOMDataModel.DataModel.MARKUP_INFO info = new KCOMDataModel.DataModel.MARKUP_INFO();
1533
                    info.ID = shortGuid();
1534
                    info.PART_CONSOLIDATE = 1;
1535
                    info.CREATE_TIME = DateTime.Now;
1536
                    info.DOCINFO_ID = _doc_id;
1537
                    info.UPDATE_TIME = DateTime.Now;
1538
                    info.USER_ID = _user_id;
1539
                    info.AVOID_CONSOLIDATE = 0;
1540
1541
                    Entity.MARKUP_INFO.AddObject(info);
1542
                    Entity.SaveChanges();
1543
1544
1545
                    KCOMDataModel.DataModel.MARKUP_INFO_VERSION info2 = new KCOMDataModel.DataModel.MARKUP_INFO_VERSION
1546
                    {
1547
                        ID = shortGuid(),
1548
                        CREATE_DATE = DateTime.Now,
1549
                        MARKUP_INFO = info,
1550
                    };
1551
                    Entity.SaveChanges();
1552
1553
                    foreach (var item in instanceDataSet)
1554
                    {
1555
                        Entity.MARKUP_DATA.AddObject(new KCOMDataModel.DataModel.MARKUP_DATA
1556
                        {
1557
                            ID = shortGuid(),
1558
                            DATA = item.DATA,
1559
                            DATA_TYPE = item.DATA_TYPE,
1560
                            PAGENUMBER = item.PAGENUMBER,
1561
                            MARKUP_INFO_VERSION = info2
1562
                        });
1563
                    }
1564
                    Entity.SaveChanges();
1565
1566
1567
                }
1568
            }
1569
            catch (Exception)
1570
            {
1571
                return false;
1572
            }
1573
            return true;
1574
        }
1575
1576
        [OperationContract]
1577 2ab012e8 djkim
        [ServiceKnownType(typeof(MEMBER))]
1578
        public MEMBER GetMember(string project_no, string user_id)
1579
        {
1580
            MEMBER rstmember = new MEMBER();
1581
            try
1582
            {
1583
                using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
1584
                {
1585
                    var tmp = (from member in Entity.MEMBER
1586
                                    where member.ID == user_id
1587
                                    select member).FirstOrDefault();
1588
                    rstmember.DEPARTMENT = tmp.DEPARTMENT;
1589
                    rstmember.ID = tmp.ID;
1590
                    rstmember.NAME = tmp.NAME;
1591
                }
1592
            }
1593
            catch (Exception)
1594
            {
1595
                return null;
1596
            }
1597
            return rstmember;
1598
        }
1599
1600
        [OperationContract]
1601
        public List<SYMBOL_PRIVATE> GetSymbolList(string user_id)
1602
        {
1603
            List<SYMBOL_PRIVATE> Custom_List = new List<SYMBOL_PRIVATE>();
1604
            try
1605
            {
1606
                using (KCOMEntities Entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
1607
                {
1608
                    Custom_List = Entity.SYMBOL_PRIVATE.Where(data => data.MEMBER_USER_ID == user_id).ToList();
1609
                }
1610
            }
1611
            catch (Exception)
1612
            {
1613
                return null;
1614
            }
1615
            return Custom_List;
1616
        }
1617
        [OperationContract]
1618
        public List<string> GetPublicSymbolDeptList()
1619
        {
1620
            List<string> Custom_List = new List<string>();
1621
            try
1622
            {
1623
                using (KCOMEntities Entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
1624
                {
1625
                    Custom_List = Entity.SYMBOL_PUBLIC.Select(data => data.DEPARTMENT).ToList();
1626
                }
1627
            }
1628
            catch (Exception)
1629
            {
1630
                return null;
1631
            }
1632
            return Custom_List;
1633
        }
1634
        [OperationContract]
1635
        public List<SYMBOL_PUBLIC> GetPublicSymbolList(string dept)
1636
        {
1637
            List<SYMBOL_PUBLIC> Custom_List = new List<SYMBOL_PUBLIC>();
1638
            try
1639
            {
1640
                using (KCOMEntities Entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
1641
                {
1642
                    if(!string.IsNullOrEmpty(dept))
1643
                    {
1644
                        Custom_List = Entity.SYMBOL_PUBLIC.Where(data => data.DEPARTMENT == dept).ToList();
1645
                    }
1646
                    else
1647
                    {
1648
                        Custom_List = Entity.SYMBOL_PUBLIC.ToList();
1649
                    }
1650
                    
1651
                }
1652
            }
1653
            catch (Exception)
1654
            {
1655
                return null;
1656
            }
1657
            return Custom_List;
1658
        }
1659
1660
        /// <summary>
1661
        /// 
1662
        /// </summary>
1663
        /// <param name="id">symbol id</param>
1664
        /// <param name="type"> 0 : PRIVATE, 1 : PUBLIC</param>
1665
        /// <returns></returns>
1666
        [OperationContract]
1667
        public string GetSymbolData(string id, int type)
1668
        {
1669
            string result;
1670
            try
1671
            {
1672
                using (KCOMEntities Entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
1673
                {
1674
                    if(type == 0)
1675
                    {
1676
                        result = Entity.SYMBOL_PRIVATE.Where(data => data.ID == id).FirstOrDefault().DATA;
1677
                    }
1678
                    else
1679
                    {
1680
                        result = Entity.SYMBOL_PUBLIC.Where(data => data.ID == id).FirstOrDefault().DATA;
1681
                    }
1682
                }
1683
            }
1684
            catch (Exception)
1685
            {
1686
                return null;
1687
            }
1688
            return result;
1689
        }
1690
1691
        [OperationContract]
1692
        public string GetSignData(string project_no, string user_id)
1693
        {
1694
            string result = null;
1695
            try
1696
            {
1697
                var ModelWFConnectionString = ConnectStringBuilder.ProjectCIConnectString(project_no).ToString();
1698
                if (null != ModelWFConnectionString)
1699
                {
1700
                    using (CIEntities entity = new CIEntities(ModelWFConnectionString))
1701
                    {
1702
                        var _sign = entity.SIGN_INFO.Where(sin => sin.MEMBER_USER_ID == user_id);
1703
                        if (_sign.Count() > 0)
1704
                        {
1705
                            result = _sign.First().SIGN_STR;                            
1706
                        }
1707
                        else
1708
                        {
1709
                            return null;
1710
                        }
1711
                    }
1712
                }
1713
            }
1714
            catch (Exception)
1715
            {
1716
                return null;
1717
            }
1718
            return result;
1719
        }
1720
1721
        [OperationContract]        
1722
        public string GetProjectName(string project_no)
1723
        {
1724
            string result = null;
1725
1726
            try
1727
            {
1728
                using (KCOMDataModel.DataModel.KCOMEntities Entity = new KCOMDataModel.DataModel.KCOMEntities(KCOMDataModel.Common.ConnectStringBuilder.KCOMConnectionString().ToString()))
1729
                {
1730
                    result = Entity.RUN_PROJECTS.Where(i => i.PROJECT_NO == project_no).FirstOrDefault().PROJECT_NAME.ToString();
1731
                }
1732
            }
1733
            catch (Exception)
1734
            {
1735
                return null;
1736
            }
1737
            return result;
1738
        }
1739
1740
        [OperationContract]
1741
        public List<DOCUMENT_ITEM> GetPreRevSelect(string project_no, string doc_no, string current_rev)
1742
        {
1743
            List<DOCUMENT_ITEM> result = new List<DOCUMENT_ITEM>();
1744
            
1745
            try
1746
            {
1747
                using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
1748
                {
1749
                    result = Entity.DOCUMENT_ITEM.Where(i => i.PROJECT_NO == project_no
1750
                    && i.DOCUMENT_NO == doc_no
1751
                    && i.REVISION != current_rev).OrderByDescending(i => i.GROUP_NO).ToList();
1752
                }
1753
            }
1754
            catch (Exception)
1755
            {
1756
                return null;
1757
            }
1758
            return result;
1759
        }
1760
1761
        [OperationContract]
1762
        public DOCINFO GetDocInfoOneSelect(string project_no, string doc_id)
1763
        {
1764
            DOCINFO docinfo = null;
1765
1766
            try
1767
            {
1768
                using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
1769
                {
1770
                    docinfo = (from info in Entity.DOCINFO
1771
                              where info.DOCUMENT_ID == doc_id
1772
                              && info.PROJECT_NO == project_no
1773
                              select info).First();
1774
                }
1775
            }
1776
            catch (Exception)
1777
            {
1778
                return null;
1779
            }
1780
            return docinfo;
1781
        }
1782
1783
        [OperationContract]
1784
        public List<MarkupInfoItem> GetPrintDocItemList(string project_no, string doc_id, List<MarkupInfoItem> _markupInfoList)
1785
        {
1786
            MarkupInfoItem _result = null;
1787
            List<MarkupInfoItem> markupinfo = new List<MarkupInfoItem>();
1788
            try
1789
            {
1790
                using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
1791
                {
1792
                    var docitem = (from info in Entity.DOCINFO
1793
                               where info.DOCUMENT_ID == doc_id
1794
                               && info.PROJECT_NO == project_no
1795
                               select info).First();
1796
1797
                    foreach (MARKUP_INFO markinfo in docitem.MARKUP_INFO)
1798
                    {
1799
                        var member = (from mem in Entity.MEMBER
1800
                                     where mem.ID == markinfo.USER_ID
1801
                                     select mem).First();
1802
                        string displaycolor = null;
1803
                        try
1804
                        {
1805
                            displaycolor = _markupInfoList.Where(info => info.MarkupInfoID == markinfo.ID).First().DisplayColor;
1806
                        }
1807
                        catch(Exception)
1808
                        {
1809
                            displaycolor = "#FFFFFF";
1810
                        }
1811
                        
1812
                        _result = new MarkupInfoItem
1813
                        {
1814
                            MarkupInfoID = markinfo.ID,
1815
                            Consolidate = markinfo.CONSOLIDATE,
1816
                            CreateTime = markinfo.UPDATE_TIME.HasValue ? markinfo.UPDATE_TIME.Value : markinfo.CREATE_TIME,
1817
                            DisplayColor = displaycolor,
1818
                            UserID = markinfo.USER_ID,
1819
                            UserName = member.NAME,
1820
                            Depatment = member.DEPARTMENT,
1821
                        };
1822
1823
                        _result.MarkupList = new List<IKCOM.MarkupItem>();
1824
                        var markup_Version = markinfo.MARKUP_INFO_VERSION.OrderByDescending(p => p.CREATE_DATE).First();
1825
1826
                        foreach (MARKUP_DATA markdata in markup_Version.MARKUP_DATA)
1827
                        {
1828
                            MarkupItem markitem = new MarkupItem()
1829
                            {
1830
                                ID = markdata.ID,
1831
                                PageNumber = markdata.PAGENUMBER,
1832
                            };
1833
                            _result.MarkupList.Add(markitem);
1834
                        }
1835
1836
                        _result.PageCount = _result.MarkupList.GroupBy(i => i.PageNumber).Count();
1837
1838
                        markupinfo.Add(_result);
1839
                    }
1840
                }
1841
            }
1842
            catch (Exception)
1843
            {
1844
                return null;
1845
            }
1846
            return markupinfo;
1847
        }
1848 04a7385a djkim
1849
        [OperationContract]
1850
        public bool AddMessage(string project_no, TALK value)
1851
        {
1852
            try
1853
            {
1854
                using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
1855
                {                    
1856
                    entity.TALK.AddObject(value);
1857
                    entity.SaveChanges();
1858
                }
1859
            }
1860
            catch (Exception)
1861
            {
1862
                return false;
1863
            }
1864
            return true;
1865
        }
1866
1867
        [OperationContract]
1868
        public List<TALK> GetMessage(string project_no, string doc_id)
1869
        {
1870
            List<TALK> result = new List<TALK>();
1871
            try
1872
            {
1873
                using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
1874
                {
1875
                    result = entity.TALK.Where(data => data.DOCUMENT_ID == doc_id).ToList();                        
1876
                }
1877
            }
1878
            catch (Exception)
1879
            {
1880
                return result;
1881
            }
1882
            return result;
1883
        }
1884 787a4489 KangIngu
    }
1885
}
클립보드 이미지 추가 (최대 크기: 500 MB)