프로젝트

일반

사용자정보

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

markus / KCOM / Events / SaveCommand.cs @ 664ea2e1

이력 | 보기 | 이력해설 | 다운로드 (5.39 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 eeb0a39c taeseongkim
        public async void Execute(ICollection<MarkupInfoItem> UserStates)
76 787a4489 KangIngu
        {
77 6c781c0c djkim
            try
78 787a4489 KangIngu
            {
79 eeb0a39c taeseongkim
                var mainmenu = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu;
80
                var client = mainmenu.BaseTaskClient;
81
82 de6499db humkyung
                foreach (var UserState in UserStates)
83 787a4489 KangIngu
                {
84 de6499db humkyung
                    List<MARKUP_DATA> markupdata = new List<MARKUP_DATA>();
85 129ca191 humkyung
                    ViewerDataModel.Instance.MyMarkupList.Where(d => d.MarkupInfoID == UserState.MarkupInfoID).ToList().GroupBy(p => p.ID).Select(g => g.First()).ToList().ForEach(value =>
86 de6499db humkyung
                    {
87 c00d0547 humkyung
                        markupdata.Add(new MARKUP_DATA()
88
                        {
89
                            ID = value.ID,
90
                            PAGENUMBER = value.PageNumber,
91
                            DATA = value.Data,
92
                            MARKUPINFO_VERSION_ID = UserState.MarkupVersionID,
93
                            DATA_TYPE = value.Data_Type
94
                        });
95 de6499db humkyung
                    });
96 6b6e937c taeseongkim
97
98
99 eeb0a39c taeseongkim
                    var SaveResult = await client.SaveMarkupDataAsync(UserState, Project_No, document_id, user_id, markupdata);
100 6b6e937c taeseongkim
101 664ea2e1 taeseongkim
                    //Logger.sendResLog("SaveCommand.Instance.Execute" , $"SaveMarkupData Call Project : {Project_No} DocID :{document_id} User ID {user_id} result {SaveResult}",1);
102 6b6e937c taeseongkim
103 eeb0a39c taeseongkim
                    mainmenu.MarkupitemViewUpdate(UserState.MarkupInfoID);
104 de6499db humkyung
                }
105 073f6118 djkim
                //User Information List Rebind
106 eeb0a39c taeseongkim
107
                mainmenu.gridViewMarkup.Rebind();
108 e05fe8ab djkim
                TempFile.Remove(); //임시파일삭제                
109 eeb0a39c taeseongkim
110 787a4489 KangIngu
            }
111 6c781c0c djkim
            catch (Exception)
112
            {
113
                throw;
114
            }
115 787a4489 KangIngu
        }
116
117
        public void SymbolSave(string Name, string Url, string Data)
118
        {
119 6c781c0c djkim
            try
120 787a4489 KangIngu
            {
121
                SYMBOL_PRIVATE symbol_private = new SYMBOL_PRIVATE
122
                {
123 24678e06 humkyung
                    ID = Commons.shortGuid(),
124 787a4489 KangIngu
                    MEMBER_USER_ID = App.ViewInfo.UserID,
125
                    NAME = Name,
126
                    IMAGE_URL = Url,
127
                    DATA = Data
128
                };
129 0f065e57 ljiyeon
130 664ea2e1 taeseongkim
                //Logger.sendReqLog("SaveSymbolAsync: ", symbol_private.ID + "," + symbol_private.MEMBER_USER_ID + "," + symbol_private.NAME + "," + symbol_private.IMAGE_URL + "," + symbol_private.DATA, 1);
131 6c781c0c djkim
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolAsync(symbol_private);
132
            }
133
            catch(Exception)
134
            {
135
                throw;
136
            }
137
        }
138 498f0fc9 ljiyeon
        public void SymbolSave_Public(string Name, string Url, string Data, string Department)
139
        {
140
            try
141
            {
142
                SYMBOL_PUBLIC symbol_public = new SYMBOL_PUBLIC
143
                {
144 24678e06 humkyung
                    ID = Commons.shortGuid(),
145 498f0fc9 ljiyeon
                    DEPARTMENT = Department,
146
                    NAME = Name,
147
                    IMAGE_URL = Url,
148
                    DATA = Data
149
                };
150 787a4489 KangIngu
151 664ea2e1 taeseongkim
                //Logger.sendReqLog("AddPublicSymbol: ", symbol_public.ID + "," + symbol_public.DEPARTMENT + "," + symbol_public.NAME + "," + symbol_public.IMAGE_URL + "," + symbol_public.DATA, 1);
152 498f0fc9 ljiyeon
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddPublicSymbol(symbol_public);
153
            }
154
            catch (Exception)
155
            {
156
                throw;
157
            }
158
        }
159 129ca191 humkyung
160 eeb0a39c taeseongkim
        public async void PageAngleSave(string project_no, List<DOCPAGE> _mldocpage)
161 6c781c0c djkim
        {
162
            try
163
            {
164 eeb0a39c taeseongkim
                var result = await Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseTaskClient.SavePageAngleAsync(project_no, _mldocpage);
165 b2c6901f swate0609
                Common.ViewerDataModel.Instance.RotationDocs.Clear();
166 eeb0a39c taeseongkim
167 664ea2e1 taeseongkim
                //Logger.sendReqLog("SavePageAngle: ", project_no + "," + _mldocpage, 1);
168
                //Logger.sendResLog("SavePageAngle", result.ToString(), 1);
169 eeb0a39c taeseongkim
             
170 6c781c0c djkim
            }
171
            catch (Exception)
172
            {
173
                throw;
174 787a4489 KangIngu
            }
175
        }
176
    }
177
}
클립보드 이미지 추가 (최대 크기: 500 MB)