개정판 a6e5055d
Markus.Service.StationController DataBaseView 추가
Change-Id: I16b9c78a690e2ae8f804bf35c8787a9c97fea157
ConvertService/ServiceBase/IServiceBase/ConvertItem.cs | ||
---|---|---|
1 | 1 |
using System; |
2 | 2 |
using System.Collections.Generic; |
3 |
using System.ComponentModel; |
|
3 | 4 |
using System.Linq; |
4 | 5 |
using System.Runtime.Serialization; |
5 | 6 |
using System.Text; |
... | ... | |
8 | 9 |
namespace Markus.Service.Interface |
9 | 10 |
{ |
10 | 11 |
[DataContract] |
11 |
public class ConvertItem : IEquatable<ConvertItem> |
|
12 |
public class ConvertItem : IEquatable<ConvertItem> ,INotifyPropertyChanged
|
|
12 | 13 |
{ |
13 | 14 |
public bool Equals(ConvertItem other) |
14 | 15 |
{ |
... | ... | |
27 | 28 |
return (id + project).GetHashCode(); |
28 | 29 |
} |
29 | 30 |
|
30 |
public ConvertItem(string ProjectNo , string ID) |
|
31 |
|
|
32 |
public ConvertItem(string ProjectNo, string ID) |
|
31 | 33 |
{ |
32 | 34 |
this._projectNumber = ProjectNo; |
33 | 35 |
this._convertID = ID; |
... | ... | |
39 | 41 |
this._projectNumber = ProjectNo; |
40 | 42 |
this._convertID = ID; |
41 | 43 |
this._originfilePath = originfilePath; |
44 |
|
|
45 |
string result = ""; |
|
46 |
if (originfilePath.Contains("/")) |
|
47 |
{ |
|
48 |
result = originfilePath.Substring(originfilePath.LastIndexOf("/") + 1); |
|
49 |
} |
|
50 |
else |
|
51 |
{ |
|
52 |
result = originfilePath.Substring(originfilePath.LastIndexOf("%") + 1); |
|
53 |
} |
|
54 |
this._FileName = result; |
|
42 | 55 |
} |
43 | 56 |
|
44 | 57 |
public ConvertItem(string key, string ProjectNo, string ID,string originfilePath,string convertPath) |
... | ... | |
48 | 61 |
this._convertID = ID; |
49 | 62 |
this._originfilePath = originfilePath; |
50 | 63 |
this._convertPath = convertPath; |
64 |
|
|
65 |
string result = ""; |
|
66 |
if (originfilePath.Contains("/")) |
|
67 |
{ |
|
68 |
result = originfilePath.Substring(originfilePath.LastIndexOf("/") + 1); |
|
69 |
} |
|
70 |
else |
|
71 |
{ |
|
72 |
result = originfilePath.Substring(originfilePath.LastIndexOf("%") + 1); |
|
73 |
} |
|
74 |
this._FileName = result; |
|
51 | 75 |
} |
52 | 76 |
|
53 | 77 |
public ConvertItem(string key, string ProjectNo, string ID, string originfilePath, string convertPath,string Status,int currentPageNo,int totalPage,string exception) |
... | ... | |
61 | 85 |
this._currentPageNo = currentPageNo; |
62 | 86 |
this._totalPage = totalPage; |
63 | 87 |
this._exception = exception; |
88 |
|
|
89 |
string result = ""; |
|
90 |
if (originfilePath.Contains("/")) |
|
91 |
{ |
|
92 |
result = originfilePath.Substring(originfilePath.LastIndexOf("/") + 1); |
|
93 |
} |
|
94 |
else |
|
95 |
{ |
|
96 |
result = originfilePath.Substring(originfilePath.LastIndexOf("%") + 1); |
|
97 |
} |
|
98 |
this._FileName = result; |
|
64 | 99 |
} |
65 | 100 |
|
66 | 101 |
|
... | ... | |
70 | 105 |
string _serviceID; |
71 | 106 |
int _reConverter; |
72 | 107 |
string _originfilePath; |
108 |
string _FileName; |
|
73 | 109 |
string _convertPath; |
74 | 110 |
string _convertState; |
75 | 111 |
int _currentPageNo; |
... | ... | |
79 | 115 |
|
80 | 116 |
DateTime _createtime; |
81 | 117 |
|
118 |
public event PropertyChangedEventHandler PropertyChanged; |
|
119 |
private void OnPropertyChanged(string propertyName) |
|
120 |
{ |
|
121 |
if (PropertyChanged != null) |
|
122 |
{ |
|
123 |
PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); |
|
124 |
} |
|
125 |
} |
|
126 |
|
|
127 |
|
|
82 | 128 |
[DataMember] |
83 |
public string ConvertID { get => _convertID; set => _convertID = value; } |
|
129 |
public string ConvertID |
|
130 |
{ |
|
131 |
get |
|
132 |
{ |
|
133 |
return _convertID; |
|
134 |
} |
|
135 |
set |
|
136 |
{ |
|
137 |
if (_convertID != value) |
|
138 |
{ |
|
139 |
_convertID = value; |
|
140 |
OnPropertyChanged("ConvertID"); |
|
141 |
} |
|
142 |
} |
|
143 |
} |
|
84 | 144 |
|
85 | 145 |
[DataMember] |
86 |
public string ServiceID { get => _serviceID; set => _serviceID = value; } |
|
146 |
public string ServiceID |
|
147 |
{ |
|
148 |
get |
|
149 |
{ |
|
150 |
return _serviceID; |
|
151 |
} |
|
152 |
set |
|
153 |
{ |
|
154 |
if (_serviceID != value) |
|
155 |
{ |
|
156 |
_serviceID = value; |
|
157 |
this.OnPropertyChanged("ServiceID"); |
|
158 |
} |
|
159 |
} |
|
160 |
} |
|
87 | 161 |
|
88 | 162 |
[DataMember] |
89 |
public int ReConverter { get => _reConverter; set => _reConverter = value; } |
|
163 |
public int ReConverter |
|
164 |
{ |
|
165 |
get |
|
166 |
{ |
|
167 |
return _reConverter; |
|
168 |
} |
|
169 |
set |
|
170 |
{ |
|
171 |
if (_reConverter != value) |
|
172 |
{ |
|
173 |
_reConverter = value; |
|
174 |
this.OnPropertyChanged("ReConverter"); |
|
175 |
} |
|
176 |
} |
|
177 |
} |
|
90 | 178 |
|
91 | 179 |
[DataMember] |
92 |
public string OriginfilePath { get => _originfilePath; set => _originfilePath = value; } |
|
180 |
public string OriginfilePath |
|
181 |
{ |
|
182 |
get |
|
183 |
{ |
|
184 |
return _originfilePath; |
|
185 |
} |
|
186 |
set |
|
187 |
{ |
|
188 |
if (_originfilePath != value) |
|
189 |
{ |
|
190 |
_originfilePath = value; |
|
191 |
this.OnPropertyChanged("OriginfilePath"); |
|
192 |
} |
|
193 |
} |
|
194 |
} |
|
195 |
|
|
93 | 196 |
|
94 | 197 |
[DataMember] |
95 |
public string ConvertPath { get => _convertPath; set => _convertPath = value; } |
|
198 |
public string FileName |
|
199 |
{ |
|
200 |
get |
|
201 |
{ |
|
202 |
return _FileName; |
|
203 |
} |
|
204 |
set |
|
205 |
{ |
|
206 |
if (_FileName != value) |
|
207 |
{ |
|
208 |
_FileName = value; |
|
209 |
this.OnPropertyChanged("FileName"); |
|
210 |
} |
|
211 |
} |
|
212 |
} |
|
213 |
|
|
96 | 214 |
|
97 | 215 |
[DataMember] |
98 |
public string ConvertState { get => _convertState; set => _convertState = value; } |
|
216 |
public string ConvertPath |
|
217 |
{ |
|
218 |
get |
|
219 |
{ |
|
220 |
return _convertPath; |
|
221 |
} |
|
222 |
set |
|
223 |
{ |
|
224 |
if (_convertPath != value) |
|
225 |
{ |
|
226 |
_convertPath = value; |
|
227 |
this.OnPropertyChanged("ConvertPath"); |
|
228 |
} |
|
229 |
} |
|
230 |
} |
|
99 | 231 |
|
100 | 232 |
[DataMember] |
101 |
public string ProjectNumber { get => _projectNumber; set => _projectNumber = value; } |
|
233 |
public string ConvertState |
|
234 |
{ |
|
235 |
get |
|
236 |
{ |
|
237 |
return _convertState; |
|
238 |
} |
|
239 |
set |
|
240 |
{ |
|
241 |
if (_convertState != value) |
|
242 |
{ |
|
243 |
_convertState = value; |
|
244 |
this.OnPropertyChanged("ConvertState"); |
|
245 |
} |
|
246 |
} |
|
247 |
} |
|
102 | 248 |
|
103 | 249 |
[DataMember] |
104 |
public int TotalPage { get => _totalPage; set => _totalPage = value; } |
|
250 |
public string ProjectNumber |
|
251 |
{ |
|
252 |
get |
|
253 |
{ |
|
254 |
return _projectNumber; |
|
255 |
} |
|
256 |
set |
|
257 |
{ |
|
258 |
if (_projectNumber != value) |
|
259 |
{ |
|
260 |
_projectNumber = value; |
|
261 |
OnPropertyChanged("ProjectNumber"); |
|
262 |
} |
|
263 |
} |
|
264 |
} |
|
265 |
|
|
266 |
[DataMember] |
|
267 |
public int TotalPage |
|
268 |
{ |
|
269 |
get |
|
270 |
{ |
|
271 |
return _totalPage; |
|
272 |
} |
|
273 |
set |
|
274 |
{ |
|
275 |
if (_totalPage != value) |
|
276 |
{ |
|
277 |
_totalPage = value; |
|
278 |
this.OnPropertyChanged("TotalPage"); |
|
279 |
} |
|
280 |
} |
|
281 |
} |
|
105 | 282 |
|
106 | 283 |
[DataMember] |
107 |
public int CurrentPageNo { get => _currentPageNo; set => _currentPageNo = value; } |
|
284 |
public int CurrentPageNo |
|
285 |
{ |
|
286 |
get |
|
287 |
{ |
|
288 |
return _currentPageNo; |
|
289 |
} |
|
290 |
set |
|
291 |
{ |
|
292 |
if (_currentPageNo != value) |
|
293 |
{ |
|
294 |
_currentPageNo = value; |
|
295 |
this.OnPropertyChanged("CurrentPageNo"); |
|
296 |
} |
|
297 |
} |
|
298 |
} |
|
108 | 299 |
|
109 | 300 |
[DataMember] |
110 |
public DateTime CreateTime { get => _createtime; set => _createtime = value; } |
|
301 |
public DateTime CreateTime |
|
302 |
{ |
|
303 |
get |
|
304 |
{ |
|
305 |
return _createtime; |
|
306 |
} |
|
307 |
set |
|
308 |
{ |
|
309 |
if (_createtime != value) |
|
310 |
{ |
|
311 |
_createtime = value; |
|
312 |
this.OnPropertyChanged("CreateTime"); |
|
313 |
} |
|
314 |
} |
|
315 |
} |
|
111 | 316 |
|
112 | 317 |
[DataMember] |
113 |
public string UniqueKey { get => _uniqueKey; set => _uniqueKey = value; } |
|
318 |
public string UniqueKey |
|
319 |
{ |
|
320 |
get |
|
321 |
{ |
|
322 |
return _uniqueKey; |
|
323 |
} |
|
324 |
set |
|
325 |
{ |
|
326 |
if (_uniqueKey != value) |
|
327 |
{ |
|
328 |
_uniqueKey = value; |
|
329 |
this.OnPropertyChanged("UniqueKey"); |
|
330 |
} |
|
331 |
} |
|
332 |
} |
|
114 | 333 |
|
115 | 334 |
|
116 | 335 |
[DataMember] |
117 |
public string Exception { get => _exception; set => _exception = value; } |
|
336 |
public string Exception |
|
337 |
{ |
|
338 |
get |
|
339 |
{ |
|
340 |
return _exception; |
|
341 |
} |
|
342 |
set |
|
343 |
{ |
|
344 |
if (_exception != value) |
|
345 |
{ |
|
346 |
_exception = value; |
|
347 |
this.OnPropertyChanged("Exception"); |
|
348 |
} |
|
349 |
} |
|
350 |
} |
|
118 | 351 |
|
119 | 352 |
[DataMember] |
120 | 353 |
public Int64 ProcessorAffinity { get; set; } |
121 |
|
|
122 | 354 |
} |
123 | 355 |
} |
ConvertService/ServiceBase/Markus.Service.DataBase/ConvertDatabase.cs | ||
---|---|---|
289 | 289 |
{ |
290 | 290 |
var item = items.First(); |
291 | 291 |
|
292 |
item.RECONVERTER = item.RECONVERTER + ReConvert;
|
|
292 |
item.RECONVERTER = item.RECONVERTER - ReConvert;
|
|
293 | 293 |
item.CREATE_DATETIME = DateTime.Now; |
294 | 294 |
//item.START_DATETIME = null; |
295 | 295 |
item.END_DATETIME = null; |
... | ... | |
390 | 390 |
return convertItems; |
391 | 391 |
} |
392 | 392 |
|
393 |
public IEnumerable<Interface.ConvertItem> GetConvertProjects(Func<CONVERTER_DOC, bool> @where) |
|
394 |
{ |
|
395 |
var items = entities.CONVERTER_DOC.Where(@where); |
|
396 |
|
|
397 |
if (items.Count() > 0) |
|
398 |
{ |
|
399 |
foreach (var item in items) |
|
400 |
{ |
|
401 |
|
|
402 |
yield return new Interface.ConvertItem(item.DOCUMENT_ID, item.PROJECT_NO, item.ID, item.DOCUMENT_URL) |
|
403 |
{ |
|
404 |
ReConverter = item.RECONVERTER, |
|
405 |
ServiceID = item.SERVICE_ID, |
|
406 |
//ConvertState = ((StatusCodeType)item.STATUS).ToString(), |
|
407 |
ConvertState = (item.STATUS).ToString(), |
|
408 |
CreateTime = item.CREATE_DATETIME, |
|
409 |
TotalPage = item.TOTAL_PAGE, |
|
410 |
CurrentPageNo = item.CURRENT_PAGE, |
|
411 |
Exception = item.EXCEPTION, |
|
412 |
ConvertPath = GetConvertPath(item.PROJECT_NO, item.DOCUMENT_ID) |
|
413 |
}; |
|
414 |
|
|
415 |
} |
|
416 |
} |
|
417 |
} |
|
418 |
|
|
419 |
public List<Interface.ConvertItem> GetConvertProjects(Func<CONVERTER_DOC, bool> @where, StatusCodeType status) |
|
420 |
{ |
|
421 |
List<Interface.ConvertItem> convertItems = new List<Interface.ConvertItem>(); |
|
422 |
|
|
423 |
|
|
424 |
//var items = entities.CONVERTER_DOC.Where(x => x.STATUS == (int)statusCodeType).Take(takeCount).ToList(); //.Where(x => x.PROJECT_NO == gProjectNo); |
|
425 |
var items = entities.CONVERTER_DOC.Where(x => x.STATUS == (int)status).ToList(); |
|
426 |
|
|
427 |
if (items.Count() > 0) |
|
428 |
{ |
|
429 |
foreach (var item in items) |
|
430 |
{ |
|
431 |
|
|
432 |
var convertitem = new Interface.ConvertItem(item.DOCUMENT_ID, item.PROJECT_NO, item.ID, item.DOCUMENT_URL) |
|
433 |
{ |
|
434 |
ReConverter = item.RECONVERTER, |
|
435 |
ServiceID = item.SERVICE_ID, |
|
436 |
//ConvertState = ((StatusCodeType)item.STATUS).ToString(), |
|
437 |
ConvertState = (item.STATUS).ToString(), |
|
438 |
CreateTime = item.CREATE_DATETIME, |
|
439 |
TotalPage = item.TOTAL_PAGE, |
|
440 |
CurrentPageNo = item.CURRENT_PAGE, |
|
441 |
Exception = item.EXCEPTION, |
|
442 |
ConvertPath = GetConvertPath(item.PROJECT_NO, item.DOCUMENT_ID) |
|
443 |
}; |
|
444 |
|
|
445 |
|
|
446 |
} |
|
447 |
} |
|
448 |
|
|
449 |
return convertItems; |
|
450 |
} |
|
451 |
|
|
452 |
public List<Interface.ConvertItem> GetConvertProjectsStatus(Func<CONVERTER_DOC, bool> @where) |
|
453 |
{ |
|
454 |
List<Interface.ConvertItem> convertItems = new List<Interface.ConvertItem>(); |
|
455 |
|
|
456 |
|
|
457 |
//var items = entities.CONVERTER_DOC.Where(x => x.STATUS == (int)statusCodeType).Take(takeCount).ToList(); //.Where(x => x.PROJECT_NO == gProjectNo); |
|
458 |
var items = entities.CONVERTER_DOC.Where(x => x.STATUS<= 4); |
|
459 |
|
|
460 |
if (items.Count() > 0) |
|
461 |
{ |
|
462 |
foreach (var item in items) |
|
463 |
{ |
|
464 |
var convertitem = new Interface.ConvertItem(item.DOCUMENT_ID, item.PROJECT_NO, item.ID, item.DOCUMENT_URL) |
|
465 |
{ |
|
466 |
ReConverter = item.RECONVERTER, |
|
467 |
ServiceID = item.SERVICE_ID, |
|
468 |
//ConvertState = ((StatusCodeType)item.STATUS).ToString(), |
|
469 |
ConvertState = (item.STATUS).ToString(), |
|
470 |
CreateTime = item.CREATE_DATETIME, |
|
471 |
TotalPage = item.TOTAL_PAGE, |
|
472 |
CurrentPageNo = item.CURRENT_PAGE, |
|
473 |
Exception = item.EXCEPTION, |
|
474 |
ConvertPath = GetConvertPath(item.PROJECT_NO, item.DOCUMENT_ID) |
|
475 |
}; |
|
476 |
|
|
477 |
|
|
478 |
convertItems.Add(convertitem); |
|
479 |
} |
|
480 |
} |
|
481 |
|
|
482 |
return convertItems; |
|
483 |
} |
|
484 |
|
|
393 | 485 |
|
394 | 486 |
/// <summary> |
395 | 487 |
/// 현재 서비스에서 컨버터중인 아이템. |
ConvertService/ServiceBase/Markus.Service.Extensions/Exntensions/CollectionExtenstions.cs | ||
---|---|---|
167 | 167 |
ArgumentCheck.IsNullorWhiteSpace(update, "update"); |
168 | 168 |
foreach (var item in enumerable) |
169 | 169 |
{ |
170 |
if (where(item)) |
|
170 |
if (where(item))//UpdateWhere에서 맨마지막 조건
|
|
171 | 171 |
{ |
172 | 172 |
update(item); |
173 | 173 |
} |
ConvertService/ServiceBase/Markus.Service.StationController/AppInit.cs | ||
---|---|---|
55 | 55 |
} |
56 | 56 |
catch (Exception ex) |
57 | 57 |
{ |
58 |
MessageBox.Show(ex.Message); |
|
58 | 59 |
} |
59 | 60 |
} |
60 | 61 |
|
ConvertService/ServiceBase/Markus.Service.StationController/Behaviors/StatusTypeList.cs | ||
---|---|---|
1 | 1 |
using System; |
2 | 2 |
using System.Collections.Generic; |
3 |
using System.ComponentModel.DataAnnotations; |
|
3 | 4 |
using System.Linq; |
4 | 5 |
using System.Text; |
5 | 6 |
using System.Threading.Tasks; |
... | ... | |
8 | 9 |
{ |
9 | 10 |
public class StatusTypeList : List<Message.StatusCodeType> |
10 | 11 |
{ |
12 |
|
|
11 | 13 |
} |
12 | 14 |
} |
ConvertService/ServiceBase/Markus.Service.StationController/Extensions/ConvertItemChangeValue.cs | ||
---|---|---|
9 | 9 |
{ |
10 | 10 |
public static class ConvertItemEx |
11 | 11 |
{ |
12 |
public static void ChangeValues(object changeitem, object newitem) |
|
12 |
public static void ChangeValues(object changeitem, object newitem)//그리드에 있는 컬렉션, 디비에 있는 컬렉션
|
|
13 | 13 |
{ |
14 |
var changeProp = changeitem.GetType().GetProperties(); |
|
15 |
var newProp = newitem.GetType().GetProperties(); |
|
14 |
var changeProp = changeitem.GetType().GetProperties();//그리드
|
|
15 |
var newProp = newitem.GetType().GetProperties();//디비
|
|
16 | 16 |
|
17 |
foreach (var item in changeProp) |
|
17 |
foreach (var item in changeProp)//그리드 포문
|
|
18 | 18 |
{ |
19 | 19 |
|
20 |
var newinfo = newProp.Where(x => x.Name == item.Name); |
|
20 |
var newinfo = newProp.Where(x => x.Name == item.Name);//그리드와 디비 조건에 맞는 오브젝트
|
|
21 | 21 |
|
22 | 22 |
if(newinfo.Count() > 0) |
23 | 23 |
{ |
24 |
item.SetValue(changeitem, newinfo.First().GetValue(newitem)); |
|
24 |
if (item.GetValue(changeitem) != newinfo.First().GetValue(newitem)) |
|
25 |
{ |
|
26 |
item.SetValue(changeitem, newinfo.First().GetValue(newitem)); |
|
27 |
} |
|
25 | 28 |
} |
26 | 29 |
} |
27 | 30 |
} |
31 |
|
|
28 | 32 |
} |
29 | 33 |
} |
ConvertService/ServiceBase/Markus.Service.StationController/Markus.Service.StationController.csproj | ||
---|---|---|
69 | 69 |
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> |
70 | 70 |
<HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll</HintPath> |
71 | 71 |
</Reference> |
72 |
<Reference Include="GemBox.Spreadsheet, Version=39.3.30.1215, Culture=neutral, PublicKeyToken=b1b72c69714d4847, processorArchitecture=MSIL"> |
|
73 |
<HintPath>..\packages\GemBox.Spreadsheet.39.3.30.1215\lib\net30\GemBox.Spreadsheet.dll</HintPath> |
|
74 |
</Reference> |
|
72 | 75 |
<Reference Include="Markus.EntityModel, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL"> |
73 | 76 |
<HintPath>..\packages\MarkusDatabase.1.7.2\lib\net45\Markus.EntityModel.dll</HintPath> |
74 | 77 |
</Reference> |
... | ... | |
162 | 165 |
<Compile Include="Extensions\VisualTreeHelper.cs" /> |
163 | 166 |
<Compile Include="ViewModel\DataBaseByStatusViewModel.cs" /> |
164 | 167 |
<Compile Include="ViewModel\AliveViewModel.cs" /> |
168 |
<Compile Include="ViewModel\DataBaseItemsModel.cs" /> |
|
165 | 169 |
<Compile Include="ViewModel\MergeDataViewModel.cs" /> |
166 | 170 |
<Compile Include="ViewModel\MainViewModel.cs" /> |
167 | 171 |
<Compile Include="ViewModel\TotalStatusViewModel.cs" /> |
172 |
<Compile Include="Views\DataBaseView.xaml.cs"> |
|
173 |
<DependentUpon>DataBaseView.xaml</DependentUpon> |
|
174 |
</Compile> |
|
168 | 175 |
<Compile Include="Views\MergeDataView.xaml.cs"> |
169 | 176 |
<DependentUpon>MergeDataView.xaml</DependentUpon> |
170 | 177 |
</Compile> |
... | ... | |
212 | 219 |
<SubType>Designer</SubType> |
213 | 220 |
<Generator>MSBuild:Compile</Generator> |
214 | 221 |
</Page> |
222 |
<Page Include="Views\DataBaseView.xaml"> |
|
223 |
<Generator>MSBuild:Compile</Generator> |
|
224 |
<SubType>Designer</SubType> |
|
225 |
</Page> |
|
215 | 226 |
<Page Include="Views\MergeDataView.xaml"> |
216 | 227 |
<SubType>Designer</SubType> |
217 | 228 |
<Generator>MSBuild:Compile</Generator> |
ConvertService/ServiceBase/Markus.Service.StationController/ViewModel/AliveViewModel.cs | ||
---|---|---|
115 | 115 |
} |
116 | 116 |
catch (Exception ex) |
117 | 117 |
{ |
118 |
System.Diagnostics.Debug.WriteLine(ex.ToString()); |
|
118 | 119 |
} |
119 | 120 |
|
120 | 121 |
IsLoading = false; |
... | ... | |
220 | 221 |
catch (Exception ex) |
221 | 222 |
{ |
222 | 223 |
result = false; |
224 |
System.Diagnostics.Debug.WriteLine(ex.ToString()); |
|
223 | 225 |
} |
224 | 226 |
|
225 | 227 |
return result; |
ConvertService/ServiceBase/Markus.Service.StationController/ViewModel/DataBaseByStatusViewModel.cs | ||
---|---|---|
141 | 141 |
} |
142 | 142 |
catch (Exception ex) |
143 | 143 |
{ |
144 |
System.Diagnostics.Debug.WriteLine(ex.ToString()); |
|
144 | 145 |
} |
145 | 146 |
} |
146 | 147 |
|
ConvertService/ServiceBase/Markus.Service.StationController/ViewModel/DataBaseItemsModel.cs | ||
---|---|---|
1 |
using GemBox.Spreadsheet; |
|
2 |
using Markus.Message; |
|
3 |
using Markus.Service.DataBase; |
|
4 |
using Markus.Service.Extensions; |
|
5 |
using Markus.Service.StationController.Behaviors; |
|
6 |
using Markus.Service.StationController.Extensions; |
|
7 |
using Microsoft.Win32; |
|
8 |
using System; |
|
9 |
using System.Collections.Generic; |
|
10 |
using System.ComponentModel; |
|
11 |
using System.Linq; |
|
12 |
using System.Windows; |
|
13 |
using Telerik.Windows.Controls; |
|
14 |
using Telerik.Windows.Data; |
|
15 |
using ConvertItem = Markus.Service.Interface.ConvertItem; |
|
16 |
|
|
17 |
namespace Markus.Service.StationController.ViewModel |
|
18 |
{ |
|
19 |
//세미 |
|
20 |
public class DataBaseItemsModel : Mvvm.ToolKit.ViewModelBase |
|
21 |
{ |
|
22 |
BackgroundWorker backgroundWorker; |
|
23 |
|
|
24 |
Random rnd = new Random(); |
|
25 |
|
|
26 |
private System.Collections.ObjectModel.ObservableCollection<ConvertItem> _FilterConvertSource; |
|
27 |
private ConvertItem _SelectRealConvert; |
|
28 |
private ConvertItem _SelectFilterConvert; |
|
29 |
|
|
30 |
private StatusTypeList _StatusType; |
|
31 |
private bool _IsLoading; |
|
32 |
|
|
33 |
private Telerik.Windows.Data.EnumMemberViewModel _SelectedStatus; |
|
34 |
|
|
35 |
public Telerik.Windows.Data.EnumMemberViewModel SelectedStatus |
|
36 |
{ |
|
37 |
get => _SelectedStatus; |
|
38 |
set |
|
39 |
{ |
|
40 |
_SelectedStatus = value; |
|
41 |
OnPropertyChanged(() => SelectedStatus); |
|
42 |
} |
|
43 |
} |
|
44 |
|
|
45 |
|
|
46 |
private SelectedCountItem _SelectedCount; |
|
47 |
|
|
48 |
public SelectedCountItem SelectedCount |
|
49 |
{ |
|
50 |
get => _SelectedCount; |
|
51 |
set |
|
52 |
{ |
|
53 |
_SelectedCount = value; |
|
54 |
OnPropertyChanged(() => SelectedCount); |
|
55 |
} |
|
56 |
} |
|
57 |
|
|
58 |
|
|
59 |
public DelegateCommand ConvertCommand { get; private set; } |
|
60 |
public DelegateCommand DeleteCommand { get; private set; } |
|
61 |
|
|
62 |
|
|
63 |
private void DataConvert(object obj) |
|
64 |
{ |
|
65 |
ConvertDatabase _DataConvert = new ConvertDatabase(App.MarkusDataBaseConnecitonString); |
|
66 |
|
|
67 |
var resultRealConvert = _DataConvert.SetCleanUpItem(SelectRealConvert.ConvertID, SelectRealConvert.ReConverter); |
|
68 |
var resultFiltertConvert = _DataConvert.SetCleanUpItem(SelectFilterConvert.ConvertID, SelectFilterConvert.ReConverter); |
|
69 |
System.Diagnostics.Debug.WriteLine(resultRealConvert + " " + resultFiltertConvert); |
|
70 |
} |
|
71 |
|
|
72 |
private void DataDelete(object obj) |
|
73 |
{ |
|
74 |
ConvertDatabase _DataConvert = new ConvertDatabase(App.MarkusDataBaseConnecitonString); |
|
75 |
|
|
76 |
var resultRealConvert = _DataConvert.RemoveItem(SelectRealConvert.ConvertID); |
|
77 |
var resultFiltertConvert = _DataConvert.RemoveItem(SelectFilterConvert.ConvertID); |
|
78 |
System.Diagnostics.Debug.WriteLine(resultRealConvert + " " + resultFiltertConvert); |
|
79 |
|
|
80 |
} |
|
81 |
|
|
82 |
|
|
83 |
public System.Collections.ObjectModel.ObservableCollection<ConvertItem> FilterConvertSource |
|
84 |
{ |
|
85 |
get => _FilterConvertSource; |
|
86 |
set |
|
87 |
{ |
|
88 |
_FilterConvertSource = value; |
|
89 |
OnPropertyChanged(() => FilterConvertSource); |
|
90 |
} |
|
91 |
} |
|
92 |
|
|
93 |
|
|
94 |
private System.Collections.ObjectModel.ObservableCollection<ConvertItem> _RealConvertSource; |
|
95 |
public System.Collections.ObjectModel.ObservableCollection<ConvertItem> RealConvertSource |
|
96 |
{ |
|
97 |
get => _RealConvertSource; |
|
98 |
set |
|
99 |
{ |
|
100 |
_RealConvertSource = value; |
|
101 |
OnPropertyChanged(() => RealConvertSource); |
|
102 |
} |
|
103 |
} |
|
104 |
|
|
105 |
|
|
106 |
|
|
107 |
public ConvertItem SelectFilterConvert |
|
108 |
{ |
|
109 |
get => _SelectFilterConvert; |
|
110 |
set |
|
111 |
{ |
|
112 |
_SelectFilterConvert = value; |
|
113 |
OnPropertyChanged(() => SelectFilterConvert); |
|
114 |
} |
|
115 |
} |
|
116 |
public ConvertItem SelectRealConvert |
|
117 |
{ |
|
118 |
get => _SelectRealConvert; |
|
119 |
set |
|
120 |
{ |
|
121 |
_SelectRealConvert = value; |
|
122 |
OnPropertyChanged(() => SelectRealConvert); |
|
123 |
} |
|
124 |
} |
|
125 |
|
|
126 |
public StatusTypeList StatusType |
|
127 |
{ |
|
128 |
get => _StatusType; |
|
129 |
set |
|
130 |
{ |
|
131 |
_StatusType = value; |
|
132 |
OnPropertyChanged(() => StatusType); |
|
133 |
} |
|
134 |
} |
|
135 |
|
|
136 |
public bool IsLoading |
|
137 |
{ |
|
138 |
get => _IsLoading; |
|
139 |
set |
|
140 |
{ |
|
141 |
if (_IsLoading != value) |
|
142 |
{ |
|
143 |
_IsLoading = value; |
|
144 |
OnPropertyChanged(() => IsLoading); |
|
145 |
} |
|
146 |
} |
|
147 |
} |
|
148 |
|
|
149 |
List<SelectedCountItem> _SelectedCountList; |
|
150 |
|
|
151 |
public List<SelectedCountItem> SelectedCountList |
|
152 |
{ |
|
153 |
get |
|
154 |
{ |
|
155 |
if (_SelectedCountList == null) |
|
156 |
{ |
|
157 |
_SelectedCountList = new List<SelectedCountItem> |
|
158 |
{ |
|
159 |
new SelectedCountItem{DisplayMember = "50",ValueMember = 50}, |
|
160 |
new SelectedCountItem{DisplayMember = "100",ValueMember = 100}, |
|
161 |
new SelectedCountItem{DisplayMember = "150",ValueMember = 150}, |
|
162 |
new SelectedCountItem{DisplayMember = "200",ValueMember = 200} |
|
163 |
}; |
|
164 |
} |
|
165 |
|
|
166 |
return _SelectedCountList; |
|
167 |
} |
|
168 |
} |
|
169 |
|
|
170 |
public DataBaseItemsModel() |
|
171 |
{ |
|
172 |
|
|
173 |
DataSaveFileGemBoxCommand = new DelegateCommand(DataExport); |
|
174 |
ConvertCommand = new DelegateCommand(DataConvert); |
|
175 |
DeleteCommand = new DelegateCommand(DataDelete); |
|
176 |
//Loaded(); |
|
177 |
} |
|
178 |
|
|
179 |
// 진행률에 변화가 있을때 이벤트가 발생 |
|
180 |
private void backgroundWorker_ProgressChanged(object sender, ProgressChangedEventArgs e) |
|
181 |
{ |
|
182 |
MessageBox.Show("진행률에 변화"); |
|
183 |
} |
|
184 |
|
|
185 |
// 일이 모두 마쳤을때 수행되어야할 코드 |
|
186 |
private void backgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) |
|
187 |
{ |
|
188 |
MessageBox.Show("임무마침"); |
|
189 |
} |
|
190 |
|
|
191 |
IEnumerable<Telerik.Windows.Data.EnumMemberViewModel> _StatusCodeList; |
|
192 |
|
|
193 |
public IEnumerable<Telerik.Windows.Data.EnumMemberViewModel> StatusCodeList |
|
194 |
{ |
|
195 |
get |
|
196 |
{ |
|
197 |
if (_StatusCodeList == null) |
|
198 |
{ |
|
199 |
_StatusCodeList = Telerik.Windows.Data.EnumDataSource.FromType<StatusCodeType>(); |
|
200 |
} |
|
201 |
|
|
202 |
return _StatusCodeList; |
|
203 |
} |
|
204 |
} |
|
205 |
|
|
206 |
// BackgroundWorker에서 수행할 일을 정의. |
|
207 |
private void backgroundWorker_DoWork(object sender, DoWorkEventArgs e) |
|
208 |
{ |
|
209 |
while (IsAcitve) |
|
210 |
{ |
|
211 |
if (FilterConvertSource == null) |
|
212 |
{ |
|
213 |
FilterConvertSource = new System.Collections.ObjectModel.ObservableCollection<ConvertItem>(); |
|
214 |
} |
|
215 |
|
|
216 |
if (RealConvertSource == null) |
|
217 |
{ |
|
218 |
RealConvertSource = new System.Collections.ObjectModel.ObservableCollection<ConvertItem>(); |
|
219 |
} |
|
220 |
|
|
221 |
/// combobox 에서 선택된 items |
|
222 |
if (SelectedStatus != null) |
|
223 |
{ |
|
224 |
DataSelect(new[] { (StatusCodeType)(SelectedStatus.Value) }, FilterConvertSource); |
|
225 |
} |
|
226 |
|
|
227 |
/// 컨버터중인 items |
|
228 |
DataSelect(new[] { StatusCodeType.None, StatusCodeType.Wait, StatusCodeType.PageLoading, StatusCodeType.Saving }, RealConvertSource); |
|
229 |
} |
|
230 |
} |
|
231 |
|
|
232 |
//<>쓸때는 IEnumerable |
|
233 |
private void DataSelect(IEnumerable<StatusCodeType> statusCodeTypeList, System.Collections.ObjectModel.ObservableCollection<ConvertItem> collection) |
|
234 |
{ |
|
235 |
|
|
236 |
try |
|
237 |
{ |
|
238 |
using (Markus.Service.DataBase.ConvertDatabase database = new Markus.Service.DataBase.ConvertDatabase(App.MarkusDataBaseConnecitonString)) |
|
239 |
{ |
|
240 |
var items = database.GetConvertProjects(x => statusCodeTypeList.Count(y => (int)y == x.STATUS) > 0) |
|
241 |
.OrderByDescending(x => x.CreateTime).Take(SelectedCount.ValueMember).ToList(); |
|
242 |
|
|
243 |
if (collection.Count() == 0) |
|
244 |
{ |
|
245 |
items.ForEach(x => collection.Add(x)); |
|
246 |
} |
|
247 |
else |
|
248 |
{ |
|
249 |
// 데이터 업데이트 |
|
250 |
items.ForEach(newitem =>//디비 포문 |
|
251 |
{ |
|
252 |
collection.UpdateWhere(changeitem => |
|
253 |
{ |
|
254 |
ConvertItemEx.ChangeValues(changeitem, newitem); |
|
255 |
System.Threading.Thread.Sleep(new TimeSpan(0, 0, 0, 0, 10)); |
|
256 |
|
|
257 |
}, x => x.ConvertID == newitem.ConvertID);//UpdateWhere의 where절 |
|
258 |
}); |
|
259 |
|
|
260 |
foreach (var item in items) |
|
261 |
{ |
|
262 |
// System.Threading.Thread.Sleep(1); |
|
263 |
if (collection.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0) |
|
264 |
{ |
|
265 |
collection.Add(item); |
|
266 |
} |
|
267 |
|
|
268 |
} |
|
269 |
|
|
270 |
//삭제 |
|
271 |
for (int i = collection.Count() - 1; i > -1; --i) |
|
272 |
{ |
|
273 |
var item = collection[i]; |
|
274 |
|
|
275 |
if (items.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)//디비에서 가져온 값과 마지막값부터 차례대로 비교 |
|
276 |
{//참=> 0제외한 모든 수 |
|
277 |
collection.RemoveAt(i); |
|
278 |
} |
|
279 |
// System.Threading.Thread.Sleep(new TimeSpan(0, 0, 0, 0, 1)); |
|
280 |
} |
|
281 |
} |
|
282 |
} |
|
283 |
} |
|
284 |
catch (Exception ex) |
|
285 |
{ |
|
286 |
MessageBox.Show(ex.ToString()); |
|
287 |
} |
|
288 |
|
|
289 |
|
|
290 |
} |
|
291 |
|
|
292 |
public override void Loaded() |
|
293 |
{ |
|
294 |
base.Loaded(); |
|
295 |
|
|
296 |
if (!App.IsDesignMode) |
|
297 |
{ |
|
298 |
backgroundWorker = new BackgroundWorker(); |
|
299 |
backgroundWorker.DoWork += backgroundWorker_DoWork; |
|
300 |
backgroundWorker.RunWorkerCompleted += backgroundWorker_RunWorkerCompleted; |
|
301 |
backgroundWorker.WorkerReportsProgress = false; |
|
302 |
backgroundWorker.ProgressChanged += new ProgressChangedEventHandler(backgroundWorker_ProgressChanged); |
|
303 |
|
|
304 |
backgroundWorker.RunWorkerAsync(); |
|
305 |
} |
|
306 |
} |
|
307 |
|
|
308 |
|
|
309 |
public override void Closed() |
|
310 |
{ |
|
311 |
|
|
312 |
if (backgroundWorker != null) |
|
313 |
{ |
|
314 |
backgroundWorker.DoWork -= backgroundWorker_DoWork; |
|
315 |
backgroundWorker.RunWorkerCompleted -= backgroundWorker_RunWorkerCompleted; |
|
316 |
backgroundWorker.WorkerReportsProgress = false; |
|
317 |
backgroundWorker.ProgressChanged -= new ProgressChangedEventHandler(backgroundWorker_ProgressChanged); |
|
318 |
|
|
319 |
} |
|
320 |
|
|
321 |
base.Closed(); |
|
322 |
} |
|
323 |
|
|
324 |
|
|
325 |
public DelegateCommand DataSaveFileGemBoxCommand { get; private set; } |
|
326 |
|
|
327 |
public class HeaderMember |
|
328 |
{ |
|
329 |
public string HeaderName { get; set; } |
|
330 |
public string Property { get; set; } |
|
331 |
} |
|
332 |
//public void DataExport<T>(IEnumerable<T> AliveItems) |
|
333 |
public void DataExport(object obj) |
|
334 |
{ |
|
335 |
SaveFileDialog saveFileDialog = new SaveFileDialog(); |
|
336 |
|
|
337 |
saveFileDialog.FileName = "Document"; // Default file name |
|
338 |
saveFileDialog.DefaultExt = ".txt"; // Default file extension |
|
339 |
saveFileDialog.Filter = "Csv documents (.Csv)|*.csv|Excel(2017~2019)Worksheets|*.xlsx"; // Filter files by extension |
|
340 |
|
|
341 |
|
|
342 |
if (saveFileDialog.ShowDialog() == true) |
|
343 |
{ |
|
344 |
|
|
345 |
|
|
346 |
if (!string.IsNullOrWhiteSpace(saveFileDialog.FileName)) |
|
347 |
{ |
|
348 |
|
|
349 |
var extension = new System.IO.FileInfo(saveFileDialog.FileName).Extension; |
|
350 |
|
|
351 |
if (extension == ".xlsx" || extension == ".csv") |
|
352 |
{ |
|
353 |
|
|
354 |
var headers = new List<HeaderMember> |
|
355 |
{ |
|
356 |
new HeaderMember{HeaderName = "ServiceID", Property = "ServiceID" }, |
|
357 |
new HeaderMember{HeaderName = "ConvertID", Property = "ConvertID" }, |
|
358 |
new HeaderMember{HeaderName = "ProjectNumber", Property = "ProjectNumber" }, |
|
359 |
new HeaderMember{HeaderName = "ConvertState", Property = "ConvertState" }, |
|
360 |
new HeaderMember{HeaderName = "CurrentPageNo", Property = "CurrentPageNo" }, |
|
361 |
new HeaderMember{HeaderName = "TotalPage", Property = "TotalPage" }, |
|
362 |
new HeaderMember{HeaderName = "OriginfilePath", Property = "OriginfilePath" }, |
|
363 |
new HeaderMember{HeaderName = "ConvertPath", Property = "ConvertPath" }, |
|
364 |
new HeaderMember{HeaderName = "CreateTime", Property = "CreateTime" }, |
|
365 |
new HeaderMember{HeaderName = "Exception", Property = "Exception" }, |
|
366 |
new HeaderMember{HeaderName = "ProcessorAffinity", Property = "ProcessorAffinity" }, |
|
367 |
new HeaderMember{HeaderName = "ReConverter", Property = "ReConverter" }, |
|
368 |
new HeaderMember{HeaderName = "UniqueKey", Property = "UniqueKey" } |
|
369 |
}; |
|
370 |
|
|
371 |
|
|
372 |
|
|
373 |
DataExportExcel(saveFileDialog.FileName, "Hello world", FilterConvertSource, headers); |
|
374 |
//_dataExport.DataExportExcel(saveFileDialog.FileName, saveFileDialog.FileName.ToString(), Projectsource, headers); |
|
375 |
//GemBoxFileSave(obj); |
|
376 |
} |
|
377 |
} |
|
378 |
} |
|
379 |
} |
|
380 |
|
|
381 |
|
|
382 |
public void DataExportExcel<T>(string SaveFile, string SheetName, IEnumerable<T> collections, List<HeaderMember> headerMembers) |
|
383 |
{ |
|
384 |
|
|
385 |
try |
|
386 |
{ |
|
387 |
SpreadsheetInfo.SetLicense("EXK0-W4HZ-N518-IMEW"); |
|
388 |
// SpreadsheetInfo.SetLicense("FREE-LIMITED-KEY");//프리버전은 15줄까지만 가능 |
|
389 |
|
|
390 |
var workbook = new ExcelFile(); |
|
391 |
var worksheet = workbook.Worksheets.Add(SheetName); |
|
392 |
|
|
393 |
// IEnumerable<T> collections를 for문 |
|
394 |
for (int rowNumber = 0; rowNumber < collections.Count(); rowNumber++)//1857 양이 너무 많아서 빨리 엑셀출력 누르면 숫자가 감소됨 차분히 기다리면 숫자 늘어남 |
|
395 |
{ |
|
396 |
// index에 해당하는 row를 가져온다. |
|
397 |
object row = collections.ElementAt(rowNumber);//우왕좌왕하게 모든 프로퍼티 있음 생성자 프로퍼티도 있음 |
|
398 |
|
|
399 |
//row의 properties를 가져옴. |
|
400 |
var rowPropInfos = row.GetType().GetProperties();//행렬로 보기좋게 프로퍼티 나옴 |
|
401 |
|
|
402 |
/// 지정된 header에 대해서 프로퍼티에 해당하는 값을 가져와서 cell에 출력 |
|
403 |
for (int i = 0; i < headerMembers.Count(); i++)//13 |
|
404 |
{ |
|
405 |
var prop = rowPropInfos.Where(x => x.Name == headerMembers[i].Property);//prop 0으로 나옴 |
|
406 |
if (headerMembers[i].Property == "CreateTime") |
|
407 |
{ |
|
408 |
worksheet.Cells[rowNumber + 1, i].Value = prop.First().GetValue(row).ToString(); |
|
409 |
} |
|
410 |
else if (prop.Count() > 0) |
|
411 |
{ |
|
412 |
worksheet.Cells[rowNumber + 1, i].Value = prop.First().GetValue(row); |
|
413 |
} |
|
414 |
} |
|
415 |
} |
|
416 |
|
|
417 |
int k = 0; |
|
418 |
foreach (var HeadInfo in headerMembers) |
|
419 |
{ |
|
420 |
worksheet.Cells[0, k].Value = HeadInfo.HeaderName; |
|
421 |
k++; |
|
422 |
} |
|
423 |
|
|
424 |
int columnCount = worksheet.CalculateMaxUsedColumns(); |
|
425 |
for (int i = 0; i < columnCount; i++) |
|
426 |
{ |
|
427 |
worksheet.Columns[i].AutoFit(); |
|
428 |
} |
|
429 |
|
|
430 |
|
|
431 |
|
|
432 |
var header = new CellStyle();//헤더 |
|
433 |
|
|
434 |
header.FillPattern.SetSolid(SpreadsheetColor.FromArgb(0, 100, 220)); |
|
435 |
header.Font.Weight = ExcelFont.BoldWeight; |
|
436 |
header.HorizontalAlignment = HorizontalAlignmentStyle.Center; |
|
437 |
header.VerticalAlignment = VerticalAlignmentStyle.Center; |
|
438 |
//worksheet.Cells.GetSubrange("A1:M1").Style = header; |
|
439 |
worksheet.Cells.GetSubrangeAbsolute(0, 0, collections.Count(), headerMembers.Count() - 1).Style = header; |
|
440 |
|
|
441 |
|
|
442 |
|
|
443 |
var style = new CellStyle(); |
|
444 |
//style.Borders.SetBorders(MultipleBorders.Right | MultipleBorders.Top | MultipleBorders.Left | MultipleBorders.Bottom, SpreadsheetColor.FromArgb(140, 120, 50), LineStyle.Thick);//바깥쪽 border 두껍게 성공 |
|
445 |
style.Borders.SetBorders(MultipleBorders.Outside, SpreadsheetColor.FromArgb(140, 120, 50), LineStyle.Thick);//바깥쪽 border 두껍게 성공 |
|
446 |
|
|
447 |
|
|
448 |
|
|
449 |
style.HorizontalAlignment = HorizontalAlignmentStyle.Center; |
|
450 |
style.VerticalAlignment = VerticalAlignmentStyle.Center; |
|
451 |
style.Font.Color = SpreadsheetColor.FromArgb(75, 60, 50);//글자 색갈 |
|
452 |
style.FillPattern.SetSolid(SpreadsheetColor.FromArgb(126, 239, 239));//cell 색갈 |
|
453 |
style.Font.Name = "맑은 고딕"; |
|
454 |
style.Font.Size = 9 * 20; |
|
455 |
worksheet.Cells.GetSubrangeAbsolute(0, 0, collections.Count(), headerMembers.Count() - 1).Style = style; |
|
456 |
//worksheet.Cells.GetSubrange("A1:M1858").Style = style; |
|
457 |
|
|
458 |
for (int line = 0; line < collections.Count() - 1; line++) //바깥border과 안쪽 얇은 border 같이 쓰면 안됨 |
|
459 |
{ |
|
460 |
//for (int j = 0; j < 14 - 1 - 1; j++) |
|
461 |
for (int j = 0; j < headerMembers.Count() - 1 - 1; j++) |
|
462 |
{ |
|
463 |
worksheet.Cells[line + 1, j + 1].Style.Borders.SetBorders(MultipleBorders.Outside, SpreadsheetColor.FromArgb(140, 120, 50), LineStyle.Thin);//안쪽 (1,1) ~ (마지막-1,마지막-1) 가운데 성공 |
|
464 |
} |
|
465 |
} |
|
466 |
|
|
467 |
|
|
468 |
for (int line = 0; line < collections.Count(); line++) //바깥border과 안쪽 얇은 border 같이 쓰면 안됨 |
|
469 |
{//Projectsource.Count() = 761개 ( 0 ~ 760 ) |
|
470 |
for (int j = 0; j < headerMembers.Count() - 1; j++) |
|
471 |
{ |
|
472 |
worksheet.Cells[0, j].Style.Borders.SetBorders(MultipleBorders.Right, SpreadsheetColor.FromArgb(140, 120, 50), LineStyle.Thin);//(0,0) ~ (0,마지막-1) 위 성공 |
|
473 |
|
|
474 |
worksheet.Cells[collections.Count(), j].Style.Borders.SetBorders(MultipleBorders.Right, SpreadsheetColor.FromArgb(140, 120, 50), LineStyle.Thin);//(마지막,0) ~ (마지막,마지막-1) 아래 성공 |
|
475 |
} |
|
476 |
|
|
477 |
worksheet.Cells[line, 0].Style.Borders.SetBorders(MultipleBorders.Bottom, SpreadsheetColor.FromArgb(140, 120, 50), LineStyle.Thin);//(0,0) ~ (마지막-1,0) 왼쪽 성공 |
|
478 |
|
|
479 |
worksheet.Cells[line, headerMembers.Count() - 1].Style.Borders.SetBorders(MultipleBorders.Bottom, SpreadsheetColor.FromArgb(140, 120, 50), LineStyle.Thin);//(0,마지막) ~ (마지막-1,마지막) 오른쪽 성공 |
|
480 |
|
|
481 |
} |
|
482 |
|
|
483 |
workbook.Save(SaveFile);//파일 열었던 파일로 저장 성공 |
|
484 |
MessageBox.Show("성공"); |
|
485 |
} |
|
486 |
|
|
487 |
catch (Exception ex) |
|
488 |
{ |
|
489 |
Console.WriteLine("예외 발생!! 메세지: {0}", ex.Message); |
|
490 |
} |
|
491 |
} |
|
492 |
|
|
493 |
} |
|
494 |
|
|
495 |
public class SelectedCountItem |
|
496 |
{ |
|
497 |
public string DisplayMember { get; set; } |
|
498 |
public int ValueMember { get; set; } |
|
499 |
} |
|
500 |
} |
ConvertService/ServiceBase/Markus.Service.StationController/ViewModel/MainViewModel.cs | ||
---|---|---|
91 | 91 |
Name = "Settings", |
92 | 92 |
Description = "Convert Station Settings", |
93 | 93 |
Content = new Views.SettingsView() |
94 |
}, |
|
95 |
new MenuItem |
|
96 |
{ |
|
97 |
Name = "DataBase Items", |
|
98 |
Description = "DataBase Items", |
|
99 |
Content = new Views.DataBaseView() |
|
94 | 100 |
} |
95 | 101 |
}; |
96 | 102 |
|
ConvertService/ServiceBase/Markus.Service.StationController/ViewModel/TotalStatusViewModel.cs | ||
---|---|---|
54 | 54 |
} |
55 | 55 |
} |
56 | 56 |
|
57 |
public TotalStatusViewModel()
|
|
58 |
{
|
|
59 |
}
|
|
57 |
public TotalStatusViewModel() |
|
58 |
{ |
|
59 |
} |
|
60 | 60 |
|
61 |
// 진행률에 변화가 있을때 이벤트가 발생
|
|
62 |
private void backgroundWorker_ProgressChanged(object sender, ProgressChangedEventArgs e)
|
|
63 |
{
|
|
64 |
}
|
|
61 |
// 진행률에 변화가 있을때 이벤트가 발생 |
|
62 |
private void backgroundWorker_ProgressChanged(object sender, ProgressChangedEventArgs e) |
|
63 |
{ |
|
64 |
} |
|
65 | 65 |
|
66 |
// 일이 모두 마쳤을때 수행되어야할 코드
|
|
67 |
private void backgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
|
|
68 |
{
|
|
69 |
}
|
|
66 |
// 일이 모두 마쳤을때 수행되어야할 코드 |
|
67 |
private void backgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) |
|
68 |
{ |
|
69 |
} |
|
70 | 70 |
|
71 |
// BackgroundWorker에서 수행할 일을 정의. |
|
72 |
private async void backgroundWorker_DoWork(object sender, DoWorkEventArgs e) |
|
71 |
// BackgroundWorker에서 수행할 일을 정의. |
|
72 |
private async void backgroundWorker_DoWork(object sender, DoWorkEventArgs e) |
|
73 |
{ |
|
74 |
while (IsAcitve) |
|
73 | 75 |
{ |
74 |
while (IsAcitve) |
|
76 |
System.Threading.Thread.Sleep(new TimeSpan(0, 0, 3)); |
|
77 |
|
|
78 |
if (!IsLoading) |
|
75 | 79 |
{ |
76 |
System.Threading.Thread.Sleep(new TimeSpan(0, 0, 3));
|
|
80 |
IsLoading = true;
|
|
77 | 81 |
|
78 |
if (!IsLoading)
|
|
82 |
try
|
|
79 | 83 |
{ |
80 |
IsLoading = true; |
|
81 |
|
|
82 |
try |
|
83 |
{ |
|
84 | 84 |
|
85 |
List<ConvertItem> newitems = new List<ConvertItem>();
|
|
85 |
List<ConvertItem> newitems = new List<ConvertItem>(); |
|
86 | 86 |
|
87 |
foreach (var client in App.StationClientList) |
|
87 |
foreach (var client in App.StationClientList) |
|
88 |
{ |
|
89 |
if (await SimplePingAsync(client.Endpoint.Address.ToString())) |
|
88 | 90 |
{ |
89 |
if (await SimplePingAsync(client.Endpoint.Address.ToString()))
|
|
91 |
try
|
|
90 | 92 |
{ |
91 |
try |
|
92 |
{ |
|
93 |
var items = await client.AliveConvertListAsync(); |
|
94 |
newitems.AddRange(items); |
|
95 |
System.Diagnostics.Trace.WriteLine($"{client.Endpoint.Address} ping"); |
|
96 |
|
|
97 |
if (items.Count() == 0) |
|
98 |
{ |
|
99 |
System.Diagnostics.Trace.WriteLine($"{client.Endpoint.Address} Alive Items is zero."); |
|
100 |
} |
|
101 |
} |
|
102 |
catch (Exception ex) |
|
93 |
var items = await client.AliveConvertListAsync(); |
|
94 |
newitems.AddRange(items); |
|
95 |
System.Diagnostics.Trace.WriteLine($"{client.Endpoint.Address} ping"); |
|
96 |
|
|
97 |
if (items.Count() == 0) |
|
103 | 98 |
{ |
104 |
System.Diagnostics.Trace.TraceError($"{client.Endpoint.Address} {ex.Message}");
|
|
99 |
System.Diagnostics.Trace.WriteLine($"{client.Endpoint.Address} Alive Items is zero.");
|
|
105 | 100 |
} |
106 | 101 |
} |
107 |
else
|
|
102 |
catch (Exception ex)
|
|
108 | 103 |
{ |
109 |
System.Diagnostics.Trace.TraceError($"{client.Endpoint.Address} ping Error");
|
|
104 |
System.Diagnostics.Trace.TraceError($"{client.Endpoint.Address} {ex.Message}");
|
|
110 | 105 |
} |
111 | 106 |
} |
112 |
|
|
113 |
}
|
|
114 |
catch (Exception ex)
|
|
115 |
{
|
|
107 |
else |
|
108 |
{
|
|
109 |
System.Diagnostics.Trace.TraceError($"{client.Endpoint.Address} ping Error");
|
|
110 |
}
|
|
116 | 111 |
} |
117 | 112 |
|
118 |
IsLoading = false; |
|
113 |
} |
|
114 |
catch (Exception ex) |
|
115 |
{ |
|
116 |
System.Diagnostics.Debug.WriteLine(ex.ToString()); |
|
119 | 117 |
} |
120 | 118 |
|
119 |
IsLoading = false; |
|
121 | 120 |
} |
121 |
|
|
122 | 122 |
} |
123 |
} |
|
123 | 124 |
|
124 | 125 |
|
125 |
private void LogWrite(string log, bool IsError) |
|
126 |
private void LogWrite(string log, bool IsError) |
|
127 |
{ |
|
128 |
if (IsError) |
|
126 | 129 |
{ |
127 |
if (IsError) |
|
128 |
{ |
|
129 |
System.Diagnostics.Trace.Fail(log); |
|
130 |
} |
|
131 |
else |
|
132 |
{ |
|
133 |
System.Diagnostics.Trace.TraceInformation(log); |
|
134 |
} |
|
130 |
System.Diagnostics.Trace.Fail(log); |
|
131 |
} |
|
132 |
else |
|
133 |
{ |
|
134 |
System.Diagnostics.Trace.TraceInformation(log); |
|
135 | 135 |
} |
136 |
} |
|
136 | 137 |
|
137 | 138 |
|
138 |
public static async Task<bool> SimplePingAsync(string uri)
|
|
139 |
{
|
|
140 |
bool result = false;
|
|
139 |
public static async Task<bool> SimplePingAsync(string uri) |
|
140 |
{ |
|
141 |
bool result = false; |
|
141 | 142 |
|
142 |
try |
|
143 |
try |
|
144 |
{ |
|
145 |
using (System.Net.Http.HttpClient Client = new System.Net.Http.HttpClient()) |
|
143 | 146 |
{ |
144 |
using (System.Net.Http.HttpClient Client = new System.Net.Http.HttpClient()) |
|
145 |
{ |
|
146 |
Client.Timeout = new TimeSpan(0, 5, 0); |
|
147 |
Client.Timeout = new TimeSpan(0, 5, 0); |
|
147 | 148 |
|
148 |
var message = await Client.GetAsync(uri);
|
|
149 |
var message = await Client.GetAsync(uri); |
|
149 | 150 |
|
150 |
System.Net.HttpStatusCode StatusCode = message.StatusCode;
|
|
151 |
System.Net.HttpStatusCode StatusCode = message.StatusCode; |
|
151 | 152 |
|
152 |
switch (StatusCode)
|
|
153 |
{
|
|
153 |
switch (StatusCode) |
|
154 |
{ |
|
154 | 155 |
|
155 |
case System.Net.HttpStatusCode.Accepted: |
|
156 |
case System.Net.HttpStatusCode.OK: |
|
157 |
result = true; |
|
158 |
break; |
|
159 |
} |
|
156 |
case System.Net.HttpStatusCode.Accepted: |
|
157 |
case System.Net.HttpStatusCode.OK: |
|
158 |
result = true; |
|
159 |
break; |
|
160 | 160 |
} |
161 | 161 |
} |
162 |
catch (Exception ex) |
|
163 |
{ |
|
164 |
result = false; |
|
165 |
} |
|
166 |
|
|
167 |
return result; |
|
168 | 162 |
} |
169 |
|
|
170 |
public override void Loaded() |
|
163 |
catch (Exception ex) |
|
171 | 164 |
{ |
172 |
base.Loaded(); |
|
165 |
result = false; |
|
166 |
System.Diagnostics.Debug.WriteLine(ex.ToString()); |
|
167 |
} |
|
173 | 168 |
|
174 |
if (!App.IsDesignMode) |
|
175 |
{ |
|
176 |
backgroundWorker = new BackgroundWorker(); |
|
177 |
backgroundWorker.DoWork += backgroundWorker_DoWork; |
|
178 |
backgroundWorker.RunWorkerCompleted += backgroundWorker_RunWorkerCompleted; |
|
179 |
backgroundWorker.WorkerReportsProgress = false; |
|
180 |
backgroundWorker.ProgressChanged += new ProgressChangedEventHandler(backgroundWorker_ProgressChanged); |
|
169 |
return result; |
|
170 |
} |
|
181 | 171 |
|
182 |
backgroundWorker.RunWorkerAsync();
|
|
183 |
}
|
|
184 |
}
|
|
172 |
public override void Loaded()
|
|
173 |
{
|
|
174 |
base.Loaded();
|
|
185 | 175 |
|
186 |
public override void Closed()
|
|
176 |
if (!App.IsDesignMode)
|
|
187 | 177 |
{ |
188 |
if (backgroundWorker != null) |
|
189 |
{ |
|
190 |
backgroundWorker.DoWork -= backgroundWorker_DoWork; |
|
191 |
backgroundWorker.RunWorkerCompleted -= backgroundWorker_RunWorkerCompleted; |
|
192 |
backgroundWorker.WorkerReportsProgress = false; |
|
193 |
backgroundWorker.ProgressChanged -= new ProgressChangedEventHandler(backgroundWorker_ProgressChanged); |
|
178 |
backgroundWorker = new BackgroundWorker(); |
|
179 |
backgroundWorker.DoWork += backgroundWorker_DoWork; |
|
180 |
backgroundWorker.RunWorkerCompleted += backgroundWorker_RunWorkerCompleted; |
|
181 |
backgroundWorker.WorkerReportsProgress = false; |
|
182 |
backgroundWorker.ProgressChanged += new ProgressChangedEventHandler(backgroundWorker_ProgressChanged); |
|
194 | 183 |
|
195 |
backgroundWorker.Dispose(); |
|
196 |
} |
|
184 |
backgroundWorker.RunWorkerAsync(); |
|
185 |
} |
|
186 |
} |
|
197 | 187 |
|
198 |
base.Closed(); |
|
188 |
public override void Closed() |
|
189 |
{ |
|
190 |
if (backgroundWorker != null) |
|
191 |
{ |
|
192 |
backgroundWorker.DoWork -= backgroundWorker_DoWork; |
|
193 |
backgroundWorker.RunWorkerCompleted -= backgroundWorker_RunWorkerCompleted; |
|
194 |
backgroundWorker.WorkerReportsProgress = false; |
|
195 |
backgroundWorker.ProgressChanged -= new ProgressChangedEventHandler(backgroundWorker_ProgressChanged); |
|
196 |
|
|
197 |
backgroundWorker.Dispose(); |
|
199 | 198 |
} |
199 |
|
|
200 |
base.Closed(); |
|
200 | 201 |
} |
202 |
} |
|
201 | 203 |
} |
ConvertService/ServiceBase/Markus.Service.StationController/Views/DataBaseView.xaml | ||
---|---|---|
1 |
<UserControl x:Class="Markus.Service.StationController.Views.DataBaseView" |
|
2 |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
|
3 |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|
4 |
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
|
5 |
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
|
6 |
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" |
|
7 |
xmlns:VM="clr-namespace:Markus.Service.StationController.ViewModel" |
|
8 |
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" |
|
9 |
mc:Ignorable="d" Background="White" |
|
10 |
d:DesignHeight="450" d:DesignWidth="800"> |
|
11 |
|
|
12 |
<UserControl.Resources> |
|
13 |
<Style TargetType="telerik:GridViewHeaderCell"> |
|
14 |
<Setter Property="HorizontalContentAlignment" Value="Center"/> |
|
15 |
<Setter Property="Background" Value="Gray"/> |
|
16 |
</Style> |
|
17 |
</UserControl.Resources> |
|
18 |
|
|
19 |
<UserControl.DataContext> |
|
20 |
<VM:DataBaseItemsModel/> |
|
21 |
</UserControl.DataContext> |
|
22 |
|
|
23 |
<i:Interaction.Triggers> |
|
24 |
<i:EventTrigger EventName="Loaded"> |
|
25 |
<i:InvokeCommandAction Command="{Binding LoadedCommand}"/> |
|
26 |
</i:EventTrigger> |
|
27 |
<i:EventTrigger EventName="Unloaded"> |
|
28 |
<i:InvokeCommandAction Command="{Binding ClosingCommand}"/> |
|
29 |
</i:EventTrigger> |
|
30 |
</i:Interaction.Triggers> |
|
31 |
|
|
32 |
<Grid HorizontalAlignment="Left"> |
|
33 |
<Grid.RowDefinitions> |
|
34 |
<RowDefinition Height="Auto"/> |
|
35 |
<RowDefinition Height="*"/> |
|
36 |
<RowDefinition Height="*"/> |
|
37 |
</Grid.RowDefinitions> |
|
38 |
<StackPanel Margin="0,10" Orientation="Horizontal" HorizontalAlignment="Right" Grid.Row="0" Height="20" > |
|
39 |
<TextBlock Text="Display Count : " VerticalAlignment="Center"/> |
|
40 |
<telerik:RadComboBox x:Name="ComboCount" Width="100" SelectedItem="{Binding SelectedCount, Mode=TwoWay}" Margin="0,0,10,0" SelectedValuePath="DisplayMember" |
|
41 |
DisplayMemberPath="ValueMember" ItemsSource="{Binding SelectedCountList}" SelectedIndex="0" /> |
|
42 |
<!--SelectedIndex 디폴트 값 ItemsSource콤보박스에 넣을 값 중 DisplayMemberPath 키와 값중 화면에 보여질거 선택 SelectedValuePath 콤보박스 아이템 선택하면 SelectedItem에 DisplayMember이 값나감--> |
|
43 |
<!--SelectedItem : object값 리턴--> |
|
44 |
<TextBlock Text="Status Type : " Margin="10,0,0,0" VerticalAlignment="Center"/> |
|
45 |
<telerik:RadComboBox Width="100" SelectedItem="{Binding SelectedStatus, Mode=TwoWay}" |
|
46 |
DisplayMemberPath="DisplayName" SelectedValuePath="Value" ItemsSource="{Binding StatusCodeList}" Height="20"/> |
|
47 |
<telerik:RadToggleButton Content=" 엑셀 저장 " Margin="10,0" Height="20" Command="{Binding DataSaveFileGemBoxCommand, Mode=OneWay}"/> |
|
48 |
</StackPanel> |
|
49 |
<GroupBox Grid.Row="1" |
|
50 |
Header="DataBase Items" BorderThickness="0" |
|
51 |
ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto"> |
|
52 |
<telerik:RadGridView x:Name="dataGrid1" GroupRenderMode="Flat" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" |
|
53 |
ItemsSource="{Binding FilterConvertSource}" |
|
54 |
SelectedItem="{Binding SelectFilterConvert}" |
|
55 |
AutoGenerateColumns="False" CanUserFreezeColumns="False" |
|
56 |
ColumnWidth="*" |
|
57 |
Grid.Row="1" ScrollViewer.CanContentScroll="False" IsFilteringAllowed="True" > |
|
58 |
<telerik:RadContextMenu.ContextMenu> |
|
59 |
<telerik:RadContextMenu x:Name= "GridContextMenu"> |
|
60 |
<telerik:RadContextMenu.Items> |
|
61 |
<telerik:RadMenuItem Header="Convert" Command="{Binding ConvertCommand}" ItemsSource="{Binding SelectedItem}" /> |
|
62 |
<telerik:RadMenuItem Header="Delete" Command="{Binding DeleteCommand}" ItemsSource="{Binding SelectedItem}"/> |
|
63 |
</telerik:RadContextMenu.Items> |
|
64 |
</telerik:RadContextMenu> |
|
65 |
</telerik:RadContextMenu.ContextMenu> |
|
66 |
|
|
67 |
<telerik:RadGridView.Columns> |
|
68 |
<telerik:GridViewDataColumn Header="Service ID" |
|
69 |
DataMemberBinding="{Binding ServiceID }" MinWidth="250" MaxWidth="270"/> |
|
70 |
<telerik:GridViewDataColumn Header="Convert ID " |
|
71 |
DataMemberBinding="{Binding ConvertID}" MinWidth="180" MaxWidth="200" /> |
|
72 |
<telerik:GridViewDataColumn Header="ProjectNO" |
|
73 |
DataMemberBinding="{Binding ProjectNumber}" MinWidth="50" MaxWidth="70"/> |
|
74 |
|
|
75 |
<telerik:GridViewDataColumn Header="ConvertState" |
|
76 |
DataMemberBinding="{Binding ConvertState,Mode=TwoWay}" MinWidth="60" MaxWidth="80" /> |
|
77 |
|
|
78 |
<telerik:GridViewDataColumn Header="CurrentPageNo" |
|
79 |
DataMemberBinding="{Binding CurrentPageNo,Mode=TwoWay}" MinWidth="80" MaxWidth="100"/> |
|
80 |
<telerik:GridViewDataColumn Header="TotalPage" |
|
81 |
DataMemberBinding="{Binding TotalPage}" MinWidth="60" MaxWidth="80" /> |
|
82 |
<!--<telerik:GridViewDataColumn Header=" OriginfilePath" |
|
83 |
DataMemberBinding="{Binding OriginfilePath}" MinWidth="170"/>--> |
|
84 |
<telerik:GridViewDynamicHyperlinkColumn Header="원본파일" |
|
85 |
NavigateUrlFormatString="{} {0}" |
|
86 |
NavigateUrlMemberPaths="OriginfilePath" |
|
87 |
Width="150"> |
|
88 |
<telerik:GridViewDynamicHyperlinkColumn.CellTemplate> |
|
89 |
<DataTemplate> |
|
90 |
<TextBlock Text="{Binding FileName}"/> |
|
91 |
</DataTemplate> |
|
92 |
</telerik:GridViewDynamicHyperlinkColumn.CellTemplate> |
|
93 |
</telerik:GridViewDynamicHyperlinkColumn> |
|
94 |
|
|
95 |
<telerik:GridViewDataColumn Header=" ConvertPath" |
|
96 |
DataMemberBinding="{Binding ConvertPath}" MinWidth="70" MaxWidth="90"/> |
|
97 |
<telerik:GridViewDataColumn Header="CreateTime" |
|
98 |
DataMemberBinding="{Binding CreateTime , StringFormat=\{0:yyyy.MM.dd HH:mm:ss\}}" MinWidth="120" MaxWidth="140"/> |
|
99 |
<telerik:GridViewDataColumn Header="Exception" |
|
100 |
DataMemberBinding="{Binding Exception}" MinWidth="60" MaxWidth="80"/> |
|
101 |
<telerik:GridViewDataColumn Header="ProcessorAffinity" |
|
102 |
DataMemberBinding="{Binding ProcessorAffinity}" MinWidth="90" MaxWidth="110"/> |
|
103 |
<telerik:GridViewDataColumn Header="ReConverter" |
내보내기 Unified diff