프로젝트

일반

사용자정보

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

markus / KCOM / Events / Save.cs @ cb33ad14

이력 | 보기 | 이력해설 | 다운로드 (5.52 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 Save
16
    {
17
        #region Properties
18

    
19
        public ViewInfo _ViewInfo;
20
        public string Project_No
21
        {
22
            get;
23
            set;
24
        }
25
        public string document_id
26
        {
27
            get;
28
            set;
29
        }
30

    
31
        public string user_id
32
        {
33
            get;
34
            set;
35
        }
36

    
37
        public int page_no
38
        {
39
            get;
40
            set;
41
        }
42
        #endregion
43

    
44
       
45

    
46
        //GUID생성(최민수 사원 수정) //조장원 대리 다시 변경
47
        public static string shortGuid()
48
        {
49
            byte[] bytes = new byte[16];
50
            using (var provider = System.Security.Cryptography.RandomNumberGenerator.Create())
51
            {
52
                provider.GetBytes(bytes);
53
            }
54

    
55
            var guid = new Guid(bytes);
56

    
57
            return Convert.ToBase64String(guid.ToByteArray())
58
                .Substring(0, 10)
59
                .Replace("/", "")
60
                .Replace("+", "") + DateTime.UtcNow.Ticks.ToString("x");
61
        }
62

    
63
        //조장원 네자리
64
        public static string shortCommentKey()
65
        {            
66
            byte[] bytes = new byte[3];
67
            using (var provider = System.Security.Cryptography.RandomNumberGenerator.Create())
68
            {
69
                provider.GetBytes(bytes);
70
            }
71

    
72
            return Convert.ToBase64String(bytes);
73
        }
74

    
75
        //강인구 추가 
76
        public static string shortFileKey()
77
        {
78
            //byte[] bytes = new byte[3];
79
            //using (var provider = System.IO.Path.GetRandomFileName())
80
            //{
81
            //    provider.GetBytes(bytes);
82
            //}
83

    
84
            return System.IO.Path.GetRandomFileName();
85
        }
86

    
87
        public void MarkupConsolidate()
88
        {
89

    
90
        }
91

    
92
        //마크업 저장하기
93
        public void MarkupSave(MarkupInfoItem UserState, int iPageNo)
94
        {
95
            try
96
            {
97
                List<MARKUP_DATA> ml_markupdata = new List<MARKUP_DATA>();
98

    
99
                ///ViewerDataModel.Instance.MarkupList_USER.Where(d => d.MarkupInfoID == UserState.MarkupInfoID).ToList().GroupBy(p => p.ID).Select(g => g.First()).ToList().ForEach(value =>
100
                ViewerDataModel.Instance.MarkupControls_USER.Where(d => d.MarkupInfoID == UserState.MarkupInfoID).ToList().GroupBy(p => p.CommentID).Select(g => g.First()).ToList().ForEach(value =>
101
                {
102
                    ml_markupdata.Add(value.GetMarkupData(App.ViewInfo.UserID, iPageNo, UserState.MarkupVersionID));
103
                });
104

    
105
                Logger.sendReqLog("GetMarkupDataListperPage: ", UserState + "," + Project_No + "," + document_id + "," + user_id  + "," + ml_markupdata, 1);
106
                Logger.sendResLog("GetMarkupDataListperPage", Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveMarkupData(UserState, Project_No, document_id, user_id, ml_markupdata).ToString(), 1);
107
                TempFile.Remove(); //임시파일삭제
108
            }
109
            catch (Exception)
110
            {
111
                throw;
112
            }
113
        }
114

    
115
        public void SymbolSave(string Name, string Url, string Data)
116
        {
117
            try
118
            {
119
                SYMBOL_PRIVATE symbol_private = new SYMBOL_PRIVATE
120
                {
121
                    ID = shortGuid(),
122
                    MEMBER_USER_ID = App.ViewInfo.UserID,
123
                    NAME = Name,
124
                    IMAGE_URL = Url,
125
                    DATA = Data
126
                };
127

    
128
                Logger.sendReqLog("SaveSymbolAsync: ", symbol_private.ID + "," + symbol_private.MEMBER_USER_ID + "," + symbol_private.NAME + "," + symbol_private.IMAGE_URL + "," + symbol_private.DATA, 1);
129
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolAsync(symbol_private);
130
            }
131
            catch(Exception)
132
            {
133
                throw;
134
            }
135
        }
136
        public void SymbolSave_Public(string Name, string Url, string Data, string Department)
137
        {
138
            try
139
            {
140
                SYMBOL_PUBLIC symbol_public = new SYMBOL_PUBLIC
141
                {
142
                    ID = shortGuid(),
143
                    DEPARTMENT = Department,
144
                    NAME = Name,
145
                    IMAGE_URL = Url,
146
                    DATA = Data
147
                };
148

    
149
                Logger.sendReqLog("AddPublicSymbol: ", symbol_public.ID + "," + symbol_public.DEPARTMENT + "," + symbol_public.NAME + "," + symbol_public.IMAGE_URL + "," + symbol_public.DATA, 1);
150
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddPublicSymbol(symbol_public);
151
            }
152
            catch (Exception)
153
            {
154
                throw;
155
            }
156
        }
157
        public void PageAngleSave(string project_no, List<DOCPAGE> _mldocpage)
158
        {
159
            try
160
            {
161

    
162
                Logger.sendReqLog("SavePageAngle: ", project_no + "," + _mldocpage, 1);
163
                Logger.sendResLog("SavePageAngle", Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SavePageAngle(project_no, _mldocpage).ToString(), 1);
164
                Common.ViewerDataModel.Instance.RotationDocs.Clear();
165
            }
166
            catch (Exception)
167
            {
168
                throw;
169
            }
170
        }
171
    }
172
}
클립보드 이미지 추가 (최대 크기: 500 MB)