markus / ConvertService / ServiceController / Markus.Service.StationController / ViewModel / FinalPDFAddDialogViewModel.cs @ be7b18b6
이력 | 보기 | 이력해설 | 다운로드 (8.21 KB)
1 |
using Markus.Service.Extensions; |
---|---|
2 |
using System; |
3 |
using System.Collections.Generic; |
4 |
using System.Linq; |
5 |
using System.Text; |
6 |
using System.Threading.Tasks; |
7 |
using System.Windows; |
8 |
using Telerik.Windows.Controls; |
9 |
using Markus.Service.StationController.Data; |
10 |
using System.Collections.ObjectModel; |
11 |
|
12 |
namespace Markus.Service.StationController.ViewModel |
13 |
{ |
14 |
class FinalPDFAddDialogViewModel : Mvvm.ToolKit.ViewModelBase |
15 |
{ |
16 |
#region Construrtor |
17 |
|
18 |
public FinalPDFAddDialogViewModel() |
19 |
{ |
20 |
if(!App.IsDesignMode) |
21 |
{ |
22 |
WcfClient = new DataService.DataServiceClient(); |
23 |
|
24 |
ProjectName(); |
25 |
|
26 |
FinalPDFAdd_OKCommand = new DelegateCommand(FinalPDFAdd_OK); |
27 |
} |
28 |
} |
29 |
|
30 |
private async void ProjectName() |
31 |
{ |
32 |
if (ProjectNames.Count() == 0) |
33 |
{ |
34 |
foreach (var x in await WcfClient.GET_SELECT_RUN_PROJECTSAsync(0)) |
35 |
{ |
36 |
ProjectName projectName = new ProjectName(x.PROJECT_NO, x.PROJECT_NAME); |
37 |
ProjectNames.Add(projectName); |
38 |
} |
39 |
} |
40 |
} |
41 |
#endregion |
42 |
|
43 |
#region Propertise |
44 |
|
45 |
DataService.DataServiceClient WcfClient; |
46 |
|
47 |
private string _FinalPDFAdd_Document_ID; |
48 |
public string FinalPDFAdd_Document_ID |
49 |
{ |
50 |
get { return _FinalPDFAdd_Document_ID; } |
51 |
set |
52 |
{ |
53 |
_FinalPDFAdd_Document_ID = value; |
54 |
OnPropertyChanged(() => FinalPDFAdd_Document_ID); |
55 |
} |
56 |
} |
57 |
|
58 |
private string _FinalPDFAdd_DocInfo_ID; |
59 |
public string FinalPDFAdd_DocInfo_ID |
60 |
{ |
61 |
get { return _FinalPDFAdd_DocInfo_ID; } |
62 |
set |
63 |
{ |
64 |
_FinalPDFAdd_DocInfo_ID = value; |
65 |
OnPropertyChanged(() => FinalPDFAdd_DocInfo_ID); |
66 |
} |
67 |
} |
68 |
|
69 |
private string _Project_NO_Border = "#FF000000"; |
70 |
public string Project_NO_Border |
71 |
{ |
72 |
get { return _Project_NO_Border; } |
73 |
set |
74 |
{ |
75 |
if (ProjectNames.Contains(ProjectNumberFilter)) |
76 |
{ |
77 |
_Project_NO_Border = "#FF000000"; |
78 |
OnPropertyChanged(() => Project_NO_Border); |
79 |
} |
80 |
else |
81 |
{ |
82 |
_Project_NO_Border = "#FFFF0000"; |
83 |
OnPropertyChanged(() => Project_NO_Border); |
84 |
} |
85 |
} |
86 |
} |
87 |
|
88 |
private string _DOCUMENT_ID_Border = "#FF000000"; |
89 |
public string DOCUMENT_ID_Border |
90 |
{ |
91 |
get { return _DOCUMENT_ID_Border; } |
92 |
set |
93 |
{ |
94 |
if (FinalPDFAdd_Document_ID != null) |
95 |
{ |
96 |
_DOCUMENT_ID_Border = "#FF000000"; |
97 |
OnPropertyChanged(() => DOCUMENT_ID_Border); |
98 |
} |
99 |
else |
100 |
{ |
101 |
_DOCUMENT_ID_Border = "#FFFF0000"; |
102 |
OnPropertyChanged(() => DOCUMENT_ID_Border); |
103 |
} |
104 |
} |
105 |
} |
106 |
|
107 |
private string _DocInfo_ID_Border = "#FF000000"; |
108 |
public string DocInfo_ID_Border |
109 |
{ |
110 |
get { return _DocInfo_ID_Border; } |
111 |
set |
112 |
{ |
113 |
if (FinalPDFAdd_DocInfo_ID != null) |
114 |
{ |
115 |
_DocInfo_ID_Border = "#FF000000"; |
116 |
OnPropertyChanged(() => DocInfo_ID_Border); |
117 |
} |
118 |
else |
119 |
{ |
120 |
_DocInfo_ID_Border = "#FFFF0000"; |
121 |
OnPropertyChanged(() => DocInfo_ID_Border); |
122 |
} |
123 |
} |
124 |
} |
125 |
|
126 |
private string _Project_NO_Color = "#FFFFFFFF"; |
127 |
public string Project_NO_Color |
128 |
{ |
129 |
get { return _Project_NO_Color; } |
130 |
set |
131 |
{ |
132 |
if (ProjectNames.Contains(ProjectNumberFilter)) |
133 |
{ |
134 |
_Project_NO_Color = "#FFFFFFFF"; |
135 |
OnPropertyChanged(() => Project_NO_Color); |
136 |
} |
137 |
else |
138 |
{ |
139 |
_Project_NO_Color = "#FFFF0000"; |
140 |
OnPropertyChanged(() => Project_NO_Color); |
141 |
} |
142 |
} |
143 |
} |
144 |
|
145 |
private string _DOCUMENT_ID_Color = "#FFFFFFFF"; |
146 |
public string DOCUMENT_ID_Color |
147 |
{ |
148 |
get { return _DOCUMENT_ID_Color; } |
149 |
set |
150 |
{ |
151 |
if (FinalPDFAdd_Document_ID != null) |
152 |
{ |
153 |
_DOCUMENT_ID_Color = "#FFFFFFFF"; |
154 |
OnPropertyChanged(() => DOCUMENT_ID_Color); |
155 |
} |
156 |
else |
157 |
{ |
158 |
_DOCUMENT_ID_Color = "#FFFF0000"; |
159 |
OnPropertyChanged(() => DOCUMENT_ID_Color); |
160 |
} |
161 |
} |
162 |
} |
163 |
|
164 |
private string _DocInfo_ID_Color = "#FFFFFFFF"; |
165 |
public string DocInfo_ID_Color |
166 |
{ |
167 |
get { return _DocInfo_ID_Color; } |
168 |
set |
169 |
{ |
170 |
if (FinalPDFAdd_DocInfo_ID != null) |
171 |
{ |
172 |
_DocInfo_ID_Color = "#FFFFFFFF"; |
173 |
OnPropertyChanged(() => DocInfo_ID_Color); |
174 |
} |
175 |
else |
176 |
{ |
177 |
_DocInfo_ID_Color = "#FFFF0000"; |
178 |
OnPropertyChanged(() => DocInfo_ID_Color); |
179 |
} |
180 |
} |
181 |
} |
182 |
|
183 |
public ObservableCollection<ProjectName> _ProjectNames; |
184 |
public ObservableCollection<ProjectName> ProjectNames |
185 |
{ |
186 |
get |
187 |
{ |
188 |
if (_ProjectNames == null) |
189 |
{ |
190 |
_ProjectNames = new System.Collections.ObjectModel.ObservableCollection<ProjectName>(); |
191 |
} |
192 |
|
193 |
return _ProjectNames; |
194 |
} |
195 |
set |
196 |
{ |
197 |
_ProjectNames = value; |
198 |
OnPropertyChanged(() => ProjectNames); |
199 |
} |
200 |
} |
201 |
|
202 |
public ProjectName _ProjectNumberFilter; |
203 |
public ProjectName ProjectNumberFilter |
204 |
{ |
205 |
get |
206 |
{ |
207 |
if (_ProjectNumberFilter == null) |
208 |
{ |
209 |
_ProjectNumberFilter = new ProjectName(); |
210 |
} |
211 |
return _ProjectNumberFilter; |
212 |
} |
213 |
set |
214 |
{ |
215 |
_ProjectNumberFilter = value; |
216 |
OnPropertyChanged(() => ProjectNumberFilter); |
217 |
} |
218 |
} |
219 |
#endregion |
220 |
|
221 |
#region Command |
222 |
|
223 |
public DelegateCommand FinalPDFAdd_OKCommand { get; private set; } |
224 |
|
225 |
#endregion |
226 |
|
227 |
#region Fuction |
228 |
|
229 |
#region ConverAdd_OK |
230 |
/// <summary> |
231 |
/// 그리드 상단 Conver 추가 버튼 |
232 |
/// ProjectNo, DocumentURL, DocumentID, 입력해서 저장 프로시저에서 추가 |
233 |
/// </summary> |
234 |
public async void FinalPDFAdd_OK(object obj) |
235 |
{ |
236 |
if (String.IsNullOrEmpty(ProjectNumberFilter.Project_NO) || String.IsNullOrEmpty(FinalPDFAdd_Document_ID) || String.IsNullOrEmpty(FinalPDFAdd_DocInfo_ID)) |
237 |
{ |
238 |
Project_NO_Border = ""; |
239 |
DOCUMENT_ID_Border = ""; |
240 |
DocInfo_ID_Border = ""; |
241 |
Project_NO_Color = ""; |
242 |
DOCUMENT_ID_Color = ""; |
243 |
DocInfo_ID_Color = ""; |
244 |
} |
245 |
else |
246 |
{ |
247 |
try |
248 |
{ |
249 |
string ConverAdd_ID = GuidExtension.shortGuid(); |
250 |
var items = await WcfClient.GET_SELECT_CONVERT_INSERTAsync(ConverAdd_ID, ProjectNumberFilter.Project_NO, FinalPDFAdd_DocInfo_ID, FinalPDFAdd_Document_ID); |
251 |
System.Diagnostics.Debug.WriteLine(items); |
252 |
|
253 |
MessageBox.Show("데이터베이스에 추가 완료! "); |
254 |
} |
255 |
catch (Exception ex) |
256 |
{ |
257 |
MessageBox.Show(ex.ToString()); |
258 |
} |
259 |
|
260 |
Project_NO_Border = ""; |
261 |
DOCUMENT_ID_Border = ""; |
262 |
DocInfo_ID_Border = ""; |
263 |
Project_NO_Color = ""; |
264 |
DOCUMENT_ID_Color = ""; |
265 |
DocInfo_ID_Color = ""; |
266 |
|
267 |
FinalPDFAdd_DocInfo_ID = null; |
268 |
FinalPDFAdd_Document_ID = null; |
269 |
} |
270 |
} |
271 |
|
272 |
#endregion |
273 |
|
274 |
#endregion |
275 |
} |
276 |
} |