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