프로젝트

일반

사용자정보

개정판 c7955b40

IDc7955b40e48122cfa18a51583ded63eefc874e96
상위 80391351
하위 e139272d, 53deabaf

semi 이(가) 4년 이상 전에 추가함

search 후 Convert 수정

Change-Id: I3c9e136d7fe702e379ec5dfc7b016bb0d3a34745

차이점 보기:

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

  
16
using System.Collections.ObjectModel;
17 17

  
18 18
namespace Markus.Service.StationController.ViewModel
19 19
{
......
92 92
            }
93 93
        }
94 94

  
95
        private List<ConvertCOUNT> _DashBoard;
96
        public List<ConvertCOUNT> DashBoard
95
        private ObservableCollection<ConvertCOUNT> _ConvertCOUNTDashBoard;
96
        public ObservableCollection<ConvertCOUNT> ConvertCOUNTDashBoard
97 97
        {
98 98
            get
99 99
            {
100
                if (_DashBoard == null)
100
                if (_ConvertCOUNTDashBoard == null)
101 101
                {
102
                    _DashBoard = new List<ConvertCOUNT>();
102
                    _ConvertCOUNTDashBoard = new ObservableCollection<ConvertCOUNT>();
103 103
                }
104
                return _DashBoard;
104
                return _ConvertCOUNTDashBoard;
105 105
            }
106 106
            set
107 107
            {
108
                _DashBoard = value;
109
                OnPropertyChanged(() => DashBoard);
108
                if (_ConvertCOUNTDashBoard != value)
109
                {
110
                    _ConvertCOUNTDashBoard = value;
111
                    OnPropertyChanged(() => ConvertCOUNTDashBoard);
112
                }
113
            }
114
        }
115

  
116
        private ObservableCollection<FinalPDFCOUNT> _FinalPDFCOUNTDashBoard;
117
        public ObservableCollection<FinalPDFCOUNT> FinalPDFCOUNTDashBoard
118
        {
119
            get
120
            {
121
                if (_FinalPDFCOUNTDashBoard == null)
122
                {
123
                    _FinalPDFCOUNTDashBoard = new ObservableCollection<FinalPDFCOUNT>();
124
                }
125
                return _FinalPDFCOUNTDashBoard;
126
            }
127
            set
128
            {
129
                if (_FinalPDFCOUNTDashBoard != value)
130
                {
131
                    _FinalPDFCOUNTDashBoard = value;
132
                    OnPropertyChanged(() => FinalPDFCOUNTDashBoard);
133
                }
110 134
            }
111 135
        }
112 136

  
......
217 241
        /// </summary>
218 242
        private void DataSelect()
219 243
        {
220
            if (DashBoard == null)
244
            if (ConvertCOUNTDashBoard == null)
245
            {
246
                ConvertCOUNTDashBoard = new ObservableCollection<ConvertCOUNT>();
247
            }
248
            if(FinalPDFCOUNTDashBoard == null)
221 249
            {
222
                DashBoard = new List<ConverCOUNT>();
250
                FinalPDFCOUNTDashBoard = new ObservableCollection<FinalPDFCOUNT>();
223 251
            }
224 252

  
225 253
            if (SelectedStatus != null)
226 254
            {
227
                DataSelect(new[] { (ConvertPDF.StatusCodeType)(SelectedStatus.Value) }, DashBoard);
255
                ConvertDataSelect(new[] { (ConvertPDF.StatusCodeType)(SelectedStatus.Value) }, ConvertCOUNTDashBoard);
256
                FinalPDFDataSelect(new[] { (ConvertPDF.StatusCodeType)(SelectedStatus.Value) }, FinalPDFCOUNTDashBoard);
228 257
            }
229

  
230 258
        }
231 259

  
232
        private void DataSelect(IEnumerable<ConvertPDF.StatusCodeType> statusCodeTypeList, List<ConverCOUNT> collection)
260
        private void ConvertDataSelect(IEnumerable<ConvertPDF.StatusCodeType> statusCodeTypeList, ObservableCollection<ConvertCOUNT> collection)
233 261
        {
234 262
            try
235 263
            {
......
255 283

  
256 284
                    var items = entities.SELECT_CONVERT_COUNT(_status, Start_CreateTime, Finish_CreateTime).ToList();
257 285

  
258
                    List<ConverCOUNT> Listitems = new List<ConverCOUNT>();
286
                    List<ConvertCOUNT> Listitems = new List<ConvertCOUNT>();
259 287

  
260 288
                    for (int i = 0; i < items.Count; i++)
261 289
                    {
262
                        ConverCOUNT AddItem = new ConverCOUNT(items[i].PROJECT_NO, items[i].COUNT, items[i].EXCEPTION_COUNT);
290
                        ConvertCOUNT AddItem = new ConvertCOUNT(items[i].PROJECT_NO, items[i].COUNT, items[i].EXCEPTION_COUNT);
263 291
                        Listitems.Add(AddItem);
264 292
                    }
265 293

  
......
269 297
                        {
270 298
                            foreach (var x in Listitems)
271 299
                            {
272
                                collection.Add(x);//observationcollection add하면 오류 & telerik chart버전 문제 
300
                                collection.Add(x); 
273 301
                            }
274 302
                        }
275 303
                    }
......
320 348
            catch (Exception ex)
321 349
            {
322 350
                MessageBox.Show(ex.ToString());
323
                //System.Diagnostics.Debug.WriteLine(ex.ToString());
324 351
            }
325 352
        }
326 353

  
354
        private void FinalPDFDataSelect(IEnumerable<ConvertPDF.StatusCodeType> statusCodeTypeList, ObservableCollection<FinalPDFCOUNT> collection)
355
        {
356
            try
357
            {
358
                using (markusEntities entities = new markusEntities(App.MarkusDataBaseConnecitonString))
359
                {
360
                    int _status = 0;
361
                    if (SelectedStatus != null)
362
                    {
363
                        _status = (int)SelectedStatus.Value;
364
                    }
365

  
366
                    //DocumentID = unikey
367
                    DateTime? Start_CreateTime = null;
368
                    DateTime? Finish_CreateTime = null;
369
                    if (SelectedCreateTimeBegin != DefaultCreateTime)
370
                    {
371
                        Start_CreateTime = SelectedCreateTimeBegin;
372
                    }
373
                    if (SelectedCreateTimeEnd != DefaultCreateTime)
374
                    {
375
                        Finish_CreateTime = SelectedCreateTimeEnd;
376
                    }
377

  
378
                    var items = entities.SELECT_FINALPDF_COUNT(_status, Start_CreateTime, Finish_CreateTime).ToList();
379

  
380
                    List<FinalPDFCOUNT> Listitems = new List<FinalPDFCOUNT>();
381

  
382
                    for (int i = 0; i < items.Count; i++)
383
                    {
384
                        FinalPDFCOUNT AddItem = new FinalPDFCOUNT(items[i].PROJECT_NO, items[i].COUNT, items[i].EXCEPTION_COUNT);
385
                        Listitems.Add(AddItem);
386
                    }
387

  
388
                    if (collection.Count() == 0)
389
                    {
390
                        if (statusCodeTypeList.Count() == 1)
391
                        {
392
                            foreach (var x in Listitems)
393
                            {
394
                                collection.Add(x);
395
                            }
396
                        }
397
                    }
398
                    else
399
                    {
400

  
401
                        //세미 업데이트
402
                        foreach (var newitem in Listitems)
403
                        {
404
                            collection.UpdateWhere(changeitem =>
405
                            ConvertItemEx.ChangeValues(changeitem, newitem), x => x.Project_NO == newitem.Project_NO && x.Count == newitem.Count);
406
                        }
407

  
408

  
409
                        if (statusCodeTypeList.Count() == 1)
410
                        {
411

  
412
                            //삭제
413
                            for (int i = collection.Count() - 1; i >= 0; --i)
414
                            {
415
                                var item = collection[i];
416

  
417
                                if (Listitems.Count(x => x.Project_NO == item.Project_NO && x.Count == item.Count) == 0)
418
                                {
419
                                    collection.RemoveAt(i);
420
                                }
421
                            }
422
                        }
423

  
424
                        if (statusCodeTypeList.Count() == 1)
425
                        {
426
                            //추가 convert 후 추가됨
427
                            foreach (var item in Listitems)
428
                            {
429
                                if (collection.Count(x => x.Project_NO == item.Project_NO && x.Count == item.Count) == 0)
430
                                {
431
                                    for (int i = 0; i < 200; i++)
432
                                    {
433
                                        collection.Add(item);
434
                                        break;
435
                                    }
436
                                }
437
                            }
438
                        }
439
                    }
440
                }
441
            }
442
            catch (Exception ex)
443
            {
444
                MessageBox.Show(ex.ToString());
445
            }
446
        }
327 447
        #endregion
328 448

  
329 449
        #endregion

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)