프로젝트

일반

사용자정보

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

markus / KCOM / Events / SaveCommand.cs @ 66bd3240

이력 | 보기 | 이력해설 | 다운로드 (6.31 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 b42dd24d taeseongkim
using System.Threading.Tasks;
13 787a4489 KangIngu
using System.Windows.Controls;
14 6a19b48d taeseongkim
using System.Windows.Input;
15 787a4489 KangIngu
16
namespace KCOM.Events
17
{
18 de6499db humkyung
    public class SaveCommand
19 787a4489 KangIngu
    {
20 de6499db humkyung
        private static readonly SaveCommand _instance = new SaveCommand();
21
22
        // Explicit static constructor to tell C# compiler
23
        // not to mark type as beforefieldinit
24
        static SaveCommand()
25
        {
26
        }
27
28
        private SaveCommand()
29
        {
30
        }
31
32
        public static SaveCommand Instance
33
        {
34
            get
35
            {
36
                return _instance;
37
            }
38
        }
39
40 787a4489 KangIngu
        #region Properties
41
42
        public ViewInfo _ViewInfo;
43
        public string Project_No
44
        {
45
            get;
46
            set;
47
        }
48
        public string document_id
49
        {
50
            get;
51
            set;
52
        }
53
54
        public string user_id
55
        {
56
            get;
57
            set;
58
        }
59
60
        public int page_no
61
        {
62
            get;
63
            set;
64
        }
65
        #endregion
66
67
        public void MarkupConsolidate()
68
        {
69
70
        }
71
72 de6499db humkyung
        /// <summary>
73
        /// save comments related to given markup information
74
        /// </summary>
75
        /// <param name="UserState"></param>
76
        /// <param name="iPageNo"></param>
77 b42dd24d taeseongkim
        public async Task<bool> Execute(ICollection<MarkupInfoItem> UserStates)
78 787a4489 KangIngu
        {
79 b42dd24d taeseongkim
            bool result = false;
80
81 6c781c0c djkim
            try
82 787a4489 KangIngu
            {
83 eeb0a39c taeseongkim
                var mainmenu = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu;
84 5c64268e taeseongkim
                //var client = mainmenu.BaseClient;
85 eeb0a39c taeseongkim
86 de6499db humkyung
                foreach (var UserState in UserStates)
87 787a4489 KangIngu
                {
88 de6499db humkyung
                    List<MARKUP_DATA> markupdata = new List<MARKUP_DATA>();
89 129ca191 humkyung
                    ViewerDataModel.Instance.MyMarkupList.Where(d => d.MarkupInfoID == UserState.MarkupInfoID).ToList().GroupBy(p => p.ID).Select(g => g.First()).ToList().ForEach(value =>
90 de6499db humkyung
                    {
91 c00d0547 humkyung
                        markupdata.Add(new MARKUP_DATA()
92
                        {
93
                            ID = value.ID,
94
                            PAGENUMBER = value.PageNumber,
95
                            DATA = value.Data,
96
                            MARKUPINFO_VERSION_ID = UserState.MarkupVersionID,
97
                            DATA_TYPE = value.Data_Type
98
                        });
99 6a19b48d taeseongkim
                        System.Diagnostics.Debug.WriteLine(value.ID);
100 de6499db humkyung
                    });
101 6b6e937c taeseongkim
102 2b1f30fe taeseongkim
                    try
103
                    {
104
                        var SaveResult = await ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseTaskClient.SaveMarkupDataAsync(UserState, Project_No, document_id, user_id, markupdata);
105 6b6e937c taeseongkim
106 2b1f30fe taeseongkim
                        result = SaveResult;
107
                    }
108
                    catch(Exception ex)
109
                    {
110
                        var client = new KcomService.ServiceDeepViewClient(App._binding, App._EndPoint);
111
                            
112
                        var SaveResult = await client.SaveMarkupDataAsync(UserState, Project_No, document_id, user_id, markupdata);
113
                        result = SaveResult;
114
115
                        if (!SaveResult)
116
                        {
117
                            Logger.sendResLog("SaveCommand.Instance.Execute", ex.ToString(), 1);
118
                        }
119
                    }
120 b42dd24d taeseongkim
121 664ea2e1 taeseongkim
                    //Logger.sendResLog("SaveCommand.Instance.Execute" , $"SaveMarkupData Call Project : {Project_No} DocID :{document_id} User ID {user_id} result {SaveResult}",1);
122 6b6e937c taeseongkim
123 eeb0a39c taeseongkim
                    mainmenu.MarkupitemViewUpdate(UserState.MarkupInfoID);
124 de6499db humkyung
                }
125 073f6118 djkim
                //User Information List Rebind
126 eeb0a39c taeseongkim
127
                mainmenu.gridViewMarkup.Rebind();
128 2b1f30fe taeseongkim
                //TempFile.Remove(); //임시파일삭제 
129 787a4489 KangIngu
            }
130 6c781c0c djkim
            catch (Exception)
131
            {
132
                throw;
133
            }
134 b42dd24d taeseongkim
135
            return result;
136 787a4489 KangIngu
        }
137
138
        public void SymbolSave(string Name, string Url, string Data)
139
        {
140 6c781c0c djkim
            try
141 787a4489 KangIngu
            {
142
                SYMBOL_PRIVATE symbol_private = new SYMBOL_PRIVATE
143
                {
144 24678e06 humkyung
                    ID = Commons.shortGuid(),
145 787a4489 KangIngu
                    MEMBER_USER_ID = App.ViewInfo.UserID,
146
                    NAME = Name,
147
                    IMAGE_URL = Url,
148
                    DATA = Data
149
                };
150 0f065e57 ljiyeon
151 664ea2e1 taeseongkim
                //Logger.sendReqLog("SaveSymbolAsync: ", symbol_private.ID + "," + symbol_private.MEMBER_USER_ID + "," + symbol_private.NAME + "," + symbol_private.IMAGE_URL + "," + symbol_private.DATA, 1);
152 6c781c0c djkim
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolAsync(symbol_private);
153
            }
154
            catch(Exception)
155
            {
156
                throw;
157
            }
158
        }
159 498f0fc9 ljiyeon
        public void SymbolSave_Public(string Name, string Url, string Data, string Department)
160
        {
161
            try
162
            {
163
                SYMBOL_PUBLIC symbol_public = new SYMBOL_PUBLIC
164
                {
165 24678e06 humkyung
                    ID = Commons.shortGuid(),
166 498f0fc9 ljiyeon
                    DEPARTMENT = Department,
167
                    NAME = Name,
168
                    IMAGE_URL = Url,
169
                    DATA = Data
170
                };
171 787a4489 KangIngu
172 664ea2e1 taeseongkim
                //Logger.sendReqLog("AddPublicSymbol: ", symbol_public.ID + "," + symbol_public.DEPARTMENT + "," + symbol_public.NAME + "," + symbol_public.IMAGE_URL + "," + symbol_public.DATA, 1);
173 498f0fc9 ljiyeon
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddPublicSymbol(symbol_public);
174
            }
175
            catch (Exception)
176
            {
177
                throw;
178
            }
179
        }
180 129ca191 humkyung
181 eeb0a39c taeseongkim
        public async void PageAngleSave(string project_no, List<DOCPAGE> _mldocpage)
182 6c781c0c djkim
        {
183
            try
184
            {
185 eeb0a39c taeseongkim
                var result = await Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseTaskClient.SavePageAngleAsync(project_no, _mldocpage);
186 b2c6901f swate0609
                Common.ViewerDataModel.Instance.RotationDocs.Clear();
187 eeb0a39c taeseongkim
188 664ea2e1 taeseongkim
                //Logger.sendReqLog("SavePageAngle: ", project_no + "," + _mldocpage, 1);
189
                //Logger.sendResLog("SavePageAngle", result.ToString(), 1);
190 eeb0a39c taeseongkim
             
191 6c781c0c djkim
            }
192
            catch (Exception)
193
            {
194
                throw;
195 787a4489 KangIngu
            }
196
        }
197
    }
198
}
클립보드 이미지 추가 (최대 크기: 500 MB)