markus / KCOM / Events / SaveCommand.cs @ c00d0547
이력 | 보기 | 이력해설 | 다운로드 (4.97 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 void Execute(ICollection<MarkupInfoItem> UserStates) |
76 |
{ |
77 |
try |
78 |
{ |
79 |
foreach (var UserState in UserStates) |
80 |
{ |
81 |
List<MARKUP_DATA> markupdata = new List<MARKUP_DATA>(); |
82 |
ViewerDataModel.Instance.MyMarkupList.Where(d => d.MarkupInfoID == UserState.MarkupInfoID).ToList().GroupBy(p => p.ID).Select(g => g.First()).ToList().ForEach(value => |
83 |
{ |
84 |
markupdata.Add(new MARKUP_DATA() |
85 |
{ |
86 |
ID = value.ID, |
87 |
PAGENUMBER = value.PageNumber, |
88 |
DATA = value.Data, |
89 |
MARKUPINFO_VERSION_ID = UserState.MarkupVersionID, |
90 |
DATA_TYPE = value.Data_Type |
91 |
}); |
92 |
}); |
93 |
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveMarkupData(UserState, Project_No, document_id, user_id, markupdata); |
94 |
} |
95 |
//User Information List Rebind |
96 |
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.gridViewMarkup.Rebind(); |
97 |
TempFile.Remove(); //임시파일삭제 |
98 |
} |
99 |
catch (Exception) |
100 |
{ |
101 |
throw; |
102 |
} |
103 |
} |
104 |
|
105 |
public void SymbolSave(string Name, string Url, string Data) |
106 |
{ |
107 |
try |
108 |
{ |
109 |
SYMBOL_PRIVATE symbol_private = new SYMBOL_PRIVATE |
110 |
{ |
111 |
ID = Commons.shortGuid(), |
112 |
MEMBER_USER_ID = App.ViewInfo.UserID, |
113 |
NAME = Name, |
114 |
IMAGE_URL = Url, |
115 |
DATA = Data |
116 |
}; |
117 |
|
118 |
Logger.sendReqLog("SaveSymbolAsync: ", symbol_private.ID + "," + symbol_private.MEMBER_USER_ID + "," + symbol_private.NAME + "," + symbol_private.IMAGE_URL + "," + symbol_private.DATA, 1); |
119 |
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolAsync(symbol_private); |
120 |
} |
121 |
catch(Exception) |
122 |
{ |
123 |
throw; |
124 |
} |
125 |
} |
126 |
public void SymbolSave_Public(string Name, string Url, string Data, string Department) |
127 |
{ |
128 |
try |
129 |
{ |
130 |
SYMBOL_PUBLIC symbol_public = new SYMBOL_PUBLIC |
131 |
{ |
132 |
ID = Commons.shortGuid(), |
133 |
DEPARTMENT = Department, |
134 |
NAME = Name, |
135 |
IMAGE_URL = Url, |
136 |
DATA = Data |
137 |
}; |
138 |
|
139 |
Logger.sendReqLog("AddPublicSymbol: ", symbol_public.ID + "," + symbol_public.DEPARTMENT + "," + symbol_public.NAME + "," + symbol_public.IMAGE_URL + "," + symbol_public.DATA, 1); |
140 |
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddPublicSymbol(symbol_public); |
141 |
} |
142 |
catch (Exception) |
143 |
{ |
144 |
throw; |
145 |
} |
146 |
} |
147 |
|
148 |
public void PageAngleSave(string project_no, List<DOCPAGE> _mldocpage) |
149 |
{ |
150 |
try |
151 |
{ |
152 |
Logger.sendReqLog("SavePageAngle: ", project_no + "," + _mldocpage, 1); |
153 |
Logger.sendResLog("SavePageAngle", Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SavePageAngle(project_no, _mldocpage).ToString(), 1); |
154 |
Common.ViewerDataModel.Instance.RotationDocs.Clear(); |
155 |
} |
156 |
catch (Exception) |
157 |
{ |
158 |
throw; |
159 |
} |
160 |
} |
161 |
} |
162 |
} |