markus / KCOM / Events / SaveCommand.cs @ dea506e2
이력 | 보기 | 이력해설 | 다운로드 (5.38 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.Collections.ObjectModel; |
10 |
using System.Linq; |
11 |
using System.Text; |
12 |
using System.Windows.Controls; |
13 |
|
14 |
namespace KCOM.Events |
15 |
{ |
16 |
public class SaveCommand |
17 |
{ |
18 |
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 |
#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 |
/// <summary> |
71 |
/// save comments related to given markup information |
72 |
/// </summary> |
73 |
/// <param name="UserState"></param> |
74 |
/// <param name="iPageNo"></param> |
75 |
public async void Execute(ICollection<MarkupInfoItem> UserStates) |
76 |
{ |
77 |
try |
78 |
{ |
79 |
var mainmenu = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu; |
80 |
var client = mainmenu.BaseTaskClient; |
81 |
|
82 |
foreach (var UserState in UserStates) |
83 |
{ |
84 |
List<MARKUP_DATA> markupdata = new List<MARKUP_DATA>(); |
85 |
ViewerDataModel.Instance.MyMarkupList.Where(d => d.MarkupInfoID == UserState.MarkupInfoID).ToList().GroupBy(p => p.ID).Select(g => g.First()).ToList().ForEach(value => |
86 |
{ |
87 |
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 |
}); |
96 |
|
97 |
|
98 |
|
99 |
var SaveResult = await client.SaveMarkupDataAsync(UserState, Project_No, document_id, user_id, markupdata); |
100 |
|
101 |
Logger.sendResLog("SaveCommand.Instance.Execute" , $"SaveMarkupData Call Project : {Project_No} DocID :{document_id} User ID {user_id} result {SaveResult}",1); |
102 |
|
103 |
mainmenu.MarkupitemViewUpdate(UserState.MarkupInfoID); |
104 |
} |
105 |
//User Information List Rebind |
106 |
|
107 |
mainmenu.gridViewMarkup.Rebind(); |
108 |
TempFile.Remove(); //임시파일삭제 |
109 |
|
110 |
} |
111 |
catch (Exception) |
112 |
{ |
113 |
throw; |
114 |
} |
115 |
} |
116 |
|
117 |
public void SymbolSave(string Name, string Url, string Data) |
118 |
{ |
119 |
try |
120 |
{ |
121 |
SYMBOL_PRIVATE symbol_private = new SYMBOL_PRIVATE |
122 |
{ |
123 |
ID = Commons.shortGuid(), |
124 |
MEMBER_USER_ID = App.ViewInfo.UserID, |
125 |
NAME = Name, |
126 |
IMAGE_URL = Url, |
127 |
DATA = Data |
128 |
}; |
129 |
|
130 |
Logger.sendReqLog("SaveSymbolAsync: ", symbol_private.ID + "," + symbol_private.MEMBER_USER_ID + "," + symbol_private.NAME + "," + symbol_private.IMAGE_URL + "," + symbol_private.DATA, 1); |
131 |
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolAsync(symbol_private); |
132 |
} |
133 |
catch(Exception) |
134 |
{ |
135 |
throw; |
136 |
} |
137 |
} |
138 |
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 |
ID = Commons.shortGuid(), |
145 |
DEPARTMENT = Department, |
146 |
NAME = Name, |
147 |
IMAGE_URL = Url, |
148 |
DATA = Data |
149 |
}; |
150 |
|
151 |
Logger.sendReqLog("AddPublicSymbol: ", symbol_public.ID + "," + symbol_public.DEPARTMENT + "," + symbol_public.NAME + "," + symbol_public.IMAGE_URL + "," + symbol_public.DATA, 1); |
152 |
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddPublicSymbol(symbol_public); |
153 |
} |
154 |
catch (Exception) |
155 |
{ |
156 |
throw; |
157 |
} |
158 |
} |
159 |
|
160 |
public async void PageAngleSave(string project_no, List<DOCPAGE> _mldocpage) |
161 |
{ |
162 |
try |
163 |
{ |
164 |
var result = await Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseTaskClient.SavePageAngleAsync(project_no, _mldocpage); |
165 |
Common.ViewerDataModel.Instance.RotationDocs.Clear(); |
166 |
|
167 |
Logger.sendReqLog("SavePageAngle: ", project_no + "," + _mldocpage, 1); |
168 |
Logger.sendResLog("SavePageAngle", result.ToString(), 1); |
169 |
|
170 |
} |
171 |
catch (Exception) |
172 |
{ |
173 |
throw; |
174 |
} |
175 |
} |
176 |
} |
177 |
} |