프로젝트

일반

사용자정보

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

markus / KCOM / Events / SaveCommand.cs @ 4cb62752

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

1 787a4489 KangIngu
using IKCOM;
2
using KCOM.Common;
3
using KCOMDataModel.Common;
4
using KCOMDataModel.DataModel;
5
using MarkupToPDF.Common;
6
using MarkupToPDF.Controls.Parsing;
7
using System;
8
using System.Collections.Generic;
9 c00d0547 humkyung
using System.Collections.ObjectModel;
10 787a4489 KangIngu
using System.Linq;
11
using System.Text;
12
using System.Windows.Controls;
13
14
namespace KCOM.Events
15
{
16 de6499db humkyung
    public class SaveCommand
17 787a4489 KangIngu
    {
18 de6499db humkyung
        private static readonly SaveCommand _instance = new SaveCommand();
19
20
        // Explicit static constructor to tell C# compiler
21
        // not to mark type as beforefieldinit
22
        static SaveCommand()
23
        {
24
        }
25
26
        private SaveCommand()
27
        {
28
        }
29
30
        public static SaveCommand Instance
31
        {
32
            get
33
            {
34
                return _instance;
35
            }
36
        }
37
38 787a4489 KangIngu
        #region Properties
39
40
        public ViewInfo _ViewInfo;
41
        public string Project_No
42
        {
43
            get;
44
            set;
45
        }
46
        public string document_id
47
        {
48
            get;
49
            set;
50
        }
51
52
        public string user_id
53
        {
54
            get;
55
            set;
56
        }
57
58
        public int page_no
59
        {
60
            get;
61
            set;
62
        }
63
        #endregion
64
65
        public void MarkupConsolidate()
66
        {
67
68
        }
69
70 de6499db humkyung
        /// <summary>
71
        /// save comments related to given markup information
72
        /// </summary>
73
        /// <param name="UserState"></param>
74
        /// <param name="iPageNo"></param>
75 4cb62752 storm566
        public void Execute(ICollection<MarkupInfoItem> UserStates)
76 787a4489 KangIngu
        {
77 6c781c0c djkim
            try
78 787a4489 KangIngu
            {
79 de6499db humkyung
                foreach (var UserState in UserStates)
80 787a4489 KangIngu
                {
81 de6499db humkyung
                    List<MARKUP_DATA> markupdata = new List<MARKUP_DATA>();
82 129ca191 humkyung
                    ViewerDataModel.Instance.MyMarkupList.Where(d => d.MarkupInfoID == UserState.MarkupInfoID).ToList().GroupBy(p => p.ID).Select(g => g.First()).ToList().ForEach(value =>
83 de6499db humkyung
                    {
84 c00d0547 humkyung
                        markupdata.Add(new MARKUP_DATA()
85
                        {
86
                            ID = value.ID,
87
                            PAGENUMBER = value.PageNumber,
88
                            DATA = value.Data,
89
                            MARKUPINFO_VERSION_ID = UserState.MarkupVersionID,
90
                            DATA_TYPE = value.Data_Type
91
                        });
92 de6499db humkyung
                    });
93 6b6e937c taeseongkim
94
95
96 4cb62752 storm566
                    var SaveResult = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveMarkupData(UserState, Project_No, document_id, user_id, markupdata);
97 6b6e937c taeseongkim
98
                    Logger.sendResLog("SaveCommand.Instance.Execute" , $"SaveMarkupData Call Project : {Project_No} DocID :{document_id} User ID {user_id} result {SaveResult}",1);
99
100 4cb62752 storm566
                    Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.MarkupitemViewUpdate(UserState.MarkupInfoID);
101 de6499db humkyung
                }
102 073f6118 djkim
                //User Information List Rebind
103 4cb62752 storm566
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.gridViewMarkup.Rebind();
104 e05fe8ab djkim
                TempFile.Remove(); //임시파일삭제                
105 787a4489 KangIngu
            }
106 6c781c0c djkim
            catch (Exception)
107
            {
108
                throw;
109
            }
110 787a4489 KangIngu
        }
111
112
        public void SymbolSave(string Name, string Url, string Data)
113
        {
114 6c781c0c djkim
            try
115 787a4489 KangIngu
            {
116
                SYMBOL_PRIVATE symbol_private = new SYMBOL_PRIVATE
117
                {
118 24678e06 humkyung
                    ID = Commons.shortGuid(),
119 787a4489 KangIngu
                    MEMBER_USER_ID = App.ViewInfo.UserID,
120
                    NAME = Name,
121
                    IMAGE_URL = Url,
122
                    DATA = Data
123
                };
124 0f065e57 ljiyeon
125
                Logger.sendReqLog("SaveSymbolAsync: ", symbol_private.ID + "," + symbol_private.MEMBER_USER_ID + "," + symbol_private.NAME + "," + symbol_private.IMAGE_URL + "," + symbol_private.DATA, 1);
126 6c781c0c djkim
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolAsync(symbol_private);
127
            }
128
            catch(Exception)
129
            {
130
                throw;
131
            }
132
        }
133 498f0fc9 ljiyeon
        public void SymbolSave_Public(string Name, string Url, string Data, string Department)
134
        {
135
            try
136
            {
137
                SYMBOL_PUBLIC symbol_public = new SYMBOL_PUBLIC
138
                {
139 24678e06 humkyung
                    ID = Commons.shortGuid(),
140 498f0fc9 ljiyeon
                    DEPARTMENT = Department,
141
                    NAME = Name,
142
                    IMAGE_URL = Url,
143
                    DATA = Data
144
                };
145 787a4489 KangIngu
146 498f0fc9 ljiyeon
                Logger.sendReqLog("AddPublicSymbol: ", symbol_public.ID + "," + symbol_public.DEPARTMENT + "," + symbol_public.NAME + "," + symbol_public.IMAGE_URL + "," + symbol_public.DATA, 1);
147
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddPublicSymbol(symbol_public);
148
            }
149
            catch (Exception)
150
            {
151
                throw;
152
            }
153
        }
154 129ca191 humkyung
155 4cb62752 storm566
        public void PageAngleSave(string project_no, List<DOCPAGE> _mldocpage)
156 6c781c0c djkim
        {
157
            try
158
            {
159 0cda2a88 taeseongkim
                Logger.sendReqLog("SavePageAngle: ", project_no + "," + _mldocpage, 1);
160 4cb62752 storm566
                Logger.sendResLog("SavePageAngle", Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SavePageAngle(project_no, _mldocpage).ToString(), 1);
161
                Common.ViewerDataModel.Instance.RotationDocs.Clear();
162 6c781c0c djkim
            }
163
            catch (Exception)
164
            {
165
                throw;
166 787a4489 KangIngu
            }
167
        }
168
    }
169
}
클립보드 이미지 추가 (최대 크기: 500 MB)