프로젝트

일반

사용자정보

통계
| 브랜치(Branch): | 개정판:

markus / ConvertService / ServiceBase / Markus.Service.StationController / ViewModel / ConvertAddDialogViewModel.cs @ 5532bcc0

이력 | 보기 | 이력해설 | 다운로드 (8.4 KB)

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