개정판 80391351
SelectedItems 수정
Change-Id: I942d91a7d78fbf05b2fb94fd782be9877423ffed
ConvertService/ServiceBase/Markus.Service.StationController/ViewModel/DashBoardViewModel.cs | ||
---|---|---|
13 | 13 |
using System.Windows; |
14 | 14 |
using System.Windows.Threading; |
15 | 15 |
using ConverCOUNT = Markus.Service.StationController.Data.ConvertCOUNT; |
16 |
using System.Collections.ObjectModel; |
|
16 |
|
|
17 | 17 |
|
18 | 18 |
namespace Markus.Service.StationController.ViewModel |
19 | 19 |
{ |
20 |
class DashBoardViewModel : Mvvm.ToolKit.ViewModelBase |
|
20 |
class DashBoardViewModel : Mvvm.ToolKit.ViewModelBase
|
|
21 | 21 |
{ |
22 | 22 |
#region Constructor |
23 | 23 |
|
... | ... | |
92 | 92 |
} |
93 | 93 |
} |
94 | 94 |
|
95 |
private ObservableCollection<ConvertCOUNT> _ExceptionCount; |
|
96 |
public ObservableCollection<ConvertCOUNT> ExceptionCount |
|
97 |
{ |
|
98 |
get |
|
99 |
{ |
|
100 |
if (_ExceptionCount == null) |
|
101 |
{ |
|
102 |
_ExceptionCount = new ObservableCollection<ConvertCOUNT>(); |
|
103 |
} |
|
104 |
return _ExceptionCount; |
|
105 |
} |
|
106 |
set |
|
107 |
{ |
|
108 |
_ExceptionCount = value; |
|
109 |
OnPropertyChanged(() => ExceptionCount); |
|
110 |
} |
|
111 |
} |
|
112 |
|
|
113 |
|
|
114 |
private ObservableCollection<ConvertCOUNT> _ConvertCount; |
|
115 |
public ObservableCollection<ConvertCOUNT> ConvertCount |
|
95 |
private List<ConvertCOUNT> _DashBoard; |
|
96 |
public List<ConvertCOUNT> DashBoard |
|
116 | 97 |
{ |
117 | 98 |
get |
118 | 99 |
{ |
119 |
if (_ConvertCount == null)
|
|
100 |
if (_DashBoard == null)
|
|
120 | 101 |
{ |
121 |
_ConvertCount = new ObservableCollection<ConvertCOUNT>();
|
|
102 |
_DashBoard = new List<ConvertCOUNT>();
|
|
122 | 103 |
} |
123 |
return _ConvertCount;
|
|
104 |
return _DashBoard;
|
|
124 | 105 |
} |
125 | 106 |
set |
126 | 107 |
{ |
127 |
_ConvertCount = value;
|
|
128 |
OnPropertyChanged(() => ConvertCount);
|
|
108 |
_DashBoard = value;
|
|
109 |
OnPropertyChanged(() => DashBoard);
|
|
129 | 110 |
} |
130 | 111 |
} |
131 | 112 |
|
... | ... | |
236 | 217 |
/// </summary> |
237 | 218 |
private void DataSelect() |
238 | 219 |
{ |
239 |
/// combobox 에서 선택된 items |
|
220 |
if (DashBoard == null) |
|
221 |
{ |
|
222 |
DashBoard = new List<ConverCOUNT>(); |
|
223 |
} |
|
224 |
|
|
240 | 225 |
if (SelectedStatus != null) |
241 | 226 |
{ |
242 |
DataSelect(new[] { (ConvertPDF.StatusCodeType)(SelectedStatus.Value) } );
|
|
227 |
DataSelect(new[] { (ConvertPDF.StatusCodeType)(SelectedStatus.Value) }, DashBoard);
|
|
243 | 228 |
} |
244 | 229 |
|
245 | 230 |
} |
246 | 231 |
|
247 |
private void DataSelect(IEnumerable<ConvertPDF.StatusCodeType> statusCodeTypeList) |
|
232 |
private void DataSelect(IEnumerable<ConvertPDF.StatusCodeType> statusCodeTypeList, List<ConverCOUNT> collection)
|
|
248 | 233 |
{ |
249 | 234 |
try |
250 | 235 |
{ |
... | ... | |
270 | 255 |
|
271 | 256 |
var items = entities.SELECT_CONVERT_COUNT(_status, Start_CreateTime, Finish_CreateTime).ToList(); |
272 | 257 |
|
273 |
ObservableCollection<ConverCOUNT> Listitems = new ObservableCollection<ConverCOUNT>();
|
|
258 |
List<ConverCOUNT> Listitems = new List<ConverCOUNT>();
|
|
274 | 259 |
|
275 |
ExceptionCount.Clear(); |
|
276 |
ConvertCount.Clear(); |
|
277 |
for (int i=0; i<items.Count; i++) |
|
260 |
for (int i = 0; i < items.Count; i++) |
|
278 | 261 |
{ |
279 |
if (i < items.Count / 2) |
|
262 |
ConverCOUNT AddItem = new ConverCOUNT(items[i].PROJECT_NO, items[i].COUNT, items[i].EXCEPTION_COUNT); |
|
263 |
Listitems.Add(AddItem); |
|
264 |
} |
|
265 |
|
|
266 |
if (collection.Count() == 0) |
|
267 |
{ |
|
268 |
if (statusCodeTypeList.Count() == 1) |
|
269 |
{ |
|
270 |
foreach (var x in Listitems) |
|
271 |
{ |
|
272 |
collection.Add(x);//observationcollection add하면 오류 & telerik chart버전 문제 |
|
273 |
} |
|
274 |
} |
|
275 |
} |
|
276 |
else |
|
277 |
{ |
|
278 |
|
|
279 |
//세미 업데이트 |
|
280 |
foreach (var newitem in Listitems) |
|
280 | 281 |
{ |
281 |
ConverCOUNT AddItem = new ConverCOUNT(items[i].PROJECT_NO, items[i].COUNT);
|
|
282 |
ExceptionCount.Add(AddItem);
|
|
282 |
collection.UpdateWhere(changeitem =>
|
|
283 |
ConvertItemEx.ChangeValues(changeitem, newitem), x => x.Project_NO == newitem.Project_NO && x.Count == newitem.Count);
|
|
283 | 284 |
} |
284 |
else |
|
285 |
|
|
286 |
|
|
287 |
if (statusCodeTypeList.Count() == 1) |
|
288 |
{ |
|
289 |
|
|
290 |
//삭제 |
|
291 |
for (int i = collection.Count() - 1; i >= 0; --i) |
|
292 |
{ |
|
293 |
var item = collection[i]; |
|
294 |
|
|
295 |
if (Listitems.Count(x => x.Project_NO == item.Project_NO && x.Count == item.Count) == 0) |
|
296 |
{ |
|
297 |
collection.RemoveAt(i); |
|
298 |
} |
|
299 |
} |
|
300 |
} |
|
301 |
|
|
302 |
if (statusCodeTypeList.Count() == 1) |
|
285 | 303 |
{ |
286 |
ConverCOUNT AddItem = new ConverCOUNT(items[i].PROJECT_NO, items[i].COUNT); |
|
287 |
ConvertCount.Add(AddItem); |
|
304 |
//추가 convert 후 추가됨 |
|
305 |
foreach (var item in Listitems) |
|
306 |
{ |
|
307 |
if (collection.Count(x => x.Project_NO == item.Project_NO && x.Count == item.Count) == 0) |
|
308 |
{ |
|
309 |
for (int i = 0; i < 200; i++) |
|
310 |
{ |
|
311 |
collection.Add(item); |
|
312 |
break; |
|
313 |
} |
|
314 |
} |
|
315 |
} |
|
288 | 316 |
} |
289 | 317 |
} |
290 | 318 |
} |
291 |
|
|
292 | 319 |
} |
293 | 320 |
catch (Exception ex) |
294 | 321 |
{ |
내보내기 Unified diff