프로젝트

일반

사용자정보

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

markus / KCOM_API / ServiceDeepView.svc.cs @ d71b4688

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

1
using IFinalPDF;
2
using IKCOM;
3
using KCOMDataModel.Common;
4
using KCOMDataModel.DataModel;
5
using MARKUS;
6
using System;
7
using System.Collections.Generic;
8
using System.Collections.ObjectModel;
9
using System.Linq;
10
using System.Net;
11
using System.Runtime.Remoting.Channels.Tcp;
12
using System.Runtime.Serialization;
13
using System.ServiceModel;
14
using System.ServiceModel.Activation;
15
using System.Text;
16
using System.Windows;
17
using System.Xml;
18

    
19
namespace KCOM_API
20
{
21
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "ServiceDeepView" in code, svc and config file together.
22
    // NOTE: In order to launch WCF Test Client for testing this service, please select ServiceDeepView.svc or ServiceDeepView.svc.cs at the Solution Explorer and start debugging.
23
    [ServiceContract(Namespace = "")]
24
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
25
    public partial class ServiceDeepView : System.Web.Services.WebService
26
    {
27
        //[OperationContract]
28
        //public List<HoneyheadTEXT> GetSearchText(int pageNo, string filePath,bool IsAllPage) //0아 아니면 지정 페이지
29
        //{
30

    
31
        //    return null;
32
        //}
33

    
34
        [OperationContract]
35
        public string GetVersionData(bool is64BitProcess, string markusVer)
36
        {
37
            string url = null;
38
            int[] markusVersion = Array.ConvertAll<string, int>(markusVer.Split('.'), int.Parse);
39

    
40
            try
41
            {
42
                using (KCOMEntities uc = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
43
                {                    
44
                    if (is64BitProcess) //64 bit machine
45
                    {
46
                        var versionData = uc.PROPERTIES.Where(data => data.TYPE == "Update_x64").FirstOrDefault();
47
                        int[] dbversion = Array.ConvertAll<string, int>(versionData.PROPERTY.Split('.'), int.Parse);
48
                        if (dbversion[0] > markusVersion[0] || dbversion[1] > markusVersion[1] || dbversion[2] > markusVersion[2] || dbversion[3] > markusVersion[3])
49
                        {
50
                            url = versionData.VALUE;
51
                        }
52
                    }
53
                    else
54
                    {
55
                        var versionData = uc.PROPERTIES.Where(data => data.TYPE == "Update_x84").FirstOrDefault();
56
                        int[] dbversion = Array.ConvertAll<string, int>(versionData.PROPERTY.Split('.'), int.Parse);
57
                        if (dbversion[0] > markusVersion[0] || dbversion[1] > markusVersion[1] || dbversion[2] > markusVersion[2] || dbversion[3] > markusVersion[3])
58
                        {
59
                            url = versionData.VALUE;
60
                        }
61
                    }                    
62
                }
63
            }
64
            catch (Exception)
65
            {
66
                url = null;
67
            }
68
            return url;
69
        }
70

    
71

    
72
        [OperationContract]
73
        public KCOM_SystemInfo GetSystemData()
74
        {
75
            try
76
            {
77
                using (KCOMEntities uc = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
78
                {
79
                    var SystemInfoSet = uc.PROPERTIES.Where(data => data.TYPE == "SystemInfo").ToList();
80

    
81
                    KCOM_SystemInfo sysInfo = new KCOM_SystemInfo();
82

    
83
                    var url = SystemInfoSet.Where(data => data.PROPERTY == "Url").FirstOrDefault();
84
                    if (url != null)
85
                    {
86
                        sysInfo.HostName = url.VALUE;
87
                    }
88

    
89
                    url = SystemInfoSet.Where(data => data.PROPERTY == "Port").FirstOrDefault();
90
                    if (url != null)
91
                    {
92
                        sysInfo.HostPort = url.VALUE;
93
                    }
94

    
95
                    url = uc.PROPERTIES.Where(data => data.TYPE == "STAMP").FirstOrDefault();
96
                    if(url != null)
97
                    {
98
                        sysInfo.STAMP = url.VALUE;
99
                    }
100
                    return sysInfo;
101
                }
102
            }
103
            catch (Exception ex)
104
            {
105
            }
106
            return null;
107
            GC.Collect(2);
108
        }
109

    
110
        private static string shortGuid()
111
        {
112
            byte[] bytes = new byte[16];
113
            using (var provider = System.Security.Cryptography.RandomNumberGenerator.Create())
114
            {
115
                provider.GetBytes(bytes);
116
            }
117

    
118
            var guid = new Guid(bytes);
119

    
120
            return Convert.ToBase64String(guid.ToByteArray())
121
                .Substring(0, 10)
122
                .Replace("/", "")
123
                .Replace("+", "") + DateTime.UtcNow.Ticks.ToString("x");
124
        }
125

    
126

    
127
        [OperationContract]
128
        public List<FAVORITE_DOC> GetFavoriteVP(string PrjNo, string userID, string sharepointItemID)
129
        {
130
            using (KCOMEntities dc = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
131
            {
132

    
133
                int flagString = Convert.ToInt32(FAVORITE_FLAG.Personal);
134
                List<FAVORITE_DOC> favoriteListSet = new List<FAVORITE_DOC>();
135
                //dc.FAVORITE_DOC.Where(data => data.PROJECT_NO == PrjNo && data.DOCUMENT_ID == sharepointItemID && data.FLAG !=
136
                //    flagString).ToList().ForEach(data => favoriteListSet.Add(data));
137

    
138

    
139
                //dc.FAVORITE_DOC.Where(data => data.PROJECT_NO == PrjNo && data.MEMBER_USER_ID == userID).ToList().ForEach(data => favoriteListSet.Add(data));
140

    
141
                favoriteListSet = dc.FAVORITE_DOC.Where(data => data.PROJECT_NO == PrjNo && data.MEMBER_USER_ID == userID && data.DOCUMENT_ID == sharepointItemID).ToList();
142

    
143
                //favoriteListSet = favoriteListSet.Distinct().ToList();
144
                return favoriteListSet;
145
            }
146
        }
147
        [OperationContract]
148
        public bool EditFavoriteVP(string prjNo, string userID, string docID, int state, string description)
149
        {
150
            using (KCOMEntities dc = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
151
            {
152
                //List<FAVORITE_DOC> favoriteSet = dc.FAVORITE_DOC.Where(data => data.PROJECT_NO == prjNo && data.MEMBER_USER_ID == userID
153
                //    && data.PAGE_NO == SavePageNo && data.CREATE_TIME == createTime).ToList();
154
                List<FAVORITE_DOC> favoriteSet = dc.FAVORITE_DOC.Where(data => data.PROJECT_NO == prjNo && data.MEMBER_USER_ID == userID
155
                    && data.ID == docID).ToList();
156
                try
157
                {
158

    
159
                    if (favoriteSet.Count > 0)
160
                    {
161
                        var FavoriteVP_Instance = favoriteSet.First();
162

    
163
                        FavoriteVP_Instance.DESCRIPTION = description;
164
                        FavoriteVP_Instance.FLAG = state;
165

    
166
                        dc.SaveChanges();
167

    
168
                        return true;
169
                    }
170
                    else
171
                    {
172
                        return false;
173
                    }
174
                }
175
                catch (Exception)
176
                {
177
                    return false;
178
                }
179
            }
180
        }
181

    
182
        [OperationContract]
183
        public bool DelFavoriteVP(string prjNo, string userID, int SavePageNo, string docID)
184
        {
185

    
186
            using (KCOMEntities dc = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
187
            {
188

    
189
                List<FAVORITE_DOC> favoriteSet = dc.FAVORITE_DOC.Where(data => data.PROJECT_NO == prjNo && data.MEMBER_USER_ID == userID
190
                    && data.ID == docID).ToList();
191

    
192
                try
193
                {
194
                    if (favoriteSet.Count > 0)
195
                    {
196
                        favoriteSet.ForEach(data => dc.FAVORITE_DOC.DeleteObject(data));
197
                        dc.SaveChanges();
198
                        return true;
199
                    }
200
                    else
201
                    {
202
                        return false;
203
                    }
204
                }
205
                catch (Exception)
206
                {
207
                    return false;
208
                }
209
            }
210
        }
211

    
212

    
213
        [OperationContract]
214
        public List<Rect> GetCompareRect(string projectNo, string originDocItem_ID, string targetDocItem_ID, string originPageNo, string targetPageNo, string isInternalAddress)
215
        {
216
            //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);
217
            //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);
218

    
219
            string originFile = "";
220
            string targetFile = "";
221

    
222
            if (Boolean.Parse(isInternalAddress))
223
            {
224
                originFile = String.Format(KCOM_API.Properties.Settings.Default.TileSoucePath, projectNo, (Convert.ToUInt32(originDocItem_ID) / 100).ToString(), originDocItem_ID, originPageNo);
225
                targetFile = String.Format(KCOM_API.Properties.Settings.Default.TileSoucePath, projectNo, (Convert.ToUInt32(targetDocItem_ID) / 100).ToString(), targetDocItem_ID, targetPageNo);
226
            }
227
            else
228
            {
229
                originFile = String.Format(KCOM_API.Properties.Settings.Default.TileSoucePath_SUB, projectNo,  originDocItem_ID, originPageNo);
230
                targetFile = String.Format(KCOM_API.Properties.Settings.Default.TileSoucePath_SUB, projectNo,  targetDocItem_ID, targetPageNo);
231
            }
232

    
233
            CompareLib compareLib = new CompareLib();
234
            //System.IO.Stream resultOrigin = compareLib.ChangeCmpUrlToPng(originFile);
235
            //System.IO.Stream resultTarget = compareLib.ChangeCmpUrlToPng(targetFile);
236

    
237
            var resultOrigin = compareLib.ChangeCmpUrlToPng_File(originFile);
238
            var resultTarget = compareLib.ChangeCmpUrlToPng_File(targetFile);
239

    
240
            string outPutFile = compareLib.ImageCompare_File(resultOrigin, resultTarget);
241
            var result = compareLib.GetBoundBoxInImage(outPutFile);
242

    
243
            return result;
244
        }
245

    
246

    
247

    
248
        #region Final PDF
249
        private string _ChanID = null;
250
        TcpChannel chan = null;
251
        [OperationContract]
252
        public FinalPDFResult SetFinalPDF(string ProjectNo, string DocInfoID, string MarkupInfoID, string CreateUserID)
253
        {
254
            #region 임시보관
255
            #endregion
256
            FinalPDFResult _result = new FinalPDFResult();
257
            RemFinalPDFObject remObj = null;
258
            try
259
            {
260
                string _finalID = shortGuid();
261
                int _DocTotalPages = -1;
262
                string docItemId;
263

    
264

    
265
                using (CIEntities _ci = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString()))
266
                {
267
                    var _doc = _ci.DOCINFO.Where(info => info.ID == DocInfoID);
268

    
269
                    if (_doc.Count() > 0)
270
                    {
271
                        _DocTotalPages = _doc.First().PAGE_COUNT;
272
                        docItemId = _doc.First().DOCUMENT_ID;
273
                    }
274
                    else
275
                    {
276
                        _result.Status = FinalStatus.Error;
277
                        _result.Exception = "페이지 정보를 가져올 수 없습니다.";
278
                        return _result;
279
                    }
280
                }
281
                if (_DocTotalPages > 0)
282
                {
283
                    FINAL_PDF fm = new FINAL_PDF()
284
                    {
285
                        ID = _finalID,
286
                        PROJECT_NO = ProjectNo,
287
                        DOCINFO_ID = DocInfoID,
288
                        DOCUMENT_ID = docItemId,
289
                        MARKUPINFO_ID = MarkupInfoID,
290
                        CREATE_USER_ID = CreateUserID,
291
                        TOTAL_PAGE = _DocTotalPages,
292
                        CREATE_DATETIME = DateTime.Now,
293
                        STATUS = (int)IFinalPDF.FinalStatus.Insert
294
                    };
295
                    using (KCOMEntities _entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
296
                    {
297
                        _entity.AddToFINAL_PDF(fm);
298
                        _entity.SaveChanges(System.Data.Objects.SaveOptions.AcceptAllChangesAfterSave);
299
                    };
300

    
301
                    System.Runtime.Remoting.Channels.IChannel _ch = System.Runtime.Remoting.Channels.ChannelServices.GetChannel("tcp");
302
                    if (_ch == null)
303
                    {
304
                        chan = new TcpChannel();
305
                        _ChanID = chan.ChannelName;
306
                        System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(chan, false);
307
                        // Create an instance of the remote object
308

    
309

    
310
                        using (KCOMEntities ec = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
311
                        {
312

    
313
                            //remObj = (RemFinalPDFObject)Activator.GetObject(typeof(RemFinalPDFObject),
314
                            //                          "tcp://localhost:9092/remFinalPDF");
315
                            remObj = (RemFinalPDFObject)Activator.GetObject(typeof(RemFinalPDFObject),
316
                                                      //"tcp://192.168.0.67:9092/remFinalPDF");
317
                                                      "tcp://localhost:9092/remFinalPDF");
318
                        }
319

    
320
                        //"tcp://localhost:8080/remFinalPDF");
321

    
322
                        _result = remObj.SetFinalPDF(ProjectNo, _finalID);
323
                        _result.FinalID = _finalID;
324
                        _result.Status = FinalStatus.Success;
325

    
326
                        //MarkupToPDF.MarkupToPDF fa = new MarkupToPDF.MarkupToPDF();
327
                        //fa.MakeFinalPDF(fm);
328
                    }
329
                    else
330
                    {
331
                        _ChanID = _ch.ChannelName;
332
                    }
333
                }
334
            }
335
            catch (Exception ex)
336
            {
337
                _result.Status = FinalStatus.Error;
338

    
339
                if (ex.GetType() == typeof(System.Net.Sockets.SocketException))
340
                    _result.Exception = "Final Server Not Connection";
341
                else _result.Exception = ex.ToString();
342
            }
343
            finally
344
            {
345
                remObj = null;
346
                if (System.Runtime.Remoting.Channels.ChannelServices.GetChannel("tcp") != null)
347
                    System.Runtime.Remoting.Channels.ChannelServices.UnregisterChannel(chan);
348

    
349
                GC.Collect(2);
350
            }
351
            return _result;
352
        }
353
        #endregion
354

    
355

    
356
        [OperationContract]
357
        public bool GetConversionState(KCOM_BasicParam param)
358
        {
359
            using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(param.projectNo).ToString()))
360
            {
361
                var doc = entity.DOCINFO.Where(data => data.DOCUMENT_ID == param.documentID).FirstOrDefault();
362
                if (doc != null)
363
                {
364
                    var count = doc.DOCPAGE.Where(data => data.DOCINFO_ID == doc.ID).Count();
365
                    if (doc.PAGE_COUNT == count)  //페이지 수가 일치하는지
366
                    {
367
                        return true;
368
                    }
369
                    else //페이지 수가 일치하지 않는 경우
370
                    {
371
                        KCOMEntities entity_kcom = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString());
372
                        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();
373

    
374
                        if (lst != null || lst.Count >= 1)
375
                        {
376
                            //Common.Helper.SystemErrorNotify(SERVICE_NAME.API, LEVEL.MEDIUM, ERROR_TYPE.CONVERT, Resources.ResourceManager.GetString("MSG_ERROR_PAGECOUNT"), param.documentID, param.projectNo);
377
                            //이메일 클라이언트를 구현해야함
378
                        }
379
                        return false;
380
                    }
381
                }
382
                else
383
                {
384
                    //Common.Helper.SystemErrorNotify(SERVICE_NAME.API, LEVEL.MEDIUM, ERROR_TYPE.CONVERT, Resources.ResourceManager.GetString("MSG_ERROR_CONVERTFAILED"), param.documentID, param.projectNo);
385
                    //이메일 클라이언트를 구현해야함
386
                    return false;
387
                }
388
            }
389
        }
390

    
391
        [OperationContract]
392
        public List<VPRevision> GetVPRevisionHistory(string ProjectNo, string vpNo, string DocumentId)
393
        {
394
            List<VPRevision> _result = new List<VPRevision>();
395
            try
396
            {
397
                using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString()))
398
                {
399
                    var _vpList = (from docitem in entity.DOCUMENT_ITEM
400
                                   where docitem.DOCUMENT_NO == vpNo
401
                                   select new VPRevision
402
                                   {
403
                                       RevNo = docitem.REVISION,
404
                                       GroupNo = docitem.GROUP_NO,
405
                                       FROM_VENDOR = docitem.ORIGINAL_FILE,
406
                                       DOCUMENT_ID = docitem.DOCUMENT_ID,
407
                                       TO_VENDOR = docitem.RESULT_FILE,
408
                                       RESULT = docitem.RESULT,
409
                                       DocNo = docitem.DOCUMENT_NO,
410
                                       EnsembleLink = docitem.ENSEMBLEINFO_URL,
411
                                       //IsSyncPossible = docitem.DOCUMENT_ID == DocumentId ? false : entity.DOCINFO.Where(d => d.DOCUMENT_ID == docitem.DOCUMENT_ID).ToList().Count > 0 ? true : false
412
                                   });
413
                    _result = _vpList.ToList();
414
                    foreach (var vp in _result)
415
                    {
416
                        if (entity.DOCINFO.Where(d => d.DOCUMENT_ID == vp.DOCUMENT_ID).ToList().Count > 0)
417
                            vp.IsSyncPossible = true;
418
                        else
419
                            vp.IsSyncPossible = false;
420
                    }
421
                    _result = _result.OrderByDescending(r => UInt64.Parse(System.Text.RegularExpressions.Regex.Replace(r.GroupNo, @"\D", ""))).ToList();
422
                }
423
            }
424
            catch (Exception)
425
            {
426

    
427
                throw;
428
            }
429
            finally
430
            {
431
                GC.Collect(2);
432
            }
433
            return _result;
434
        }
435

    
436
        [OperationContract]
437
        public VPRevision GetVPRevisionFirstOrDefault(string ProjectNo, string DocumentId)
438
        {
439
            VPRevision _result = null;
440
            try
441
            {
442
                using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString()))
443
                {
444
                    _result = (from docitem in entity.DOCUMENT_ITEM
445
                     where docitem.DOCUMENT_ID == DocumentId
446
                     select new VPRevision
447
                     {
448
                         RevNo = docitem.REVISION,
449
                         GroupNo = docitem.GROUP_NO,
450
                         FROM_VENDOR = docitem.ORIGINAL_FILE,
451
                         DOCUMENT_ID = docitem.DOCUMENT_ID,
452
                         TO_VENDOR = docitem.RESULT_FILE,
453
                         RESULT = docitem.RESULT
454
                     }).FirstOrDefault();
455
                }
456
            }
457
            catch (Exception)
458
            {
459
                throw;
460
            }
461
            finally
462
            {
463
                GC.Collect(2);
464
            }
465
            return _result;
466
        }
467

    
468
        [OperationContract]
469
        public DOCINFO GetDocInfo(KCOM_BasicParam param)
470
        {
471
            DOCINFO _result = null;
472
            try
473
            {
474
                // 차후 아래의 코드로 변경
475
                //using (CI_Entities ModelDeeview = new CI_Entities(DaelimCiConnectionString.ToString()))
476
                CIEntities ModelDeeview = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(param.projectNo).ToString());
477

    
478
                var docinfo = ModelDeeview.DOCINFO.Where(doc => doc.DOCUMENT_ID == param.documentID);
479
                if (docinfo.Count() > 0)
480
                {
481
                    _result = docinfo.First();
482
                    _result.MARKUP_INFO.Clear();
483

    
484
                }
485
                return _result;
486

    
487
            }
488
            catch (Exception ex)
489
            {
490
                System.Diagnostics.Trace.WriteLine("GetDocInfo Error : " + ex);
491
            }
492
            finally
493
            {
494
                GC.Collect(2);
495
            }
496
            return null;
497
        }
498

    
499
        [OperationContract]
500
        public bool GetCheckSystemAdmin(string UserID)
501
        {
502
            using (KCOMEntities uc = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
503
            {
504
                var user = uc.PROPERTIES.Where(data => data.TYPE == "Administrator" && data.PROPERTY.Contains(UserID)).FirstOrDefault();
505
                if (user != null)
506
                {
507
                    return true;
508
                }
509
                else
510
                {
511
                    return false;
512
                }
513
            }
514
            GC.Collect(2);
515
        }
516

    
517
        [OperationContract]
518
        public DOCUMENT_ITEM GetDocumentItemInfo(KCOM_BasicParam param)
519
        {
520
            ///param : prjNo, documentId, userId
521
            DOCUMENT_ITEM _result = null;
522

    
523
            try
524
            {
525
                CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(param.projectNo).ToString());
526

    
527
                var _items = entity.DOCUMENT_ITEM.Where(data => data.DOCUMENT_ID == param.documentID);
528

    
529
                if (_items.Count() > 0)
530
                {
531
                    _result = _items.First();
532

    
533
                    return _result;
534
                }
535
                //else
536
                //{
537
                //    Common.Helper.SystemErrorNotify(SERVICE_NAME.API, LEVEL.MEDIUM, ERROR_TYPE.CONVERT, Resources.ResourceManager.GetString("MSG_ERROR_DOCUMENTNOTFOUND"), param.documentID, param.projectNo);
538
                //}
539
            }
540
            catch (Exception ex)
541
            {
542
                System.Diagnostics.Trace.WriteLine("GetVendorItemInfo Error : " + ex);
543
                //Common.Helper.SystemErrorNotify(SERVICE_NAME.API, LEVEL.MEDIUM, ERROR_TYPE.CONVERT, "GetDocumentItemInfo / " + ex.Message, param.documentID, param.projectNo);
544
            }
545

    
546
            return _result;
547
        }
548
        /// <summary>
549
        /// DOCUMENT_ITEM Table 의 ID 로 Item 을 Select
550
        /// </summary>
551
        /// <param name="ensemble_id"></param>
552
        /// <returns></returns>
553
        [OperationContract]
554
        public string GetDocItemID(string ensemble_id)
555
        {
556
            ///param : prjNo, documentId, userId
557
            string _result = string.Empty;
558

    
559
            try
560
            {
561
                CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString("markus").ToString());
562

    
563
                var _items = entity.DOCUMENT_ITEM.Where(data => data.ID == ensemble_id).FirstOrDefault();
564
                if(_items != null)
565
                    _result = _items.DOCUMENT_ID;
566
            }
567
            catch (Exception ex)
568
            {
569
                //System.Diagnostics.Trace.WriteLine("GetVendorItemInfo Error : " + ex);
570
                //Common.Helper.SystemErrorNotify(SERVICE_NAME.API, LEVEL.MEDIUM, ERROR_TYPE.CONVERT, "GetDocumentItemInfo / " + ex.Message, param.documentID, param.projectNo);
571
            }
572

    
573
            return _result;
574
        }
575
        public string UserGO(MARKUP_INFO item)
576
        {
577
            if (item != null)
578
            {
579
                return item.MARKUP_INFO_VERSION.OrderByDescending(data => data.CREATE_DATE).FirstOrDefault().ID;
580
            }
581
            return null;
582
        }
583
        
584
        [OperationContract]
585
        public List<MarkupInfoItem> GetMarkupInfoItems(string ProjectNo, string DocInfoId)
586
        {
587
            List<MarkupInfoItem> _result = new List<MarkupInfoItem>();
588
            try
589
            {
590
                using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString()))
591
                {
592
                    var markupListData = entity.MARKUP_INFO.Where(data => data.DOCINFO_ID == DocInfoId).ToList();
593

    
594
                    var markupList = from markup in markupListData
595
                                     orderby markup.CREATE_TIME descending
596
                                     select new MarkupInfoItem
597
                                     {
598
                                         MarkupInfoID = markup.ID,
599
                                         UserID = markup.USER_ID,
600
                                         MarkupVersionID = markup.MARKUP_INFO_VERSION.Count() == 0 ? null : markup.MARKUP_INFO_VERSION.OrderByDescending(data => data.CREATE_DATE).FirstOrDefault().ID,
601
                                         CreateTime = markup.CREATE_TIME,
602
                                         Consolidate = markup.CONSOLIDATE,
603
                                         Description = markup.DESCRIPTION,
604
                                         AvoidConsolidate = markup.AVOID_CONSOLIDATE,
605
                                         PartConsolidate = markup.PART_CONSOLIDATE,
606
                                         UpdateTime = DateTime.Parse(markup.UPDATE_TIME.ToString()),
607
                                     };
608

    
609
                    if (markupList.Count() > 0)
610
                    {
611
                        _result = markupList.ToList();
612
                    }
613

    
614
                    _result.ForEach(r =>
615
                    {
616

    
617
                        r.MarkupList = (from markupData in entity.MARKUP_DATA
618
                                        where markupData.MARKUPINFO_VERSION_ID == r.MarkupVersionID
619
                                        orderby markupData.PAGENUMBER
620
                                        select new MarkupItem { ID = markupData.ID, PageNumber = markupData.PAGENUMBER, Data = markupData.DATA, Data_Type = markupData.DATA_TYPE, Symbol_ID = markupData.SYMBOL_ID}).ToList();
621
                    });
622

    
623
                    List<PROPERTIES> _ColorsProperties = new List<PROPERTIES>();
624
                    Random random = new Random();
625
                    
626
                    using (KCOMEntities kcomEntity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
627
                    {
628
                        _ColorsProperties = (from property in kcomEntity.PROPERTIES
629
                                             where property.TYPE == "DisplayColor"
630
                                             select property).ToList();
631
                    }                    
632

    
633
                    foreach (var item in _result)
634
                    {
635
                        var _member = entity.MEMBER.Where(member => member.ID == item.UserID).FirstOrDefault();
636
                        
637
                        if (_member != null)
638
                        {
639
                            item.UserName = _member.NAME;
640
                            item.Depatment = _member.DEPARTMENT;
641
                        }
642

    
643
                        if (_ColorsProperties.Count > 0)
644
                        {
645
                            int colorIdx = random.Next(0, _ColorsProperties.Count() - 1);
646
                            #region 부서별로 색상을 지정하고자 할때
647
                            /// 일단 의견을 들어보자구!
648
                            #endregion
649
                            item.DisplayColor = "#FF" + _ColorsProperties[colorIdx].VALUE;
650
                            _ColorsProperties.Remove(_ColorsProperties[colorIdx]);
651
                        }
652
                        else
653
                        {
654
                            item.DisplayColor = String.Format("#FF{0:X6}", random.Next(0x1000000));
655
                        }
656
                    }
657
                }
658
            }
659
            catch (Exception EX)
660
            {
661
                System.Diagnostics.Debug.WriteLine(this.GetType().ToString() + " " + EX);
662
                return _result;
663
            }
664
            finally
665
            {
666
                GC.Collect(2);
667
            }
668

    
669
            return _result;
670
        }
671

    
672

    
673
        /*
674
        [OperationContract]
675
        public List<MarkupInfoItem> GetMarkupInfoItems(string ProjectNo, string DocInfoId)
676
        {
677
            List<MarkupInfoItem> _result = new List<MarkupInfoItem>();
678
            try
679
            {
680
                using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString()))
681
                {
682
                    var markupListData = entity.MARKUP_INFO.Where(data => data.DOCINFO_ID == DocInfoId).ToList();
683

    
684
                    var markupList = from markup in markupListData
685
                                     orderby markup.CREATE_TIME descending
686
                                     select new MarkupInfoItem
687
                                     {
688
                                         MarkupInfoID = markup.ID,
689
                                         UserID = markup.USER_ID,
690
                                         MarkupVersionID = markup.MARKUP_INFO_VERSION.Count() == 0 ? null : markup.MARKUP_INFO_VERSION.OrderByDescending(data => data.CREATE_DATE).FirstOrDefault().ID,
691
                                         CreateTime = markup.CREATE_TIME,
692
                                         Consolidate = markup.CONSOLIDATE,
693
                                         Description = markup.DESCRIPTION,
694
                                         AvoidConsolidate = markup.AVOID_CONSOLIDATE,
695
                                         PartConsolidate = markup.PART_CONSOLIDATE,
696
                                         UpdateTime = DateTime.Parse(markup.UPDATE_TIME.ToString()),
697
                                     };
698

    
699
                    if (markupList.Count() > 0)
700
                    {
701
                        _result = markupList.ToList();
702
                    }
703

    
704
                    _result.ForEach(r =>
705
                    {
706

    
707
                        r.MarkupList = (from markupData in entity.MARKUP_DATA
708
                                        where markupData.MARKUPINFO_VERSION_ID == r.MarkupVersionID
709
                                        orderby markupData.PAGENUMBER
710
                                        select new MarkupItem { ID = markupData.ID, PageNumber = markupData.PAGENUMBER, Data = markupData.DATA, Data_Type = markupData.DATA_TYPE, Symbol_ID = markupData.SYMBOL_ID }).ToList();
711
                    });
712

    
713
                    Random random = new Random();
714

    
715
                    _MemberDeptColors memberDeptColors = new _MemberDeptColors();
716
                    _MemberDeptColorsInfo memberDeptColorsInfo = new _MemberDeptColorsInfo();
717

    
718

    
719
                    memberDeptColors._memberDeptColors = (from memberdeptcolor in entity.MEMBER_DEPT_COLOR
720
                                                              //where memberdeptcolor.DEPARTMENT == "DisplayColor"
721
                                                          select memberdeptcolor).ToList();
722
                    memberDeptColorsInfo._memberDeptColorsInfo = (from memberdeptcolorinfo in entity.MEMBER_DEPT_COLORINFO
723
                                                                      //where memberdeptcolor.DEPARTMENT == "DisplayColor"
724
                                                                  select memberdeptcolorinfo).ToList();
725

    
726

    
727
                    foreach (var item in _result)
728
                    {
729
                        var _member = entity.MEMBER.Where(member => member.ID == item.UserID);
730

    
731
                        if (_member.Count() > 0)
732
                        {
733
                            item.UserName = _member.First().NAME;
734
                            item.Depatment = _member.First().DEPARTMENT;
735
                        }
736

    
737
                        foreach (var dept in memberDeptColors._memberDeptColors)
738
                        {//dept 지정  색상 
739
                            if (dept.DEPARTMENT == item.Depatment)
740
                            {
741
                                var colorlist = memberDeptColorsInfo._memberDeptColorsInfo.Where(d => d.COLORID == dept.COLORID).ToList();
742

    
743
                                int colorIdx = random.Next(1, colorlist.Count());
744
                                if (colorlist.Count > 0)
745
                                {
746
                                    item.DisplayColor = "#FF" + colorlist[colorIdx].DISPLAYCOLOR;
747
                                    memberDeptColorsInfo._memberDeptColorsInfo.Remove(colorlist[colorIdx]);
748
                                    break;
749
                                }
750
                                else
751
                                {
752
                                    item.DisplayColor = String.Format("#FF{0:X6}", random.Next(0x1000000));
753
                                    break;
754
                                }
755
                            }
756
                        }
757

    
758

    
759
                        if (item.DisplayColor == null)
760
                        {
761
                            foreach (var dept in memberDeptColors._memberDeptColors)
762
                            {
763
                                if (dept.DEPARTMENT == null)
764
                                {
765
                                    dept.DEPARTMENT = item.Depatment;
766
                                    var colorlist = memberDeptColorsInfo._memberDeptColorsInfo.Where(d => d.COLORID == dept.COLORID).ToList();
767
                                    int colorIdx = random.Next(1, colorlist.Count());
768
                                    if (colorlist.Count > 0)
769
                                    {
770
                                        item.DisplayColor = "#FF" + colorlist[colorIdx].DISPLAYCOLOR;
771
                                        memberDeptColorsInfo._memberDeptColorsInfo.Remove(colorlist[colorIdx]);
772
                                        break;
773
                                    }
774
                                    else
775
                                    {
776
                                        item.DisplayColor = String.Format("#FF{0:X6}", random.Next(0x1000000));
777
                                        break;
778
                                    }
779
                                }
780
                            }
781
                        }
782

    
783
                        if (item.DisplayColor == null)
784
                        {
785
                            item.DisplayColor = String.Format("#FF{0:X6}", random.Next(0x1000000));
786
                        }
787
                    }
788
                }
789
            }
790
            catch (Exception EX)
791
            {
792
                System.Diagnostics.Debug.WriteLine(this.GetType().ToString() + " " + EX);
793
                return _result;
794
            }
795
            finally
796
            {
797
                GC.Collect(2);
798
            }
799

    
800
            return _result;
801
        }
802

    
803
        /*
804
        [OperationContract]
805
        public List<MarkupInfoItem> GetMarkupInfoItems(string ProjectNo, string DocInfoId)
806
        {
807
            List<MarkupInfoItem> _result = new List<MarkupInfoItem>();
808
            try
809
            {
810
                using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString()))
811
                {
812
                    var markupListData = entity.MARKUP_INFO.Where(data => data.DOCINFO_ID == DocInfoId).ToList();
813
                    //foreach (var item in markupListData)
814
                    //{
815
                    //    if (!item.AVOID_CONSOLIDATE.HasValue)
816
                    //    {
817
                    //        item.AVOID_CONSOLIDATE = 0;
818
                    //    }
819
                    //}
820

    
821
                    var markupList = from markup in markupListData
822
                                     orderby markup.CREATE_TIME descending
823
                                     select new MarkupInfoItem
824
                                     {
825
                                         MarkupInfoID = markup.ID,
826
                                         UserID = markup.USER_ID,
827
                                         MarkupVersionID = markup.MARKUP_INFO_VERSION.Count() == 0 ? null : markup.MARKUP_INFO_VERSION.OrderByDescending(data => data.CREATE_DATE).FirstOrDefault().ID,
828
                                         CreateTime = markup.CREATE_TIME,
829
                                         Consolidate = markup.CONSOLIDATE,
830
                                         Description = markup.DESCRIPTION,
831
                                         AvoidConsolidate = markup.AVOID_CONSOLIDATE,
832
                                         PartConsolidate = markup.PART_CONSOLIDATE,
833
                                         UpdateTime = DateTime.Parse(markup.UPDATE_TIME.ToString()),
834
                                     };
835

    
836

    
837

    
838
                    if (markupList.Count() > 0)
839
                    {
840
                        _result = markupList.ToList();
841
                    }
842

    
843

    
844

    
845
                    _result.ForEach(r =>
846
                    {
847

    
848
                        r.MarkupList = (from markupData in entity.MARKUP_DATA
849
                                        where markupData.MARKUPINFO_VERSION_ID == r.MarkupVersionID
850
                                        orderby markupData.PAGENUMBER
851
                                        select new MarkupItem { ID = markupData.ID, PageNumber = markupData.PAGENUMBER, Data = markupData.DATA, Data_Type = markupData.DATA_TYPE, Symbol_ID = markupData.SYMBOL_ID, Group_ID = markupData.GROUP_ID ?? 0 }).ToList();
852
                    });
853

    
854
                    _ColorsProperties colors = new _ColorsProperties();
855
                    Random random = new Random();
856

    
857
                    using (KCOMEntities kcomEntity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
858
                    {
859
                        colors._colorsProperties = (from property in kcomEntity.PROPERTIES
860
                                             where property.TYPE == "DisplayColor"
861
                                             select property).ToList();
862
                    }
863
                    List<DeptColor> deptColor = new List<DeptColor>();
864

    
865
                    List<DeptColor> listTest = new List<DeptColor>();
866
                    //Dictionary<string, string> d = new Dictionary<string, string>();
867
                    var list = new List<KeyValuePair<string, string>>();
868
                    foreach (var test in colors._colorsProperties)
869
                    {
870
                        list.Add(new KeyValuePair<string, string>(test.PROPERTY, test.VALUE));
871
                        //d.Add(test.PROPERTY, test.VALUE);
872
                        listTest.Add(new DeptColor { Property = test.PROPERTY,DisplayColor = test.VALUE});
873
                    }
874
                    
875

    
876
                    foreach (var item in _result)
877
                    {
878
                        var _member = entity.MEMBER.Where(member => member.ID == item.UserID);
879

    
880
                        if (_member.Count() > 0)
881
                        {
882
                            item.UserName = _member.First().NAME;
883
                            item.Depatment = _member.First().DEPARTMENT;
884
                        }
885

    
886
                        if (colors._colorsProperties.Count > 0)
887
                        {
888
                            int colorIdx = random.Next(1, colors._colorsProperties.Count());
889
                            #region 부서별로 색상을 지정하고자 할때
890

    
891
                            if(deptColor.Count > 0)
892
                            {
893
                                foreach (var dept in deptColor)
894
                                {
895
                                    if (dept.Depatment == item.Depatment)
896
                                    {
897
                                        //list에서 deptColor.Property의 값 중 상위의 데이터를 뽑아서 지정하고 list에서 삭제 
898
                                        item.DisplayColor = "#FF" + list.Where(p => p.Key == dept.Property).FirstOrDefault().Value;
899
                                        list.Remove(new KeyValuePair<string, string>(dept.Property, dept.DisplayColor));
900
                                        break;
901
                                    }
902
                                    else
903
                                    {
904
                                        item.DisplayColor = "#FF" + colors._colorsProperties[colorIdx].VALUE;
905
                                        deptColor.Add(new DeptColor { DisplayColor = item.DisplayColor, Depatment = item.Depatment, Property = colors._colorsProperties[colorIdx].PROPERTY });
906
                                        colors._colorsProperties.RemoveAll(p => p.PROPERTY.Equals(colors._colorsProperties[colorIdx].PROPERTY)); //같은 계열의 색상은 지운다
907
                                        break;
908
                                    }
909
                                }
910
                            }
911
                            else
912
                            {
913
                                item.DisplayColor = "#FF" + colors._colorsProperties[colorIdx].VALUE;
914
                                deptColor.Add(new DeptColor { DisplayColor = item.DisplayColor, Depatment = item.Depatment, Property = colors._colorsProperties[colorIdx].PROPERTY });
915
                                colors._colorsProperties.RemoveAll(p => p.PROPERTY.Equals(colors._colorsProperties[colorIdx].PROPERTY)); //같은 계열의 색상은 지운다
916
                            }                                                     
917
                            #endregion
918
                        }
919
                        else
920
                        {
921
                            item.DisplayColor = String.Format("#FF{0:X6}", random.Next(0x1000000));
922
                        }
923
                    }
924
                }
925
            }
926
            catch (Exception EX)
927
            {
928
                System.Diagnostics.Debug.WriteLine(this.GetType().ToString() + " " + EX);
929
                return _result;
930
            }
931
            finally
932
            {
933
                GC.Collect(2);
934
            }
935

    
936
            return _result;
937
        }
938
        */
939
        [OperationContract]
940
        public List<MarkupInfoItem> GetSyncMarkupInfoItems(string ProjectNo, string DocInfoId, string currentUser)
941
        {
942
            List<MarkupInfoItem> _result = new List<MarkupInfoItem>();
943
            try
944
            {
945
                using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString()))
946
                {
947
                    var docItem = entity.DOCINFO.Where(data => data.DOCUMENT_ID == DocInfoId).FirstOrDefault();
948
                    if (docItem == null)
949
                    {
950
                        return null;
951
                    }
952
                    var markupListData = entity.MARKUP_INFO.Where(data => data.DOCINFO_ID == docItem.ID).ToList();
953

    
954
                    var markupList = from markup in markupListData
955
                                     where markup.USER_ID == currentUser || markup.CONSOLIDATE == 1
956
                                     orderby markup.CREATE_TIME descending
957
                                     select new MarkupInfoItem
958
                                     {
959
                                         MarkupInfoID = markup.ID,
960
                                         UserID = markup.USER_ID,
961
                                         MarkupVersionID = markup.MARKUP_INFO_VERSION.Count() == 0 ? null : markup.MARKUP_INFO_VERSION.OrderByDescending(data => data.CREATE_DATE).FirstOrDefault().ID,
962
                                         CreateTime = markup.CREATE_TIME,
963
                                         Consolidate = markup.CONSOLIDATE,
964
                                         Description = markup.DESCRIPTION,
965
                                         AvoidConsolidate = markup.AVOID_CONSOLIDATE,
966
                                         PartConsolidate = markup.PART_CONSOLIDATE,
967
                                     };
968

    
969

    
970

    
971
                    if (markupList.Count() > 0)
972
                    {
973
                        _result = markupList.ToList();
974
                    }
975

    
976

    
977

    
978
                    _result.ForEach(r =>
979
                    {
980

    
981
                        r.MarkupList = (from markupData in entity.MARKUP_DATA
982
                                        where markupData.MARKUPINFO_VERSION_ID == r.MarkupVersionID
983
                                        orderby markupData.PAGENUMBER
984
                                        select new MarkupItem { ID = markupData.ID, PageNumber = markupData.PAGENUMBER, Data = markupData.DATA, Data_Type = markupData.DATA_TYPE, Symbol_ID = markupData.SYMBOL_ID}).ToList();
985
                    });
986

    
987
                    List<PROPERTIES> _ColorsProperties = new List<PROPERTIES>();
988
                    Random random = new Random();
989

    
990
                    using (KCOMEntities kcomEntity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
991
                    {
992
                        _ColorsProperties = (from property in kcomEntity.PROPERTIES
993
                                             where property.TYPE == "DisplayColor"
994
                                             select property).ToList();
995
                    }
996

    
997
                    foreach (var item in _result)
998
                    {
999
                        var _member = entity.MEMBER.Where(member => member.ID == item.UserID);
1000

    
1001
                        if (_member.Count() > 0)
1002
                        {
1003
                            item.UserName = _member.First().NAME;
1004
                            item.Depatment = _member.First().DEPARTMENT;
1005
                        }
1006

    
1007
                        if (_ColorsProperties.Count > 0)
1008
                        {
1009
                            int colorIdx = random.Next(1, _ColorsProperties.Count());
1010
                            #region 부서별로 색상을 지정하고자 할때
1011
                            /// 일단 의견을 들어보자구!
1012
                            #endregion
1013
                            item.DisplayColor = "#FF" + _ColorsProperties[colorIdx].VALUE;
1014
                            _ColorsProperties.Remove(_ColorsProperties[colorIdx]);
1015
                            //item.DisplayColor = "#FF" + _Colors.First();
1016
                            //_Colors.Remove(_Colors.First());
1017
                        }
1018
                        else
1019
                        {
1020
                            item.DisplayColor = String.Format("#FF{0:X6}", random.Next(0x1000000));
1021
                        }
1022
                    }
1023
                }
1024
            }
1025
            catch (Exception EX)
1026
            {
1027
                System.Diagnostics.Debug.WriteLine(this.GetType().ToString() + " " + EX);
1028
                return _result;
1029
            }
1030
            finally
1031
            {
1032
                GC.Collect(2);
1033
            }
1034

    
1035
            return _result;
1036
        }
1037

    
1038

    
1039
        //[OperationContract]
1040
        //[ServiceKnownType(typeof(MEMBER))]
1041
        //public List<MEMBER> GetUserData(string ProjectNo, string UserID)
1042
        //{
1043
        //    List<MEMBER> _result = new List<MEMBER>();
1044

    
1045
        //    using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString()))
1046
        //    {
1047
        //        var _UserList = from member in entity.MEMBER
1048
        //                        where member.ID == UserID
1049
        //                        select member;
1050
        //        _result = _UserList.ToList();
1051
        //    }
1052
        //    //GC.Collect(2);
1053
        //    return _result;
1054
        //}
1055

    
1056
        [OperationContract]
1057
        [ServiceKnownType(typeof(MEMBER))]
1058
        public List<MEMBER> GetUserData(string ProjectNo, string UserID)
1059
        {
1060
            List<MEMBER> _result = new List<MEMBER>();
1061

    
1062
            using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString()))
1063
            {
1064
                var _UserList = from member in entity.MEMBER
1065
                                where member.ID == UserID
1066
                                select member;
1067
                _result = _UserList.ToList();
1068
            }
1069
            //GC.Collect(2);
1070
            return _result;
1071
        }
1072

    
1073

    
1074
        [OperationContract]
1075
        public List<string> GetDeptData(string UserDept) //그룹 추가 옵션 부여 예정
1076
        {
1077
            List<string> _result = new List<string>();
1078

    
1079
            try
1080
            {
1081
                KCOMEntities entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString());
1082
                var YourEnginner = (from dept in entity.PROPERTIES
1083
                                    where dept.TYPE == "DeptName" && UserDept.Contains(dept.VALUE)
1084
                                    select dept).FirstOrDefault();
1085

    
1086
                if (YourEnginner != null)
1087
                {
1088
                    _result = (from dept in entity.PROPERTIES
1089
                               where dept.PROPERTY == YourEnginner.PROPERTY
1090
                               select dept.VALUE).ToList();
1091
                    return _result;
1092
                }
1093
                else
1094
                {
1095
                    return null;
1096
                }
1097
            }
1098
            catch (Exception ex)
1099
            {
1100
                System.Diagnostics.Debug.WriteLine(ex.Message);
1101
            }
1102
            finally
1103
            {
1104
                GC.Collect(2);
1105
            }
1106
            return _result;
1107
        }
1108

    
1109
        [OperationContract]
1110
        public bool DeleteMarkup(string ProjectNo, string MarkupInfoID)
1111
        {
1112
            bool _result = false;
1113
            try
1114
            {
1115
                using (KCOMDataModel.DataModel.CIEntities Entity = new KCOMDataModel.DataModel.CIEntities(KCOMDataModel.Common.ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString()))
1116
                {
1117

    
1118
                    MARKUP_INFO instance = Entity.MARKUP_INFO.Where(root => root.ID == MarkupInfoID).FirstOrDefault();
1119

    
1120
                    if (instance == null)
1121
                    {
1122
                        return false;
1123
                    }
1124
                    MARKUP_INFO_VERSION version = instance.MARKUP_INFO_VERSION.FirstOrDefault();
1125

    
1126

    
1127
                    version.MARKUP_DATA.ToList().ForEach(data =>
1128
                    {
1129
                        Entity.MARKUP_DATA.DeleteObject(data);
1130
                        Entity.SaveChanges();
1131
                    });
1132

    
1133
                    Entity.MARKUP_INFO_VERSION.DeleteObject(version);
1134
                    Entity.SaveChanges();
1135

    
1136
                    Entity.MARKUP_INFO.DeleteObject(instance);
1137
                    Entity.SaveChanges();
1138

    
1139
                }
1140
                _result = true;
1141
            }
1142
            catch (Exception ex)
1143
            {
1144
                System.Diagnostics.Trace.WriteLine(ex, "SaveMarkup");
1145
            }
1146
            finally
1147
            {
1148
                GC.Collect(2);
1149
            }
1150
            return _result;
1151
        }
1152

    
1153
        #region Favorite
1154
        [OperationContract]
1155
        public bool SetFavoriteVP(string prjNo, string userID, string groupNo, string docNo, string rev, int SavePageNo, string documentItemID, string VPDescription, IKCOM.FAVORITE_FLAG flag)
1156
        {
1157

    
1158
            using (KCOMEntities entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
1159
            {
1160
                try
1161
                {
1162
                    entity.FAVORITE_DOC.AddObject(new FAVORITE_DOC
1163
                    {
1164
                        ID = shortGuid(),
1165
                        PROJECT_NO = prjNo,
1166
                        DOCUMENT_ID = documentItemID,
1167
                        GROUP_NO = groupNo,
1168
                        DOCUMENT_NO = docNo,
1169
                        MEMBER_USER_ID = userID,
1170
                        DESCRIPTION = VPDescription,
1171
                        CREATE_TIME = DateTime.Now,
1172
                        REVISION = rev,
1173
                        FLAG = (int)flag,
1174
                        PAGE_NO = SavePageNo,
1175
                    });
1176
                    entity.SaveChanges();
1177
                }
1178
                catch (Exception)
1179
                {
1180
                    return false;
1181
                }
1182

    
1183
                return true;
1184
            }
1185
        }
1186

    
1187
        //[OperationContract]
1188
        //public List<FAVORITE_DOC> GetFavoriteVP(string PrjNo, string userID, string sharepointItemID)
1189
        //{
1190
        //    using (KCOMEntities entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
1191
        //    {
1192

    
1193
        //        int flagString = Convert.ToInt32(IKCOM.FAVORITE_FLAG.Personal);                
1194
        //        List<FAVORITE_DOC> favoriteListSet = new List<FAVORITE_DOC>();
1195
        //        entity.FAVORITE_DOC.Where(data => data.PROJECT_NO == PrjNo && data.DOCUMENT_ID == sharepointItemID && data.FLAG !=
1196
        //            flagString).ToList().ForEach(data => favoriteListSet.Add(data));
1197
        //        entity.FAVORITE_DOC.Where(data => data.PROJECT_NO == PrjNo && data.MEMBER_USER_ID == userID).ToList().ForEach(data => favoriteListSet.Add(data));
1198
        //        favoriteListSet = favoriteListSet.Distinct().ToList();
1199
        //        return favoriteListSet;
1200
        //    }
1201
        //}
1202
        //[OperationContract]
1203
        //public bool EditFavoriteVP(string prjNo, string userID, int SavePageNo, string sharepointItemID, DateTime createTime, int state, string description)
1204
        //{
1205
        //    using (DeepViewEntities dc = new DeepViewEntities(ConnectStringBuilder.DeepViewConnectionString().ToString()))
1206
        //    {
1207
        //        List<FavoriteVP> favoriteSet = dc.FavoriteVP.Where(data => data.ProjectNo == prjNo && data.CreateUserID == userID
1208
        //            && data.PageNo == SavePageNo && data.CreateTime == createTime).ToList();
1209

    
1210
        //        try
1211
        //        {
1212

    
1213

    
1214
        //            if (favoriteSet.Count > 0)
1215
        //            {
1216
        //                var FavoriteVP_Instance = favoriteSet.First();
1217

    
1218
        //                FavoriteVP_Instance.Description = description;
1219
        //                FavoriteVP_Instance.Flag = state;
1220

    
1221
        //                dc.SaveChanges();
1222

    
1223
        //                return true;
1224
        //            }
1225
        //            else
1226
        //            {
1227
        //                return false;
1228
        //            }
1229
        //        }
1230
        //        catch (Exception)
1231
        //        {
1232
        //            return false;
1233
        //        }
1234
        //    }
1235
        //}
1236
        //[OperationContract]
1237
        //public bool DelFavoriteVP(string prjNo, string userID, int SavePageNo, string sharepointItemID, DateTime createTime)
1238
        //{
1239

    
1240
        //    using (DeepViewEntities dc = new DeepViewEntities(ConnectStringBuilder.DeepViewConnectionString().ToString()))
1241
        //    {
1242
        //        List<FavoriteVP> favoriteSet = dc.FavoriteVP.Where(data => data.ProjectNo == prjNo && data.CreateUserID == userID
1243
        //            && data.PageNo == SavePageNo && data.CreateTime == createTime).ToList();
1244

    
1245
        //        try
1246
        //        {
1247

    
1248

    
1249
        //            if (favoriteSet.Count > 0)
1250
        //            {
1251
        //                favoriteSet.ForEach(data => dc.FavoriteVP.DeleteObject(data));
1252
        //                dc.SaveChanges();
1253
        //                return true;
1254
        //            }
1255
        //            else
1256
        //            {
1257
        //                return false;
1258
        //            }
1259
        //        }
1260
        //        catch (Exception)
1261
        //        {
1262
        //            return false;
1263
        //        }
1264
        //    }
1265
        //}
1266
        #endregion
1267

    
1268
        [OperationContract]
1269
        public bool SaveMarkupData(MarkupInfoItem UserState,string project_no,string doc_id, string user_id, List<MARKUP_DATA> mlmarkup_data)
1270
        {
1271
            using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
1272
            {     
1273
                #region Docinfo 정보 가져오기
1274

    
1275
                string docinfoid_ = (from info in Entity.DOCINFO
1276
                                     where info.DOCUMENT_ID == doc_id
1277
                                     && info.PROJECT_NO == project_no
1278
                                     select info.ID
1279
                                     ).First().ToString();
1280
                #endregion
1281

    
1282
                #region Markup_Info 저장
1283

    
1284
                MARKUP_INFO markup_info = new MARKUP_INFO();
1285
                try
1286
                {
1287
                    markup_info = (from info in Entity.MARKUP_INFO
1288
                                   where info.ID == UserState.MarkupInfoID && info.USER_ID == user_id
1289
                                   select info).FirstOrDefault();
1290
                }
1291
                catch (Exception)
1292
                {
1293
                    markup_info = null;
1294
                }
1295

    
1296
                //markup_info가 없을 경우 생성
1297
                if (markup_info == null)
1298
                {
1299
                    //MarkupInfo 저장
1300
                    markup_info = new MARKUP_INFO
1301
                    {
1302
                        ID = UserState.MarkupInfoID,
1303
                        DOCINFO_ID = docinfoid_,
1304
                        USER_ID = user_id,
1305
                        CREATE_TIME = DateTime.Now,
1306
                        CONSOLIDATE = UserState.Consolidate,
1307
                        AVOID_CONSOLIDATE = UserState.AvoidConsolidate,
1308
                        PART_CONSOLIDATE = UserState.PartConsolidate,
1309
                        DESCRIPTION = UserState.Description,
1310
                        UPDATE_TIME = DateTime.Now
1311
                    };
1312
                    Entity.MARKUP_INFO.AddObject(markup_info);
1313
                }
1314
                //markup_info가 있을 경우 업데이트
1315
                else
1316
                {
1317
                    markup_info.UPDATE_TIME = DateTime.Now;
1318
                }
1319
                Entity.SaveChanges();
1320
                #endregion
1321

    
1322
                #region Markup_Info_Version 저장
1323

    
1324
                MARKUP_INFO_VERSION markup_info_version = new MARKUP_INFO_VERSION();
1325

    
1326
                try
1327
                {
1328
                    markup_info_version = (from info in Entity.MARKUP_INFO_VERSION
1329
                                           where info.MARKUPINFO_ID == markup_info.ID
1330
                                           select info).FirstOrDefault();
1331
                }
1332
                catch (Exception)
1333
                {
1334
                    markup_info_version = null;
1335
                }
1336

    
1337
                //markup_info_version 없을 경우 생성
1338
                if (markup_info_version == null)
1339
                {
1340
                    //MarkupInfo_version 저장
1341
                    markup_info_version = new MARKUP_INFO_VERSION()
1342
                    {
1343
                        ID = UserState.MarkupVersionID,
1344
                        MARKUPINFO_ID = markup_info.ID,
1345
                        CREATE_DATE = DateTime.Now
1346
                    };
1347
                    Entity.MARKUP_INFO_VERSION.AddObject(markup_info_version);
1348
                    Entity.SaveChanges();
1349
                }
1350
                #endregion
1351

    
1352
                
1353
                Entity.MARKUP_DATA.Where(data => data.MARKUPINFO_VERSION_ID == markup_info_version.ID).ToList().ForEach(item =>
1354
                {
1355
                    Entity.MARKUP_DATA.DeleteObject(item);
1356
                });
1357
                Entity.SaveChanges();
1358

    
1359
                try
1360
                {
1361
                    mlmarkup_data.ForEach(value =>
1362
                    {
1363
                        Entity.MARKUP_DATA.AddObject(new MARKUP_DATA
1364
                        {
1365
                            ID = value.ID,
1366
                            DATA = value.DATA,
1367
                            DATA_TYPE = value.DATA_TYPE,
1368
                            PAGENUMBER = value.PAGENUMBER,
1369
                            MARKUPINFO_VERSION_ID = markup_info_version.ID,
1370
                            SYMBOL_ID = value.SYMBOL_ID,
1371
                            //GROUP_ID = value.GROUP_ID
1372
                        });
1373
                    });
1374
                    Entity.SaveChanges();
1375
                }
1376
                catch (Exception)
1377
                {
1378
                    return false;
1379
                }
1380
            }
1381
            return true;
1382
        }
1383

    
1384
        //[OperationContract]
1385
        //public long AddMarkupDataGroup(MARKUP_DATA_GROUP mARKUP_DATA_GROUP, string ProjectNo)
1386
        //{
1387
        //    try
1388
        //    {
1389
        //        using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString()))
1390
        //        {
1391
        //            Entity.AddToMARKUP_DATA_GROUP(mARKUP_DATA_GROUP);
1392
        //            //MARKUP_DATA_GROUP tt = Entity.MARKUP_DATA_GROUP.Where(info => info.ID == id).FirstOrDefault();
1393
        //            Entity.SaveChanges();
1394

    
1395
        //            return Entity.MARKUP_DATA_GROUP.ToList().LastOrDefault().ID;
1396
        //        }
1397
        //    }
1398
        //    catch (Exception)
1399
        //    {
1400
        //        return 0;
1401
        //    }
1402
        //}
1403
        //[OperationContract]
1404
        //public bool UpdateMarkupDataGroup(long Group_ID, string ProjectNo)
1405
        //{
1406
        //    try
1407
        //    {
1408
        //        using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString()))
1409
        //        {
1410
        //            var UpdateItem = Entity.MARKUP_DATA_GROUP.Where(info => info.ID == Group_ID).FirstOrDefault();
1411
        //            UpdateItem.STATE = 1;
1412
        //            Entity.SaveChanges();
1413
        //        }
1414
        //    }
1415
        //    catch (Exception)
1416
        //    {
1417
        //        return false;
1418
        //    }
1419
        //    return true;
1420
        //}
1421
        [OperationContract]
1422
        public bool UpdateMarkupData(string CommentID, long Group_ID, string ProjectNo)
1423
        {
1424
            try
1425
            {
1426
                using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString()))
1427
                {
1428
                    var UpdateItem = Entity.MARKUP_DATA.Where(info => info.ID == CommentID).FirstOrDefault();
1429
                    //UpdateItem.GROUP_ID = Group_ID;
1430
                    Entity.SaveChanges();
1431
                }
1432
            }
1433
            catch (Exception)
1434
            {
1435
                return false;
1436
            }
1437
            return true;
1438
        }
1439

    
1440
        [OperationContract]
1441
        public bool SaveSymbol(SYMBOL_PRIVATE symbol_private)
1442
        {
1443
            try
1444
            {
1445
                using (KCOMDataModel.DataModel.KCOMEntities uc = new KCOMDataModel.DataModel.KCOMEntities(KCOMDataModel.Common.ConnectStringBuilder.KCOMConnectionString().ToString()))
1446
                {
1447
                    uc.AddToSYMBOL_PRIVATE(symbol_private);
1448
                    uc.SaveChanges();
1449
                }
1450
            }
1451
            catch(Exception)
1452
            {
1453
                return false;
1454
            }
1455
            return true;
1456
        }
1457
        [OperationContract]
1458
        public bool AddPublicSymbol(SYMBOL_PUBLIC symbol)
1459
        {
1460
            try
1461
            {
1462
                using (KCOMDataModel.DataModel.KCOMEntities uc = new KCOMDataModel.DataModel.KCOMEntities(KCOMDataModel.Common.ConnectStringBuilder.KCOMConnectionString().ToString()))
1463
                {
1464
                    uc.AddToSYMBOL_PUBLIC(symbol);
1465
                    uc.SaveChanges();
1466
                }
1467
            }
1468
            catch (Exception)
1469
            {
1470
                return false;
1471
            }
1472
            return true;
1473
        }
1474
        [OperationContract]
1475
        public bool DeleteSymbol(string symbol_id, int type)
1476
        {
1477
            try
1478
            {
1479
                using (KCOMEntities Entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
1480
                {
1481
                    if (type == 0)
1482
                    {
1483
                        string delItem_ID = symbol_id;
1484
                        var delitem = Entity.SYMBOL_PRIVATE.Where(data => data.ID == delItem_ID).FirstOrDefault();
1485
                        Entity.SYMBOL_PRIVATE.DeleteObject(delitem);
1486
                        Entity.SaveChanges();
1487
                    }
1488
                    else
1489
                    {
1490
                        string delItem_ID = symbol_id;
1491
                        var delitem = Entity.SYMBOL_PUBLIC.Where(data => data.ID == delItem_ID).FirstOrDefault();
1492
                        Entity.SYMBOL_PUBLIC.DeleteObject(delitem);
1493
                        Entity.SaveChanges();
1494
                    }
1495
                }
1496
            }
1497
            catch(Exception)
1498
            {
1499
                return false;
1500
            }
1501
            return true;
1502
        }
1503

    
1504
        [OperationContract]
1505
        public bool RenameSymbol(string symbol_id, string name, int type)
1506
        {
1507
            try
1508
            {
1509
                using (KCOMEntities Entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
1510
                {
1511
                    if (type == 0)
1512
                    {
1513
                        var UpdateItem = Entity.SYMBOL_PRIVATE.Where(info => info.ID == symbol_id).FirstOrDefault();
1514
                        UpdateItem.NAME = name;
1515
                        Entity.SaveChanges();
1516
                    }
1517
                    else
1518
                    {
1519
                        var UpdateItem = Entity.SYMBOL_PUBLIC.Where(info => info.ID == symbol_id).FirstOrDefault();
1520
                        UpdateItem.NAME = name;
1521
                        Entity.SaveChanges();
1522
                    }
1523
                }
1524
            }
1525
            catch (Exception)
1526
            {
1527
                return false;
1528
            }
1529
            return true;
1530
        }
1531

    
1532
        [OperationContract]
1533
        public bool AddCheckListHistory(string project_no, CHECK_LIST_HISTORY Check_History)
1534
        {
1535
            try
1536
            {                
1537
                using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
1538
                {
1539
                    Entity.CHECK_LIST_HISTORY.AddObject(Check_History);
1540
                    Entity.SaveChanges();  
1541
                }
1542
            }
1543
            catch (Exception)
1544
            {
1545
                return false;
1546
            }
1547
            return true;
1548
        }
1549
        [OperationContract]
1550
        public bool SaveCheckListHistory(string project_no, string rev, CHECK_LIST_HISTORY Check_History)
1551
        {
1552
            try
1553
            {
1554
                using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
1555
                {
1556
                    var item = Entity.CHECK_LIST_HISTORY.Where(info => info.REVISION == rev).FirstOrDefault();
1557
                    item = Check_History;
1558
                    Entity.SaveChanges();
1559
                }
1560
            }
1561
            catch (Exception)
1562
            {
1563
                return false;
1564
            }
1565
            return true;
1566
        }
1567
        [OperationContract]
1568
        public bool SaveCheckList(string project_no, string _id, CHECK_LIST Check_value)
1569
        {
1570
            try
1571
            {
1572
                using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
1573
                {
1574
                    var item = Entity.CHECK_LIST.Where(info => info.ID == _id).FirstOrDefault();
1575
                    item.TODOLIST = Check_value.TODOLIST;
1576
                    item.REMARK = Check_value.REMARK;
1577
                    item.STATUS = Check_value.STATUS;
1578
                    item.VENDOR = Check_value.VENDOR;
1579
                    item.REPLY = Check_value.REPLY;
1580
                    item.IMAGE_URL = Check_value.IMAGE_URL;
1581
                    item.IMAGE_ANCHOR = Check_value.IMAGE_ANCHOR;
1582
                    item.UPDATE_TIME = Check_value.UPDATE_TIME;
1583
                    if(Check_value.STATUS == "False")
1584
                    {
1585
                        item.STATUS_DESC_OPEN = Check_value.STATUS_DESC_OPEN;
1586
                    }
1587
                    else
1588
                    {
1589
                        item.STATUS_DESC_CLOSE = Check_value.STATUS_DESC_CLOSE;
1590
                    }                     
1591
                    Entity.SaveChanges();
1592
                }
1593
            }
1594
            catch (Exception)
1595
            {
1596
                return false;
1597
            }
1598
            return true;
1599
        }
1600
        [OperationContract]
1601
        public bool AddCheckList(string project_no, CHECK_LIST Check_value)
1602
        {
1603
            try
1604
            {
1605
                using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
1606
                {
1607
                    Entity.CHECK_LIST.AddObject(Check_value);
1608
                    Entity.SaveChanges();
1609
                }
1610
            }
1611
            catch (Exception)
1612
            {
1613
                return false;
1614
            }
1615
            return true;
1616
        }
1617

    
1618
        [OperationContract]
1619
        public CHECK_LIST GetCheckList(string project_no, string _id)
1620
        {
1621
            CHECK_LIST Check_value = new CHECK_LIST();
1622
            try
1623
            {
1624
                using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
1625
                {
1626
                    Check_value = Entity.CHECK_LIST.Where(info => info.ID == _id).FirstOrDefault();
1627
                }
1628
            }
1629
            catch (Exception)
1630
            {
1631
                return null;
1632
            }
1633
            return Check_value;
1634
        }
1635
        [OperationContract]
1636
        public List<CHECK_LIST> GetUserCheckList(string project_no, string user_id, string doc_no)
1637
        {
1638
            List<CHECK_LIST> list = new List<CHECK_LIST>();
1639
            try
1640
            {
1641
                using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
1642
                {
1643
                    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();
1644
                }
1645
            }
1646
            catch (Exception)
1647
            {
1648
                return null;
1649
            }
1650
            return list;
1651
        }
1652
        [OperationContract]
1653
        public List<CHECK_LIST_HISTORY> GetCheckListHistory(string project_no, string _id)
1654
        {
1655
            List<CHECK_LIST_HISTORY> history = new List<CHECK_LIST_HISTORY>();
1656
            try
1657
            {
1658
                using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
1659
                {
1660
                    history = Entity.CHECK_LIST_HISTORY.Where(data => data.CHECKLIST_ID == _id).ToList();
1661
                }
1662
            }
1663
            catch (Exception)
1664
            {
1665
                return null;
1666
            }
1667
            return history;
1668
        }
1669
        [OperationContract]
1670
        public CHECK_LIST_HISTORY GetCheckListHistoryFirstOrDefault(string project_no, string checklist_id, string rev)
1671
        {
1672
            CHECK_LIST_HISTORY Check_Item = new CHECK_LIST_HISTORY();
1673
            try
1674
            {
1675
                using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
1676
                {   
1677
                    Check_Item = Entity.CHECK_LIST_HISTORY.Where(info => info.CHECKLIST_ID == checklist_id && info.REVISION == rev).FirstOrDefault();
1678
                }
1679
            }
1680
            catch (Exception)
1681
            {
1682
                return null;
1683
            }
1684
            return Check_Item;
1685
        }
1686
        [OperationContract]
1687
        public bool SavePageAngle(string project_no, List<DOCPAGE> _mldocpage)
1688
        {
1689
            try
1690
            {
1691
                using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
1692
                {
1693
                    KCOMDataModel.DataModel.DOCPAGE _docpage = new KCOMDataModel.DataModel.DOCPAGE();
1694
                    _mldocpage.ForEach(data =>
1695
                    {
1696
                        _docpage = (from info in Entity.DOCPAGE
1697
                                    where info.ID == data.ID
1698
                                    select info).FirstOrDefault();
1699

    
1700
                        if (_docpage.PAGE_ANGLE != data.PAGE_ANGLE)
1701
                        {
1702
                            _docpage.PAGE_ANGLE = data.PAGE_ANGLE;
1703
                        }
1704
                    });
1705

    
1706
                    Entity.SaveChanges();
1707
                }
1708
            }
1709
            catch (Exception)
1710
            {
1711
                return false;
1712
            }
1713
            return true;
1714
        }
1715

    
1716
        [OperationContract]
1717
        public MARKUP_INFO GetMarkupInfo(string project_no, string _id)
1718
        {
1719
            MARKUP_INFO markupInfo = new MARKUP_INFO();
1720

    
1721
            try
1722
            {
1723
                using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
1724
                {
1725
                    markupInfo = Entity.MARKUP_INFO.Where(entity => entity.DOCINFO_ID == _id).OrderByDescending(i => i.CONSOLIDATE).OrderByDescending(j => j.CREATE_TIME).FirstOrDefault();
1726
                }
1727
            }
1728
            catch (Exception)
1729
            {
1730
                return null;
1731
            }
1732
            return markupInfo;
1733
        }
1734

    
1735
        [OperationContract]
1736
        public List<string> GetMarkupDataListperPage(string project_no, string _markupinfoid, int _pageNo)
1737
        {
1738
            List<string> markupdata = new List<string>();
1739
            MARKUP_INFO_VERSION markup_info_version = new MARKUP_INFO_VERSION();
1740
            try
1741
            {
1742
                using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
1743
                {
1744
                    markup_info_version = (from version in Entity.MARKUP_INFO_VERSION
1745
                                           where version.MARKUPINFO_ID == _markupinfoid
1746
                                           orderby version.CREATE_DATE descending
1747
                                           select version).First();
1748
                    markupdata = (from data in Entity.MARKUP_DATA
1749
                                  where data.MARKUPINFO_VERSION_ID == markup_info_version.ID && data.PAGENUMBER == _pageNo
1750
                                  select data.DATA).ToList();
1751
                }
1752
            }
1753
            catch (Exception)
1754
            {
1755
                return null;
1756
            }
1757
            return markupdata;
1758
        }
1759

    
1760
        [OperationContract]
1761
        public bool AddMarkupInfo(string project_no, MARKUP_INFO value)
1762
        {
1763
            try
1764
            {
1765
                using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
1766
                {
1767
                    Entity.MARKUP_INFO.AddObject(value);
1768
                    Entity.SaveChanges();
1769
                }
1770
            }
1771
            catch (Exception)
1772
            {
1773
                return false;
1774
            }
1775
            return true;
1776
        }
1777

    
1778
        [OperationContract]
1779
        public bool AddMarkupInfoVersion(string project_no, MARKUP_INFO_VERSION value)
1780
        {
1781
            try
1782
            {
1783
                using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
1784
                {
1785
                    Entity.MARKUP_INFO_VERSION.AddObject(value);
1786
                    Entity.SaveChanges();
1787
                }
1788
            }
1789
            catch (Exception)
1790
            {
1791
                return false;
1792
            }
1793
            return true;
1794
        }
1795

    
1796
        [OperationContract]
1797
        public bool AddMarkupData(string project_no, MARKUP_DATA value)
1798
        {
1799
            try
1800
            {
1801
                using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
1802
                {
1803
                    Entity.MARKUP_DATA.AddObject(value);
1804
                    Entity.SaveChanges();
1805
                }
1806
            }
1807
            catch (Exception)
1808
            {
1809
                return false;
1810
            }
1811
            return true;
1812
        }
1813

    
1814
        [OperationContract]
1815
        public bool AvoidMarkupInfo(string project_no, string _doc_id)
1816
        {
1817
            try
1818
            {
1819
                using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
1820
                {
1821
                    var item = Entity.MARKUP_INFO.Where(entity => entity.DOCINFO_ID == _doc_id).OrderByDescending(i => i.CONSOLIDATE).OrderByDescending(j => j.CREATE_TIME).FirstOrDefault();
1822
                    item.AVOID_CONSOLIDATE = 1;
1823
                    Entity.SaveChanges();
1824
                }
1825
            }
1826
            catch (Exception)
1827
            {
1828
                return false;
1829
            }
1830
            return true;
1831
        }
1832

    
1833
        [OperationContract]
1834
        public bool SaveMarkupInfo(string project_no, string _id, MARKUP_INFO value)
1835
        {
1836
            try
1837
            {
1838
                using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
1839
                {
1840
                    var item = Entity.MARKUP_INFO.Where(info => info.ID == _id).FirstOrDefault();
1841
                    item = value;                    
1842
                    Entity.SaveChanges();
1843
                }
1844
            }
1845
            catch (Exception)
1846
            {
1847
                return false;
1848
            }
1849
            return true;
1850
        }
1851
        [OperationContract]
1852
        public List<MARKUP_DATA> GetMarkupDataList(string project_no, string _versionid)
1853
        {
1854
            List<MARKUP_DATA> mlresult = new List<MARKUP_DATA>();
1855

    
1856
            try
1857
            {
1858
                using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
1859
                {
1860
                    mlresult = Entity.MARKUP_DATA.Where(data => data.MARKUPINFO_VERSION_ID == _versionid).ToList();
1861
                }
1862
            }
1863
            catch (Exception)
1864
            {
1865
                return null;
1866
            }
1867
            return mlresult;
1868
        }
1869

    
1870
        [OperationContract]
1871
        public bool Consolidate(string project_no, string _user_id, string _doc_id, List<MarkupInfoItem> markupInfoItems)
1872
        {
1873
            try
1874
            {
1875
                List<KCOMDataModel.DataModel.MARKUP_DATA> instanceDataSet = new List<KCOMDataModel.DataModel.MARKUP_DATA>();
1876
                using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
1877
                {
1878
                    var markupInfo = Entity.MARKUP_INFO.Where(entity => entity.DOCINFO_ID == _doc_id && entity.CONSOLIDATE == 1).OrderByDescending(j => j.CREATE_TIME).FirstOrDefault();
1879
                    if (markupInfo != null)
1880
                    {
1881
                        markupInfo.AVOID_CONSOLIDATE = 1;
1882
                    }
1883

    
1884
                    foreach (MarkupInfoItem item in markupInfoItems)
1885
                    {
1886
                        Entity.MARKUP_DATA.Where(data => data.MARKUPINFO_VERSION_ID == item.MarkupVersionID).ToList().ForEach(d =>
1887
                        {
1888
                            instanceDataSet.Add(d);
1889
                        });
1890
                    }
1891

    
1892
                    KCOMDataModel.DataModel.MARKUP_INFO info = new KCOMDataModel.DataModel.MARKUP_INFO();
1893
                    info.ID = shortGuid();
1894
                    info.CONSOLIDATE = 1;
1895
                    info.CREATE_TIME = DateTime.Now;
1896
                    info.DOCINFO_ID = _doc_id;
1897
                    info.UPDATE_TIME = DateTime.Now;
1898
                    info.USER_ID = _user_id;
1899
                    info.AVOID_CONSOLIDATE = 0;
1900

    
1901
                    Entity.MARKUP_INFO.AddObject(info);
1902
                    Entity.SaveChanges();
1903

    
1904

    
1905
                    KCOMDataModel.DataModel.MARKUP_INFO_VERSION info2 = new KCOMDataModel.DataModel.MARKUP_INFO_VERSION
1906
                    {
1907
                        ID = shortGuid(),
1908
                        CREATE_DATE = DateTime.Now,
1909
                        MARKUP_INFO = info,
1910
                    };
1911
                    Entity.SaveChanges();
1912

    
1913
                    foreach (var item in instanceDataSet)
1914
                    {
1915
                        Entity.MARKUP_DATA.AddObject(new KCOMDataModel.DataModel.MARKUP_DATA
1916
                        {
1917
                            ID = shortGuid(),
1918
                            DATA = item.DATA,
1919
                            DATA_TYPE = item.DATA_TYPE,
1920
                            PAGENUMBER = item.PAGENUMBER,
1921
                            MARKUP_INFO_VERSION = info2,
1922
                            SYMBOL_ID = item.SYMBOL_ID,
1923
                            //GROUP_ID = item.GROUP_ID
1924
                        });
1925
                    }
1926
                    Entity.SaveChanges();
1927

    
1928

    
1929
                }
1930
            }
1931
            catch (Exception)
1932
            {
1933
                return false;
1934
            }
1935
            return true;
1936
        }
1937

    
1938

    
1939
        [OperationContract]
1940
        public FinalPDFResult ConsolidateMergedPDF(string project_no, string _user_id, string _doc_id, List<MarkupInfoItem> markupInfoItems, string ProjectNo, string DocInfoID, string CreateUserID)
1941
        {
1942
            bool consolidate = false;
1943
            try
1944
            {
1945
                List<KCOMDataModel.DataModel.MARKUP_DATA> instanceDataSet = new List<KCOMDataModel.DataModel.MARKUP_DATA>();
1946
                using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
1947
                {
1948
                    var markupInfo = Entity.MARKUP_INFO.Where(entity => entity.DOCINFO_ID == _doc_id).OrderByDescending(i => i.CONSOLIDATE).OrderByDescending(j => j.CREATE_TIME).FirstOrDefault();
1949
                    if (markupInfo.CONSOLIDATE == 1)
1950
                    {
1951
                        markupInfo.AVOID_CONSOLIDATE = 1;
1952
                    }
1953

    
1954
                    foreach (MarkupInfoItem item in markupInfoItems)
1955
                    {
1956
                        Entity.MARKUP_DATA.Where(data => data.MARKUPINFO_VERSION_ID == item.MarkupVersionID).ToList().ForEach(d =>
1957
                        {
1958
                            instanceDataSet.Add(d);
1959
                        });
1960
                    }
1961

    
1962
                    KCOMDataModel.DataModel.MARKUP_INFO info = new KCOMDataModel.DataModel.MARKUP_INFO();
1963
                    info.ID = shortGuid();
1964
                    info.CONSOLIDATE = 1;
1965
                    info.CREATE_TIME = DateTime.Now;
1966
                    info.DOCINFO_ID = _doc_id;
1967
                    info.UPDATE_TIME = DateTime.Now;
1968
                    info.USER_ID = _user_id;
1969
                    info.AVOID_CONSOLIDATE = 0;
1970

    
1971
                    Entity.MARKUP_INFO.AddObject(info);
1972
                    Entity.SaveChanges();
1973

    
1974

    
1975
                    KCOMDataModel.DataModel.MARKUP_INFO_VERSION info2 = new KCOMDataModel.DataModel.MARKUP_INFO_VERSION
1976
                    {
1977
                        ID = shortGuid(),
1978
                        CREATE_DATE = DateTime.Now,
1979
                        MARKUP_INFO = info,
1980
                    };
1981
                    Entity.SaveChanges();
1982

    
1983
                    foreach (var item in instanceDataSet)
1984
                    {
1985
                        Entity.MARKUP_DATA.AddObject(new KCOMDataModel.DataModel.MARKUP_DATA
1986
                        {
1987
                            ID = shortGuid(),
1988
                            DATA = item.DATA,
1989
                            DATA_TYPE = item.DATA_TYPE,
1990
                            PAGENUMBER = item.PAGENUMBER,
1991
                            MARKUP_INFO_VERSION = info2,
1992
                            SYMBOL_ID = item.SYMBOL_ID,
1993
                            //GROUP_ID = item.GROUP_ID
1994
                        });
1995
                    }
1996
                    Entity.SaveChanges();
1997

    
1998

    
1999
                }
2000
                consolidate = true;
2001
            }
2002
            catch (Exception)
2003
            {
2004
                consolidate = false;
2005
            }
2006
            FinalPDFResult _result = new FinalPDFResult();
2007
            if (consolidate == true)
2008
            {
2009
                RemFinalPDFObject remObj = null;
2010
                try
2011
                {
2012
                    string _finalID = shortGuid();
2013
                    int _DocTotalPages = -1;
2014
                    string docItemId;
2015

    
2016

    
2017
                    using (CIEntities _ci = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString()))
2018
                    {
2019
                        var _doc = _ci.DOCINFO.Where(info => info.ID == DocInfoID);
2020

    
2021
                        if (_doc.Count() > 0)
2022
                        {
2023
                            _DocTotalPages = _doc.First().PAGE_COUNT;
2024
                            docItemId = _doc.First().DOCUMENT_ID;
2025
                        }
2026
                        else
2027
                        {
2028
                            _result.Status = FinalStatus.Error;
2029
                            _result.Exception = "페이지 정보를 가져올 수 없습니다.";
2030
                            return _result;
2031
                        }
2032
                    }
2033

    
2034
                    var Items = GetMarkupInfoItems(ProjectNo, DocInfoID);
2035
                    if (_DocTotalPages > 0)
2036
                    {
2037
                        var item2 = Items.Cast<MarkupInfoItem>().Where(d => d.Consolidate == 1 && d.AvoidConsolidate == 0).FirstOrDefault();
2038
                        FINAL_PDF fm = new FINAL_PDF()
2039
                        {
2040
                            ID = _finalID,
2041
                            PROJECT_NO = ProjectNo,
2042
                            DOCINFO_ID = DocInfoID,
2043
                            DOCUMENT_ID = docItemId,
2044
                            MARKUPINFO_ID = item2.MarkupInfoID,
2045
                            CREATE_USER_ID = CreateUserID,
2046
                            TOTAL_PAGE = _DocTotalPages,
2047
                            CREATE_DATETIME = DateTime.Now,
2048
                            STATUS = (int)IFinalPDF.FinalStatus.Insert
2049
                        };
2050
                        using (KCOMEntities _entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
2051
                        {
2052
                            _entity.AddToFINAL_PDF(fm);
2053
                            _entity.SaveChanges(System.Data.Objects.SaveOptions.AcceptAllChangesAfterSave);
2054
                        };
2055

    
2056
                        System.Runtime.Remoting.Channels.IChannel _ch = System.Runtime.Remoting.Channels.ChannelServices.GetChannel("tcp");
2057
                        if (_ch == null)
2058
                        {
2059
                            chan = new TcpChannel();
2060
                            _ChanID = chan.ChannelName;
2061
                            System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(chan, false);
2062
                            // Create an instance of the remote object
2063

    
2064

    
2065
                            using (KCOMEntities ec = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
2066
                            {
2067

    
2068
                                //remObj = (RemFinalPDFObject)Activator.GetObject(typeof(RemFinalPDFObject),
2069
                                //                          "tcp://localhost:9092/remFinalPDF");
2070
                                remObj = (RemFinalPDFObject)Activator.GetObject(typeof(RemFinalPDFObject),
2071
                                                          //"tcp://192.168.0.67:9092/remFinalPDF");
2072
                                                          "tcp://192.168.0.67:9092/remFinalPDF");
2073
                            }
2074

    
2075
                            //"tcp://localhost:8080/remFinalPDF");
2076

    
2077
                            _result = remObj.SetFinalPDF(ProjectNo, _finalID);
2078
                            _result.FinalID = _finalID;
2079
                            _result.Status = FinalStatus.Success;
2080

    
2081
                            //MarkupToPDF.MarkupToPDF fa = new MarkupToPDF.MarkupToPDF();
2082
                            //fa.MakeFinalPDF(fm);
2083
                        }
2084
                        else
2085
                        {
2086
                            _ChanID = _ch.ChannelName;
2087
                        }
2088
                    }
2089
                }
2090
                catch (Exception ex)
2091
                {
2092
                    _result.Status = FinalStatus.Error;
2093

    
2094
                    if (ex.GetType() == typeof(System.Net.Sockets.SocketException))
2095
                        _result.Exception = "Final Server Not Connection";
2096
                }
2097
                finally
2098
                {
2099
                    remObj = null;
2100
                    if (System.Runtime.Remoting.Channels.ChannelServices.GetChannel("tcp") != null)
2101
                        System.Runtime.Remoting.Channels.ChannelServices.UnregisterChannel(chan);
2102

    
2103
                    GC.Collect(2);
2104
                }
2105
            }
2106
            return _result;
2107
        }
2108
        [OperationContract]
2109
        public bool TeamConsolidate(string project_no, string _user_id, string _doc_id, List<MarkupInfoItem> markupInfoItems)
2110
        {
2111
            try
2112
            {
2113
                List<KCOMDataModel.DataModel.MARKUP_DATA> instanceDataSet = new List<KCOMDataModel.DataModel.MARKUP_DATA>();
2114
                using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
2115
                {
2116
                    string user_dept = Entity.MEMBER.Where(m => m.ID == _user_id).FirstOrDefault().DEPARTMENT;
2117
                    var markupInfos = Entity.MARKUP_INFO.Where(entity => entity.DOCINFO_ID == _doc_id
2118
                    && entity.PART_CONSOLIDATE == 1
2119
                    ).OrderByDescending(j => j.CREATE_TIME).ToList();
2120
                    foreach (var markupinfo in markupInfos)
2121
                    {
2122
                        string markupdept = Entity.MEMBER.Where(m => m.ID == markupinfo.USER_ID).FirstOrDefault().DEPARTMENT;
2123
                        if (user_dept == markupdept)
2124
                        {
2125
                            markupinfo.AVOID_CONSOLIDATE = 1;
2126
                        }
2127
                    }
2128

    
2129
                    foreach (MarkupInfoItem item in markupInfoItems)
2130
                    {
2131
                        Entity.MARKUP_DATA.Where(data => data.MARKUPINFO_VERSION_ID == item.MarkupVersionID).ToList().ForEach(d =>
2132
                        {
2133
                            instanceDataSet.Add(d);
2134
                        });
2135
                    }
2136

    
2137
                    KCOMDataModel.DataModel.MARKUP_INFO info = new KCOMDataModel.DataModel.MARKUP_INFO();
2138
                    info.ID = shortGuid();
2139
                    info.PART_CONSOLIDATE = 1;
2140
                    info.CREATE_TIME = DateTime.Now;
2141
                    info.DOCINFO_ID = _doc_id;
2142
                    info.UPDATE_TIME = DateTime.Now;
2143
                    info.USER_ID = _user_id;
2144
                    info.AVOID_CONSOLIDATE = 0;
2145

    
2146
                    Entity.MARKUP_INFO.AddObject(info);
2147
                    Entity.SaveChanges();
2148

    
2149

    
2150
                    KCOMDataModel.DataModel.MARKUP_INFO_VERSION info2 = new KCOMDataModel.DataModel.MARKUP_INFO_VERSION
2151
                    {
2152
                        ID = shortGuid(),
2153
                        CREATE_DATE = DateTime.Now,
2154
                        MARKUP_INFO = info,
2155
                    };
2156
                    Entity.SaveChanges();
2157

    
2158
                    foreach (var item in instanceDataSet)
2159
                    {
2160
                        Entity.MARKUP_DATA.AddObject(new KCOMDataModel.DataModel.MARKUP_DATA
2161
                        {
2162
                            ID = shortGuid(),
2163
                            DATA = item.DATA,
2164
                            DATA_TYPE = item.DATA_TYPE,
2165
                            PAGENUMBER = item.PAGENUMBER,
2166
                            MARKUP_INFO_VERSION = info2,
2167
                            SYMBOL_ID = item.SYMBOL_ID,
2168
                            //GROUP_ID = item.GROUP_ID
2169
                        });
2170
                    }
2171
                    Entity.SaveChanges();
2172

    
2173

    
2174
                }
2175
            }
2176
            catch (Exception)
2177
            {
2178
                return false;
2179
            }
2180
            return true;
2181
        }
2182

    
2183
        [OperationContract]
2184
        [ServiceKnownType(typeof(MEMBER))]
2185
        public MEMBER GetMember(string project_no, string user_id)
2186
        {
2187
            MEMBER rstmember = new MEMBER();
2188
            try
2189
            {
2190
                using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
2191
                {
2192
                    var tmp = (from member in Entity.MEMBER
2193
                                    where member.ID == user_id
2194
                                    select member).FirstOrDefault();
2195
                    rstmember.DEPARTMENT = tmp.DEPARTMENT;
2196
                    rstmember.ID = tmp.ID;
2197
                    rstmember.NAME = tmp.NAME;
2198
                }
2199
            }
2200
            catch (Exception)
2201
            {
2202
                return null;
2203
            }
2204
            return rstmember;
2205
        }
2206

    
2207
        [OperationContract]
2208
        public List<SYMBOL_PRIVATE> GetSymbolList(string user_id)
2209
        {
2210
            List<SYMBOL_PRIVATE> Custom_List = new List<SYMBOL_PRIVATE>();
2211
            try
2212
            {
2213
                using (KCOMEntities Entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
2214
                {
2215
                    Custom_List = Entity.SYMBOL_PRIVATE.Where(data => data.MEMBER_USER_ID == user_id).ToList();
2216
                }
2217
            }
2218
            catch (Exception)
2219
            {
2220
                return null;
2221
            }
2222
            return Custom_List;
2223
        }
2224
        [OperationContract]
2225
        public List<string> GetPublicSymbolDeptList()
2226
        {
2227
            List<string> Custom_List = new List<string>();
2228
            try
2229
            {
2230
                using (KCOMEntities Entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
2231
                {
2232
                    Custom_List = Entity.SYMBOL_PUBLIC.Select(data => data.DEPARTMENT).Distinct().ToList();
2233
                }
2234
            }
2235
            catch (Exception)
2236
            {
2237
                return null;
2238
            }
2239
            return Custom_List;
2240
        }
2241
        [OperationContract]
2242
        public List<SYMBOL_PUBLIC> GetPublicSymbolList(string dept)
2243
        {
2244
            List<SYMBOL_PUBLIC> Custom_List = new List<SYMBOL_PUBLIC>();
2245
            try
2246
            {
2247
                using (KCOMEntities Entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
2248
                {
2249
                    if(!string.IsNullOrEmpty(dept))
2250
                    {
2251
                        Custom_List = Entity.SYMBOL_PUBLIC.Where(data => data.DEPARTMENT == dept).ToList();
2252
                    }
2253
                    else
2254
                    {
2255
                        Custom_List = Entity.SYMBOL_PUBLIC.ToList();
2256
                    }
2257
                    
2258
                }
2259
            }
2260
            catch (Exception)
2261
            {
2262
                return null;
2263
            }
2264
            return Custom_List;
2265
        }
2266

    
2267
        /// <summary>
2268
        /// 
2269
        /// </summary>
2270
        /// <param name="id">symbol id</param>
2271
        /// <param name="type"> 0 : PRIVATE, 1 : PUBLIC</param>
2272
        /// <returns></returns>
2273
        [OperationContract]
2274
        public string GetSymbolData(string id, int type)
2275
        {
2276
            string result;
2277
            try
2278
            {
2279
                using (KCOMEntities Entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
2280
                {
2281
                    if(type == 0)
2282
                    {
2283
                        result = Entity.SYMBOL_PRIVATE.Where(data => data.ID == id).FirstOrDefault().DATA;
2284
                    }
2285
                    else
2286
                    {
2287
                        result = Entity.SYMBOL_PUBLIC.Where(data => data.ID == id).FirstOrDefault().DATA;
2288
                    }
2289
                }
2290
            }
2291
            catch (Exception)
2292
            {
2293
                return null;
2294
            }
2295
            return result;
2296
        }
2297
        [OperationContract]
2298
        public string GetSymbolImageURL(string id, int type)
2299
        {
2300
            string result;
2301
            try
2302
            {
2303
                using (KCOMEntities Entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
2304
                {
2305
                    if (type == 0)
2306
                    {
2307
                        result = Entity.SYMBOL_PRIVATE.Where(data => data.ID == id).FirstOrDefault().IMAGE_URL;
2308
                    }
2309
                    else
2310
                    {
2311
                        result = Entity.SYMBOL_PUBLIC.Where(data => data.ID == id).FirstOrDefault().IMAGE_URL;
2312
                    }
2313
                }
2314
            }
2315
            catch (Exception)
2316
            {
2317
                return null;
2318
            }
2319
            return result;
2320
        }
2321
        [OperationContract]
2322
        public string GetSignData(string project_no, string user_id)
2323
        {
2324
            string result = null;
2325
            try
2326
            {
2327
                string ifsign = getEnsembleSign(user_id);
2328
                if (string.IsNullOrEmpty(ifsign))
2329
                {
2330
                    var ModelWFConnectionString = ConnectStringBuilder.ProjectCIConnectString(project_no).ToString();
2331
                    if (null != ModelWFConnectionString)
2332
                    {
2333
                        using (CIEntities entity = new CIEntities(ModelWFConnectionString))
2334
                        {
2335
                            var _sign = entity.SIGN_INFO.Where(sin => sin.MEMBER_USER_ID == user_id);
2336
                            if (_sign.Count() > 0)
2337
                            {
2338
                                result = _sign.First().SIGN_STR;
2339
                            }
2340
                            else
2341
                            {
2342
                                return null;
2343
                            }
2344
                        }
2345
                    }
2346
                }
2347
                else
2348
                {
2349
                    result = ifsign;
2350
                }
2351

    
2352
            }
2353
            catch (Exception)
2354
            {
2355
                return null;
2356
            }
2357
            return result;
2358
        }
2359

    
2360
        [OperationContract]        
2361
        public string GetProjectName(string project_no)
2362
        {
2363
            string result = null;
2364

    
2365
            try
2366
            {
2367
                using (KCOMDataModel.DataModel.KCOMEntities Entity = new KCOMDataModel.DataModel.KCOMEntities(KCOMDataModel.Common.ConnectStringBuilder.KCOMConnectionString().ToString()))
2368
                {
2369
                    result = Entity.RUN_PROJECTS.Where(i => i.PROJECT_NO == project_no).FirstOrDefault().PROJECT_NAME.ToString();
2370
                }
2371
            }
2372
            catch (Exception)
2373
            {
2374
                return null;
2375
            }
2376
            return result;
2377
        }
2378

    
2379
        [OperationContract]
2380
        public List<DOCUMENT_ITEM> GetPreRevSelect(string project_no, string doc_no, string current_rev)
2381
        {
2382
            List<DOCUMENT_ITEM> result = new List<DOCUMENT_ITEM>();
2383
            
2384
            try
2385
            {
2386
                using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
2387
                {
2388
                    result = Entity.DOCUMENT_ITEM.Where(i => i.PROJECT_NO == project_no
2389
                    && i.DOCUMENT_NO == doc_no
2390
                    && i.REVISION != current_rev).OrderByDescending(i => i.GROUP_NO).ToList();
2391
                }
2392
            }
2393
            catch (Exception)
2394
            {
2395
                return null;
2396
            }
2397
            return result;
2398
        }
2399

    
2400
        [OperationContract]
2401
        public DOCINFO GetDocInfoOneSelect(string project_no, string doc_id)
2402
        {
2403
            DOCINFO docinfo = null;
2404

    
2405
            try
2406
            {
2407
                using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
2408
                {
2409
                    docinfo = (from info in Entity.DOCINFO
2410
                              where info.DOCUMENT_ID == doc_id
2411
                              && info.PROJECT_NO == project_no
2412
                              select info).First();
2413
                }
2414
            }
2415
            catch (Exception)
2416
            {
2417
                return null;
2418
            }
2419
            return docinfo;
2420
        }
2421

    
2422
        [OperationContract]
2423
        public List<MarkupInfoItem> GetPrintDocItemList(string project_no, string doc_id, List<MarkupInfoItem> _markupInfoList)
2424
        {
2425
            MarkupInfoItem _result = null;
2426
            List<MarkupInfoItem> markupinfo = new List<MarkupInfoItem>();
2427
            try
2428
            {
2429
                using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
2430
                {
2431
                    var docitem = (from info in Entity.DOCINFO
2432
                               where info.DOCUMENT_ID == doc_id
2433
                               && info.PROJECT_NO == project_no
2434
                               select info).First();
2435

    
2436
                    foreach (MARKUP_INFO markinfo in docitem.MARKUP_INFO)
2437
                    {
2438
                        var member = (from mem in Entity.MEMBER
2439
                                     where mem.ID == markinfo.USER_ID
2440
                                     select mem).First();
2441
                        string displaycolor = null;
2442
                        try
2443
                        {
2444
                            displaycolor = _markupInfoList.Where(info => info.MarkupInfoID == markinfo.ID).First().DisplayColor;
2445
                        }
2446
                        catch(Exception)
2447
                        {
2448
                            displaycolor = "#FFFFFF";
2449
                        }
2450
                        
2451
                        _result = new MarkupInfoItem
2452
                        {
2453
                            MarkupInfoID = markinfo.ID,
2454
                            Consolidate = markinfo.CONSOLIDATE,
2455
                            CreateTime = markinfo.UPDATE_TIME.HasValue ? markinfo.UPDATE_TIME.Value : markinfo.CREATE_TIME,
2456
                            DisplayColor = displaycolor,
2457
                            UserID = markinfo.USER_ID,
2458
                            UserName = member.NAME,
2459
                            Depatment = member.DEPARTMENT,
2460
                        };
2461

    
2462
                        _result.MarkupList = new List<IKCOM.MarkupItem>();
2463
                        var markup_Version = markinfo.MARKUP_INFO_VERSION.OrderByDescending(p => p.CREATE_DATE).First();
2464

    
2465
                        foreach (MARKUP_DATA markdata in markup_Version.MARKUP_DATA)
2466
                        {
2467
                            MarkupItem markitem = new MarkupItem()
2468
                            {
2469
                                ID = markdata.ID,
2470
                                PageNumber = markdata.PAGENUMBER,
2471
                            };
2472
                            _result.MarkupList.Add(markitem);
2473
                        }
2474

    
2475
                        _result.PageCount = _result.MarkupList.GroupBy(i => i.PageNumber).Count();
2476

    
2477
                        markupinfo.Add(_result);
2478
                    }
2479
                }
2480
            }
2481
            catch (Exception)
2482
            {
2483
                return null;
2484
            }
2485
            return markupinfo;
2486
        }
2487

    
2488
        [OperationContract]
2489
        public bool AddMessage(string project_no, TALK value)
2490
        {
2491
            try
2492
            {
2493
                using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
2494
                {                    
2495
                    entity.TALK.AddObject(value);
2496
                    entity.SaveChanges();
2497
                }
2498
            }
2499
            catch (Exception)
2500
            {
2501
                return false;
2502
            }
2503
            return true;
2504
        }
2505

    
2506
        [OperationContract]
2507
        public List<TALK> GetMessage(string project_no, string doc_id)
2508
        {
2509
            List<TALK> result = new List<TALK>();
2510
            try
2511
            {
2512
                using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
2513
                {
2514
                    result = entity.TALK.Where(data => data.DOCUMENT_ID == doc_id).ToList();                        
2515
                }
2516
            }
2517
            catch (Exception)
2518
            {
2519
                return result;
2520
            }
2521
            return result;
2522
        }
2523

    
2524

    
2525
        #region Legacy System I/F
2526
        /// <summary>
2527
        /// Ensemble+ Sign Data Return
2528
        /// </summary>
2529
        /// <param name="user_id"></param>
2530
        /// <returns></returns>
2531
        private string getEnsembleSign(string user_id)
2532
        {
2533
            string result = string.Empty;
2534
            string soapurl = string.Empty;
2535
            try
2536
            {
2537
                using (KCOMEntities Entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
2538
                {
2539
                    var item = Entity.PROPERTIES.Where(d => d.TYPE == "UpLoadServiceUrl").FirstOrDefault();
2540
                    soapurl = item.VALUE;
2541
                }
2542
                WebClient webClient = new WebClient();
2543
                string data = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ens=\"http://EnsemblePlus.Webservice\"> <soapenv:Header/> <soapenv:Body> <ens:checkoutSignImage>"
2544
                    + "<ens:sUserNo>" + user_id + "</ens:sUserNo>"
2545
                    + "</ens:checkoutSignImage> </soapenv:Body></soapenv:Envelope>";
2546
                webClient.Headers.Add(HttpRequestHeader.ContentType, "text/xml");
2547
                webClient.Headers.Add("SOAPAction", "http://EnsemblePlus.Webservice");
2548
                var _result = webClient.UploadString(new Uri(soapurl), data);
2549
                XmlDocument xmlDoc = new XmlDocument();
2550
                xmlDoc.LoadXml(_result);
2551
                XmlNodeList list = xmlDoc.GetElementsByTagName("checkoutSignImageResponse");
2552
                foreach (XmlNode xn in list)
2553
                {
2554
                    result = xn["checkoutSignImageReturn"].InnerText;
2555
                }
2556
                if (!result.Contains("No business object"))
2557
                {
2558
                    return result;
2559
                }
2560
                else
2561
                {
2562
                    return null;
2563
                }
2564
            }
2565
            catch (Exception ex)
2566
            {
2567
                return null;
2568
            }
2569

    
2570

    
2571
        }
2572
        #endregion
2573

    
2574
        #region Final Service
2575
        [OperationContract]
2576
        [ServiceKnownType(typeof(DOCINFO))]                
2577
        public DOCINFO FinalPDF_GetDocinfo(string project_no, string docinfo_id)
2578
        {
2579
            DOCINFO docinfo = null;
2580

    
2581
            try
2582
            {
2583
                using (CIEntities _entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
2584
                {
2585
                    var doc = _entity.DOCINFO.Where(x => x.ID == docinfo_id).FirstOrDefault();
2586
                    if(doc != null)
2587
                    {
2588
                        docinfo = new DOCINFO()
2589
                        {
2590
                            ID = doc.ID,
2591
                            DOCUMENT_ID = doc.DOCUMENT_ID,
2592
                            PAGE_COUNT = doc.PAGE_COUNT,
2593
                            ORIGINAL_FILE = doc.ORIGINAL_FILE,
2594
                            PROJECT_NO = doc.PROJECT_NO
2595
                        };
2596
                    }                    
2597
                }
2598
            }
2599
            catch (Exception)
2600
            {
2601
                throw;
2602
            }
2603
            return docinfo;
2604
        }
2605
        [OperationContract]
2606
        [ServiceKnownType(typeof(DOCUMENT_ITEM))]
2607
        public DOCUMENT_ITEM FinalPDF_GetDocumentItem(string project_no, string document_id)
2608
        {
2609
            DOCUMENT_ITEM item = null;
2610

    
2611
            try
2612
            {
2613
                using (CIEntities _entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
2614
                {
2615
                    var doc = _entity.DOCUMENT_ITEM.Where(x => x.DOCUMENT_ID == document_id).FirstOrDefault();
2616
                    if(doc != null)
2617
                    {
2618
                        item = new DOCUMENT_ITEM()
2619
                        {
2620
                            ID = doc.ID,
2621
                            ORIGINAL_FILE = doc.ORIGINAL_FILE,
2622
                            PROJECT_NO = doc.PROJECT_NO,
2623
                            DOCUMENT_ID = doc.DOCUMENT_ID,
2624
                            DOCUMENT_NO = doc.DOCUMENT_NO,
2625
                            DOCUMENT_NAME = doc.DOCUMENT_NAME,
2626
                            ENSEMBLEINFO_URL = doc.ENSEMBLEINFO_URL,
2627
                            GROUP_NO = doc.GROUP_NO,
2628
                            RESULT = doc.RESULT,
2629
                            REVISION = doc.REVISION,
2630
                            RESULT_FILE = doc.RESULT_FILE
2631
                        };
2632
                    }
2633
                    
2634
                }
2635
            }
2636
            catch (Exception)
2637
            {
2638
                throw;
2639
            }
2640
            return item;
2641
        }
2642
        [OperationContract]
2643
        [ServiceKnownType(typeof(MARKUP_DATA))]
2644
        public List<MARKUP_DATA> FinalPDF_GetMarkupdata(string project_no, string docinfo_id)
2645
        {
2646
            List<MARKUP_DATA> results = new List<MARKUP_DATA>();
2647

    
2648
            try
2649
            {
2650
                //using (CIEntities _entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
2651
                using (CIEntities _entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
2652
                {
2653
                    var datas = _entity.MARKUP_DATA.Where(x => x.MARKUP_INFO_VERSION.MARKUP_INFO.DOCINFO_ID == docinfo_id
2654
                    && x.MARKUP_INFO_VERSION.MARKUP_INFO.CONSOLIDATE == 1
2655
                    && x.MARKUP_INFO_VERSION.MARKUP_INFO.AVOID_CONSOLIDATE == 0
2656
                    && x.MARKUP_INFO_VERSION.MARKUP_INFO.PART_CONSOLIDATE == 0).ToList();
2657
                    foreach (var data in datas)
2658
                    {
2659
                        MARKUP_DATA d = new MARKUP_DATA()
2660
                        {
2661
                            ID = data.ID,
2662
                            //GROUP_ID = data.GROUP_ID,
2663
                            SYMBOL_ID = data.SYMBOL_ID,
2664
                            DATA = data.DATA,
2665
                            DATA_TYPE = data.DATA_TYPE,
2666
                            MARKUPINFO_VERSION_ID = data.MARKUPINFO_VERSION_ID,
2667
                            PAGENUMBER = data.PAGENUMBER
2668
                        };
2669
                        results.Add(d);
2670
                    }
2671
                }
2672
            }
2673
            catch (Exception)
2674
            {
2675
                throw;
2676
            }
2677
            return results;
2678
        }
2679
        [OperationContract]
2680
        [ServiceKnownType(typeof(MARKUP_INFO))]
2681
        public MARKUP_INFO FinalPDF_GetMarkupinfo(string project_no, string docinfo_id)
2682
        {
2683
            MARKUP_INFO markupInfo = null;
2684

    
2685
            try
2686
            {
2687
                using (CIEntities _entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
2688
                {
2689
                    var tmp = _entity.MARKUP_INFO.Where(x => x.DOCINFO_ID == docinfo_id && x.CONSOLIDATE == 1 && x.AVOID_CONSOLIDATE == 0 && x.PART_CONSOLIDATE == 0).FirstOrDefault();
2690
                    if (tmp != null)
2691
                    {
2692
                        markupInfo = new MARKUP_INFO()
2693
                        {
2694
                            ID = tmp.ID,
2695
                            DOCINFO_ID = tmp.DOCINFO_ID,
2696
                            USER_ID = tmp.USER_ID
2697
                        };
2698
                    }                    
2699
                }
2700
            }
2701
            catch (Exception)
2702
            {
2703
                throw;
2704
            }
2705
            return markupInfo;
2706
        }
2707
        [OperationContract]
2708
        [ServiceKnownType(typeof(FINAL_PDF))]
2709
        public List<FINAL_PDF> FinalPDF_GetFinalPDFs(string final_id)
2710
        {
2711
            List<FINAL_PDF> results = new List<FINAL_PDF>();
2712

    
2713
            try
2714
            {
2715
                using (KCOMEntities _entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
2716
                {
2717
                    var finalList = _entity.FINAL_PDF.Where(final => final.ID == final_id).ToList();
2718
                    foreach(var final in finalList)
2719
                    {
2720
                        FINAL_PDF pdf = new FINAL_PDF()
2721
                        {
2722
                            ID = final.ID,
2723
                            DOCINFO_ID = final.DOCINFO_ID,
2724
                            DOCUMENT_ID = final.DOCUMENT_ID,
2725
                            STATUS = final.STATUS,
2726
                            CURRENT_PAGE = final.CURRENT_PAGE,
2727
                            CREATE_DATETIME = final.CREATE_DATETIME,
2728
                            START_DATETIME = final.START_DATETIME,
2729
                            END_DATETIME = final.END_DATETIME,
2730
                            EXCEPTION = final.EXCEPTION,
2731
                            PROJECT_NO = final.PROJECT_NO,
2732
                            TOTAL_PAGE = final.TOTAL_PAGE,
2733
                            MARKUPINFO_ID = final.MARKUPINFO_ID,
2734
                            CREATE_USER_ID = final.CREATE_USER_ID
2735
                        };
2736
                        results.Add(pdf);
2737
                    }
2738
                }
2739
            }
2740
            catch (Exception)
2741
            {
2742
                throw;
2743
            }
2744
            return results;
2745
        }
2746
        [OperationContract]
2747
        [ServiceKnownType(typeof(DOCPAGE))]
2748
        public List<DOCPAGE> FinalPDF_GetDocpage(string project_no, string docinfo_id)
2749
        {
2750
            List<DOCPAGE> results = new List<DOCPAGE>();
2751

    
2752
            try
2753
            {
2754
                using (CIEntities _entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
2755
                {
2756
                    var pages = _entity.DOCPAGE.Where(x => x.DOCINFO_ID == docinfo_id).OrderBy(x => x.PAGE_NUMBER).ToList();
2757
                    foreach(var page in pages)
2758
                    {
2759
                        DOCPAGE p = new DOCPAGE()
2760
                        {
2761
                            PAGE_ANGLE = page.PAGE_ANGLE,
2762
                            PAGE_NUMBER = page.PAGE_NUMBER,
2763
                            PAGE_HEIGHT = page.PAGE_HEIGHT,
2764
                            PAGE_WIDTH = page.PAGE_WIDTH,
2765
                            DOCINFO_ID = page.DOCINFO_ID                            
2766
                        };
2767
                        results.Add(p);
2768
                    }                    
2769
                }
2770
            }
2771
            catch (Exception)
2772
            {
2773
                throw;
2774
            }
2775
            return results;
2776
        }
2777
        [OperationContract]        
2778
        public bool FinalPDF_SetFinalPDFStatus(string final_id, FinalStatus status)
2779
        {
2780
            bool result = false;
2781

    
2782
            try
2783
            {
2784
                using (KCOMEntities _entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
2785
                {
2786
                    var tmp = _entity.FINAL_PDF.Where(x => x.ID == final_id).FirstOrDefault();
2787
                    if(tmp != null)
2788
                    {
2789
                        switch(status)
2790
                        {
2791
                            case FinalStatus.Create:
2792
                                tmp.START_DATETIME = DateTime.Now;
2793
                                break;
2794
                            case FinalStatus.Success:
2795
                                tmp.END_DATETIME = DateTime.Now;
2796
                                tmp.EXCEPTION = string.Empty;
2797
                                break;                                
2798
                        }
2799
                        tmp.STATUS = (int)status;
2800
                        _entity.SaveChanges();
2801
                        result = true;                        
2802
                    }
2803
                }                    
2804
            }
2805
            catch (Exception)
2806
            {
2807
                throw;
2808
            }
2809
            return result;
2810
        }
2811

    
2812
        /// <summary>
2813
        /// 현재 진행중인 Final PDF 가 없거나 Success 일 경우에만 true return
2814
        /// </summary>
2815
        /// <param name="DocInfoID"></param>
2816
        /// <param name="MarkupInfoID"></param>
2817
        /// <param name="CreateUserID"></param>
2818
        /// <returns></returns>
2819
        [OperationContract]
2820
        public bool FinalPDF_GetFinalPDFStatus(string DocInfoID, string MarkupInfoID, string CreateUserID)
2821
        {
2822
            bool result = false;
2823

    
2824
            try
2825
            {
2826
                using (KCOMEntities _entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
2827
                {
2828
                    var finalpdf = _entity.FINAL_PDF.Where(x => x.DOCINFO_ID == DocInfoID && x.MARKUPINFO_ID == MarkupInfoID && x.CREATE_USER_ID == CreateUserID && x.STATUS != (int)FinalStatus.Error).FirstOrDefault();
2829
                    if (finalpdf != null)
2830
                    {
2831
                        if (finalpdf.STATUS == (int)FinalStatus.Success)
2832
                        {
2833
                            result = true;
2834
                        }
2835
                    }
2836
                    else
2837
                        result = true;
2838
                }
2839
            }
2840
            catch (Exception)
2841
            {
2842
                throw;
2843
            }
2844
            return result;
2845
        }
2846

    
2847
        [OperationContract]
2848
        public bool FinalPDF_SetCurrentPage(string final_id, int currentpage)
2849
        {
2850
            bool result = false;
2851

    
2852
            try
2853
            {
2854
                using (KCOMEntities _entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
2855
                {
2856
                    var tmp = _entity.FINAL_PDF.Where(x => x.ID == final_id).FirstOrDefault();
2857
                    if (tmp != null)
2858
                    {
2859
                        tmp.CURRENT_PAGE = currentpage;
2860
                        _entity.SaveChanges();
2861
                        result = true;
2862
                    }
2863
                }
2864
            }
2865
            catch (Exception)
2866
            {
2867
                throw;
2868
            }
2869
            return result;
2870
        }
2871
        [OperationContract]
2872
        public bool FinalPDF_SetError(string final_id, string msg)
2873
        {
2874
            bool result = false;
2875

    
2876
            try
2877
            {
2878
                using (KCOMEntities _entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
2879
                {
2880
                    var tmp = _entity.FINAL_PDF.Where(x => x.ID == final_id).FirstOrDefault();
2881
                    if (tmp != null)
2882
                    {                        
2883
                        tmp.STATUS = (int)FinalStatus.Error;
2884
                        tmp.EXCEPTION = DateTime.Now.ToShortDateString() + " " + msg;                        
2885
                        _entity.SaveChanges();
2886
                        result = true;
2887
                    }
2888
                }
2889
            }
2890
            catch (Exception)
2891
            {
2892
                throw;
2893
            }
2894
            return result;
2895
        }
2896

    
2897
        [OperationContract]
2898
        public bool FinalPDF_SetFinalResultPath(string project_no, string document_id, string url)
2899
        {
2900
            bool result = false;
2901

    
2902
            try
2903
            {
2904
                using (CIEntities _entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
2905
                {
2906
                    var item = _entity.DOCUMENT_ITEM.Where(d => d.DOCUMENT_ID == document_id).FirstOrDefault();
2907
                    if (item != null)
2908
                    {
2909
                        item.RESULT_FILE = url;
2910
                        _entity.SaveChanges();
2911
                        result = true;
2912
                    }
2913
                }
2914
            }
2915
            catch (Exception)
2916
            {
2917
                throw;
2918
            }
2919
            return result;
2920
        }
2921
        [OperationContract]
2922
        [ServiceKnownType(typeof(MEMBER))]
2923
        public MEMBER FinalPDF_GetCommentMember(string project_no, string markupdata_id)
2924
        {
2925
            MEMBER member = null;
2926
            try
2927
            {
2928
                using (CIEntities _entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
2929
                {
2930
                    var data = _entity.MARKUP_DATA.Where(x => x.ID == markupdata_id).FirstOrDefault();
2931
                    string user_id = data.MARKUP_INFO_VERSION.MARKUP_INFO.USER_ID;
2932
                    var person = _entity.MEMBER.Where(p => p.ID == user_id).FirstOrDefault();
2933
                    if(person != null)
2934
                    {
2935
                        member = new MEMBER()
2936
                        {
2937
                            ID = user_id,
2938
                            NAME = person.NAME,
2939
                            DEPARTMENT = person.DEPARTMENT
2940
                        };
2941
                    }
2942
                }
2943
            }
2944
            catch (Exception)
2945
            {
2946
                throw;
2947
            }
2948
            return member;
2949
        }
2950

    
2951
        [OperationContract]
2952
        [ServiceKnownType(typeof(PROPERTIES))]
2953
        public List<PROPERTIES> FinalPDF_GetProperties(string project_no)
2954
        {
2955
            List<PROPERTIES> results = new List<PROPERTIES>();
2956
            try
2957
            {
2958
                using (KCOMEntities _entity = new KCOMEntities(KCOMDataModel.Common.ConnectStringBuilder.KCOMConnectionString().ToString()))
2959
                {
2960
                    var _items = _entity.PROPERTIES.Where(x => x.PROPERTY == project_no).ToList();
2961
                    foreach(var item in _items)
2962
                    {
2963
                        PROPERTIES pROPERTIES = new PROPERTIES()
2964
                        {
2965
                            ID = item.ID,
2966
                            PROPERTY = item.PROPERTY,
2967
                            TYPE = item.TYPE,
2968
                            VALUE = item.VALUE
2969
                        };
2970
                        results.Add(pROPERTIES);
2971
                    }
2972
                }
2973

    
2974
            }
2975
            catch (Exception)
2976
            {
2977
                throw;
2978
            }
2979
            return results;
2980
        }
2981
        #endregion
2982
    }
2983
}
클립보드 이미지 추가 (최대 크기: 500 MB)