개정판 95e7bd84
수정사항 & Add Dialog validation 하는 중
Change-Id: Id53bbd718ea1cc5aebfc97f0216fe6a3f464ee00
ConvertService/ServiceBase/Markus.Service.StationController/ViewModel/ConvertAddDialogViewModel.cs | ||
---|---|---|
8 | 8 |
using Microsoft.Win32; |
9 | 9 |
using Markus.Service.Extensions; |
10 | 10 |
using System.Windows; |
11 |
using System.Windows.Controls; |
|
12 |
using System.ComponentModel; |
|
11 | 13 |
|
12 | 14 |
namespace Markus.Service.StationController.ViewModel |
13 | 15 |
{ |
14 |
class ConvertAddDialogViewModel : Mvvm.ToolKit.ViewModelBase |
|
16 |
class ConvertAddDialogViewModel : Mvvm.ToolKit.ViewModelBase, IDataErrorInfo
|
|
15 | 17 |
{ |
16 | 18 |
#region Construrtor |
17 | 19 |
|
... | ... | |
22 | 24 |
|
23 | 25 |
#endregion |
24 | 26 |
|
27 |
#region IDataErrorInfo Members |
|
28 |
|
|
29 |
public string Error |
|
30 |
{ |
|
31 |
get { throw new NotImplementedException(); } |
|
32 |
} |
|
33 |
|
|
34 |
public string this[string columnName] |
|
35 |
{ |
|
36 |
get |
|
37 |
{ |
|
38 |
string result = null; |
|
39 |
if (string.IsNullOrEmpty(ConverAdd_Project_NO)) |
|
40 |
{ |
|
41 |
if (string.IsNullOrEmpty(ConverAdd_Project_NO)) |
|
42 |
result = "Please enter a Project NO"; |
|
43 |
} |
|
44 |
if (columnName == "ConverAdd_DOCUMENT_ID") |
|
45 |
{ |
|
46 |
if (string.IsNullOrEmpty(ConverAdd_DOCUMENT_ID)) |
|
47 |
result = "Please enter a DOCUMENT ID"; |
|
48 |
} |
|
49 |
if (columnName == "ConverAdd_DOCUMENT_URL") |
|
50 |
{ |
|
51 |
if (string.IsNullOrEmpty(ConverAdd_DOCUMENT_URL)) |
|
52 |
result = "Please enter a DOCUMENT URL"; |
|
53 |
} |
|
54 |
return result; |
|
55 |
} |
|
56 |
} |
|
57 |
|
|
58 |
#endregion |
|
59 |
|
|
25 | 60 |
#region Propertise |
26 | 61 |
|
27 | 62 |
DataService.DataServiceClient WcfClient = new DataService.DataServiceClient(); |
... | ... | |
32 | 67 |
get { return _ConverAdd_Project_NO; } |
33 | 68 |
set |
34 | 69 |
{ |
35 |
_ConverAdd_Project_NO = value; |
|
36 |
OnPropertyChanged(() => ConverAdd_Project_NO); |
|
70 |
if (_ConverAdd_Project_NO != value) |
|
71 |
{ |
|
72 |
_ConverAdd_Project_NO = value; |
|
73 |
OnPropertyChanged(() => ConverAdd_Project_NO); |
|
74 |
} |
|
37 | 75 |
} |
38 | 76 |
} |
39 | 77 |
|
... | ... | |
43 | 81 |
get { return _ConverAdd_DOCUMENT_ID; } |
44 | 82 |
set |
45 | 83 |
{ |
46 |
_ConverAdd_DOCUMENT_ID = value; |
|
47 |
OnPropertyChanged(() => ConverAdd_DOCUMENT_ID); |
|
84 |
if (_ConverAdd_DOCUMENT_ID != value) |
|
85 |
{ |
|
86 |
_ConverAdd_DOCUMENT_ID = value; |
|
87 |
OnPropertyChanged(() => ConverAdd_DOCUMENT_ID); |
|
88 |
} |
|
48 | 89 |
} |
49 | 90 |
} |
50 | 91 |
|
... | ... | |
54 | 95 |
get { return _ConverAdd_DOCUMENT_URL; } |
55 | 96 |
set |
56 | 97 |
{ |
57 |
_ConverAdd_DOCUMENT_URL = value; |
|
58 |
OnPropertyChanged(() => ConverAdd_DOCUMENT_URL); |
|
98 |
if (_ConverAdd_DOCUMENT_URL != value) |
|
99 |
{ |
|
100 |
_ConverAdd_DOCUMENT_URL = value; |
|
101 |
OnPropertyChanged(() => ConverAdd_DOCUMENT_URL); |
|
102 |
} |
|
103 |
} |
|
104 |
} |
|
105 |
|
|
106 |
private bool _Bool_Project_NO; |
|
107 |
public bool Bool_Project_NO |
|
108 |
{ |
|
109 |
get { return _Bool_Project_NO; } |
|
110 |
set |
|
111 |
{ |
|
112 |
_Bool_Project_NO = value; |
|
113 |
OnPropertyChanged(() => Bool_Project_NO); |
|
114 |
|
|
115 |
} |
|
116 |
} |
|
117 |
|
|
118 |
private bool _Bool_DOCUMENT_ID; |
|
119 |
public bool Bool_DOCUMENT_ID |
|
120 |
{ |
|
121 |
get { return _Bool_DOCUMENT_ID; } |
|
122 |
set |
|
123 |
{ |
|
124 |
_Bool_DOCUMENT_ID = value; |
|
125 |
OnPropertyChanged(() => Bool_DOCUMENT_ID); |
|
59 | 126 |
} |
60 | 127 |
} |
61 | 128 |
|
... | ... | |
76 | 143 |
/// </summary> |
77 | 144 |
public async void ConverAdd_OK(object obj) |
78 | 145 |
{ |
79 |
|
|
80 |
try |
|
146 |
if (String.IsNullOrEmpty(ConverAdd_Project_NO) || String.IsNullOrEmpty(ConverAdd_DOCUMENT_URL)|| String.IsNullOrEmpty(ConverAdd_DOCUMENT_ID) ) |
|
81 | 147 |
{ |
82 |
string ConverAdd_ID = GuidExtension.shortGuid(); |
|
83 |
var items = await WcfClient.GET_SELECT_CONVERT_INSERTAsync(ConverAdd_ID, ConverAdd_Project_NO, ConverAdd_DOCUMENT_URL, ConverAdd_DOCUMENT_ID); |
|
84 |
System.Diagnostics.Debug.WriteLine(items); |
|
85 |
|
|
86 |
MessageBox.Show("데이터베이스에 추가 완료! "); |
|
148 |
if (String.IsNullOrEmpty(ConverAdd_Project_NO)) |
|
149 |
{ |
|
150 |
ConverAdd_Project_NO = "Project_NOisEmpty"; |
|
151 |
} |
|
152 |
if (String.IsNullOrEmpty(ConverAdd_DOCUMENT_URL)) |
|
153 |
{ |
|
154 |
ConverAdd_DOCUMENT_URL = "DOCUMENT_URLisEmpty"; |
|
155 |
} |
|
156 |
if (String.IsNullOrEmpty(ConverAdd_DOCUMENT_ID)) |
|
157 |
{ |
|
158 |
ConverAdd_DOCUMENT_ID = "DOCUMENT_IDisEmpty"; |
|
159 |
} |
|
87 | 160 |
} |
88 |
catch (Exception ex)
|
|
161 |
else
|
|
89 | 162 |
{ |
90 |
MessageBox.Show(ex.ToString()); |
|
163 |
try |
|
164 |
{ |
|
165 |
string ConverAdd_ID = GuidExtension.shortGuid(); |
|
166 |
var items = await WcfClient.GET_SELECT_CONVERT_INSERTAsync(ConverAdd_ID, ConverAdd_Project_NO, ConverAdd_DOCUMENT_URL, ConverAdd_DOCUMENT_ID); |
|
167 |
System.Diagnostics.Debug.WriteLine(items); |
|
168 |
|
|
169 |
MessageBox.Show("데이터베이스에 추가 완료! "); |
|
170 |
} |
|
171 |
catch (Exception ex) |
|
172 |
{ |
|
173 |
MessageBox.Show(ex.ToString()); |
|
174 |
} |
|
175 |
|
|
176 |
ConverAdd_Project_NO = null; |
|
177 |
ConverAdd_DOCUMENT_ID = null; |
|
178 |
ConverAdd_DOCUMENT_URL = null; |
|
91 | 179 |
} |
92 |
|
|
93 |
ConverAdd_Project_NO = null; |
|
94 |
ConverAdd_DOCUMENT_ID = null; |
|
95 |
ConverAdd_DOCUMENT_URL = null; |
|
96 |
|
|
97 | 180 |
} |
98 | 181 |
|
99 | 182 |
#endregion |
100 | 183 |
|
101 | 184 |
#endregion |
102 | 185 |
} |
103 |
} |
|
186 |
public class NameValidator : ValidationRule |
|
187 |
{ |
|
188 |
public override ValidationResult Validate(object value, System.Globalization.CultureInfo cultureInfo) |
|
189 |
{ |
|
190 |
if (value == null) |
|
191 |
return new ValidationResult(false, "value cannot be empty."); |
|
192 |
|
|
193 |
return ValidationResult.ValidResult; |
|
194 |
} |
|
195 |
} |
|
196 |
} |
내보내기 Unified diff