프로젝트

일반

사용자정보

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

markus / KCOM_API / ServiceDeepView.svc.cs @ 7ca218b3

이력 | 보기 | 이력해설 | 다운로드 (28.4 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
using System.Linq;
8
using System.Runtime.Remoting.Channels.Tcp;
9
using System.Runtime.Serialization;
10
using System.ServiceModel;
11
using System.ServiceModel.Activation;
12
using System.Text;
13
using System.Windows;
14
15
namespace KCOM_API
16
{
17
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "ServiceDeepView" in code, svc and config file together.
18
    // 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.
19
    [ServiceContract(Namespace = "")]
20
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
21
    public partial class ServiceDeepView : System.Web.Services.WebService
22
    {
23
        //[OperationContract]
24
        //public List<HoneyheadTEXT> GetSearchText(int pageNo, string filePath,bool IsAllPage) //0아 아니면 지정 페이지
25
        //{
26
27
        //    return null;
28
        //}
29
30
31
        [OperationContract]
32
        public KCOM_SystemInfo GetSystemData()
33
        {
34
            try
35
            {
36
                using (KCOMEntities uc = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
37
                {
38
                    var SystemInfoSet = uc.PROPERTIES.Where(data => data.TYPE == "SystemInfo").ToList();
39
40
                    KCOM_SystemInfo sysInfo = new KCOM_SystemInfo();
41
42
                    var url = SystemInfoSet.Where(data => data.PROPERTY == "Url").FirstOrDefault();
43
                    if (url != null)
44
                    {
45
                        sysInfo.HostName = url.VALUE;
46
                    }
47
48
                    url = SystemInfoSet.Where(data => data.PROPERTY == "Port").FirstOrDefault();
49
                    if (url != null)
50
                    {
51
                        sysInfo.HostPort = url.VALUE;
52
                    }
53
                    return sysInfo;
54
                }
55
            }
56
            catch (Exception ex)
57
            {
58
            }
59
            return null;
60
            GC.Collect(2);
61
        }
62
63
        private static string shortGuid()
64
        {
65
            byte[] bytes = new byte[16];
66
            using (var provider = System.Security.Cryptography.RandomNumberGenerator.Create())
67
            {
68
                provider.GetBytes(bytes);
69
            }
70
71
            var guid = new Guid(bytes);
72
73
            return Convert.ToBase64String(guid.ToByteArray())
74
                .Substring(0, 10)
75
                .Replace("/", "")
76
                .Replace("+", "") + DateTime.UtcNow.Ticks.ToString("x");
77
        }
78
79
80
        [OperationContract]
81
        public List<Rect> GetCompareRect(string projectNo, string originDocItem_ID, string targetDocItem_ID, string originPageNo, string targetPageNo)
82
        {
83
            //string originFile = String.Format(@"http://cloud.devdoftech.co.kr:5977/TileSource/{0}_Tile/{1}/{2}/{3}.cmp", projectNo, (Convert.ToInt32(originDocItem_ID) / 100).ToString(), originDocItem_ID, originPageNo);
84
            //string targetFile = String.Format(@"http://cloud.devdoftech.co.kr:5977/TileSource/{0}_Tile/{1}/{2}/{3}.cmp", projectNo, (Convert.ToInt32(targetDocItem_ID) / 100).ToString(), targetDocItem_ID, targetPageNo);
85
            string originFile = String.Format(@"http://cloud.devdoftech.co.kr:5977/TileSource/{0}_Tile/{1}/{2}/{3}.png", projectNo, (Convert.ToInt32(originDocItem_ID) / 100).ToString(), originDocItem_ID, originPageNo);
86
            string targetFile = String.Format(@"http://cloud.devdoftech.co.kr:5977/TileSource/{0}_Tile/{1}/{2}/{3}.png", projectNo, (Convert.ToInt32(targetDocItem_ID) / 100).ToString(), targetDocItem_ID, targetPageNo);
87
88
            MARKUS.CompareLib compareLib = new MARKUS.CompareLib();
89
            //System.IO.Stream resultOrigin = compareLib.ChangeCmpUrlToPng(originFile);
90
            //System.IO.Stream resultTarget = compareLib.ChangeCmpUrlToPng(targetFile);
91
92
            var resultOrigin = compareLib.ChangeCmpUrlToPng_File(originFile);
93
            var resultTarget = compareLib.ChangeCmpUrlToPng_File(targetFile);
94
95
            string outPutFile = compareLib.ImageCompare_File(resultOrigin, resultTarget);
96
            var result = compareLib.GetBoundBoxInImage(outPutFile);
97
98
            return result;
99
        }
100
101
102
103
        #region Final PDF
104
        private string _ChanID = null;
105
        TcpChannel chan = null;
106
        [OperationContract]
107
        public FinalPDFResult SetFinalPDF(string ProjectNo, string DocInfoID, string MarkupInfoID, string CreateUserID)
108
        {
109
            #region 임시보관
110
            #endregion
111
            FinalPDFResult _result = new FinalPDFResult();
112
            RemFinalPDFObject remObj = null;
113
            try
114
            {
115
                string _finalID = shortGuid();
116
                int _DocTotalPages = -1;
117
                string docItemId;
118
119
120
                using (CIEntities _ci = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString()))
121
                {
122
                    var _doc = _ci.DOCINFO.Where(info => info.ID == DocInfoID);
123
124
                    if (_doc.Count() > 0)
125
                    {
126
                        _DocTotalPages = _doc.First().PAGE_COUNT;
127
                        docItemId = _doc.First().DOCUMENT_ID;
128
                    }
129
                    else
130
                    {
131
                        _result.Status = FinalStatus.Error;
132
                        _result.Exception = "페이지 정보를 가져올 수 없습니다.";
133
                        return _result;
134
                    }
135
                }
136
                if (_DocTotalPages > 0)
137
                {
138
                    FINAL_PDF fm = new FINAL_PDF()
139
                    {
140
                        ID = _finalID,
141
                        PROJECT_NO = ProjectNo,
142
                        DOCINFO_ID = DocInfoID,
143
                        DOCUMENT_ID = docItemId,
144
                        MARKUPINFO_ID = MarkupInfoID,
145
                        CREATE_USER_ID = CreateUserID,
146
                        TOTAL_PAGE = _DocTotalPages,
147
                        CREATE_DATETIME = DateTime.Now,
148
                        STATUS = (int)IFinalPDF.FinalStatus.Insert
149
                    };
150
                    using (KCOMEntities _entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
151
                    {
152
                        _entity.AddToFINAL_PDF(fm);
153
                        _entity.SaveChanges(System.Data.Objects.SaveOptions.AcceptAllChangesAfterSave);
154
                    };
155
156
                    System.Runtime.Remoting.Channels.IChannel _ch = System.Runtime.Remoting.Channels.ChannelServices.GetChannel("tcp");
157
                    if (_ch == null)
158
                    {
159
                        chan = new TcpChannel();
160
                        _ChanID = chan.ChannelName;
161
                        System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(chan, false);
162
                        // Create an instance of the remote object
163
164
165
                        using (KCOMEntities ec = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
166
                        {
167
168
                            //remObj = (RemFinalPDFObject)Activator.GetObject(typeof(RemFinalPDFObject),
169
                            //                          "tcp://localhost:9092/remFinalPDF");
170
                            remObj = (RemFinalPDFObject)Activator.GetObject(typeof(RemFinalPDFObject),
171
                                                      //"tcp://192.168.0.67:9092/remFinalPDF");
172
                                                      "tcp://192.168.0.67:9092/remFinalPDF");
173
                        }
174
175
                        //"tcp://localhost:8080/remFinalPDF");
176
177
                        _result = remObj.SetFinalPDF(ProjectNo, _finalID);
178
                        _result.FinalID = _finalID;
179
                        _result.Status = FinalStatus.Success;
180
181
                        //MarkupToPDF.MarkupToPDF fa = new MarkupToPDF.MarkupToPDF();
182
                        //fa.MakeFinalPDF(fm);
183
                    }
184
                    else
185
                    {
186
                        _ChanID = _ch.ChannelName;
187
                    }
188
                }
189
            }
190
            catch (Exception ex)
191
            {
192
                _result.Status = FinalStatus.Error;
193
194
                if (ex.GetType() == typeof(System.Net.Sockets.SocketException))
195
                    _result.Exception = "Final Server Not Connection";
196
            }
197
            finally
198
            {
199
                remObj = null;
200
                if (System.Runtime.Remoting.Channels.ChannelServices.GetChannel("tcp") != null)
201
                    System.Runtime.Remoting.Channels.ChannelServices.UnregisterChannel(chan);
202
203
                GC.Collect(2);
204
            }
205
            return _result;
206
        }
207
        #endregion
208
209
210
        [OperationContract]
211
        public bool GetConversionState(KCOM_BasicParam param)
212
        {
213
            using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(param.projectNo).ToString()))
214
            {
215
                var doc = entity.DOCINFO.Where(data => data.DOCUMENT_ID == param.documentID).FirstOrDefault();
216
                if (doc != null)
217
                {
218
                    var count = doc.DOCPAGE.Where(data => data.DOCINFO_ID == doc.ID).Count();
219
                    if (doc.PAGE_COUNT == count)  //페이지 수가 일치하는지
220
                    {
221
                        return true;
222
                    }
223
                    else //페이지 수가 일치하지 않는 경우
224
                    {
225
                        KCOMEntities entity_kcom = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString());
226
                        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();
227
228
                        if (lst != null || lst.Count >= 1)
229
                        {
230
                            //Common.Helper.SystemErrorNotify(SERVICE_NAME.API, LEVEL.MEDIUM, ERROR_TYPE.CONVERT, Resources.ResourceManager.GetString("MSG_ERROR_PAGECOUNT"), param.documentID, param.projectNo);
231
                            //이메일 클라이언트를 구현해야함
232
                        }
233
                        return false;
234
                    }
235
                }
236
                else
237
                {
238
                    //Common.Helper.SystemErrorNotify(SERVICE_NAME.API, LEVEL.MEDIUM, ERROR_TYPE.CONVERT, Resources.ResourceManager.GetString("MSG_ERROR_CONVERTFAILED"), param.documentID, param.projectNo);
239
                    //이메일 클라이언트를 구현해야함
240
                    return false;
241
                }
242
            }
243
        }
244
245
        [OperationContract]
246
        public List<VPRevision> GetVPRevisionHistory(string ProjectNo, string vpNo, string DocumentId)
247
        {
248
            List<VPRevision> _result = new List<VPRevision>();
249
            try
250
            {
251
                using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString()))
252
                {
253
                    var _vpList = (from docitem in entity.DOCUMENT_ITEM
254
                                   where docitem.DOCUMENT_NO == vpNo
255
                                   select new VPRevision
256
                                   {
257
                                       RevNo = docitem.REVISION,
258
                                       GroupNo = docitem.GROUP_NO,
259
                                       FROM_VENDOR = docitem.ORIGINAL_FILE,
260
                                       DOCUMENT_ID = docitem.DOCUMENT_ID,
261
                                       TO_VENDOR = docitem.RESULT_FILE,
262
                                       RESULT = docitem.RESULT,
263
264
                                       IsSyncPossible = docitem.DOCUMENT_ID == DocumentId ? false : true
265
                                   });
266
                    _result = _vpList.ToList();
267
                    _result = _result.OrderByDescending(r => Convert.ToInt32(r.GroupNo)).ToList();
268
                }
269
            }
270
            catch (Exception)
271
            {
272
273
                throw;
274
            }
275
            finally
276
            {
277
                GC.Collect(2);
278
            }
279
            return _result;
280
        }
281
282
        [OperationContract]
283
        public DOCINFO GetDocInfo(KCOM_BasicParam param)
284
        {
285
            DOCINFO _result = null;
286
            try
287
            {
288
                // 차후 아래의 코드로 변경
289
                //using (CI_Entities ModelDeeview = new CI_Entities(DaelimCiConnectionString.ToString()))
290
                CIEntities ModelDeeview = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(param.projectNo).ToString());
291
292
                var docinfo = ModelDeeview.DOCINFO.Where(doc => doc.DOCUMENT_ID == param.documentID);
293
                if (docinfo.Count() > 0)
294
                {
295
                    _result = docinfo.First();
296
                    _result.MARKUP_INFO.Clear();
297
298
                }
299
                return _result;
300
301
            }
302
            catch (Exception ex)
303
            {
304
                System.Diagnostics.Trace.WriteLine("GetDocInfo Error : " + ex);
305
            }
306
            finally
307
            {
308
                GC.Collect(2);
309
            }
310
            return null;
311
        }
312
313
        [OperationContract]
314
        public bool GetCheckSystemAdmin(string UserID)
315
        {
316
            using (KCOMEntities uc = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
317
            {
318
                var user = uc.PROPERTIES.Where(data => data.TYPE == "Administrator" && data.PROPERTY.Contains(UserID)).FirstOrDefault();
319
                if (user != null)
320
                {
321
                    return true;
322
                }
323
                else
324
                {
325
                    return false;
326
                }
327
            }
328
            GC.Collect(2);
329
        }
330
331
        [OperationContract]
332
        public DOCUMENT_ITEM GetDocumentItemInfo(KCOM_BasicParam param)
333
        {
334
            ///param : prjNo, documentId, userId
335
            DOCUMENT_ITEM _result = null;
336
337
            try
338
            {
339
                CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(param.projectNo).ToString());
340
341
                var _items = entity.DOCUMENT_ITEM.Where(data => data.DOCUMENT_ID == param.documentID);
342
343
                if (_items.Count() > 0)
344
                {
345
                    _result = _items.First();
346
347
                    return _result;
348
                }
349
                //else
350
                //{
351
                //    Common.Helper.SystemErrorNotify(SERVICE_NAME.API, LEVEL.MEDIUM, ERROR_TYPE.CONVERT, Resources.ResourceManager.GetString("MSG_ERROR_DOCUMENTNOTFOUND"), param.documentID, param.projectNo);
352
                //}
353
            }
354
            catch (Exception ex)
355
            {
356
                System.Diagnostics.Trace.WriteLine("GetVendorItemInfo Error : " + ex);
357
                //Common.Helper.SystemErrorNotify(SERVICE_NAME.API, LEVEL.MEDIUM, ERROR_TYPE.CONVERT, "GetDocumentItemInfo / " + ex.Message, param.documentID, param.projectNo);
358
            }
359
360
            return _result;
361
        }
362
363
        public string UserGO(MARKUP_INFO item)
364
        {
365
            if (item != null)
366
            {
367
                return item.MARKUP_INFO_VERSION.OrderByDescending(data => data.CREATE_DATE).FirstOrDefault().ID;
368
            }
369
            return null;
370
        }
371
372
        [OperationContract]
373
        public List<MarkupInfoItem> GetMarkupInfoItems(string ProjectNo, string DocInfoId)
374
        {
375
            List<MarkupInfoItem> _result = new List<MarkupInfoItem>();
376
            try
377
            {
378
                using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString()))
379
                {
380
                    var markupListData = entity.MARKUP_INFO.Where(data => data.DOCINFO_ID == DocInfoId).ToList();
381
                    //foreach (var item in markupListData)
382
                    //{
383
                    //    if (!item.AVOID_CONSOLIDATE.HasValue)
384
                    //    {
385
                    //        item.AVOID_CONSOLIDATE = 0;
386
                    //    }
387
                    //}
388
389
                    var markupList = from markup in markupListData
390
                                     orderby markup.CREATE_TIME descending
391
                                     select new MarkupInfoItem
392
                                     {
393
                                         MarkupInfoID = markup.ID,
394
                                         UserID = markup.USER_ID,
395
                                         MarkupVersionID = markup.MARKUP_INFO_VERSION.Count() == 0 ? null : markup.MARKUP_INFO_VERSION.OrderByDescending(data => data.CREATE_DATE).FirstOrDefault().ID,
396
                                         CreateTime = markup.CREATE_TIME,
397
                                         Consolidate = markup.CONSOLIDATE,
398
                                         Description = markup.DESCRIPTION,
399
                                         AvoidConsolidate = markup.AVOID_CONSOLIDATE,
400
                                         PartConsolidate = markup.PART_CONSOLIDATE,
401
                                     };
402
403
404
405
                    if (markupList.Count() > 0)
406
                    {
407
                        _result = markupList.ToList();
408
                    }
409
410
411
412
                    _result.ForEach(r =>
413
                    {
414
415
                        r.MarkupList = (from markupData in entity.MARKUP_DATA
416
                                        where markupData.MARKUPINFO_VERSION_ID == r.MarkupVersionID
417
                                        orderby markupData.PAGENUMBER
418
                                        select new MarkupItem { ID = markupData.ID, PageNumber = markupData.PAGENUMBER, Data = markupData.DATA, Data_Type = markupData.DATA_TYPE }).ToList();
419
                    });
420
421
                    List<PROPERTIES> _ColorsProperties = new List<PROPERTIES>();
422
                    Random random = new Random();
423
424
                    using (KCOMEntities kcomEntity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
425
                    {
426
                        _ColorsProperties = (from property in kcomEntity.PROPERTIES
427
                                             where property.TYPE == "DisplayColor"
428
                                             select property).ToList();
429
                    }
430
431
                    foreach (var item in _result)
432
                    {
433
                        var _member = entity.MEMBER.Where(member => member.ID == item.UserID);
434
435
                        if (_member.Count() > 0)
436
                        {
437
                            item.UserName = _member.First().NAME;
438
                            item.Depatment = _member.First().DEPARTMENT;
439
                        }
440
441
                        if (_ColorsProperties.Count > 0)
442
                        {
443
                            int colorIdx = random.Next(1, _ColorsProperties.Count());
444
                            #region 부서별로 색상을 지정하고자 할때
445
                            /// 일단 의견을 들어보자구!
446
                            #endregion
447
                            item.DisplayColor = "#FF" + _ColorsProperties[colorIdx].VALUE;
448
                            _ColorsProperties.Remove(_ColorsProperties[colorIdx]);
449
                            //item.DisplayColor = "#FF" + _Colors.First();
450
                            //_Colors.Remove(_Colors.First());
451
                        }
452
                        else
453
                        {
454
                            item.DisplayColor = String.Format("#FF{0:X6}", random.Next(0x1000000));
455
                        }
456
                    }
457
                }
458
            }
459
            catch (Exception EX)
460
            {
461
                System.Diagnostics.Debug.WriteLine(this.GetType().ToString() + " " + EX);
462
                return _result;
463
            }
464
            finally
465
            {
466
                GC.Collect(2);
467
            }
468
469
            return _result;
470
        }
471
472
        [OperationContract]
473
        public List<MarkupInfoItem> GetSyncMarkupInfoItems(string ProjectNo, string DocInfoId, string currentUser)
474
        {
475
            List<MarkupInfoItem> _result = new List<MarkupInfoItem>();
476
            try
477
            {
478
                using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString()))
479
                {
480
                    var docItem = entity.DOCINFO.Where(data => data.DOCUMENT_ID == DocInfoId).FirstOrDefault();
481
                    if (docItem == null)
482
                    {
483
                        return null;
484
                    }
485
                    var markupListData = entity.MARKUP_INFO.Where(data => data.DOCINFO_ID == docItem.ID).ToList();
486
487
                    var markupList = from markup in markupListData
488
                                     where markup.USER_ID == currentUser || markup.CONSOLIDATE == 1
489
                                     orderby markup.CREATE_TIME descending
490
                                     select new MarkupInfoItem
491
                                     {
492
                                         MarkupInfoID = markup.ID,
493
                                         UserID = markup.USER_ID,
494
                                         MarkupVersionID = markup.MARKUP_INFO_VERSION.Count() == 0 ? null : markup.MARKUP_INFO_VERSION.OrderByDescending(data => data.CREATE_DATE).FirstOrDefault().ID,
495
                                         CreateTime = markup.CREATE_TIME,
496
                                         Consolidate = markup.CONSOLIDATE,
497
                                         Description = markup.DESCRIPTION,
498
                                         AvoidConsolidate = markup.AVOID_CONSOLIDATE,
499
                                         PartConsolidate = markup.PART_CONSOLIDATE,
500
                                     };
501
502
503
504
                    if (markupList.Count() > 0)
505
                    {
506
                        _result = markupList.ToList();
507
                    }
508
509
510
511
                    _result.ForEach(r =>
512
                    {
513
514
                        r.MarkupList = (from markupData in entity.MARKUP_DATA
515
                                        where markupData.MARKUPINFO_VERSION_ID == r.MarkupVersionID
516
                                        orderby markupData.PAGENUMBER
517
                                        select new MarkupItem { ID = markupData.ID, PageNumber = markupData.PAGENUMBER, Data = markupData.DATA, Data_Type = markupData.DATA_TYPE }).ToList();
518
                    });
519
520
                    List<PROPERTIES> _ColorsProperties = new List<PROPERTIES>();
521
                    Random random = new Random();
522
523
                    using (KCOMEntities kcomEntity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
524
                    {
525
                        _ColorsProperties = (from property in kcomEntity.PROPERTIES
526
                                             where property.TYPE == "DisplayColor"
527
                                             select property).ToList();
528
                    }
529
530
                    foreach (var item in _result)
531
                    {
532
                        var _member = entity.MEMBER.Where(member => member.ID == item.UserID);
533
534
                        if (_member.Count() > 0)
535
                        {
536
                            item.UserName = _member.First().NAME;
537
                            item.Depatment = _member.First().DEPARTMENT;
538
                        }
539
540
                        if (_ColorsProperties.Count > 0)
541
                        {
542
                            int colorIdx = random.Next(1, _ColorsProperties.Count());
543
                            #region 부서별로 색상을 지정하고자 할때
544
                            /// 일단 의견을 들어보자구!
545
                            #endregion
546
                            item.DisplayColor = "#FF" + _ColorsProperties[colorIdx].VALUE;
547
                            _ColorsProperties.Remove(_ColorsProperties[colorIdx]);
548
                            //item.DisplayColor = "#FF" + _Colors.First();
549
                            //_Colors.Remove(_Colors.First());
550
                        }
551
                        else
552
                        {
553
                            item.DisplayColor = String.Format("#FF{0:X6}", random.Next(0x1000000));
554
                        }
555
                    }
556
                }
557
            }
558
            catch (Exception EX)
559
            {
560
                System.Diagnostics.Debug.WriteLine(this.GetType().ToString() + " " + EX);
561
                return _result;
562
            }
563
            finally
564
            {
565
                GC.Collect(2);
566
            }
567
568
            return _result;
569
        }
570
571
572
        //[OperationContract]
573
        //[ServiceKnownType(typeof(MEMBER))]
574
        //public List<MEMBER> GetUserData(string ProjectNo, string UserID)
575
        //{
576
        //    List<MEMBER> _result = new List<MEMBER>();
577
578
        //    using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString()))
579
        //    {
580
        //        var _UserList = from member in entity.MEMBER
581
        //                        where member.ID == UserID
582
        //                        select member;
583
        //        _result = _UserList.ToList();
584
        //    }
585
        //    //GC.Collect(2);
586
        //    return _result;
587
        //}
588
589
        //[OperationContract]
590
        //[ServiceKnownType(typeof(MEMBER))]
591
        //public List<MEMBER> GetUserData(string ProjectNo, string UserID)
592
        //{
593
        //    List<MEMBER> _result = new List<MEMBER>();
594
595
        //    using (CIEntities entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString()))
596
        //    {
597
        //        var _UserList = from member in entity.MEMBER
598
        //                        where member.ID == UserID
599
        //                        select member;
600
        //        _result = _UserList.ToList();
601
        //    }
602
        //    //GC.Collect(2);
603
        //    return _result;
604
        //}
605
606
607
        [OperationContract]
608
        public List<string> GetDeptData(string UserDept) //그룹 추가 옵션 부여 예정
609
        {
610
            List<string> _result = new List<string>();
611
612
            try
613
            {
614
                KCOMEntities entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString());
615
                var YourEnginner = (from dept in entity.PROPERTIES
616
                                    where dept.TYPE == "DeptName" && UserDept.Contains(dept.VALUE)
617
                                    select dept).FirstOrDefault();
618
619
                if (YourEnginner != null)
620
                {
621
                    _result = (from dept in entity.PROPERTIES
622
                               where dept.PROPERTY == YourEnginner.PROPERTY
623
                               select dept.VALUE).ToList();
624
                    return _result;
625
                }
626
                else
627
                {
628
                    return null;
629
                }
630
            }
631
            catch (Exception ex)
632
            {
633
                System.Diagnostics.Debug.WriteLine(ex.Message);
634
            }
635
            finally
636
            {
637
                GC.Collect(2);
638
            }
639
            return _result;
640
        }
641
642
        [OperationContract]
643
        public bool DeleteMarkup(string ProjectNo, string MarkupInfoID)
644
        {
645
            bool _result = false;
646
            try
647
            {
648
                using (KCOMDataModel.DataModel.CIEntities Entity = new KCOMDataModel.DataModel.CIEntities(KCOMDataModel.Common.ConnectStringBuilder.ProjectCIConnectString(ProjectNo).ToString()))
649
                {
650
651
                    MARKUP_INFO instance = Entity.MARKUP_INFO.Where(root => root.ID == MarkupInfoID).FirstOrDefault();
652
653
                    if (instance == null)
654
                    {
655
                        return false;
656
                    }
657
                    MARKUP_INFO_VERSION version = instance.MARKUP_INFO_VERSION.FirstOrDefault();
658
659
660
                    version.MARKUP_DATA.ToList().ForEach(data =>
661
                    {
662
                        Entity.MARKUP_DATA.DeleteObject(data);
663
                        Entity.SaveChanges();
664
                    });
665
666
                    Entity.MARKUP_INFO_VERSION.DeleteObject(version);
667
                    Entity.SaveChanges();
668
669
                    Entity.MARKUP_INFO.DeleteObject(instance);
670
                    Entity.SaveChanges();
671
672
                }
673
                _result = true;
674
            }
675
            catch (Exception ex)
676
            {
677
                System.Diagnostics.Trace.WriteLine(ex, "SaveMarkup");
678
            }
679
            finally
680
            {
681
                GC.Collect(2);
682
            }
683
            return _result;
684
        }
685
    }
686
}
클립보드 이미지 추가 (최대 크기: 500 MB)