프로젝트

일반

사용자정보

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

markus / KCOM_API / ServiceDeepView.svc.cs @ 55bf7ac2

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

1 787a4489 KangIngu
using IFinalPDF;
2
using IKCOM;
3
using KCOMDataModel.Common;
4
using KCOMDataModel.DataModel;
5
using System;
6
using System.Collections.Generic;
7 2ab012e8 djkim
using System.Collections.ObjectModel;
8 ff01c725 humkyung
using System.Configuration;
9 787a4489 KangIngu
using System.Linq;
10 dfb95d0f djkim
using System.Net;
11 787a4489 KangIngu
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 ff01c725 humkyung
using System.Web.Services;
17 787a4489 KangIngu
using System.Windows;
18 dfb95d0f djkim
using System.Xml;
19 315ae55e taeseongkim
using ColorSelector;
20 787a4489 KangIngu
21
namespace KCOM_API
22
{
23
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "ServiceDeepView" in code, svc and config file together.
24
    // 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.
25
    [ServiceContract(Namespace = "")]
26
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
27
    public partial class ServiceDeepView : System.Web.Services.WebService
28
    {
29 0585d5cc taeseongkim
        public ServiceDeepView()
30
        {
31 e1c892f7 taeseongkim
            //System.Diagnostics.Debug.WriteLine(OperationContext.Current.RequestContext.RequestMessage.Headers.Action.ToString());
32 0585d5cc taeseongkim
        }
33
34 ffddbe4e djkim
        /// <summary>
35
        /// Client Version 과 Server Version 을 비교하여 Server Version 이 최신이면 다운로드 url 리턴.
36
        /// </summary>
37
        /// <param name="is64BitProcess">64bit = true, 32bit = false</param>
38
        /// <param name="markusVer">client version</param>
39
        /// <returns></returns>
40 264c9309 ljiyeon
        [OperationContract]
41
        public string GetVersionData(bool is64BitProcess, string markusVer)
42
        {
43
            string url = null;
44 d71b4688 ljiyeon
45 264c9309 ljiyeon
            try
46
            {
47 ffddbe4e djkim
                Version client_version = new Version(markusVer);
48
                
49
                //DB에서 version 정보와 다운로드 url 을 Select
50
                PROPERTIES dbvalue = null;
51 ff01c725 humkyung
                string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
52
                using (KCOMEntities uc = new KCOMEntities(sConnString))
53 ffddbe4e djkim
                {
54
                    string wherestr = string.Empty;
55
                    if (is64BitProcess)
56 264c9309 ljiyeon
                    {
57 ffddbe4e djkim
                        wherestr = "Update_x64";                        
58 264c9309 ljiyeon
                    }
59
                    else
60
                    {
61 075cbfcf taeseongkim
                        wherestr = "Update_x86";                        
62 ffddbe4e djkim
                    }
63
                    dbvalue = uc.PROPERTIES.Where(data => data.TYPE == wherestr).FirstOrDefault();
64
                }
65
66
                //서버 버전이 최신이면 0보다 큰값 리턴
67
                Version server_version = new Version(dbvalue.PROPERTY);
68
                int result = server_version.CompareTo(client_version);  
69
                if (result > 0)
70
                {
71
                    url = dbvalue.VALUE;
72 264c9309 ljiyeon
                }
73
            }
74 0585d5cc taeseongkim
            catch (Exception ex)
75 264c9309 ljiyeon
            {
76 0585d5cc taeseongkim
                System.Diagnostics.Debug.WriteLine("KCOM_API - GetVersionData : " + ex.ToString());
77
78 264c9309 ljiyeon
                url = null;
79
            }
80
            return url;
81
        }
82 ff01c725 humkyung
    
83 787a4489 KangIngu
84
        [OperationContract]
85
        public KCOM_SystemInfo GetSystemData()
86
        {
87
            try
88
            {
89 ff01c725 humkyung
                string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
90
                using (KCOMEntities uc = new KCOMEntities(sConnString))
91 787a4489 KangIngu
                {
92
                    var SystemInfoSet = uc.PROPERTIES.Where(data => data.TYPE == "SystemInfo").ToList();
93
94
                    KCOM_SystemInfo sysInfo = new KCOM_SystemInfo();
95
96
                    var url = SystemInfoSet.Where(data => data.PROPERTY == "Url").FirstOrDefault();
97
                    if (url != null)
98
                    {
99
                        sysInfo.HostName = url.VALUE;
100
                    }
101
102
                    url = SystemInfoSet.Where(data => data.PROPERTY == "Port").FirstOrDefault();
103
                    if (url != null)
104
                    {
105
                        sysInfo.HostPort = url.VALUE;
106
                    }
107 9a1ce1db KangIngu
108
                    url = uc.PROPERTIES.Where(data => data.TYPE == "STAMP").FirstOrDefault();
109
                    if(url != null)
110
                    {
111
                        sysInfo.STAMP = url.VALUE;
112
                    }
113 787a4489 KangIngu
                    return sysInfo;
114
                }
115
            }
116
            catch (Exception ex)
117
            {
118 0585d5cc taeseongkim
                System.Diagnostics.Debug.WriteLine("KCOM_API - GetSystemData : " + ex.ToString());
119
120 787a4489 KangIngu
            }
121
            return null;
122 24c5e56c taeseongkim
            //GC.Collect(2);
123 787a4489 KangIngu
        }
124
125
        private static string shortGuid()
126 e1c892f7 taeseongkim
        { 
127 787a4489 KangIngu
            byte[] bytes = new byte[16];
128
            using (var provider = System.Security.Cryptography.RandomNumberGenerator.Create())
129
            {
130
                provider.GetBytes(bytes);
131
            }
132
133
            var guid = new Guid(bytes);
134
135
            return Convert.ToBase64String(guid.ToByteArray())
136
                .Substring(0, 10)
137
                .Replace("/", "")
138
                .Replace("+", "") + DateTime.UtcNow.Ticks.ToString("x");
139
        }
140
141
142
        [OperationContract]
143 992a98b4 KangIngu
        public List<FAVORITE_DOC> GetFavoriteVP(string PrjNo, string userID, string sharepointItemID)
144
        {
145 ff01c725 humkyung
            string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
146
            using (KCOMEntities dc = new KCOMEntities(sConnString))
147 992a98b4 KangIngu
            {
148
149
                int flagString = Convert.ToInt32(FAVORITE_FLAG.Personal);
150
                List<FAVORITE_DOC> favoriteListSet = new List<FAVORITE_DOC>();
151
                //dc.FAVORITE_DOC.Where(data => data.PROJECT_NO == PrjNo && data.DOCUMENT_ID == sharepointItemID && data.FLAG !=
152
                //    flagString).ToList().ForEach(data => favoriteListSet.Add(data));
153
154
155
                //dc.FAVORITE_DOC.Where(data => data.PROJECT_NO == PrjNo && data.MEMBER_USER_ID == userID).ToList().ForEach(data => favoriteListSet.Add(data));
156
157
                favoriteListSet = dc.FAVORITE_DOC.Where(data => data.PROJECT_NO == PrjNo && data.MEMBER_USER_ID == userID && data.DOCUMENT_ID == sharepointItemID).ToList();
158
159
                //favoriteListSet = favoriteListSet.Distinct().ToList();
160
                return favoriteListSet;
161
            }
162
        }
163 0585d5cc taeseongkim
164 992a98b4 KangIngu
        [OperationContract]
165
        public bool EditFavoriteVP(string prjNo, string userID, string docID, int state, string description)
166
        {
167 ff01c725 humkyung
            string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
168
            using (KCOMEntities dc = new KCOMEntities(sConnString))
169 992a98b4 KangIngu
            {
170
                //List<FAVORITE_DOC> favoriteSet = dc.FAVORITE_DOC.Where(data => data.PROJECT_NO == prjNo && data.MEMBER_USER_ID == userID
171
                //    && data.PAGE_NO == SavePageNo && data.CREATE_TIME == createTime).ToList();
172
                List<FAVORITE_DOC> favoriteSet = dc.FAVORITE_DOC.Where(data => data.PROJECT_NO == prjNo && data.MEMBER_USER_ID == userID
173
                    && data.ID == docID).ToList();
174
                try
175
                {
176
177
                    if (favoriteSet.Count > 0)
178
                    {
179
                        var FavoriteVP_Instance = favoriteSet.First();
180
181
                        FavoriteVP_Instance.DESCRIPTION = description;
182
                        FavoriteVP_Instance.FLAG = state;
183
184
                        dc.SaveChanges();
185
186
                        return true;
187
                    }
188
                    else
189
                    {
190
                        return false;
191
                    }
192
                }
193 0585d5cc taeseongkim
                catch (Exception ex)
194 992a98b4 KangIngu
                {
195 0585d5cc taeseongkim
                    System.Diagnostics.Debug.WriteLine("KCOM_API - EditFavoriteVP : " + ex.ToString());
196
197 992a98b4 KangIngu
                    return false;
198
                }
199
            }
200
        }
201
202
        [OperationContract]
203
        public bool DelFavoriteVP(string prjNo, string userID, int SavePageNo, string docID)
204
        {
205 ff01c725 humkyung
            string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
206
            using (KCOMEntities dc = new KCOMEntities(sConnString))
207 992a98b4 KangIngu
            {
208
209
                List<FAVORITE_DOC> favoriteSet = dc.FAVORITE_DOC.Where(data => data.PROJECT_NO == prjNo && data.MEMBER_USER_ID == userID
210
                    && data.ID == docID).ToList();
211
212
                try
213
                {
214
                    if (favoriteSet.Count > 0)
215
                    {
216
                        favoriteSet.ForEach(data => dc.FAVORITE_DOC.DeleteObject(data));
217
                        dc.SaveChanges();
218
                        return true;
219
                    }
220
                    else
221
                    {
222
                        return false;
223
                    }
224
                }
225 0585d5cc taeseongkim
                catch (Exception ex)
226 992a98b4 KangIngu
                {
227 0585d5cc taeseongkim
                    System.Diagnostics.Debug.WriteLine("KCOM_API - DelFavoriteVP : " + ex.ToString());
228
229 992a98b4 KangIngu
                    return false;
230
                }
231
            }
232
        }
233
234 9294fed6 humkyung
        /// <summary>
235
        /// 두 페이지를 비교하여 결과를 리턴한다
236
        /// </summary>
237
        /// <param name="projectNo"></param>
238
        /// <param name="originDocItem_ID"></param>
239
        /// <param name="targetDocItem_ID"></param>
240
        /// <param name="originPageNo"></param>
241
        /// <param name="targetPageNo"></param>
242
        /// <param name="isInternalAddress"></param>
243
        /// <returns></returns>
244 992a98b4 KangIngu
        [OperationContract]
245 d9cf7d6e djkim
        public List<Rect> GetCompareRect(string projectNo, string originDocItem_ID, string targetDocItem_ID, string originPageNo, string targetPageNo, string isInternalAddress)
246 787a4489 KangIngu
        {
247 6b6e937c taeseongkim
            List<Rect> result = new List<Rect>();
248
249 72424099 taeseongkim
            try
250
            {
251
                string originFile = "";
252
                string targetFile = "";
253 a874198d humkyung
254 72424099 taeseongkim
                string sOriginFolder = originDocItem_ID.All(char.IsDigit) ? (Convert.ToUInt32(originDocItem_ID) / 100).ToString() : (originDocItem_ID.Length >= 5 ? originDocItem_ID.Substring(0, 5) : originDocItem_ID);
255
                string sTagetFolder = targetDocItem_ID.All(char.IsDigit) ? (Convert.ToUInt32(targetDocItem_ID) / 100).ToString() : (targetDocItem_ID.Length >= 5 ? targetDocItem_ID.Substring(0, 5) : targetDocItem_ID);
256 a1142a6b taeseongkim
257 72424099 taeseongkim
                if (Boolean.Parse(isInternalAddress))
258
                {
259
                    originFile = String.Format(KCOM_API.Properties.Settings.Default.TileSoucePath, projectNo, sOriginFolder, originDocItem_ID, originPageNo);
260
                    targetFile = String.Format(KCOM_API.Properties.Settings.Default.TileSoucePath, projectNo, sTagetFolder, targetDocItem_ID, targetPageNo);
261
                }
262
                else
263
                {
264
                    originFile = String.Format(KCOM_API.Properties.Settings.Default.TileSoucePath_SUB, projectNo, originDocItem_ID, originPageNo);
265
                    targetFile = String.Format(KCOM_API.Properties.Settings.Default.TileSoucePath_SUB, projectNo, targetDocItem_ID, targetPageNo);
266
                }
267 787a4489 KangIngu
268 5b5d9b1f taeseongkim
                using (Markus.Image.ImageCompare compareLib = new Markus.Image.ImageCompare())
269 72424099 taeseongkim
                {
270
                    result = compareLib.CompareReturnRects(originFile, targetFile, new System.Drawing.Size(20, 20));
271
                }
272
            }
273
            catch (Exception ex)
274 6b6e937c taeseongkim
            {
275 0585d5cc taeseongkim
                System.Diagnostics.Debug.WriteLine("KCOM_API - GetCompareRect : " + ex.ToString());
276 72424099 taeseongkim
                //throw new FaultException(ex.ToString() + " Inner Exception : " + ex.InnerException?.ToString());
277 6b6e937c taeseongkim
            }
278 0585d5cc taeseongkim
279 787a4489 KangIngu
280
            return result;
281
        }
282
283 6b6e937c taeseongkim
        //[OperationContract]
284
        //public List<Rect> GetCompareRect_old(string projectNo, string originDocItem_ID, string targetDocItem_ID, string originPageNo, string targetPageNo, string isInternalAddress)
285
        //{
286
        //    System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch();
287
288
        //    stopwatch.Start();
289
290
        //    string originFile = "";
291
        //    string targetFile = "";
292
293
        //    string sFolder = originDocItem_ID.All(char.IsDigit) ? (Convert.ToUInt32(originDocItem_ID) / 100).ToString() : (originDocItem_ID.Length >= 5 ? originDocItem_ID.Substring(0, 5) : originDocItem_ID);
294
        //    if (Boolean.Parse(isInternalAddress))
295
        //    {
296
        //        originFile = String.Format(KCOM_API.Properties.Settings.Default.TileSoucePath, projectNo, sFolder, originDocItem_ID, originPageNo);
297
        //        targetFile = String.Format(KCOM_API.Properties.Settings.Default.TileSoucePath, projectNo, sFolder, targetDocItem_ID, targetPageNo);
298
        //    }
299
        //    else
300
        //    {
301
        //        originFile = String.Format(KCOM_API.Properties.Settings.Default.TileSoucePath_SUB, projectNo, originDocItem_ID, originPageNo);
302
        //        targetFile = String.Format(KCOM_API.Properties.Settings.Default.TileSoucePath_SUB, projectNo, targetDocItem_ID, targetPageNo);
303
        //    }
304
305
        //    CompareLib compareLib = new CompareLib();
306
307
        //    var resultOrigin = compareLib.ChangeCmpUrlToPng_File(originFile);
308
        //    var resultTarget = compareLib.ChangeCmpUrlToPng_File(targetFile);
309
310
        //    string outPutFile = compareLib.ImageCompare_File(resultOrigin, resultTarget);
311
        //    var result = compareLib.GetBoundBoxInImage(outPutFile);
312
313
        //    System.Diagnostics.Debug.WriteLine(new TimeSpan(stopwatch.ElapsedTicks));
314
315
        //    return result;
316
        //}
317
318 787a4489 KangIngu
319
        #region Final PDF
320
        private string _ChanID = null;
321
        TcpChannel chan = null;
322
        [OperationContract]
323
        public FinalPDFResult SetFinalPDF(string ProjectNo, string DocInfoID, string MarkupInfoID, string CreateUserID)
324
        {
325
            #region 임시보관
326
            #endregion
327
            FinalPDFResult _result = new FinalPDFResult();
328
            RemFinalPDFObject remObj = null;
329
            try
330
            {
331
                string _finalID = shortGuid();
332
                int _DocTotalPages = -1;
333
                string docItemId;
334
335 ff01c725 humkyung
                string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString;
336
                using (CIEntities _ci = new CIEntities(sCIConnString))
337 787a4489 KangIngu
                {
338
                    var _doc = _ci.DOCINFO.Where(info => info.ID == DocInfoID);
339
340
                    if (_doc.Count() > 0)
341
                    {
342
                        _DocTotalPages = _doc.First().PAGE_COUNT;
343
                        docItemId = _doc.First().DOCUMENT_ID;
344
                    }
345
                    else
346
                    {
347
                        _result.Status = FinalStatus.Error;
348
                        _result.Exception = "페이지 정보를 가져올 수 없습니다.";
349
                        return _result;
350
                    }
351
                }
352
                if (_DocTotalPages > 0)
353
                {
354
                    FINAL_PDF fm = new FINAL_PDF()
355
                    {
356
                        ID = _finalID,
357
                        PROJECT_NO = ProjectNo,
358
                        DOCINFO_ID = DocInfoID,
359
                        DOCUMENT_ID = docItemId,
360
                        MARKUPINFO_ID = MarkupInfoID,
361
                        CREATE_USER_ID = CreateUserID,
362
                        TOTAL_PAGE = _DocTotalPages,
363
                        CREATE_DATETIME = DateTime.Now,
364
                        STATUS = (int)IFinalPDF.FinalStatus.Insert
365
                    };
366 ff01c725 humkyung
367
                    string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
368
                    using (KCOMEntities _entity = new KCOMEntities(sConnString))
369 787a4489 KangIngu
                    {
370
                        _entity.AddToFINAL_PDF(fm);
371
                        _entity.SaveChanges(System.Data.Objects.SaveOptions.AcceptAllChangesAfterSave);
372
                    };
373
374
                    System.Runtime.Remoting.Channels.IChannel _ch = System.Runtime.Remoting.Channels.ChannelServices.GetChannel("tcp");
375
                    if (_ch == null)
376
                    {
377
                        chan = new TcpChannel();
378
                        _ChanID = chan.ChannelName;
379
                        System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(chan, false);
380
                        // Create an instance of the remote object
381
382 ff01c725 humkyung
                        using (KCOMEntities ec = new KCOMEntities(sConnString))
383 787a4489 KangIngu
                        {
384
385
                            //remObj = (RemFinalPDFObject)Activator.GetObject(typeof(RemFinalPDFObject),
386
                            //                          "tcp://localhost:9092/remFinalPDF");
387
                            remObj = (RemFinalPDFObject)Activator.GetObject(typeof(RemFinalPDFObject),
388
                                                      //"tcp://192.168.0.67:9092/remFinalPDF");
389 55bf7ac2 taeseongkim
                                                      KCOM_API.Properties.Settings.Default.FinalService);
390 787a4489 KangIngu
                        }
391
392
                        //"tcp://localhost:8080/remFinalPDF");
393
394
                        _result = remObj.SetFinalPDF(ProjectNo, _finalID);
395
                        _result.FinalID = _finalID;
396
                        _result.Status = FinalStatus.Success;
397
398
                        //MarkupToPDF.MarkupToPDF fa = new MarkupToPDF.MarkupToPDF();
399
                        //fa.MakeFinalPDF(fm);
400
                    }
401
                    else
402
                    {
403
                        _ChanID = _ch.ChannelName;
404
                    }
405
                }
406
            }
407
            catch (Exception ex)
408
            {
409 0585d5cc taeseongkim
                System.Diagnostics.Debug.WriteLine("KCOM_API - SetFinalPDF : " + ex.ToString());
410
411 787a4489 KangIngu
                _result.Status = FinalStatus.Error;
412
413
                if (ex.GetType() == typeof(System.Net.Sockets.SocketException))
414
                    _result.Exception = "Final Server Not Connection";
415 b734b65d djkim
                else _result.Exception = ex.ToString();
416 787a4489 KangIngu
            }
417
            finally
418
            {
419
                remObj = null;
420
                if (System.Runtime.Remoting.Channels.ChannelServices.GetChannel("tcp") != null)
421
                    System.Runtime.Remoting.Channels.ChannelServices.UnregisterChannel(chan);
422
423
                GC.Collect(2);
424
            }
425
            return _result;
426
        }
427
        #endregion
428
429
430
        [OperationContract]
431
        public bool GetConversionState(KCOM_BasicParam param)
432
        {
433 ff01c725 humkyung
            string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString;
434
            using (CIEntities entity = new CIEntities(sCIConnString))
435 787a4489 KangIngu
            {
436
                var doc = entity.DOCINFO.Where(data => data.DOCUMENT_ID == param.documentID).FirstOrDefault();
437
                if (doc != null)
438
                {
439
                    var count = doc.DOCPAGE.Where(data => data.DOCINFO_ID == doc.ID).Count();
440
                    if (doc.PAGE_COUNT == count)  //페이지 수가 일치하는지
441
                    {
442
                        return true;
443
                    }
444
                    else //페이지 수가 일치하지 않는 경우
445
                    {
446 ff01c725 humkyung
                        string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
447
                        KCOMEntities entity_kcom = new KCOMEntities(sConnString);
448 787a4489 KangIngu
                        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();
449
450
                        if (lst != null || lst.Count >= 1)
451
                        {
452
                            //Common.Helper.SystemErrorNotify(SERVICE_NAME.API, LEVEL.MEDIUM, ERROR_TYPE.CONVERT, Resources.ResourceManager.GetString("MSG_ERROR_PAGECOUNT"), param.documentID, param.projectNo);
453
                            //이메일 클라이언트를 구현해야함
454
                        }
455
                        return false;
456
                    }
457
                }
458
                else
459
                {
460
                    //Common.Helper.SystemErrorNotify(SERVICE_NAME.API, LEVEL.MEDIUM, ERROR_TYPE.CONVERT, Resources.ResourceManager.GetString("MSG_ERROR_CONVERTFAILED"), param.documentID, param.projectNo);
461
                    //이메일 클라이언트를 구현해야함
462
                    return false;
463
                }
464
            }
465
        }
466
467
        [OperationContract]
468
        public List<VPRevision> GetVPRevisionHistory(string ProjectNo, string vpNo, string DocumentId)
469
        {
470
            List<VPRevision> _result = new List<VPRevision>();
471
            try
472
            {
473 ff01c725 humkyung
                string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString;
474
                using (CIEntities entity = new CIEntities(sCIConnString))
475 787a4489 KangIngu
                {
476
                    var _vpList = (from docitem in entity.DOCUMENT_ITEM
477 0585d5cc taeseongkim
                                   where docitem.PROJECT_NO == ProjectNo && docitem.DOCUMENT_NO == vpNo
478 787a4489 KangIngu
                                   select new VPRevision
479
                                   {
480
                                       RevNo = docitem.REVISION,
481
                                       GroupNo = docitem.GROUP_NO,
482
                                       FROM_VENDOR = docitem.ORIGINAL_FILE,
483
                                       DOCUMENT_ID = docitem.DOCUMENT_ID,
484
                                       TO_VENDOR = docitem.RESULT_FILE,
485
                                       RESULT = docitem.RESULT,
486 c91f45f3 djkim
                                       DocNo = docitem.DOCUMENT_NO,
487 ab5aa762 taeseongkim
                                       //EnsembleLink = docitem.ENSEMBLEINFO_URL,
488 c0977e97 djkim
                                       //IsSyncPossible = docitem.DOCUMENT_ID == DocumentId ? false : entity.DOCINFO.Where(d => d.DOCUMENT_ID == docitem.DOCUMENT_ID).ToList().Count > 0 ? true : false
489 787a4489 KangIngu
                                   });
490
                    _result = _vpList.ToList();
491 c0977e97 djkim
                    foreach (var vp in _result)
492
                    {
493
                        if (entity.DOCINFO.Where(d => d.DOCUMENT_ID == vp.DOCUMENT_ID).ToList().Count > 0)
494
                            vp.IsSyncPossible = true;
495
                        else
496
                            vp.IsSyncPossible = false;
497
                    }
498 ff01c725 humkyung
499
                    //_result = _result.OrderByDescending(r => UInt64.Parse(System.Text.RegularExpressions.Regex.Replace(r.GroupNo, @"\D", ""))).ToList();
500 f65e6c02 taeseongkim
                    _result =  _result.OrderByDescending(r => r.GroupNo).ToList();
501 787a4489 KangIngu
                }
502
            }
503 ff01c725 humkyung
            catch (Exception ex)
504 787a4489 KangIngu
            {
505 0585d5cc taeseongkim
                System.Diagnostics.Debug.WriteLine("KCOM_API - GetVPRevisionHistory : " + ex.ToString());
506 787a4489 KangIngu
            }
507
            finally
508
            {
509 24c5e56c taeseongkim
                //GC.Collect(2);
510 787a4489 KangIngu
            }
511 0585d5cc taeseongkim
512 787a4489 KangIngu
            return _result;
513
        }
514
515
        [OperationContract]
516 2ab012e8 djkim
        public VPRevision GetVPRevisionFirstOrDefault(string ProjectNo, string DocumentId)
517
        {
518
            VPRevision _result = null;
519
            try
520
            {
521 ff01c725 humkyung
                string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString;
522
                using (CIEntities entity = new CIEntities(sCIConnString))
523 2ab012e8 djkim
                {
524
                    _result = (from docitem in entity.DOCUMENT_ITEM
525 0585d5cc taeseongkim
                     where docitem.PROJECT_NO == ProjectNo && docitem.DOCUMENT_ID == DocumentId
526 2ab012e8 djkim
                     select new VPRevision
527
                     {
528
                         RevNo = docitem.REVISION,
529
                         GroupNo = docitem.GROUP_NO,
530
                         FROM_VENDOR = docitem.ORIGINAL_FILE,
531
                         DOCUMENT_ID = docitem.DOCUMENT_ID,
532
                         TO_VENDOR = docitem.RESULT_FILE,
533
                         RESULT = docitem.RESULT
534
                     }).FirstOrDefault();
535
                }
536
            }
537 0585d5cc taeseongkim
            catch (Exception ex)
538 2ab012e8 djkim
            {
539 0585d5cc taeseongkim
                System.Diagnostics.Debug.WriteLine("KCOM_API - GetVPRevisionFirstOrDefault : " + ex.ToString());
540 2ab012e8 djkim
            }
541
            finally
542
            {
543 24c5e56c taeseongkim
                //GC.Collect(2);
544 2ab012e8 djkim
            }
545
            return _result;
546
        }
547
548
        [OperationContract]
549 787a4489 KangIngu
        public DOCINFO GetDocInfo(KCOM_BasicParam param)
550
        {
551
            DOCINFO _result = null;
552
            try
553
            {
554
                // 차후 아래의 코드로 변경
555
                //using (CI_Entities ModelDeeview = new CI_Entities(DaelimCiConnectionString.ToString()))
556 ff01c725 humkyung
                string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString;
557
                CIEntities ModelDeeview = new CIEntities(sCIConnString);
558 787a4489 KangIngu
559 683a4a8f djkim
                var docinfo = ModelDeeview.DOCINFO.Where(doc => doc.DOCUMENT_ID == param.documentID && doc.PROJECT_NO == param.projectNo);
560 787a4489 KangIngu
                if (docinfo.Count() > 0)
561
                {
562
                    _result = docinfo.First();
563
                    _result.MARKUP_INFO.Clear();
564
565
                }
566
                return _result;
567
568
            }
569
            catch (Exception ex)
570
            {
571 0585d5cc taeseongkim
                System.Diagnostics.Debug.WriteLine("KCOM_API - GetDocInfo : " + ex.ToString());
572 787a4489 KangIngu
            }
573
            finally
574
            {
575 24c5e56c taeseongkim
                //GC.Collect(2);
576 787a4489 KangIngu
            }
577
            return null;
578
        }
579
580
        [OperationContract]
581
        public bool GetCheckSystemAdmin(string UserID)
582
        {
583 ff01c725 humkyung
            string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
584
            using (KCOMEntities uc = new KCOMEntities(sConnString))
585 787a4489 KangIngu
            {
586
                var user = uc.PROPERTIES.Where(data => data.TYPE == "Administrator" && data.PROPERTY.Contains(UserID)).FirstOrDefault();
587
                if (user != null)
588
                {
589
                    return true;
590
                }
591
                else
592
                {
593
                    return false;
594
                }
595
            }
596 24c5e56c taeseongkim
            //GC.Collect(2);
597 787a4489 KangIngu
        }
598
599
        [OperationContract]
600
        public DOCUMENT_ITEM GetDocumentItemInfo(KCOM_BasicParam param)
601
        {
602
            ///param : prjNo, documentId, userId
603
            DOCUMENT_ITEM _result = null;
604
605
            try
606
            {
607 ff01c725 humkyung
                string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString;
608
                CIEntities entity = new CIEntities(sCIConnString);
609 ac91e747 taeseongkim
               
610 0585d5cc taeseongkim
                var _items = entity.DOCUMENT_ITEM.Where(data => data.PROJECT_NO == param.projectNo && data.DOCUMENT_ID == param.documentID);
611 787a4489 KangIngu
612
                if (_items.Count() > 0)
613
                {
614
                    _result = _items.First();
615
616
                    return _result;
617
                }
618
                //else
619
                //{
620
                //    Common.Helper.SystemErrorNotify(SERVICE_NAME.API, LEVEL.MEDIUM, ERROR_TYPE.CONVERT, Resources.ResourceManager.GetString("MSG_ERROR_DOCUMENTNOTFOUND"), param.documentID, param.projectNo);
621
                //}
622
            }
623
            catch (Exception ex)
624
            {
625 0585d5cc taeseongkim
                System.Diagnostics.Debug.WriteLine("KCOM_API - GetDocumentItemInfo : " + ex.ToString());
626 ac91e747 taeseongkim
627
                new FaultException("GetDocumentItemInfo Error - "  + ex.ToString());
628 ff01c725 humkyung
                //throw new FaultException(ex.ToString());
629 787a4489 KangIngu
                //Common.Helper.SystemErrorNotify(SERVICE_NAME.API, LEVEL.MEDIUM, ERROR_TYPE.CONVERT, "GetDocumentItemInfo / " + ex.Message, param.documentID, param.projectNo);
630
            }
631
632
            return _result;
633
        }
634 35afe17c djkim
        /// <summary>
635
        /// DOCUMENT_ITEM Table 의 ID 로 Item 을 Select
636
        /// </summary>
637 5ded1e5a djkim
        /// 대림의 경우 Interface ID(Document 의 ID) 를 parameter 로 전달
638
        /// 넘어온 ID를 통해 document id 를 확인하는 과정이 필요
639 35afe17c djkim
        /// <param name="ensemble_id"></param>
640
        /// <returns></returns>
641 c0977e97 djkim
        [OperationContract]
642
        public string GetDocItemID(string ensemble_id)
643
        {
644
            ///param : prjNo, documentId, userId
645
            string _result = string.Empty;
646
647
            try
648
            {
649 ff01c725 humkyung
                string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString;
650
                CIEntities entity = new CIEntities(sCIConnString);
651 787a4489 KangIngu
652 c0977e97 djkim
                var _items = entity.DOCUMENT_ITEM.Where(data => data.ID == ensemble_id).FirstOrDefault();
653 35afe17c djkim
                if(_items != null)
654
                    _result = _items.DOCUMENT_ID;
655 c0977e97 djkim
            }
656
            catch (Exception ex)
657
            {
658 0585d5cc taeseongkim
                System.Diagnostics.Debug.WriteLine("KCOM_API - GetDocItemID : " + ex.ToString());
659 c0977e97 djkim
                //System.Diagnostics.Trace.WriteLine("GetVendorItemInfo Error : " + ex);
660
                //Common.Helper.SystemErrorNotify(SERVICE_NAME.API, LEVEL.MEDIUM, ERROR_TYPE.CONVERT, "GetDocumentItemInfo / " + ex.Message, param.documentID, param.projectNo);
661
            }
662
663
            return _result;
664
        }
665 787a4489 KangIngu
        public string UserGO(MARKUP_INFO item)
666
        {
667
            if (item != null)
668
            {
669
                return item.MARKUP_INFO_VERSION.OrderByDescending(data => data.CREATE_DATE).FirstOrDefault().ID;
670
            }
671
            return null;
672
        }
673 53880c83 ljiyeon
        
674
        [OperationContract]
675
        public List<MarkupInfoItem> GetMarkupInfoItems(string ProjectNo, string DocInfoId)
676
        {
677
            List<MarkupInfoItem> _result = new List<MarkupInfoItem>();
678
            try
679
            {
680 ff01c725 humkyung
                string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString;
681
                using (CIEntities entity = new CIEntities(sCIConnString))
682 53880c83 ljiyeon
                {
683
                    var markupListData = entity.MARKUP_INFO.Where(data => data.DOCINFO_ID == DocInfoId).ToList();
684
685
                    var markupList = from markup in markupListData
686
                                     orderby markup.CREATE_TIME descending
687
                                     select new MarkupInfoItem
688
                                     {
689
                                         MarkupInfoID = markup.ID,
690
                                         UserID = markup.USER_ID,
691
                                         MarkupVersionID = markup.MARKUP_INFO_VERSION.Count() == 0 ? null : markup.MARKUP_INFO_VERSION.OrderByDescending(data => data.CREATE_DATE).FirstOrDefault().ID,
692
                                         CreateTime = markup.CREATE_TIME,
693
                                         Consolidate = markup.CONSOLIDATE,
694
                                         Description = markup.DESCRIPTION,
695
                                         AvoidConsolidate = markup.AVOID_CONSOLIDATE,
696
                                         PartConsolidate = markup.PART_CONSOLIDATE,
697
                                         UpdateTime = DateTime.Parse(markup.UPDATE_TIME.ToString()),
698
                                     };
699
700
                    if (markupList.Count() > 0)
701
                    {
702
                        _result = markupList.ToList();
703
                    }
704
705
                    _result.ForEach(r =>
706
                    {
707
708
                        r.MarkupList = (from markupData in entity.MARKUP_DATA
709
                                        where markupData.MARKUPINFO_VERSION_ID == r.MarkupVersionID
710
                                        orderby markupData.PAGENUMBER
711 c0977e97 djkim
                                        select new MarkupItem { ID = markupData.ID, PageNumber = markupData.PAGENUMBER, Data = markupData.DATA, Data_Type = markupData.DATA_TYPE, Symbol_ID = markupData.SYMBOL_ID}).ToList();
712 53880c83 ljiyeon
                    });
713
714 c0977e97 djkim
                    List<PROPERTIES> _ColorsProperties = new List<PROPERTIES>();
715 53880c83 ljiyeon
                    Random random = new Random();
716 ff01c725 humkyung
717
                    string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
718
                    using (KCOMEntities kcomEntity = new KCOMEntities(sConnString))
719 c0977e97 djkim
                    {
720
                        _ColorsProperties = (from property in kcomEntity.PROPERTIES
721
                                             where property.TYPE == "DisplayColor"
722
                                             select property).ToList();
723 315ae55e taeseongkim
724
                    }
725
726
                    if (_ColorsProperties.Count() == 0)
727
                    {
728
                        ColorGenerator uniqueColorGenerator = new ColorGenerator(System.Drawing.Color.Red); // 2303 = (int)Color.Red
729
730
                        uniqueColorGenerator.GetEnumerator(_result.Count());
731
732
                        for (int i = 0; i < _result.Count(); i++)
733
                        {
734
                             var c = uniqueColorGenerator.GetNext();
735
                            _ColorsProperties.Add(new PROPERTIES { VALUE = String.Format("{0:X2}{1:X2}{2:X2}",c.R, c.G,c.B) });
736
                        }
737 a1142a6b taeseongkim
                    }
738
739
                    bool IsProjectNoPass = Properties.Settings.Default.IsProjectNoPass;
740 53880c83 ljiyeon
741
                    foreach (var item in _result)
742
                    {
743 a1142a6b taeseongkim
                        string query = "SELECT members.ID,members.NAME,members.DEPARTMENT FROM CIEntities.MEMBER as members where members.ID = @userId";
744
745
                        System.Data.Objects.ObjectQuery<System.Data.Common.DbDataRecord> memberQuery 
746
                                      = entity.CreateQuery<System.Data.Common.DbDataRecord>(query,new System.Data.Objects.ObjectParameter("userId",item.UserID));
747 c0977e97 djkim
                        
748 a1142a6b taeseongkim
                        if (memberQuery.Count() > 0)
749 53880c83 ljiyeon
                        {
750 a1142a6b taeseongkim
                            string userName = memberQuery.First()["NAME"]?.ToString().Trim();
751
                            string depatment = memberQuery.First()["DEPARTMENT"]?.ToString().Trim();
752
753
                            item.UserName = userName;
754
                            item.Depatment = depatment;
755 53880c83 ljiyeon
                        }
756
757 c0977e97 djkim
                        if (_ColorsProperties.Count > 0)
758 53880c83 ljiyeon
                        {
759 c0977e97 djkim
                            int colorIdx = random.Next(0, _ColorsProperties.Count() - 1);
760
                            #region 부서별로 색상을 지정하고자 할때
761
                            /// 일단 의견을 들어보자구!
762
                            #endregion
763
                            item.DisplayColor = "#FF" + _ColorsProperties[colorIdx].VALUE;
764
                            _ColorsProperties.Remove(_ColorsProperties[colorIdx]);
765 53880c83 ljiyeon
                        }
766 c0977e97 djkim
                        else
767 53880c83 ljiyeon
                        {
768
                            item.DisplayColor = String.Format("#FF{0:X6}", random.Next(0x1000000));
769 c0977e97 djkim
                        }
770 53880c83 ljiyeon
                    }
771
                }
772
            }
773 0585d5cc taeseongkim
            catch (Exception ex)
774 53880c83 ljiyeon
            {
775 0585d5cc taeseongkim
                System.Diagnostics.Debug.WriteLine("KCOM_API - GetMarkupInfoItems : " + ex.ToString());
776
777 53880c83 ljiyeon
                return _result;
778
            }
779
            finally
780
            {
781 24c5e56c taeseongkim
                //GC.Collect(2);
782 53880c83 ljiyeon
            }
783
784
            return _result;
785
        }
786
787 787a4489 KangIngu
        [OperationContract]
788
        public List<MarkupInfoItem> GetSyncMarkupInfoItems(string ProjectNo, string DocInfoId, string currentUser)
789
        {
790
            List<MarkupInfoItem> _result = new List<MarkupInfoItem>();
791
            try
792
            {
793 ff01c725 humkyung
                string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString;
794
                using (CIEntities entity = new CIEntities(sCIConnString))
795 787a4489 KangIngu
                {
796
                    var docItem = entity.DOCINFO.Where(data => data.DOCUMENT_ID == DocInfoId).FirstOrDefault();
797
                    if (docItem == null)
798
                    {
799
                        return null;
800
                    }
801
                    var markupListData = entity.MARKUP_INFO.Where(data => data.DOCINFO_ID == docItem.ID).ToList();
802
803
                    var markupList = from markup in markupListData
804
                                     where markup.USER_ID == currentUser || markup.CONSOLIDATE == 1
805
                                     orderby markup.CREATE_TIME descending
806
                                     select new MarkupInfoItem
807
                                     {
808
                                         MarkupInfoID = markup.ID,
809
                                         UserID = markup.USER_ID,
810
                                         MarkupVersionID = markup.MARKUP_INFO_VERSION.Count() == 0 ? null : markup.MARKUP_INFO_VERSION.OrderByDescending(data => data.CREATE_DATE).FirstOrDefault().ID,
811
                                         CreateTime = markup.CREATE_TIME,
812
                                         Consolidate = markup.CONSOLIDATE,
813
                                         Description = markup.DESCRIPTION,
814
                                         AvoidConsolidate = markup.AVOID_CONSOLIDATE,
815
                                         PartConsolidate = markup.PART_CONSOLIDATE,
816
                                     };
817
818
819
820
                    if (markupList.Count() > 0)
821
                    {
822
                        _result = markupList.ToList();
823
                    }
824
825
826
827
                    _result.ForEach(r =>
828
                    {
829
830
                        r.MarkupList = (from markupData in entity.MARKUP_DATA
831
                                        where markupData.MARKUPINFO_VERSION_ID == r.MarkupVersionID
832
                                        orderby markupData.PAGENUMBER
833 ab5aa762 taeseongkim
                                        select new MarkupItem
834
                                        {
835
                                            ID = markupData.ID,
836
                                            PageNumber = markupData.PAGENUMBER,
837
                                            Data = markupData.DATA,
838
                                            Data_Type = markupData.DATA_TYPE,
839
                                            Symbol_ID = markupData.SYMBOL_ID
840
                                        }).ToList();
841 787a4489 KangIngu
                    });
842
843
                    List<PROPERTIES> _ColorsProperties = new List<PROPERTIES>();
844
                    Random random = new Random();
845
846 ff01c725 humkyung
                    string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
847
                    using (KCOMEntities kcomEntity = new KCOMEntities(sConnString))
848 787a4489 KangIngu
                    {
849
                        _ColorsProperties = (from property in kcomEntity.PROPERTIES
850
                                             where property.TYPE == "DisplayColor"
851
                                             select property).ToList();
852
                    }
853
854
                    foreach (var item in _result)
855
                    {
856 a1142a6b taeseongkim
                        string query = "SELECT members.ID,members.NAME,members.DEPARTMENT FROM CIEntities.MEMBER as members where members.ID = @userId";
857
858
                        System.Data.Objects.ObjectQuery<System.Data.Common.DbDataRecord> memberQuery
859
                                      = entity.CreateQuery<System.Data.Common.DbDataRecord>(query, new System.Data.Objects.ObjectParameter("userId", item.UserID));
860 787a4489 KangIngu
861 a1142a6b taeseongkim
                        if (memberQuery.Count() > 0)
862 787a4489 KangIngu
                        {
863 a1142a6b taeseongkim
864
                            string userName = memberQuery.First()["NAME"]?.ToString().Trim();
865
                            string depatment = memberQuery.First()["DEPARTMENT"]?.ToString().Trim();
866
867
                            item.UserName = userName;
868
                            item.Depatment = depatment;
869 787a4489 KangIngu
                        }
870
871
                        if (_ColorsProperties.Count > 0)
872
                        {
873
                            int colorIdx = random.Next(1, _ColorsProperties.Count());
874
                            #region 부서별로 색상을 지정하고자 할때
875
                            /// 일단 의견을 들어보자구!
876
                            #endregion
877
                            item.DisplayColor = "#FF" + _ColorsProperties[colorIdx].VALUE;
878
                            _ColorsProperties.Remove(_ColorsProperties[colorIdx]);
879
                            //item.DisplayColor = "#FF" + _Colors.First();
880
                            //_Colors.Remove(_Colors.First());
881
                        }
882
                        else
883
                        {
884
                            item.DisplayColor = String.Format("#FF{0:X6}", random.Next(0x1000000));
885
                        }
886
                    }
887
                }
888
            }
889 0585d5cc taeseongkim
            catch (Exception ex)
890 787a4489 KangIngu
            {
891 0585d5cc taeseongkim
                System.Diagnostics.Debug.WriteLine("KCOM_API - GetSyncMarkupInfoItems : " + ex.ToString());
892 787a4489 KangIngu
                return _result;
893
            }
894
            finally
895
            {
896 24c5e56c taeseongkim
                //GC.Collect(2);
897 787a4489 KangIngu
            }
898
899
            return _result;
900
        }
901
902
903
        //[OperationContract]
904
        //[ServiceKnownType(typeof(MEMBER))]
905
        //public List<MEMBER> GetUserData(string ProjectNo, string UserID)
906
        //{
907
        //    List<MEMBER> _result = new List<MEMBER>();
908
909
        //    using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString()))
910
        //    {
911
        //        var _UserList = from member in entity.MEMBER
912
        //                        where member.ID == UserID
913
        //                        select member;
914
        //        _result = _UserList.ToList();
915
        //    }
916
        //    //GC.Collect(2);
917
        //    return _result;
918
        //}
919
920 2ab012e8 djkim
        [OperationContract]
921
        [ServiceKnownType(typeof(MEMBER))]
922
        public List<MEMBER> GetUserData(string ProjectNo, string UserID)
923
        {
924
            List<MEMBER> _result = new List<MEMBER>();
925 787a4489 KangIngu
926 ff01c725 humkyung
            string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString;
927 285635d3 taeseongkim
928 ff01c725 humkyung
            using (CIEntities entity = new CIEntities(sCIConnString))
929 2ab012e8 djkim
            {
930 285635d3 taeseongkim
                _result = GetMemberQuery(entity, UserID);
931 2ab012e8 djkim
            }
932
            //GC.Collect(2);
933
            return _result;
934
        }
935 787a4489 KangIngu
936
937
        [OperationContract]
938
        public List<string> GetDeptData(string UserDept) //그룹 추가 옵션 부여 예정
939
        {
940
            List<string> _result = new List<string>();
941
942
            try
943
            {
944 ff01c725 humkyung
                string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
945
                KCOMEntities entity = new KCOMEntities(sConnString);
946 787a4489 KangIngu
                var YourEnginner = (from dept in entity.PROPERTIES
947
                                    where dept.TYPE == "DeptName" && UserDept.Contains(dept.VALUE)
948
                                    select dept).FirstOrDefault();
949
950
                if (YourEnginner != null)
951
                {
952
                    _result = (from dept in entity.PROPERTIES
953
                               where dept.PROPERTY == YourEnginner.PROPERTY
954
                               select dept.VALUE).ToList();
955
                    return _result;
956
                }
957
                else
958
                {
959
                    return null;
960
                }
961
            }
962
            catch (Exception ex)
963
            {
964 0585d5cc taeseongkim
                System.Diagnostics.Debug.WriteLine("KCOM_API - GetDeptData : " + ex.ToString());
965 787a4489 KangIngu
            }
966
            finally
967
            {
968 24c5e56c taeseongkim
                //GC.Collect(2);
969 787a4489 KangIngu
            }
970
            return _result;
971
        }
972
973
        [OperationContract]
974
        public bool DeleteMarkup(string ProjectNo, string MarkupInfoID)
975
        {
976
            bool _result = false;
977
            try
978
            {
979 ff01c725 humkyung
                string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString;
980
                using (KCOMDataModel.DataModel.CIEntities Entity = new KCOMDataModel.DataModel.CIEntities(sCIConnString))
981 787a4489 KangIngu
                {
982
983
                    MARKUP_INFO instance = Entity.MARKUP_INFO.Where(root => root.ID == MarkupInfoID).FirstOrDefault();
984
985
                    if (instance == null)
986
                    {
987
                        return false;
988
                    }
989
                    MARKUP_INFO_VERSION version = instance.MARKUP_INFO_VERSION.FirstOrDefault();
990
991
992
                    version.MARKUP_DATA.ToList().ForEach(data =>
993
                    {
994
                        Entity.MARKUP_DATA.DeleteObject(data);
995
                        Entity.SaveChanges();
996
                    });
997
998
                    Entity.MARKUP_INFO_VERSION.DeleteObject(version);
999
                    Entity.SaveChanges();
1000
1001
                    Entity.MARKUP_INFO.DeleteObject(instance);
1002
                    Entity.SaveChanges();
1003
1004
                }
1005
                _result = true;
1006
            }
1007
            catch (Exception ex)
1008
            {
1009 0585d5cc taeseongkim
                System.Diagnostics.Debug.WriteLine("KCOM_API - DeleteMarkup : " + ex.ToString());
1010 787a4489 KangIngu
            }
1011
            finally
1012
            {
1013 24c5e56c taeseongkim
                //GC.Collect(2);
1014 787a4489 KangIngu
            }
1015
            return _result;
1016
        }
1017 992a98b4 KangIngu
1018
        #region Favorite
1019
        [OperationContract]
1020
        public bool SetFavoriteVP(string prjNo, string userID, string groupNo, string docNo, string rev, int SavePageNo, string documentItemID, string VPDescription, IKCOM.FAVORITE_FLAG flag)
1021
        {
1022 ff01c725 humkyung
            string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
1023
            using (KCOMEntities entity = new KCOMEntities(sConnString))
1024 992a98b4 KangIngu
            {
1025
                try
1026
                {
1027
                    entity.FAVORITE_DOC.AddObject(new FAVORITE_DOC
1028
                    {
1029
                        ID = shortGuid(),
1030
                        PROJECT_NO = prjNo,
1031
                        DOCUMENT_ID = documentItemID,
1032
                        GROUP_NO = groupNo,
1033
                        DOCUMENT_NO = docNo,
1034
                        MEMBER_USER_ID = userID,
1035
                        DESCRIPTION = VPDescription,
1036
                        CREATE_TIME = DateTime.Now,
1037
                        REVISION = rev,
1038
                        FLAG = (int)flag,
1039
                        PAGE_NO = SavePageNo,
1040
                    });
1041
                    entity.SaveChanges();
1042
                }
1043 0585d5cc taeseongkim
                catch (Exception ex)
1044 992a98b4 KangIngu
                {
1045 0585d5cc taeseongkim
                    System.Diagnostics.Debug.WriteLine("KCOM_API - SetFavoriteVP : " + ex.ToString());
1046 992a98b4 KangIngu
                    return false;
1047
                }
1048
1049
                return true;
1050
            }
1051
        }
1052
1053
        //[OperationContract]
1054
        //public List<FAVORITE_DOC> GetFavoriteVP(string PrjNo, string userID, string sharepointItemID)
1055
        //{
1056
        //    using (KCOMEntities entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
1057
        //    {
1058
1059
        //        int flagString = Convert.ToInt32(IKCOM.FAVORITE_FLAG.Personal);                
1060
        //        List<FAVORITE_DOC> favoriteListSet = new List<FAVORITE_DOC>();
1061
        //        entity.FAVORITE_DOC.Where(data => data.PROJECT_NO == PrjNo && data.DOCUMENT_ID == sharepointItemID && data.FLAG !=
1062
        //            flagString).ToList().ForEach(data => favoriteListSet.Add(data));
1063
        //        entity.FAVORITE_DOC.Where(data => data.PROJECT_NO == PrjNo && data.MEMBER_USER_ID == userID).ToList().ForEach(data => favoriteListSet.Add(data));
1064
        //        favoriteListSet = favoriteListSet.Distinct().ToList();
1065
        //        return favoriteListSet;
1066
        //    }
1067
        //}
1068
        //[OperationContract]
1069
        //public bool EditFavoriteVP(string prjNo, string userID, int SavePageNo, string sharepointItemID, DateTime createTime, int state, string description)
1070
        //{
1071
        //    using (DeepViewEntities dc = new DeepViewEntities(ConnectStringBuilder.DeepViewConnectionString().ToString()))
1072
        //    {
1073
        //        List<FavoriteVP> favoriteSet = dc.FavoriteVP.Where(data => data.ProjectNo == prjNo && data.CreateUserID == userID
1074
        //            && data.PageNo == SavePageNo && data.CreateTime == createTime).ToList();
1075
1076
        //        try
1077
        //        {
1078
1079
1080
        //            if (favoriteSet.Count > 0)
1081
        //            {
1082
        //                var FavoriteVP_Instance = favoriteSet.First();
1083
1084
        //                FavoriteVP_Instance.Description = description;
1085
        //                FavoriteVP_Instance.Flag = state;
1086
1087
        //                dc.SaveChanges();
1088
1089
        //                return true;
1090
        //            }
1091
        //            else
1092
        //            {
1093
        //                return false;
1094
        //            }
1095
        //        }
1096 24c5e56c taeseongkim
        //        catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex);
1097 992a98b4 KangIngu
        //        {
1098
        //            return false;
1099
        //        }
1100
        //    }
1101
        //}
1102
        //[OperationContract]
1103
        //public bool DelFavoriteVP(string prjNo, string userID, int SavePageNo, string sharepointItemID, DateTime createTime)
1104
        //{
1105
1106
        //    using (DeepViewEntities dc = new DeepViewEntities(ConnectStringBuilder.DeepViewConnectionString().ToString()))
1107
        //    {
1108
        //        List<FavoriteVP> favoriteSet = dc.FavoriteVP.Where(data => data.ProjectNo == prjNo && data.CreateUserID == userID
1109
        //            && data.PageNo == SavePageNo && data.CreateTime == createTime).ToList();
1110
1111
        //        try
1112
        //        {
1113
1114
1115
        //            if (favoriteSet.Count > 0)
1116
        //            {
1117
        //                favoriteSet.ForEach(data => dc.FavoriteVP.DeleteObject(data));
1118
        //                dc.SaveChanges();
1119
        //                return true;
1120
        //            }
1121
        //            else
1122
        //            {
1123
        //                return false;
1124
        //            }
1125
        //        }
1126 24c5e56c taeseongkim
        //        catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex);
1127 992a98b4 KangIngu
        //        {
1128
        //            return false;
1129
        //        }
1130
        //    }
1131
        //}
1132
        #endregion
1133 2ab012e8 djkim
1134
        [OperationContract]
1135
        public bool SaveMarkupData(MarkupInfoItem UserState,string project_no,string doc_id, string user_id, List<MARKUP_DATA> mlmarkup_data)
1136
        {
1137 6b6e937c taeseongkim
            
1138 ff01c725 humkyung
            string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString;
1139
            using (CIEntities Entity = new CIEntities(sCIConnString))
1140 2ab012e8 djkim
            {     
1141
                #region Docinfo 정보 가져오기
1142
1143
                string docinfoid_ = (from info in Entity.DOCINFO
1144
                                     where info.DOCUMENT_ID == doc_id
1145
                                     && info.PROJECT_NO == project_no
1146
                                     select info.ID
1147
                                     ).First().ToString();
1148
                #endregion
1149
1150
                #region Markup_Info 저장
1151
1152
                MARKUP_INFO markup_info = new MARKUP_INFO();
1153
                try
1154
                {
1155
                    markup_info = (from info in Entity.MARKUP_INFO
1156
                                   where info.ID == UserState.MarkupInfoID && info.USER_ID == user_id
1157
                                   select info).FirstOrDefault();
1158
                }
1159 0585d5cc taeseongkim
                catch (Exception ex)
1160 2ab012e8 djkim
                {
1161 0585d5cc taeseongkim
                    System.Diagnostics.Debug.WriteLine("KCOM_API - SaveMarkupData Get markup_info: " + ex.ToString());
1162 2ab012e8 djkim
                    markup_info = null;
1163
                }
1164
1165
                //markup_info가 없을 경우 생성
1166
                if (markup_info == null)
1167
                {
1168
                    //MarkupInfo 저장
1169
                    markup_info = new MARKUP_INFO
1170
                    {
1171
                        ID = UserState.MarkupInfoID,
1172
                        DOCINFO_ID = docinfoid_,
1173
                        USER_ID = user_id,
1174
                        CREATE_TIME = DateTime.Now,
1175
                        CONSOLIDATE = UserState.Consolidate,
1176
                        AVOID_CONSOLIDATE = UserState.AvoidConsolidate,
1177
                        PART_CONSOLIDATE = UserState.PartConsolidate,
1178
                        DESCRIPTION = UserState.Description,
1179
                        UPDATE_TIME = DateTime.Now
1180
                    };
1181
                    Entity.MARKUP_INFO.AddObject(markup_info);
1182
                }
1183
                //markup_info가 있을 경우 업데이트
1184
                else
1185
                {
1186
                    markup_info.UPDATE_TIME = DateTime.Now;
1187
                }
1188
                Entity.SaveChanges();
1189
                #endregion
1190
1191
                #region Markup_Info_Version 저장
1192
1193
                MARKUP_INFO_VERSION markup_info_version = new MARKUP_INFO_VERSION();
1194
1195
                try
1196
                {
1197
                    markup_info_version = (from info in Entity.MARKUP_INFO_VERSION
1198
                                           where info.MARKUPINFO_ID == markup_info.ID
1199
                                           select info).FirstOrDefault();
1200
                }
1201 0585d5cc taeseongkim
                catch (Exception ex)
1202 2ab012e8 djkim
                {
1203 0585d5cc taeseongkim
                    System.Diagnostics.Debug.WriteLine("KCOM_API - SaveMarkupData  Get markup_info_version : " + ex.ToString());
1204 2ab012e8 djkim
                    markup_info_version = null;
1205
                }
1206
1207
                //markup_info_version 없을 경우 생성
1208
                if (markup_info_version == null)
1209
                {
1210
                    //MarkupInfo_version 저장
1211
                    markup_info_version = new MARKUP_INFO_VERSION()
1212
                    {
1213
                        ID = UserState.MarkupVersionID,
1214
                        MARKUPINFO_ID = markup_info.ID,
1215
                        CREATE_DATE = DateTime.Now
1216
                    };
1217
                    Entity.MARKUP_INFO_VERSION.AddObject(markup_info_version);
1218
                    Entity.SaveChanges();
1219
                }
1220
                #endregion
1221
1222
                
1223
                Entity.MARKUP_DATA.Where(data => data.MARKUPINFO_VERSION_ID == markup_info_version.ID).ToList().ForEach(item =>
1224
                {
1225
                    Entity.MARKUP_DATA.DeleteObject(item);
1226
                });
1227
                Entity.SaveChanges();
1228 6b6e937c taeseongkim
1229
                try
1230
                {
1231
                    mlmarkup_data.ForEach(value =>
1232
                    {
1233
                        Entity.MARKUP_DATA.AddObject(new MARKUP_DATA
1234
                        {
1235
                            ID = value.ID,
1236
                            DATA = value.DATA,
1237
                            DATA_TYPE = value.DATA_TYPE,
1238
                            PAGENUMBER = value.PAGENUMBER,
1239
                            MARKUPINFO_VERSION_ID = markup_info_version.ID,
1240
                            SYMBOL_ID = value.SYMBOL_ID,
1241
                            //GROUP_ID = value.GROUP_ID
1242
                        });
1243
                    });
1244
                    Entity.SaveChanges();
1245
                }
1246 0585d5cc taeseongkim
                catch (Exception ex)
1247 6b6e937c taeseongkim
                {
1248 0585d5cc taeseongkim
                    System.Diagnostics.Debug.WriteLine("KCOM_API - SaveMarkupData  set mlmarkup_data : " + ex.ToString());
1249 6b6e937c taeseongkim
                    return false;
1250
                }
1251
            }
1252
            return true;
1253
        }
1254
1255
        [OperationContract]
1256
        public bool SavePageMarkupData(MarkupInfoItem UserState,int PageNo, string project_no, string doc_id, string user_id, List<MARKUP_DATA> mlmarkup_data)
1257
        {
1258
1259
            string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString;
1260
            using (CIEntities Entity = new CIEntities(sCIConnString))
1261
            {
1262
                #region Docinfo 정보 가져오기
1263
1264
                string docinfoid_ = (from info in Entity.DOCINFO
1265
                                     where info.DOCUMENT_ID == doc_id
1266
                                     && info.PROJECT_NO == project_no
1267
                                     select info.ID
1268
                                     ).First().ToString();
1269
                #endregion
1270
1271
                #region Markup_Info 저장
1272
1273
                MARKUP_INFO markup_info = new MARKUP_INFO();
1274
                try
1275
                {
1276
                    markup_info = (from info in Entity.MARKUP_INFO
1277
                                   where info.ID == UserState.MarkupInfoID && info.USER_ID == user_id
1278
                                   select info).FirstOrDefault();
1279
                }
1280 0585d5cc taeseongkim
                catch (Exception ex)
1281 6b6e937c taeseongkim
                {
1282 0585d5cc taeseongkim
                    System.Diagnostics.Debug.WriteLine("KCOM_API - SavePageMarkupData : " + ex.ToString());
1283
1284 6b6e937c taeseongkim
                    markup_info = null;
1285
                }
1286
1287
                //markup_info가 없을 경우 생성
1288
                if (markup_info == null)
1289
                {
1290
                    //MarkupInfo 저장
1291
                    markup_info = new MARKUP_INFO
1292
                    {
1293
                        ID = UserState.MarkupInfoID,
1294
                        DOCINFO_ID = docinfoid_,
1295
                        USER_ID = user_id,
1296
                        CREATE_TIME = DateTime.Now,
1297
                        CONSOLIDATE = UserState.Consolidate,
1298
                        AVOID_CONSOLIDATE = UserState.AvoidConsolidate,
1299
                        PART_CONSOLIDATE = UserState.PartConsolidate,
1300
                        DESCRIPTION = UserState.Description,
1301
                        UPDATE_TIME = DateTime.Now
1302
                    };
1303
                    Entity.MARKUP_INFO.AddObject(markup_info);
1304
                }
1305
                //markup_info가 있을 경우 업데이트
1306
                else
1307
                {
1308
                    markup_info.UPDATE_TIME = DateTime.Now;
1309
                }
1310
                Entity.SaveChanges();
1311
                #endregion
1312
1313
                #region Markup_Info_Version 저장
1314
1315
                MARKUP_INFO_VERSION markup_info_version = new MARKUP_INFO_VERSION();
1316
1317
                try
1318
                {
1319
                    markup_info_version = (from info in Entity.MARKUP_INFO_VERSION
1320
                                           where info.MARKUPINFO_ID == markup_info.ID
1321
                                           select info).FirstOrDefault();
1322
                }
1323 0585d5cc taeseongkim
                catch (Exception ex)
1324 6b6e937c taeseongkim
                {
1325 0585d5cc taeseongkim
                    System.Diagnostics.Debug.WriteLine("KCOM_API - SavePageMarkupData get markup_info_version : " + ex.ToString());
1326 6b6e937c taeseongkim
                    markup_info_version = null;
1327
                }
1328
1329
                //markup_info_version 없을 경우 생성
1330
                if (markup_info_version == null)
1331
                {
1332
                    //MarkupInfo_version 저장
1333
                    markup_info_version = new MARKUP_INFO_VERSION()
1334
                    {
1335
                        ID = UserState.MarkupVersionID,
1336
                        MARKUPINFO_ID = markup_info.ID,
1337
                        CREATE_DATE = DateTime.Now
1338
                    };
1339
                    Entity.MARKUP_INFO_VERSION.AddObject(markup_info_version);
1340
                    Entity.SaveChanges();
1341
                }
1342
                #endregion
1343
1344
1345
                Entity.MARKUP_DATA.Where(data =>  data.PAGENUMBER == PageNo && data.MARKUPINFO_VERSION_ID == markup_info_version.ID).ToList().ForEach(item =>
1346
                {
1347
                    Entity.MARKUP_DATA.DeleteObject(item);
1348
                });
1349
                Entity.SaveChanges();
1350 2ab012e8 djkim
1351
                try
1352
                {
1353
                    mlmarkup_data.ForEach(value =>
1354
                    {
1355
                        Entity.MARKUP_DATA.AddObject(new MARKUP_DATA
1356
                        {
1357
                            ID = value.ID,
1358
                            DATA = value.DATA,
1359
                            DATA_TYPE = value.DATA_TYPE,
1360
                            PAGENUMBER = value.PAGENUMBER,
1361 c8e9b3e4 ljiyeon
                            MARKUPINFO_VERSION_ID = markup_info_version.ID,
1362 53880c83 ljiyeon
                            SYMBOL_ID = value.SYMBOL_ID,
1363 c0977e97 djkim
                            //GROUP_ID = value.GROUP_ID
1364 2ab012e8 djkim
                        });
1365
                    });
1366
                    Entity.SaveChanges();
1367
                }
1368 0585d5cc taeseongkim
                catch (Exception ex)
1369 2ab012e8 djkim
                {
1370 0585d5cc taeseongkim
                    System.Diagnostics.Debug.WriteLine("KCOM_API - SavePageMarkupData set mlmarkup_data : " + ex.ToString());
1371 2ab012e8 djkim
                    return false;
1372
                }
1373
            }
1374
            return true;
1375
        }
1376
1377 c0977e97 djkim
        //[OperationContract]
1378
        //public long AddMarkupDataGroup(MARKUP_DATA_GROUP mARKUP_DATA_GROUP, string ProjectNo)
1379
        //{
1380
        //    try
1381
        //    {
1382
        //        using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString()))
1383
        //        {
1384
        //            Entity.AddToMARKUP_DATA_GROUP(mARKUP_DATA_GROUP);
1385
        //            //MARKUP_DATA_GROUP tt = Entity.MARKUP_DATA_GROUP.Where(info => info.ID == id).FirstOrDefault();
1386
        //            Entity.SaveChanges();
1387 53880c83 ljiyeon
1388 c0977e97 djkim
        //            return Entity.MARKUP_DATA_GROUP.ToList().LastOrDefault().ID;
1389
        //        }
1390
        //    }
1391 24c5e56c taeseongkim
        //    catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex);
1392 c0977e97 djkim
        //    {
1393
        //        return 0;
1394
        //    }
1395
        //}
1396
        //[OperationContract]
1397
        //public bool UpdateMarkupDataGroup(long Group_ID, string ProjectNo)
1398
        //{
1399
        //    try
1400
        //    {
1401
        //        using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString()))
1402
        //        {
1403
        //            var UpdateItem = Entity.MARKUP_DATA_GROUP.Where(info => info.ID == Group_ID).FirstOrDefault();
1404
        //            UpdateItem.STATE = 1;
1405
        //            Entity.SaveChanges();
1406
        //        }
1407
        //    }
1408 24c5e56c taeseongkim
        //    catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex);
1409 c0977e97 djkim
        //    {
1410
        //        return false;
1411
        //    }
1412
        //    return true;
1413
        //}
1414 53880c83 ljiyeon
        [OperationContract]
1415
        public bool UpdateMarkupData(string CommentID, long Group_ID, string ProjectNo)
1416
        {
1417
            try
1418
            {
1419 ff01c725 humkyung
                string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString;
1420
                using (CIEntities Entity = new CIEntities(sCIConnString))
1421 53880c83 ljiyeon
                {
1422
                    var UpdateItem = Entity.MARKUP_DATA.Where(info => info.ID == CommentID).FirstOrDefault();
1423 c0977e97 djkim
                    //UpdateItem.GROUP_ID = Group_ID;
1424 53880c83 ljiyeon
                    Entity.SaveChanges();
1425
                }
1426
            }
1427 0585d5cc taeseongkim
            catch (Exception ex)
1428 53880c83 ljiyeon
            {
1429 0585d5cc taeseongkim
                System.Diagnostics.Debug.WriteLine("KCOM_API - UpdateMarkupData: " + ex.ToString());
1430 53880c83 ljiyeon
                return false;
1431
            }
1432
            return true;
1433
        }
1434 2ab012e8 djkim
1435
        [OperationContract]
1436
        public bool SaveSymbol(SYMBOL_PRIVATE symbol_private)
1437
        {
1438
            try
1439
            {
1440 ff01c725 humkyung
                string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
1441
                using (KCOMDataModel.DataModel.KCOMEntities uc = new KCOMDataModel.DataModel.KCOMEntities(sConnString))
1442 2ab012e8 djkim
                {
1443
                    uc.AddToSYMBOL_PRIVATE(symbol_private);
1444
                    uc.SaveChanges();
1445
                }
1446
            }
1447 0585d5cc taeseongkim
            catch (Exception ex)
1448 2ab012e8 djkim
            {
1449 0585d5cc taeseongkim
                System.Diagnostics.Debug.WriteLine("KCOM_API - SaveSymbol: " + ex.ToString());
1450 2ab012e8 djkim
                return false;
1451
            }
1452
            return true;
1453
        }
1454
        [OperationContract]
1455 498f0fc9 ljiyeon
        public bool AddPublicSymbol(SYMBOL_PUBLIC symbol)
1456
        {
1457
            try
1458
            {
1459 ff01c725 humkyung
                string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
1460
                using (KCOMDataModel.DataModel.KCOMEntities uc = new KCOMDataModel.DataModel.KCOMEntities(sConnString))
1461 498f0fc9 ljiyeon
                {
1462
                    uc.AddToSYMBOL_PUBLIC(symbol);
1463
                    uc.SaveChanges();
1464
                }
1465
            }
1466 0585d5cc taeseongkim
            catch (Exception ex)
1467 498f0fc9 ljiyeon
            {
1468 0585d5cc taeseongkim
                System.Diagnostics.Debug.WriteLine("KCOM_API - AddPublicSymbol: " + ex.ToString());
1469 498f0fc9 ljiyeon
                return false;
1470
            }
1471
            return true;
1472
        }
1473
        [OperationContract]
1474
        public bool DeleteSymbol(string symbol_id, int type)
1475 2ab012e8 djkim
        {
1476
            try
1477
            {
1478 ff01c725 humkyung
                string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
1479
                using (KCOMEntities Entity = new KCOMEntities(sConnString))
1480 2ab012e8 djkim
                {
1481 498f0fc9 ljiyeon
                    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 2ab012e8 djkim
                }
1496
            }
1497 0585d5cc taeseongkim
            catch (Exception ex)
1498 2ab012e8 djkim
            {
1499 0585d5cc taeseongkim
                System.Diagnostics.Debug.WriteLine("KCOM_API - DeleteSymbol : " + ex.ToString());
1500
1501 2ab012e8 djkim
                return false;
1502
            }
1503
            return true;
1504
        }
1505
1506
        [OperationContract]
1507 498f0fc9 ljiyeon
        public bool RenameSymbol(string symbol_id, string name, int type)
1508 2ab012e8 djkim
        {
1509
            try
1510
            {
1511 ff01c725 humkyung
                string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
1512
                using (KCOMEntities Entity = new KCOMEntities(sConnString))
1513 2ab012e8 djkim
                {
1514 498f0fc9 ljiyeon
                    if (type == 0)
1515
                    {
1516
                        var UpdateItem = Entity.SYMBOL_PRIVATE.Where(info => info.ID == symbol_id).FirstOrDefault();
1517
                        UpdateItem.NAME = name;
1518
                        Entity.SaveChanges();
1519
                    }
1520
                    else
1521
                    {
1522
                        var UpdateItem = Entity.SYMBOL_PUBLIC.Where(info => info.ID == symbol_id).FirstOrDefault();
1523
                        UpdateItem.NAME = name;
1524
                        Entity.SaveChanges();
1525
                    }
1526 2ab012e8 djkim
                }
1527
            }
1528 0585d5cc taeseongkim
            catch (Exception ex)
1529 2ab012e8 djkim
            {
1530 0585d5cc taeseongkim
                System.Diagnostics.Debug.WriteLine("KCOM_API - RenameSymbol: " + ex.ToString());
1531 2ab012e8 djkim
                return false;
1532
            }
1533
            return true;
1534
        }
1535
1536
        [OperationContract]
1537
        public bool AddCheckListHistory(string project_no, CHECK_LIST_HISTORY Check_History)
1538
        {
1539
            try
1540 ff01c725 humkyung
            {
1541
                string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString;
1542
                using (CIEntities Entity = new CIEntities(sCIConnString))
1543 2ab012e8 djkim
                {
1544
                    Entity.CHECK_LIST_HISTORY.AddObject(Check_History);
1545
                    Entity.SaveChanges();  
1546
                }
1547
            }
1548 0585d5cc taeseongkim
            catch (Exception ex)
1549 2ab012e8 djkim
            {
1550 0585d5cc taeseongkim
                System.Diagnostics.Debug.WriteLine("KCOM_API - AddCheckListHistory: " + ex.ToString());
1551 2ab012e8 djkim
                return false;
1552
            }
1553
            return true;
1554
        }
1555
        [OperationContract]
1556
        public bool SaveCheckListHistory(string project_no, string rev, CHECK_LIST_HISTORY Check_History)
1557
        {
1558
            try
1559
            {
1560 ff01c725 humkyung
                string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString;
1561
                using (CIEntities Entity = new CIEntities(sCIConnString))
1562 2ab012e8 djkim
                {
1563
                    var item = Entity.CHECK_LIST_HISTORY.Where(info => info.REVISION == rev).FirstOrDefault();
1564
                    item = Check_History;
1565
                    Entity.SaveChanges();
1566
                }
1567
            }
1568 0585d5cc taeseongkim
            catch (Exception ex)
1569 2ab012e8 djkim
            {
1570 0585d5cc taeseongkim
                System.Diagnostics.Debug.WriteLine("KCOM_API - SaveCheckListHistory: " + ex.ToString());
1571 2ab012e8 djkim
                return false;
1572
            }
1573
            return true;
1574
        }
1575
        [OperationContract]
1576
        public bool SaveCheckList(string project_no, string _id, CHECK_LIST Check_value)
1577
        {
1578
            try
1579
            {
1580 ff01c725 humkyung
                string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString;
1581
                using (CIEntities Entity = new CIEntities(sCIConnString))
1582 2ab012e8 djkim
                {
1583
                    var item = Entity.CHECK_LIST.Where(info => info.ID == _id).FirstOrDefault();
1584
                    item.TODOLIST = Check_value.TODOLIST;
1585
                    item.REMARK = Check_value.REMARK;
1586
                    item.STATUS = Check_value.STATUS;
1587
                    item.VENDOR = Check_value.VENDOR;
1588
                    item.REPLY = Check_value.REPLY;
1589
                    item.IMAGE_URL = Check_value.IMAGE_URL;
1590
                    item.IMAGE_ANCHOR = Check_value.IMAGE_ANCHOR;
1591
                    item.UPDATE_TIME = Check_value.UPDATE_TIME;
1592 5de0c110 ljiyeon
                    if(Check_value.STATUS == "False")
1593
                    {
1594
                        item.STATUS_DESC_OPEN = Check_value.STATUS_DESC_OPEN;
1595
                    }
1596
                    else
1597
                    {
1598
                        item.STATUS_DESC_CLOSE = Check_value.STATUS_DESC_CLOSE;
1599
                    }                     
1600 2ab012e8 djkim
                    Entity.SaveChanges();
1601
                }
1602
            }
1603 24c5e56c taeseongkim
            catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex);
1604 2ab012e8 djkim
                return false;
1605
            }
1606
            return true;
1607
        }
1608
        [OperationContract]
1609
        public bool AddCheckList(string project_no, CHECK_LIST Check_value)
1610
        {
1611
            try
1612
            {
1613 24c5e56c taeseongkim
               
1614 ff01c725 humkyung
                string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString;
1615
                using (CIEntities Entity = new CIEntities(sCIConnString))
1616 2ab012e8 djkim
                {
1617
                    Entity.CHECK_LIST.AddObject(Check_value);
1618
                    Entity.SaveChanges();
1619
                }
1620
            }
1621 24c5e56c taeseongkim
            catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex);
1622 2ab012e8 djkim
                return false;
1623
            }
1624
            return true;
1625
        }
1626
1627
        [OperationContract]
1628
        public CHECK_LIST GetCheckList(string project_no, string _id)
1629
        {
1630
            CHECK_LIST Check_value = new CHECK_LIST();
1631
            try
1632
            {
1633 ff01c725 humkyung
                string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString;
1634
                using (CIEntities Entity = new CIEntities(sCIConnString))
1635 2ab012e8 djkim
                {
1636
                    Check_value = Entity.CHECK_LIST.Where(info => info.ID == _id).FirstOrDefault();
1637
                }
1638
            }
1639 24c5e56c taeseongkim
            catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex);
1640 2ab012e8 djkim
                return null;
1641
            }
1642
            return Check_value;
1643
        }
1644
        [OperationContract]
1645
        public List<CHECK_LIST> GetUserCheckList(string project_no, string user_id, string doc_no)
1646
        {
1647
            List<CHECK_LIST> list = new List<CHECK_LIST>();
1648
            try
1649
            {
1650 ff01c725 humkyung
                string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString;
1651
                using (CIEntities Entity = new CIEntities(sCIConnString))
1652 2ab012e8 djkim
                {
1653
                    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();
1654
                }
1655
            }
1656 24c5e56c taeseongkim
            catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex);
1657 2ab012e8 djkim
                return null;
1658
            }
1659
            return list;
1660
        }
1661
        [OperationContract]
1662
        public List<CHECK_LIST_HISTORY> GetCheckListHistory(string project_no, string _id)
1663
        {
1664
            List<CHECK_LIST_HISTORY> history = new List<CHECK_LIST_HISTORY>();
1665
            try
1666
            {
1667 ff01c725 humkyung
                string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString;
1668
                using (CIEntities Entity = new CIEntities(sCIConnString))
1669 2ab012e8 djkim
                {
1670
                    history = Entity.CHECK_LIST_HISTORY.Where(data => data.CHECKLIST_ID == _id).ToList();
1671
                }
1672
            }
1673 24c5e56c taeseongkim
            catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex);
1674 2ab012e8 djkim
                return null;
1675
            }
1676
            return history;
1677
        }
1678
        [OperationContract]
1679
        public CHECK_LIST_HISTORY GetCheckListHistoryFirstOrDefault(string project_no, string checklist_id, string rev)
1680
        {
1681
            CHECK_LIST_HISTORY Check_Item = new CHECK_LIST_HISTORY();
1682
            try
1683
            {
1684 ff01c725 humkyung
                string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString;
1685
                using (CIEntities Entity = new CIEntities(sCIConnString))
1686 2ab012e8 djkim
                {   
1687
                    Check_Item = Entity.CHECK_LIST_HISTORY.Where(info => info.CHECKLIST_ID == checklist_id && info.REVISION == rev).FirstOrDefault();
1688
                }
1689
            }
1690 24c5e56c taeseongkim
            catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex);
1691 2ab012e8 djkim
                return null;
1692
            }
1693
            return Check_Item;
1694
        }
1695
        [OperationContract]
1696
        public bool SavePageAngle(string project_no, List<DOCPAGE> _mldocpage)
1697
        {
1698
            try
1699
            {
1700 ff01c725 humkyung
                string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString;
1701
                using (CIEntities Entity = new CIEntities(sCIConnString))
1702 2ab012e8 djkim
                {
1703
                    KCOMDataModel.DataModel.DOCPAGE _docpage = new KCOMDataModel.DataModel.DOCPAGE();
1704
                    _mldocpage.ForEach(data =>
1705
                    {
1706
                        _docpage = (from info in Entity.DOCPAGE
1707
                                    where info.ID == data.ID
1708
                                    select info).FirstOrDefault();
1709
1710
                        if (_docpage.PAGE_ANGLE != data.PAGE_ANGLE)
1711
                        {
1712
                            _docpage.PAGE_ANGLE = data.PAGE_ANGLE;
1713
                        }
1714
                    });
1715
1716
                    Entity.SaveChanges();
1717
                }
1718
            }
1719 24c5e56c taeseongkim
            catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex);
1720 2ab012e8 djkim
                return false;
1721
            }
1722
            return true;
1723
        }
1724
1725
        [OperationContract]
1726
        public MARKUP_INFO GetMarkupInfo(string project_no, string _id)
1727
        {
1728
            MARKUP_INFO markupInfo = new MARKUP_INFO();
1729
1730
            try
1731
            {
1732 ff01c725 humkyung
                string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString;
1733
                using (CIEntities Entity = new CIEntities(sCIConnString))
1734 2ab012e8 djkim
                {
1735
                    markupInfo = Entity.MARKUP_INFO.Where(entity => entity.DOCINFO_ID == _id).OrderByDescending(i => i.CONSOLIDATE).OrderByDescending(j => j.CREATE_TIME).FirstOrDefault();
1736
                }
1737
            }
1738 24c5e56c taeseongkim
            catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex);
1739 2ab012e8 djkim
                return null;
1740
            }
1741
            return markupInfo;
1742
        }
1743
1744
        [OperationContract]
1745
        public List<string> GetMarkupDataListperPage(string project_no, string _markupinfoid, int _pageNo)
1746
        {
1747
            List<string> markupdata = new List<string>();
1748
            MARKUP_INFO_VERSION markup_info_version = new MARKUP_INFO_VERSION();
1749
            try
1750
            {
1751 ff01c725 humkyung
                string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString;
1752
                using (CIEntities Entity = new CIEntities(sCIConnString))
1753 2ab012e8 djkim
                {
1754
                    markup_info_version = (from version in Entity.MARKUP_INFO_VERSION
1755
                                           where version.MARKUPINFO_ID == _markupinfoid
1756
                                           orderby version.CREATE_DATE descending
1757
                                           select version).First();
1758
                    markupdata = (from data in Entity.MARKUP_DATA
1759
                                  where data.MARKUPINFO_VERSION_ID == markup_info_version.ID && data.PAGENUMBER == _pageNo
1760
                                  select data.DATA).ToList();
1761
                }
1762
            }
1763 24c5e56c taeseongkim
            catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex);
1764 2ab012e8 djkim
                return null;
1765
            }
1766
            return markupdata;
1767
        }
1768
1769
        [OperationContract]
1770
        public bool AddMarkupInfo(string project_no, MARKUP_INFO value)
1771
        {
1772
            try
1773
            {
1774 ff01c725 humkyung
                string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString;
1775
                using (CIEntities Entity = new CIEntities(sCIConnString))
1776 2ab012e8 djkim
                {
1777
                    Entity.MARKUP_INFO.AddObject(value);
1778
                    Entity.SaveChanges();
1779
                }
1780
            }
1781 24c5e56c taeseongkim
            catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex);
1782 2ab012e8 djkim
                return false;
1783
            }
1784
            return true;
1785
        }
1786
1787
        [OperationContract]
1788
        public bool AddMarkupInfoVersion(string project_no, MARKUP_INFO_VERSION value)
1789
        {
1790
            try
1791
            {
1792 ff01c725 humkyung
                string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString;
1793
                using (CIEntities Entity = new CIEntities(sCIConnString))
1794 2ab012e8 djkim
                {
1795
                    Entity.MARKUP_INFO_VERSION.AddObject(value);
1796
                    Entity.SaveChanges();
1797
                }
1798
            }
1799 24c5e56c taeseongkim
            catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex);
1800 2ab012e8 djkim
                return false;
1801
            }
1802
            return true;
1803
        }
1804
1805
        [OperationContract]
1806
        public bool AddMarkupData(string project_no, MARKUP_DATA value)
1807
        {
1808
            try
1809
            {
1810 ff01c725 humkyung
                string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString;
1811
                using (CIEntities Entity = new CIEntities(sCIConnString))
1812 2ab012e8 djkim
                {
1813
                    Entity.MARKUP_DATA.AddObject(value);
1814
                    Entity.SaveChanges();
1815
                }
1816
            }
1817 24c5e56c taeseongkim
            catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex);
1818 2ab012e8 djkim
                return false;
1819
            }
1820
            return true;
1821
        }
1822
1823
        [OperationContract]
1824
        public bool AvoidMarkupInfo(string project_no, string _doc_id)
1825
        {
1826
            try
1827
            {
1828 ff01c725 humkyung
                string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString;
1829
                using (CIEntities Entity = new CIEntities(sCIConnString))
1830 2ab012e8 djkim
                {
1831
                    var item = Entity.MARKUP_INFO.Where(entity => entity.DOCINFO_ID == _doc_id).OrderByDescending(i => i.CONSOLIDATE).OrderByDescending(j => j.CREATE_TIME).FirstOrDefault();
1832
                    item.AVOID_CONSOLIDATE = 1;
1833
                    Entity.SaveChanges();
1834
                }
1835
            }
1836 24c5e56c taeseongkim
            catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex);
1837 2ab012e8 djkim
                return false;
1838
            }
1839
            return true;
1840
        }
1841
1842
        [OperationContract]
1843
        public bool SaveMarkupInfo(string project_no, string _id, MARKUP_INFO value)
1844
        {
1845
            try
1846
            {
1847 ff01c725 humkyung
                string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString;
1848
                using (CIEntities Entity = new CIEntities(sCIConnString))
1849 2ab012e8 djkim
                {
1850
                    var item = Entity.MARKUP_INFO.Where(info => info.ID == _id).FirstOrDefault();
1851
                    item = value;                    
1852
                    Entity.SaveChanges();
1853
                }
1854
            }
1855 24c5e56c taeseongkim
            catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex);
1856 2ab012e8 djkim
                return false;
1857
            }
1858
            return true;
1859
        }
1860
        [OperationContract]
1861
        public List<MARKUP_DATA> GetMarkupDataList(string project_no, string _versionid)
1862
        {
1863
            List<MARKUP_DATA> mlresult = new List<MARKUP_DATA>();
1864
1865
            try
1866
            {
1867 ff01c725 humkyung
                string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString;
1868
                using (CIEntities Entity = new CIEntities(sCIConnString))
1869 2ab012e8 djkim
                {
1870
                    mlresult = Entity.MARKUP_DATA.Where(data => data.MARKUPINFO_VERSION_ID == _versionid).ToList();
1871
                }
1872
            }
1873 24c5e56c taeseongkim
            catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex);
1874 2ab012e8 djkim
                return null;
1875
            }
1876
            return mlresult;
1877
        }
1878
1879
        [OperationContract]
1880
        public bool Consolidate(string project_no, string _user_id, string _doc_id, List<MarkupInfoItem> markupInfoItems)
1881
        {
1882
            try
1883
            {
1884
                List<KCOMDataModel.DataModel.MARKUP_DATA> instanceDataSet = new List<KCOMDataModel.DataModel.MARKUP_DATA>();
1885 ff01c725 humkyung
                string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString;
1886
                using (CIEntities Entity = new CIEntities(sCIConnString))
1887 2ab012e8 djkim
                {
1888 0c624340 djkim
                    var markupInfo = Entity.MARKUP_INFO.Where(entity => entity.DOCINFO_ID == _doc_id && entity.CONSOLIDATE == 1).OrderByDescending(j => j.CREATE_TIME).FirstOrDefault();
1889
                    if (markupInfo != null)
1890 2ab012e8 djkim
                    {
1891
                        markupInfo.AVOID_CONSOLIDATE = 1;
1892
                    }
1893
1894
                    foreach (MarkupInfoItem item in markupInfoItems)
1895
                    {
1896
                        Entity.MARKUP_DATA.Where(data => data.MARKUPINFO_VERSION_ID == item.MarkupVersionID).ToList().ForEach(d =>
1897
                        {
1898
                            instanceDataSet.Add(d);
1899
                        });
1900
                    }
1901
1902
                    KCOMDataModel.DataModel.MARKUP_INFO info = new KCOMDataModel.DataModel.MARKUP_INFO();
1903
                    info.ID = shortGuid();
1904
                    info.CONSOLIDATE = 1;
1905
                    info.CREATE_TIME = DateTime.Now;
1906
                    info.DOCINFO_ID = _doc_id;
1907
                    info.UPDATE_TIME = DateTime.Now;
1908
                    info.USER_ID = _user_id;
1909
                    info.AVOID_CONSOLIDATE = 0;
1910
1911
                    Entity.MARKUP_INFO.AddObject(info);
1912
                    Entity.SaveChanges();
1913
1914
1915
                    KCOMDataModel.DataModel.MARKUP_INFO_VERSION info2 = new KCOMDataModel.DataModel.MARKUP_INFO_VERSION
1916
                    {
1917
                        ID = shortGuid(),
1918
                        CREATE_DATE = DateTime.Now,
1919
                        MARKUP_INFO = info,
1920
                    };
1921
                    Entity.SaveChanges();
1922
1923
                    foreach (var item in instanceDataSet)
1924
                    {
1925
                        Entity.MARKUP_DATA.AddObject(new KCOMDataModel.DataModel.MARKUP_DATA
1926
                        {
1927
                            ID = shortGuid(),
1928
                            DATA = item.DATA,
1929
                            DATA_TYPE = item.DATA_TYPE,
1930
                            PAGENUMBER = item.PAGENUMBER,
1931 c8e9b3e4 ljiyeon
                            MARKUP_INFO_VERSION = info2,
1932 53880c83 ljiyeon
                            SYMBOL_ID = item.SYMBOL_ID,
1933 c0977e97 djkim
                            //GROUP_ID = item.GROUP_ID
1934 2ab012e8 djkim
                        });
1935
                    }
1936
                    Entity.SaveChanges();
1937
1938
1939
                }
1940
            }
1941 24c5e56c taeseongkim
            catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex);
1942 2ab012e8 djkim
                return false;
1943
            }
1944
            return true;
1945
        }
1946
1947 49d444ef ljiyeon
1948
        [OperationContract]
1949
        public FinalPDFResult ConsolidateMergedPDF(string project_no, string _user_id, string _doc_id, List<MarkupInfoItem> markupInfoItems, string ProjectNo, string DocInfoID, string CreateUserID)
1950
        {
1951
            bool consolidate = false;
1952
            try
1953
            {
1954
                List<KCOMDataModel.DataModel.MARKUP_DATA> instanceDataSet = new List<KCOMDataModel.DataModel.MARKUP_DATA>();
1955 ff01c725 humkyung
                string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString;
1956
                using (CIEntities Entity = new CIEntities(sCIConnString))
1957 49d444ef ljiyeon
                {
1958
                    var markupInfo = Entity.MARKUP_INFO.Where(entity => entity.DOCINFO_ID == _doc_id).OrderByDescending(i => i.CONSOLIDATE).OrderByDescending(j => j.CREATE_TIME).FirstOrDefault();
1959
                    if (markupInfo.CONSOLIDATE == 1)
1960
                    {
1961
                        markupInfo.AVOID_CONSOLIDATE = 1;
1962
                    }
1963
1964
                    foreach (MarkupInfoItem item in markupInfoItems)
1965
                    {
1966
                        Entity.MARKUP_DATA.Where(data => data.MARKUPINFO_VERSION_ID == item.MarkupVersionID).ToList().ForEach(d =>
1967
                        {
1968
                            instanceDataSet.Add(d);
1969
                        });
1970
                    }
1971
1972
                    KCOMDataModel.DataModel.MARKUP_INFO info = new KCOMDataModel.DataModel.MARKUP_INFO();
1973
                    info.ID = shortGuid();
1974
                    info.CONSOLIDATE = 1;
1975
                    info.CREATE_TIME = DateTime.Now;
1976
                    info.DOCINFO_ID = _doc_id;
1977
                    info.UPDATE_TIME = DateTime.Now;
1978
                    info.USER_ID = _user_id;
1979
                    info.AVOID_CONSOLIDATE = 0;
1980
1981
                    Entity.MARKUP_INFO.AddObject(info);
1982
                    Entity.SaveChanges();
1983
1984
1985
                    KCOMDataModel.DataModel.MARKUP_INFO_VERSION info2 = new KCOMDataModel.DataModel.MARKUP_INFO_VERSION
1986
                    {
1987
                        ID = shortGuid(),
1988
                        CREATE_DATE = DateTime.Now,
1989
                        MARKUP_INFO = info,
1990
                    };
1991
                    Entity.SaveChanges();
1992
1993
                    foreach (var item in instanceDataSet)
1994
                    {
1995
                        Entity.MARKUP_DATA.AddObject(new KCOMDataModel.DataModel.MARKUP_DATA
1996
                        {
1997
                            ID = shortGuid(),
1998
                            DATA = item.DATA,
1999
                            DATA_TYPE = item.DATA_TYPE,
2000
                            PAGENUMBER = item.PAGENUMBER,
2001
                            MARKUP_INFO_VERSION = info2,
2002 53880c83 ljiyeon
                            SYMBOL_ID = item.SYMBOL_ID,
2003 c0977e97 djkim
                            //GROUP_ID = item.GROUP_ID
2004 49d444ef ljiyeon
                        });
2005
                    }
2006
                    Entity.SaveChanges();
2007
2008
2009
                }
2010
                consolidate = true;
2011
            }
2012 24c5e56c taeseongkim
            catch (Exception ex)
2013 49d444ef ljiyeon
            {
2014 24c5e56c taeseongkim
                System.Diagnostics.Debug.WriteLine(ex);
2015 49d444ef ljiyeon
                consolidate = false;
2016
            }
2017 24c5e56c taeseongkim
2018 49d444ef ljiyeon
            FinalPDFResult _result = new FinalPDFResult();
2019
            if (consolidate == true)
2020
            {
2021
                RemFinalPDFObject remObj = null;
2022
                try
2023
                {
2024
                    string _finalID = shortGuid();
2025
                    int _DocTotalPages = -1;
2026
                    string docItemId;
2027
2028 ff01c725 humkyung
                    string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString;
2029
                    using (CIEntities _ci = new CIEntities(sCIConnString))
2030 49d444ef ljiyeon
                    {
2031
                        var _doc = _ci.DOCINFO.Where(info => info.ID == DocInfoID);
2032
2033
                        if (_doc.Count() > 0)
2034
                        {
2035
                            _DocTotalPages = _doc.First().PAGE_COUNT;
2036
                            docItemId = _doc.First().DOCUMENT_ID;
2037
                        }
2038
                        else
2039
                        {
2040
                            _result.Status = FinalStatus.Error;
2041
                            _result.Exception = "페이지 정보를 가져올 수 없습니다.";
2042
                            return _result;
2043
                        }
2044
                    }
2045
2046
                    var Items = GetMarkupInfoItems(ProjectNo, DocInfoID);
2047
                    if (_DocTotalPages > 0)
2048
                    {
2049
                        var item2 = Items.Cast<MarkupInfoItem>().Where(d => d.Consolidate == 1 && d.AvoidConsolidate == 0).FirstOrDefault();
2050
                        FINAL_PDF fm = new FINAL_PDF()
2051
                        {
2052
                            ID = _finalID,
2053
                            PROJECT_NO = ProjectNo,
2054
                            DOCINFO_ID = DocInfoID,
2055
                            DOCUMENT_ID = docItemId,
2056
                            MARKUPINFO_ID = item2.MarkupInfoID,
2057
                            CREATE_USER_ID = CreateUserID,
2058
                            TOTAL_PAGE = _DocTotalPages,
2059
                            CREATE_DATETIME = DateTime.Now,
2060
                            STATUS = (int)IFinalPDF.FinalStatus.Insert
2061
                        };
2062 ff01c725 humkyung
2063
                        string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
2064
                        using (KCOMEntities _entity = new KCOMEntities(sConnString))
2065 49d444ef ljiyeon
                        {
2066
                            _entity.AddToFINAL_PDF(fm);
2067
                            _entity.SaveChanges(System.Data.Objects.SaveOptions.AcceptAllChangesAfterSave);
2068
                        };
2069
2070
                        System.Runtime.Remoting.Channels.IChannel _ch = System.Runtime.Remoting.Channels.ChannelServices.GetChannel("tcp");
2071
                        if (_ch == null)
2072
                        {
2073
                            chan = new TcpChannel();
2074
                            _ChanID = chan.ChannelName;
2075
                            System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(chan, false);
2076
                            // Create an instance of the remote object
2077
2078 ff01c725 humkyung
                            using (KCOMEntities ec = new KCOMEntities(sConnString))
2079 49d444ef ljiyeon
                            {
2080
2081
                                //remObj = (RemFinalPDFObject)Activator.GetObject(typeof(RemFinalPDFObject),
2082
                                //                          "tcp://localhost:9092/remFinalPDF");
2083
                                remObj = (RemFinalPDFObject)Activator.GetObject(typeof(RemFinalPDFObject),
2084
                                                          //"tcp://192.168.0.67:9092/remFinalPDF");
2085
                                                          "tcp://192.168.0.67:9092/remFinalPDF");
2086
                            }
2087
2088
                            //"tcp://localhost:8080/remFinalPDF");
2089
2090
                            _result = remObj.SetFinalPDF(ProjectNo, _finalID);
2091
                            _result.FinalID = _finalID;
2092
                            _result.Status = FinalStatus.Success;
2093
2094
                            //MarkupToPDF.MarkupToPDF fa = new MarkupToPDF.MarkupToPDF();
2095
                            //fa.MakeFinalPDF(fm);
2096
                        }
2097
                        else
2098
                        {
2099
                            _ChanID = _ch.ChannelName;
2100
                        }
2101
                    }
2102
                }
2103
                catch (Exception ex)
2104
                {
2105
                    _result.Status = FinalStatus.Error;
2106
2107
                    if (ex.GetType() == typeof(System.Net.Sockets.SocketException))
2108
                        _result.Exception = "Final Server Not Connection";
2109
                }
2110
                finally
2111
                {
2112
                    remObj = null;
2113
                    if (System.Runtime.Remoting.Channels.ChannelServices.GetChannel("tcp") != null)
2114
                        System.Runtime.Remoting.Channels.ChannelServices.UnregisterChannel(chan);
2115
2116
                    GC.Collect(2);
2117
                }
2118
            }
2119
            return _result;
2120
        }
2121 2ab012e8 djkim
        [OperationContract]
2122 04a7385a djkim
        public bool TeamConsolidate(string project_no, string _user_id, string _doc_id, List<MarkupInfoItem> markupInfoItems)
2123
        {
2124
            try
2125
            {
2126
                List<KCOMDataModel.DataModel.MARKUP_DATA> instanceDataSet = new List<KCOMDataModel.DataModel.MARKUP_DATA>();
2127 ff01c725 humkyung
                string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString;
2128
                using (CIEntities Entity = new CIEntities(sCIConnString))
2129 04a7385a djkim
                {
2130 285635d3 taeseongkim
                    var members = GetMemberQuery(Entity, _user_id);
2131
2132
                    string user_dept = "";
2133
2134
                    if(members.Count() > 0)
2135
                    {
2136
                        user_dept = members.First().DEPARTMENT;
2137
                    }
2138
                    
2139
                    var markupInfos = Entity.MARKUP_INFO.Where(entity => entity.DOCINFO_ID == _doc_id && entity.PART_CONSOLIDATE == 1)
2140
                                        .OrderByDescending(j => j.CREATE_TIME).ToList();
2141
2142 0c624340 djkim
                    foreach (var markupinfo in markupInfos)
2143 04a7385a djkim
                    {
2144 285635d3 taeseongkim
                        string markupdept = "";
2145
2146
                        var markupMembers = GetMemberQuery(Entity, markupinfo.USER_ID);
2147
2148
                        if (markupMembers.Count() > 0)
2149
                        {
2150
                            markupdept = markupMembers.First().DEPARTMENT;
2151
                        }
2152
2153 0c624340 djkim
                        if (user_dept == markupdept)
2154
                        {
2155
                            markupinfo.AVOID_CONSOLIDATE = 1;
2156
                        }
2157 04a7385a djkim
                    }
2158
2159
                    foreach (MarkupInfoItem item in markupInfoItems)
2160
                    {
2161
                        Entity.MARKUP_DATA.Where(data => data.MARKUPINFO_VERSION_ID == item.MarkupVersionID).ToList().ForEach(d =>
2162
                        {
2163
                            instanceDataSet.Add(d);
2164
                        });
2165
                    }
2166
2167
                    KCOMDataModel.DataModel.MARKUP_INFO info = new KCOMDataModel.DataModel.MARKUP_INFO();
2168
                    info.ID = shortGuid();
2169
                    info.PART_CONSOLIDATE = 1;
2170
                    info.CREATE_TIME = DateTime.Now;
2171
                    info.DOCINFO_ID = _doc_id;
2172
                    info.UPDATE_TIME = DateTime.Now;
2173
                    info.USER_ID = _user_id;
2174
                    info.AVOID_CONSOLIDATE = 0;
2175
2176
                    Entity.MARKUP_INFO.AddObject(info);
2177
                    Entity.SaveChanges();
2178
2179
2180
                    KCOMDataModel.DataModel.MARKUP_INFO_VERSION info2 = new KCOMDataModel.DataModel.MARKUP_INFO_VERSION
2181
                    {
2182
                        ID = shortGuid(),
2183
                        CREATE_DATE = DateTime.Now,
2184
                        MARKUP_INFO = info,
2185
                    };
2186
                    Entity.SaveChanges();
2187
2188
                    foreach (var item in instanceDataSet)
2189
                    {
2190
                        Entity.MARKUP_DATA.AddObject(new KCOMDataModel.DataModel.MARKUP_DATA
2191
                        {
2192
                            ID = shortGuid(),
2193
                            DATA = item.DATA,
2194
                            DATA_TYPE = item.DATA_TYPE,
2195
                            PAGENUMBER = item.PAGENUMBER,
2196 c8e9b3e4 ljiyeon
                            MARKUP_INFO_VERSION = info2,
2197 53880c83 ljiyeon
                            SYMBOL_ID = item.SYMBOL_ID,
2198 c0977e97 djkim
                            //GROUP_ID = item.GROUP_ID
2199 04a7385a djkim
                        });
2200
                    }
2201
                    Entity.SaveChanges();
2202
2203
2204
                }
2205
            }
2206 24c5e56c taeseongkim
            catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex);
2207 04a7385a djkim
                return false;
2208
            }
2209
            return true;
2210
        }
2211
2212
        [OperationContract]
2213 2ab012e8 djkim
        [ServiceKnownType(typeof(MEMBER))]
2214
        public MEMBER GetMember(string project_no, string user_id)
2215
        {
2216 503cb09e taeseongkim
            MEMBER rstmember = null;
2217 2ab012e8 djkim
            try
2218
            {
2219 ff01c725 humkyung
                string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString;
2220
                using (CIEntities Entity = new CIEntities(sCIConnString))
2221 2ab012e8 djkim
                {
2222 285635d3 taeseongkim
                    var members = GetMemberQuery(Entity, user_id);
2223 503cb09e taeseongkim
2224 285635d3 taeseongkim
                    if(members.Count() > 0)
2225
                    {
2226
                        rstmember = members.First();
2227
                    }
2228
                }
2229
            }
2230
            catch (Exception ex)
2231
            {
2232
                return null;
2233
            }
2234
            return rstmember;
2235
        }
2236 503cb09e taeseongkim
2237 285635d3 taeseongkim
        private  List<MEMBER> GetMemberQuery(System.Data.Objects.ObjectContext context, string UserID)
2238
        {
2239
            List<MEMBER> result = new List<MEMBER>();
2240 503cb09e taeseongkim
2241 285635d3 taeseongkim
            try
2242
            {
2243
                string query = "SELECT members.ID,members.NAME,members.DEPARTMENT FROM CIEntities.MEMBER as members where members.ID = @userId";
2244
2245
                var param = new[] { new System.Data.Objects.ObjectParameter("userId", UserID) };
2246
2247
                System.Data.Objects.ObjectQuery<System.Data.Common.DbDataRecord> memberQuery
2248
                              = context.CreateQuery<System.Data.Common.DbDataRecord>(query, param);
2249
2250
                if (memberQuery.Count() > 0)
2251
                {
2252
                    foreach (var dataRecord in memberQuery)
2253 503cb09e taeseongkim
                    {
2254 285635d3 taeseongkim
                        MEMBER member = new MEMBER();
2255
2256
                        string userName = dataRecord["NAME"]?.ToString().Trim();
2257
                        string ID = dataRecord["ID"]?.ToString().Trim();
2258
                        string depatment = dataRecord["DEPARTMENT"]?.ToString().Trim();
2259 a7372e37 taeseongkim
2260 285635d3 taeseongkim
                        member.NAME = userName;
2261
                        member.ID = ID;
2262
                        member.DEPARTMENT = depatment;
2263 503cb09e taeseongkim
2264 285635d3 taeseongkim
                        result.Add(member);
2265 503cb09e taeseongkim
                    }
2266 2ab012e8 djkim
                }
2267
            }
2268 ff01c725 humkyung
            catch (Exception ex)
2269 2ab012e8 djkim
            {
2270 285635d3 taeseongkim
                throw new Exception("GetMember(System.Data.Objects.ObjectContext context, string UserID) " , ex);
2271 2ab012e8 djkim
            }
2272 285635d3 taeseongkim
2273
            return result;
2274 2ab012e8 djkim
        }
2275
2276 ff01c725 humkyung
        [WebMethod]
2277 2ab012e8 djkim
        [OperationContract]
2278
        public List<SYMBOL_PRIVATE> GetSymbolList(string user_id)
2279
        {
2280
            List<SYMBOL_PRIVATE> Custom_List = new List<SYMBOL_PRIVATE>();
2281
            try
2282
            {
2283 ff01c725 humkyung
                string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
2284
                using (KCOMEntities Entity = new KCOMEntities(sConnString))
2285 2ab012e8 djkim
                {
2286
                    Custom_List = Entity.SYMBOL_PRIVATE.Where(data => data.MEMBER_USER_ID == user_id).ToList();
2287
                }
2288
            }
2289 ff01c725 humkyung
            catch (Exception ex)
2290 2ab012e8 djkim
            {
2291
                return null;
2292
            }
2293
            return Custom_List;
2294
        }
2295
        [OperationContract]
2296
        public List<string> GetPublicSymbolDeptList()
2297
        {
2298
            List<string> Custom_List = new List<string>();
2299
            try
2300
            {
2301 ff01c725 humkyung
                string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
2302
                using (KCOMEntities Entity = new KCOMEntities(sConnString))
2303 2ab012e8 djkim
                {
2304 b3251eea ljiyeon
                    Custom_List = Entity.SYMBOL_PUBLIC.Select(data => data.DEPARTMENT).Distinct().ToList();
2305 2ab012e8 djkim
                }
2306
            }
2307 24c5e56c taeseongkim
            catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex);
2308 2ab012e8 djkim
                return null;
2309
            }
2310
            return Custom_List;
2311
        }
2312
        [OperationContract]
2313
        public List<SYMBOL_PUBLIC> GetPublicSymbolList(string dept)
2314
        {
2315
            List<SYMBOL_PUBLIC> Custom_List = new List<SYMBOL_PUBLIC>();
2316
            try
2317
            {
2318 ff01c725 humkyung
                string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
2319
                using (KCOMEntities Entity = new KCOMEntities(sConnString))
2320 2ab012e8 djkim
                {
2321
                    if(!string.IsNullOrEmpty(dept))
2322
                    {
2323
                        Custom_List = Entity.SYMBOL_PUBLIC.Where(data => data.DEPARTMENT == dept).ToList();
2324
                    }
2325
                    else
2326
                    {
2327
                        Custom_List = Entity.SYMBOL_PUBLIC.ToList();
2328
                    }
2329
                    
2330
                }
2331
            }
2332 24c5e56c taeseongkim
            catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex);
2333 2ab012e8 djkim
                return null;
2334
            }
2335
            return Custom_List;
2336
        }
2337
2338
        /// <summary>
2339
        /// 
2340
        /// </summary>
2341
        /// <param name="id">symbol id</param>
2342
        /// <param name="type"> 0 : PRIVATE, 1 : PUBLIC</param>
2343
        /// <returns></returns>
2344
        [OperationContract]
2345
        public string GetSymbolData(string id, int type)
2346
        {
2347
            string result;
2348
            try
2349
            {
2350 ff01c725 humkyung
                string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
2351
                using (KCOMEntities Entity = new KCOMEntities(sConnString))
2352 2ab012e8 djkim
                {
2353
                    if(type == 0)
2354
                    {
2355
                        result = Entity.SYMBOL_PRIVATE.Where(data => data.ID == id).FirstOrDefault().DATA;
2356
                    }
2357
                    else
2358
                    {
2359
                        result = Entity.SYMBOL_PUBLIC.Where(data => data.ID == id).FirstOrDefault().DATA;
2360
                    }
2361
                }
2362
            }
2363 24c5e56c taeseongkim
            catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex);
2364 2ab012e8 djkim
                return null;
2365
            }
2366
            return result;
2367
        }
2368 53880c83 ljiyeon
        [OperationContract]
2369
        public string GetSymbolImageURL(string id, int type)
2370
        {
2371
            string result;
2372
            try
2373
            {
2374 ff01c725 humkyung
                string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
2375
                using (KCOMEntities Entity = new KCOMEntities(sConnString))
2376 53880c83 ljiyeon
                {
2377
                    if (type == 0)
2378
                    {
2379
                        result = Entity.SYMBOL_PRIVATE.Where(data => data.ID == id).FirstOrDefault().IMAGE_URL;
2380
                    }
2381
                    else
2382
                    {
2383
                        result = Entity.SYMBOL_PUBLIC.Where(data => data.ID == id).FirstOrDefault().IMAGE_URL;
2384
                    }
2385
                }
2386
            }
2387 24c5e56c taeseongkim
            catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex);
2388 53880c83 ljiyeon
                return null;
2389
            }
2390
            return result;
2391
        }
2392 2ab012e8 djkim
        [OperationContract]
2393
        public string GetSignData(string project_no, string user_id)
2394
        {
2395
            string result = null;
2396
            try
2397
            {
2398 dfb95d0f djkim
                string ifsign = getEnsembleSign(user_id);
2399
                if (string.IsNullOrEmpty(ifsign))
2400 2ab012e8 djkim
                {
2401 ff01c725 humkyung
                    string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString;
2402
                    var ModelWFConnectionString = sCIConnString;
2403 dfb95d0f djkim
                    if (null != ModelWFConnectionString)
2404 2ab012e8 djkim
                    {
2405 dfb95d0f djkim
                        using (CIEntities entity = new CIEntities(ModelWFConnectionString))
2406 2ab012e8 djkim
                        {
2407 dfb95d0f djkim
                            var _sign = entity.SIGN_INFO.Where(sin => sin.MEMBER_USER_ID == user_id);
2408
                            if (_sign.Count() > 0)
2409
                            {
2410
                                result = _sign.First().SIGN_STR;
2411
                            }
2412
                            else
2413
                            {
2414
                                return null;
2415
                            }
2416 2ab012e8 djkim
                        }
2417
                    }
2418
                }
2419 dfb95d0f djkim
                else
2420
                {
2421
                    result = ifsign;
2422
                }
2423
2424 2ab012e8 djkim
            }
2425 24c5e56c taeseongkim
            catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex);
2426 2ab012e8 djkim
                return null;
2427
            }
2428
            return result;
2429
        }
2430
2431
        [OperationContract]        
2432
        public string GetProjectName(string project_no)
2433
        {
2434
            string result = null;
2435
2436
            try
2437
            {
2438 ff01c725 humkyung
                string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
2439
                using (KCOMDataModel.DataModel.KCOMEntities Entity = new KCOMDataModel.DataModel.KCOMEntities(sConnString))
2440 2ab012e8 djkim
                {
2441
                    result = Entity.RUN_PROJECTS.Where(i => i.PROJECT_NO == project_no).FirstOrDefault().PROJECT_NAME.ToString();
2442
                }
2443
            }
2444 24c5e56c taeseongkim
            catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex);
2445 2ab012e8 djkim
                return null;
2446
            }
2447
            return result;
2448
        }
2449
2450
        [OperationContract]
2451
        public List<DOCUMENT_ITEM> GetPreRevSelect(string project_no, string doc_no, string current_rev)
2452
        {
2453
            List<DOCUMENT_ITEM> result = new List<DOCUMENT_ITEM>();
2454
            
2455
            try
2456
            {
2457 ff01c725 humkyung
                string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString;
2458
                using (CIEntities Entity = new CIEntities(sCIConnString))
2459 2ab012e8 djkim
                {
2460
                    result = Entity.DOCUMENT_ITEM.Where(i => i.PROJECT_NO == project_no
2461
                    && i.DOCUMENT_NO == doc_no
2462
                    && i.REVISION != current_rev).OrderByDescending(i => i.GROUP_NO).ToList();
2463
                }
2464
            }
2465 24c5e56c taeseongkim
            catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex);
2466 2ab012e8 djkim
                return null;
2467
            }
2468
            return result;
2469
        }
2470
2471
        [OperationContract]
2472
        public DOCINFO GetDocInfoOneSelect(string project_no, string doc_id)
2473
        {
2474
            DOCINFO docinfo = null;
2475
2476
            try
2477
            {
2478 ff01c725 humkyung
                string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString;
2479
                using (CIEntities Entity = new CIEntities(sCIConnString))
2480 2ab012e8 djkim
                {
2481
                    docinfo = (from info in Entity.DOCINFO
2482
                              where info.DOCUMENT_ID == doc_id
2483
                              && info.PROJECT_NO == project_no
2484
                              select info).First();
2485
                }
2486
            }
2487 24c5e56c taeseongkim
            catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex);
2488 2ab012e8 djkim
                return null;
2489
            }
2490
            return docinfo;
2491
        }
2492
2493
        [OperationContract]
2494
        public List<MarkupInfoItem> GetPrintDocItemList(string project_no, string doc_id, List<MarkupInfoItem> _markupInfoList)
2495
        {
2496
            MarkupInfoItem _result = null;
2497
            List<MarkupInfoItem> markupinfo = new List<MarkupInfoItem>();
2498
            try
2499
            {
2500 ff01c725 humkyung
                string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString;
2501
                using (CIEntities Entity = new CIEntities(sCIConnString))
2502 2ab012e8 djkim
                {
2503
                    var docitem = (from info in Entity.DOCINFO
2504
                               where info.DOCUMENT_ID == doc_id
2505
                               && info.PROJECT_NO == project_no
2506
                               select info).First();
2507
2508
                    foreach (MARKUP_INFO markinfo in docitem.MARKUP_INFO)
2509
                    {
2510 285635d3 taeseongkim
                        var members = GetMemberQuery(Entity, markinfo.USER_ID);
2511
2512
                        MEMBER member = new MEMBER();
2513
2514
                        if (members.Count() > 0)
2515
                        {
2516
                            member = members.First();
2517
                        }
2518
2519 2ab012e8 djkim
                        string displaycolor = null;
2520 285635d3 taeseongkim
2521 2ab012e8 djkim
                        try
2522
                        {
2523
                            displaycolor = _markupInfoList.Where(info => info.MarkupInfoID == markinfo.ID).First().DisplayColor;
2524
                        }
2525 0585d5cc taeseongkim
                        catch (Exception ex)
2526 2ab012e8 djkim
                        {
2527 0585d5cc taeseongkim
                            System.Diagnostics.Debug.WriteLine("KCOM_API - GetPrintDocItemList displaycolor : " + ex.ToString());
2528
2529 2ab012e8 djkim
                            displaycolor = "#FFFFFF";
2530
                        }
2531
                        
2532
                        _result = new MarkupInfoItem
2533
                        {
2534
                            MarkupInfoID = markinfo.ID,
2535
                            Consolidate = markinfo.CONSOLIDATE,
2536
                            CreateTime = markinfo.UPDATE_TIME.HasValue ? markinfo.UPDATE_TIME.Value : markinfo.CREATE_TIME,
2537
                            DisplayColor = displaycolor,
2538
                            UserID = markinfo.USER_ID,
2539
                            UserName = member.NAME,
2540
                            Depatment = member.DEPARTMENT,
2541
                        };
2542
2543
                        _result.MarkupList = new List<IKCOM.MarkupItem>();
2544
                        var markup_Version = markinfo.MARKUP_INFO_VERSION.OrderByDescending(p => p.CREATE_DATE).First();
2545
2546
                        foreach (MARKUP_DATA markdata in markup_Version.MARKUP_DATA)
2547
                        {
2548
                            MarkupItem markitem = new MarkupItem()
2549
                            {
2550
                                ID = markdata.ID,
2551
                                PageNumber = markdata.PAGENUMBER,
2552
                            };
2553
                            _result.MarkupList.Add(markitem);
2554
                        }
2555
2556
                        _result.PageCount = _result.MarkupList.GroupBy(i => i.PageNumber).Count();
2557
2558
                        markupinfo.Add(_result);
2559
                    }
2560
                }
2561
            }
2562 285635d3 taeseongkim
            catch (Exception ex)
2563 2ab012e8 djkim
            {
2564
                return null;
2565
            }
2566
            return markupinfo;
2567
        }
2568 04a7385a djkim
2569
        [OperationContract]
2570
        public bool AddMessage(string project_no, TALK value)
2571
        {
2572
            try
2573
            {
2574 ff01c725 humkyung
                string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString;
2575
                using (CIEntities entity = new CIEntities(sCIConnString))
2576 04a7385a djkim
                {                    
2577
                    entity.TALK.AddObject(value);
2578
                    entity.SaveChanges();
2579
                }
2580
            }
2581 24c5e56c taeseongkim
            catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex);
2582 04a7385a djkim
                return false;
2583
            }
2584
            return true;
2585
        }
2586
2587
        [OperationContract]
2588
        public List<TALK> GetMessage(string project_no, string doc_id)
2589
        {
2590
            List<TALK> result = new List<TALK>();
2591
            try
2592
            {
2593 ff01c725 humkyung
                string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString;
2594
                using (CIEntities entity = new CIEntities(sCIConnString))
2595 04a7385a djkim
                {
2596
                    result = entity.TALK.Where(data => data.DOCUMENT_ID == doc_id).ToList();                        
2597
                }
2598
            }
2599 ff01c725 humkyung
            catch (Exception ex)
2600 04a7385a djkim
            {
2601
                return result;
2602
            }
2603
            return result;
2604
        }
2605 dfb95d0f djkim
2606
2607
        #region Legacy System I/F
2608
        /// <summary>
2609
        /// Ensemble+ Sign Data Return
2610
        /// </summary>
2611
        /// <param name="user_id"></param>
2612
        /// <returns></returns>
2613
        private string getEnsembleSign(string user_id)
2614
        {
2615 ac4f1e13 taeseongkim
            string result = null;
2616 dfb95d0f djkim
            string soapurl = string.Empty;
2617 ac4f1e13 taeseongkim
2618 dfb95d0f djkim
            try
2619
            {
2620 ff01c725 humkyung
                string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
2621
                using (KCOMEntities Entity = new KCOMEntities(sConnString))
2622 dfb95d0f djkim
                {
2623
                    var item = Entity.PROPERTIES.Where(d => d.TYPE == "UpLoadServiceUrl").FirstOrDefault();
2624 ac4f1e13 taeseongkim
2625
                    if (item != null)
2626
                    {
2627
                        soapurl = item.VALUE;
2628
2629
                        WebClient webClient = new WebClient();
2630
                        string data = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ens=\"http://EnsemblePlus.Webservice\"> <soapenv:Header/> <soapenv:Body> <ens:checkoutSignImage>"
2631
                            + "<ens:sUserNo>" + user_id + "</ens:sUserNo>"
2632
                            + "</ens:checkoutSignImage> </soapenv:Body></soapenv:Envelope>";
2633
                        webClient.Headers.Add(HttpRequestHeader.ContentType, "text/xml");
2634
                        webClient.Headers.Add("SOAPAction", "http://EnsemblePlus.Webservice");
2635
                        var _result = webClient.UploadString(new Uri(soapurl), data);
2636
                        XmlDocument xmlDoc = new XmlDocument();
2637
                        xmlDoc.LoadXml(_result);
2638
                        XmlNodeList list = xmlDoc.GetElementsByTagName("checkoutSignImageResponse");
2639
2640
                        foreach (XmlNode xn in list)
2641
                        {
2642
                            result = xn["checkoutSignImageReturn"].InnerText;
2643
                        }
2644
2645
                        if (result.Contains("No business object"))
2646
                        {
2647
                            result = null;
2648
                        }
2649
                    }
2650
                    else
2651
                    {
2652
                        result = null;
2653
                    }
2654 dfb95d0f djkim
                }
2655 ac4f1e13 taeseongkim
             
2656 dfb95d0f djkim
            }
2657
            catch (Exception ex)
2658 ac4f1e13 taeseongkim
            {   
2659
                result = null;
2660 dfb95d0f djkim
            }
2661
2662 ac4f1e13 taeseongkim
            return result;
2663 dfb95d0f djkim
        }
2664
        #endregion
2665 6c9fec59 djkim
2666
        #region Final Service
2667
        [OperationContract]
2668
        [ServiceKnownType(typeof(DOCINFO))]                
2669
        public DOCINFO FinalPDF_GetDocinfo(string project_no, string docinfo_id)
2670
        {
2671
            DOCINFO docinfo = null;
2672
2673
            try
2674
            {
2675 ff01c725 humkyung
                string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString;
2676
                using (CIEntities _entity = new CIEntities(sCIConnString))
2677 6c9fec59 djkim
                {
2678
                    var doc = _entity.DOCINFO.Where(x => x.ID == docinfo_id).FirstOrDefault();
2679
                    if(doc != null)
2680
                    {
2681
                        docinfo = new DOCINFO()
2682
                        {
2683
                            ID = doc.ID,
2684
                            DOCUMENT_ID = doc.DOCUMENT_ID,
2685
                            PAGE_COUNT = doc.PAGE_COUNT,
2686
                            ORIGINAL_FILE = doc.ORIGINAL_FILE,
2687
                            PROJECT_NO = doc.PROJECT_NO
2688
                        };
2689
                    }                    
2690
                }
2691
            }
2692 24c5e56c taeseongkim
            catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex);
2693 6c9fec59 djkim
                throw;
2694
            }
2695
            return docinfo;
2696
        }
2697
        [OperationContract]
2698
        [ServiceKnownType(typeof(DOCUMENT_ITEM))]
2699
        public DOCUMENT_ITEM FinalPDF_GetDocumentItem(string project_no, string document_id)
2700
        {
2701
            DOCUMENT_ITEM item = null;
2702
2703
            try
2704
            {
2705 ff01c725 humkyung
                string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString;
2706
                using (CIEntities _entity = new CIEntities(sCIConnString))
2707 6c9fec59 djkim
                {
2708 0585d5cc taeseongkim
                    var doc = _entity.DOCUMENT_ITEM.Where(x => x.PROJECT_NO == project_no &&  x.DOCUMENT_ID == document_id).FirstOrDefault();
2709 6c9fec59 djkim
                    if(doc != null)
2710
                    {
2711
                        item = new DOCUMENT_ITEM()
2712
                        {
2713
                            ID = doc.ID,
2714
                            ORIGINAL_FILE = doc.ORIGINAL_FILE,
2715
                            PROJECT_NO = doc.PROJECT_NO,
2716
                            DOCUMENT_ID = doc.DOCUMENT_ID,
2717
                            DOCUMENT_NO = doc.DOCUMENT_NO,
2718
                            DOCUMENT_NAME = doc.DOCUMENT_NAME,
2719 ab5aa762 taeseongkim
                            //ENSEMBLEINFO_URL = doc.ENSEMBLEINFO_URL,
2720 6c9fec59 djkim
                            GROUP_NO = doc.GROUP_NO,
2721
                            RESULT = doc.RESULT,
2722
                            REVISION = doc.REVISION,
2723
                            RESULT_FILE = doc.RESULT_FILE
2724
                        };
2725
                    }
2726
                    
2727
                }
2728
            }
2729 24c5e56c taeseongkim
            catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex);
2730 6c9fec59 djkim
                throw;
2731
            }
2732
            return item;
2733
        }
2734
        [OperationContract]
2735
        [ServiceKnownType(typeof(MARKUP_DATA))]
2736
        public List<MARKUP_DATA> FinalPDF_GetMarkupdata(string project_no, string docinfo_id)
2737
        {
2738
            List<MARKUP_DATA> results = new List<MARKUP_DATA>();
2739
2740
            try
2741
            {
2742 c0977e97 djkim
                //using (CIEntities _entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(project_no).ToString()))
2743 ff01c725 humkyung
                string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString;
2744
                using (CIEntities _entity = new CIEntities(sCIConnString))
2745 6c9fec59 djkim
                {
2746
                    var datas = _entity.MARKUP_DATA.Where(x => x.MARKUP_INFO_VERSION.MARKUP_INFO.DOCINFO_ID == docinfo_id
2747
                    && x.MARKUP_INFO_VERSION.MARKUP_INFO.CONSOLIDATE == 1
2748
                    && x.MARKUP_INFO_VERSION.MARKUP_INFO.AVOID_CONSOLIDATE == 0
2749
                    && x.MARKUP_INFO_VERSION.MARKUP_INFO.PART_CONSOLIDATE == 0).ToList();
2750
                    foreach (var data in datas)
2751
                    {
2752
                        MARKUP_DATA d = new MARKUP_DATA()
2753
                        {
2754
                            ID = data.ID,
2755 c0977e97 djkim
                            //GROUP_ID = data.GROUP_ID,
2756 6c9fec59 djkim
                            SYMBOL_ID = data.SYMBOL_ID,
2757
                            DATA = data.DATA,
2758 abaa85b4 djkim
                            DATA_TYPE = data.DATA_TYPE,
2759
                            MARKUPINFO_VERSION_ID = data.MARKUPINFO_VERSION_ID,
2760
                            PAGENUMBER = data.PAGENUMBER
2761 6c9fec59 djkim
                        };
2762
                        results.Add(d);
2763
                    }
2764
                }
2765
            }
2766 24c5e56c taeseongkim
            catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex);
2767 6c9fec59 djkim
                throw;
2768
            }
2769
            return results;
2770
        }
2771
        [OperationContract]
2772
        [ServiceKnownType(typeof(MARKUP_INFO))]
2773
        public MARKUP_INFO FinalPDF_GetMarkupinfo(string project_no, string docinfo_id)
2774
        {
2775
            MARKUP_INFO markupInfo = null;
2776
2777
            try
2778
            {
2779 ff01c725 humkyung
                string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString;
2780
                using (CIEntities _entity = new CIEntities(sCIConnString))
2781 6c9fec59 djkim
                {
2782
                    var tmp = _entity.MARKUP_INFO.Where(x => x.DOCINFO_ID == docinfo_id && x.CONSOLIDATE == 1 && x.AVOID_CONSOLIDATE == 0 && x.PART_CONSOLIDATE == 0).FirstOrDefault();
2783
                    if (tmp != null)
2784
                    {
2785
                        markupInfo = new MARKUP_INFO()
2786
                        {
2787
                            ID = tmp.ID,
2788
                            DOCINFO_ID = tmp.DOCINFO_ID,
2789
                            USER_ID = tmp.USER_ID
2790
                        };
2791
                    }                    
2792
                }
2793
            }
2794 24c5e56c taeseongkim
            catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex);
2795 6c9fec59 djkim
                throw;
2796
            }
2797
            return markupInfo;
2798
        }
2799
        [OperationContract]
2800 abaa85b4 djkim
        [ServiceKnownType(typeof(FINAL_PDF))]
2801
        public List<FINAL_PDF> FinalPDF_GetFinalPDFs(string final_id)
2802
        {
2803
            List<FINAL_PDF> results = new List<FINAL_PDF>();
2804
2805
            try
2806
            {
2807 ff01c725 humkyung
                string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
2808
                using (KCOMEntities _entity = new KCOMEntities(sConnString))
2809 abaa85b4 djkim
                {
2810
                    var finalList = _entity.FINAL_PDF.Where(final => final.ID == final_id).ToList();
2811
                    foreach(var final in finalList)
2812
                    {
2813
                        FINAL_PDF pdf = new FINAL_PDF()
2814
                        {
2815
                            ID = final.ID,
2816
                            DOCINFO_ID = final.DOCINFO_ID,
2817
                            DOCUMENT_ID = final.DOCUMENT_ID,
2818
                            STATUS = final.STATUS,
2819
                            CURRENT_PAGE = final.CURRENT_PAGE,
2820
                            CREATE_DATETIME = final.CREATE_DATETIME,
2821
                            START_DATETIME = final.START_DATETIME,
2822
                            END_DATETIME = final.END_DATETIME,
2823
                            EXCEPTION = final.EXCEPTION,
2824
                            PROJECT_NO = final.PROJECT_NO,
2825
                            TOTAL_PAGE = final.TOTAL_PAGE,
2826
                            MARKUPINFO_ID = final.MARKUPINFO_ID,
2827
                            CREATE_USER_ID = final.CREATE_USER_ID
2828
                        };
2829
                        results.Add(pdf);
2830
                    }
2831
                }
2832
            }
2833 24c5e56c taeseongkim
            catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex);
2834 abaa85b4 djkim
                throw;
2835
            }
2836
            return results;
2837
        }
2838
        [OperationContract]
2839 6c9fec59 djkim
        [ServiceKnownType(typeof(DOCPAGE))]
2840
        public List<DOCPAGE> FinalPDF_GetDocpage(string project_no, string docinfo_id)
2841
        {
2842
            List<DOCPAGE> results = new List<DOCPAGE>();
2843
2844
            try
2845
            {
2846 ff01c725 humkyung
                string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString;
2847
                using (CIEntities _entity = new CIEntities(sCIConnString))
2848 6c9fec59 djkim
                {
2849
                    var pages = _entity.DOCPAGE.Where(x => x.DOCINFO_ID == docinfo_id).OrderBy(x => x.PAGE_NUMBER).ToList();
2850
                    foreach(var page in pages)
2851
                    {
2852
                        DOCPAGE p = new DOCPAGE()
2853
                        {
2854
                            PAGE_ANGLE = page.PAGE_ANGLE,
2855
                            PAGE_NUMBER = page.PAGE_NUMBER,
2856
                            PAGE_HEIGHT = page.PAGE_HEIGHT,
2857
                            PAGE_WIDTH = page.PAGE_WIDTH,
2858
                            DOCINFO_ID = page.DOCINFO_ID                            
2859
                        };
2860
                        results.Add(p);
2861
                    }                    
2862
                }
2863
            }
2864 24c5e56c taeseongkim
            catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex);
2865 6c9fec59 djkim
                throw;
2866
            }
2867
            return results;
2868
        }
2869 abaa85b4 djkim
        [OperationContract]        
2870
        public bool FinalPDF_SetFinalPDFStatus(string final_id, FinalStatus status)
2871
        {
2872
            bool result = false;
2873
2874
            try
2875
            {
2876 ff01c725 humkyung
                string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
2877
                using (KCOMEntities _entity = new KCOMEntities(sConnString))
2878 abaa85b4 djkim
                {
2879
                    var tmp = _entity.FINAL_PDF.Where(x => x.ID == final_id).FirstOrDefault();
2880
                    if(tmp != null)
2881
                    {
2882
                        switch(status)
2883
                        {
2884
                            case FinalStatus.Create:
2885
                                tmp.START_DATETIME = DateTime.Now;
2886
                                break;
2887
                            case FinalStatus.Success:
2888
                                tmp.END_DATETIME = DateTime.Now;
2889
                                tmp.EXCEPTION = string.Empty;
2890
                                break;                                
2891
                        }
2892
                        tmp.STATUS = (int)status;
2893
                        _entity.SaveChanges();
2894
                        result = true;                        
2895
                    }
2896
                }                    
2897
            }
2898 24c5e56c taeseongkim
            catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex);
2899 abaa85b4 djkim
                throw;
2900
            }
2901
            return result;
2902
        }
2903
2904 3c71b3a5 taeseongkim
        /// <summary>
2905
        /// 현재 진행중인 Final PDF 가 없거나 Success 일 경우에만 true return
2906
        /// </summary>
2907
        /// <param name="DocInfoID"></param>
2908
        /// <param name="MarkupInfoID"></param>
2909
        /// <param name="CreateUserID"></param>
2910
        /// <returns></returns>
2911 abaa85b4 djkim
        [OperationContract]
2912 3b62305d ljiyeon
        public bool FinalPDF_GetFinalPDFStatus(string DocInfoID, string MarkupInfoID, string CreateUserID)
2913
        {
2914
            bool result = false;
2915
2916
            try
2917
            {
2918 ff01c725 humkyung
                string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
2919
                using (KCOMEntities _entity = new KCOMEntities(sConnString))
2920 3b62305d ljiyeon
                {
2921 76688e76 djkim
                    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();
2922 3b62305d ljiyeon
                    if (finalpdf != null)
2923
                    {
2924 3c71b3a5 taeseongkim
                        if (finalpdf.STATUS == (int)FinalStatus.Success)
2925 3b62305d ljiyeon
                        {
2926
                            result = true;
2927
                        }
2928
                    }
2929 3c71b3a5 taeseongkim
                    else
2930
                        result = true;
2931 3b62305d ljiyeon
                }
2932
            }
2933 24c5e56c taeseongkim
            catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex);
2934 3b62305d ljiyeon
                throw;
2935
            }
2936
            return result;
2937
        }
2938
2939
        [OperationContract]
2940 abaa85b4 djkim
        public bool FinalPDF_SetCurrentPage(string final_id, int currentpage)
2941
        {
2942
            bool result = false;
2943
2944
            try
2945
            {
2946 ff01c725 humkyung
                string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
2947
                using (KCOMEntities _entity = new KCOMEntities(sConnString))
2948 abaa85b4 djkim
                {
2949
                    var tmp = _entity.FINAL_PDF.Where(x => x.ID == final_id).FirstOrDefault();
2950
                    if (tmp != null)
2951
                    {
2952
                        tmp.CURRENT_PAGE = currentpage;
2953
                        _entity.SaveChanges();
2954
                        result = true;
2955
                    }
2956
                }
2957
            }
2958 24c5e56c taeseongkim
            catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex);
2959 abaa85b4 djkim
                throw;
2960
            }
2961
            return result;
2962
        }
2963
        [OperationContract]
2964
        public bool FinalPDF_SetError(string final_id, string msg)
2965
        {
2966
            bool result = false;
2967
2968
            try
2969
            {
2970 ff01c725 humkyung
                string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
2971
                using (KCOMEntities _entity = new KCOMEntities(sConnString))
2972 abaa85b4 djkim
                {
2973
                    var tmp = _entity.FINAL_PDF.Where(x => x.ID == final_id).FirstOrDefault();
2974
                    if (tmp != null)
2975
                    {                        
2976
                        tmp.STATUS = (int)FinalStatus.Error;
2977
                        tmp.EXCEPTION = DateTime.Now.ToShortDateString() + " " + msg;                        
2978
                        _entity.SaveChanges();
2979
                        result = true;
2980
                    }
2981
                }
2982
            }
2983 24c5e56c taeseongkim
            catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex);
2984 abaa85b4 djkim
                throw;
2985
            }
2986
            return result;
2987
        }
2988
2989
        [OperationContract]
2990
        public bool FinalPDF_SetFinalResultPath(string project_no, string document_id, string url)
2991
        {
2992
            bool result = false;
2993
2994
            try
2995
            {
2996 ff01c725 humkyung
                string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString;
2997
                using (CIEntities _entity = new CIEntities(sCIConnString))
2998 abaa85b4 djkim
                {
2999 0585d5cc taeseongkim
                    var item = _entity.DOCUMENT_ITEM.Where(d =>d.PROJECT_NO == project_no && d.DOCUMENT_ID == document_id).FirstOrDefault();
3000 abaa85b4 djkim
                    if (item != null)
3001
                    {
3002
                        item.RESULT_FILE = url;
3003
                        _entity.SaveChanges();
3004
                        result = true;
3005
                    }
3006
                }
3007
            }
3008 24c5e56c taeseongkim
            catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex);
3009 abaa85b4 djkim
                throw;
3010
            }
3011
            return result;
3012
        }
3013
        [OperationContract]
3014
        [ServiceKnownType(typeof(MEMBER))]
3015
        public MEMBER FinalPDF_GetCommentMember(string project_no, string markupdata_id)
3016
        {
3017
            MEMBER member = null;
3018
            try
3019
            {
3020 ff01c725 humkyung
                string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString;
3021
                using (CIEntities _entity = new CIEntities(sCIConnString))
3022 abaa85b4 djkim
                {
3023
                    var data = _entity.MARKUP_DATA.Where(x => x.ID == markupdata_id).FirstOrDefault();
3024
                    string user_id = data.MARKUP_INFO_VERSION.MARKUP_INFO.USER_ID;
3025 285635d3 taeseongkim
3026
                    var person = GetMemberQuery(_entity,user_id);
3027
3028
                    if(person.Count() > 0)
3029 abaa85b4 djkim
                    {
3030 285635d3 taeseongkim
                        member = person.First();
3031 abaa85b4 djkim
                    }
3032
                }
3033
            }
3034 24c5e56c taeseongkim
            catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex);
3035 abaa85b4 djkim
                throw;
3036
            }
3037 285635d3 taeseongkim
3038 abaa85b4 djkim
            return member;
3039
        }
3040
3041
        [OperationContract]
3042
        [ServiceKnownType(typeof(PROPERTIES))]
3043
        public List<PROPERTIES> FinalPDF_GetProperties(string project_no)
3044
        {
3045
            List<PROPERTIES> results = new List<PROPERTIES>();
3046
            try
3047
            {
3048 ff01c725 humkyung
                string sConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
3049
                using (KCOMEntities _entity = new KCOMEntities(sConnString))
3050 abaa85b4 djkim
                {
3051
                    var _items = _entity.PROPERTIES.Where(x => x.PROPERTY == project_no).ToList();
3052
                    foreach(var item in _items)
3053
                    {
3054
                        PROPERTIES pROPERTIES = new PROPERTIES()
3055
                        {
3056
                            ID = item.ID,
3057
                            PROPERTY = item.PROPERTY,
3058
                            TYPE = item.TYPE,
3059
                            VALUE = item.VALUE
3060
                        };
3061
                        results.Add(pROPERTIES);
3062
                    }
3063
                }
3064
3065
            }
3066 24c5e56c taeseongkim
            catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex);
3067 abaa85b4 djkim
                throw;
3068
            }
3069
            return results;
3070
        }
3071 6c9fec59 djkim
        #endregion
3072 ffddbe4e djkim
    }    
3073 787a4489 KangIngu
}
클립보드 이미지 추가 (최대 크기: 500 MB)