프로젝트

일반

사용자정보

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

markus / KCOM / Events / SaveCommand.cs @ de6499db

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

1
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
using System.Linq;
10
using System.Text;
11
using System.Windows.Controls;
12

    
13
namespace KCOM.Events
14
{
15
    public class SaveCommand
16
    {
17
        private static readonly SaveCommand _instance = new SaveCommand();
18

    
19
        // Explicit static constructor to tell C# compiler
20
        // not to mark type as beforefieldinit
21
        static SaveCommand()
22
        {
23
        }
24

    
25
        private SaveCommand()
26
        {
27
        }
28

    
29
        public static SaveCommand Instance
30
        {
31
            get
32
            {
33
                return _instance;
34
            }
35
        }
36

    
37
        #region Properties
38

    
39
        public ViewInfo _ViewInfo;
40
        public string Project_No
41
        {
42
            get;
43
            set;
44
        }
45
        public string document_id
46
        {
47
            get;
48
            set;
49
        }
50

    
51
        public string user_id
52
        {
53
            get;
54
            set;
55
        }
56

    
57
        public int page_no
58
        {
59
            get;
60
            set;
61
        }
62
        #endregion
63

    
64
        //GUID생성(최민수 사원 수정) //조장원 대리 다시 변경
65
        public static string shortGuid()
66
        {
67
            byte[] bytes = new byte[16];
68
            using (var provider = System.Security.Cryptography.RandomNumberGenerator.Create())
69
            {
70
                provider.GetBytes(bytes);
71
            }
72

    
73
            var guid = new Guid(bytes);
74

    
75
            return Convert.ToBase64String(guid.ToByteArray())
76
                .Substring(0, 10)
77
                .Replace("/", "")
78
                .Replace("+", "") + DateTime.UtcNow.Ticks.ToString("x");
79
        }
80

    
81
        //조장원 네자리
82
        public static string shortCommentKey()
83
        {            
84
            byte[] bytes = new byte[3];
85
            using (var provider = System.Security.Cryptography.RandomNumberGenerator.Create())
86
            {
87
                provider.GetBytes(bytes);
88
            }
89

    
90
            return Convert.ToBase64String(bytes);
91
        }
92

    
93
        //강인구 추가 
94
        public static string shortFileKey()
95
        {
96
            //byte[] bytes = new byte[3];
97
            //using (var provider = System.IO.Path.GetRandomFileName())
98
            //{
99
            //    provider.GetBytes(bytes);
100
            //}
101

    
102
            return System.IO.Path.GetRandomFileName();
103
        }
104

    
105
        public void MarkupConsolidate()
106
        {
107

    
108
        }
109

    
110
        /// <summary>
111
        /// save comments related to given markup information
112
        /// </summary>
113
        /// <param name="UserState"></param>
114
        /// <param name="iPageNo"></param>
115
        public void Execute(ICollection<MarkupInfoItem> UserStates, int iPageNo)
116
        {
117
            try
118
            {
119
                foreach (var UserState in UserStates)
120
                {
121
                    List<MARKUP_DATA> markupdata = new List<MARKUP_DATA>();
122
                    ViewerDataModel.Instance.MarkupControls_USER.Where(d => d.MarkupInfoID == UserState.MarkupInfoID).ToList().GroupBy(p => p.CommentID).Select(g => g.First()).ToList().ForEach(value =>
123
                    {
124
                        markupdata.Add(value.GetMarkupData(App.ViewInfo.UserID, iPageNo, UserState.MarkupVersionID));
125
                    });
126

    
127
                    Logger.sendReqLog("GetMarkupDataListperPage: ", UserState + "," + Project_No + "," + document_id + "," + user_id + "," + markupdata, 1);
128
                    Logger.sendResLog("GetMarkupDataListperPage", Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveMarkupData(UserState, Project_No, document_id, user_id, markupdata).ToString(), 1);
129
                }
130
                TempFile.Remove(); //임시파일삭제
131
            }
132
            catch (Exception)
133
            {
134
                throw;
135
            }
136
        }
137

    
138
        public void SymbolSave(string Name, string Url, string Data)
139
        {
140
            try
141
            {
142
                SYMBOL_PRIVATE symbol_private = new SYMBOL_PRIVATE
143
                {
144
                    ID = shortGuid(),
145
                    MEMBER_USER_ID = App.ViewInfo.UserID,
146
                    NAME = Name,
147
                    IMAGE_URL = Url,
148
                    DATA = Data
149
                };
150

    
151
                Logger.sendReqLog("SaveSymbolAsync: ", symbol_private.ID + "," + symbol_private.MEMBER_USER_ID + "," + symbol_private.NAME + "," + symbol_private.IMAGE_URL + "," + symbol_private.DATA, 1);
152
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolAsync(symbol_private);
153
            }
154
            catch(Exception)
155
            {
156
                throw;
157
            }
158
        }
159
        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
                    ID = shortGuid(),
166
                    DEPARTMENT = Department,
167
                    NAME = Name,
168
                    IMAGE_URL = Url,
169
                    DATA = Data
170
                };
171

    
172
                Logger.sendReqLog("AddPublicSymbol: ", symbol_public.ID + "," + symbol_public.DEPARTMENT + "," + symbol_public.NAME + "," + symbol_public.IMAGE_URL + "," + symbol_public.DATA, 1);
173
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddPublicSymbol(symbol_public);
174
            }
175
            catch (Exception)
176
            {
177
                throw;
178
            }
179
        }
180
        public void PageAngleSave(string project_no, List<DOCPAGE> _mldocpage)
181
        {
182
            try
183
            {
184

    
185
                Logger.sendReqLog("SavePageAngle: ", project_no + "," + _mldocpage, 1);
186
                Logger.sendResLog("SavePageAngle", Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SavePageAngle(project_no, _mldocpage).ToString(), 1);
187
                Common.ViewerDataModel.Instance.RotationDocs.Clear();
188
            }
189
            catch (Exception)
190
            {
191
                throw;
192
            }
193
        }
194
    }
195
}
클립보드 이미지 추가 (최대 크기: 500 MB)