프로젝트

일반

사용자정보

개정판 5a954acc

ID5a954acc8178b874e3fea4461dbfb0fba1dcf90e
상위 902f397c
하위 87d56836

semi 이(가) 약 5년 전에 추가함

FilterConvertSourceView 수정

Change-Id: I722ba6f320480c737ef6f0fc97612116ead4ae82

차이점 보기:

ConvertService/ServiceBase/Markus.Service.StationController/ViewModel/DataBaseItemsModel.cs
39 39
            DeleteCommand = new DelegateCommand(DataDelete);
40 40
            ValidateCommand = new DelegateCommand(DataValidate);
41 41
            MarkusLinkCommand = new DelegateCommand(MarkusLink);
42
            RemoveCreateTimeFilterCommand = new DelegateCommand(RemoveCreateTimeFilter);
43
            FilterConvertSourceView.Filter = new Predicate<object>(o => DetailFilter(o as ConvertItem));
42 44
        }
43 45

  
44 46
        #endregion
......
56 58
            }
57 59
        }
58 60

  
61
        public ICollectionView FilterConvertSourceView
62
        {
63
            get { return CollectionViewSource.GetDefaultView(FilterConvertSource); }
64
        }
65

  
59 66
        private System.Collections.ObjectModel.ObservableCollection<ConvertItem> _FilterConvertSource;
60 67
        public System.Collections.ObjectModel.ObservableCollection<ConvertItem> FilterConvertSource
61 68
        {
62 69
            //get => _FilterConvertSource;
63 70
            get
64 71
            {
65
                //if (_FilterConvertSource == null)
66
                //{
67
                //    _FilterConvertSource = new System.Collections.ObjectModel.ObservableCollection<ConvertItem>();
68
                //}
69
                //var view = CollectionViewSource.GetDefaultView(FilterConvertSource);
70
                //if (view.CanFilter)
72
                if (_FilterConvertSource == null)
73
                {
74
                    _FilterConvertSource = new System.Collections.ObjectModel.ObservableCollection<ConvertItem>();
75
                }
76
                //if (_FilterConvertSource != null)
71 77
                //{
72
                //    view.Filter = TestFilter;
78
                //    var view = CollectionViewSource.GetDefaultView(FilterConvertSource);
79
                //    if (view.CanFilter)
80
                //    {
81
                //        view.Filter = DetailFilter;
82
                //    }
73 83
                //}
74 84
                return _FilterConvertSource;
75 85
            }
......
237 247
                if (_ProjectNumberFilter != value)
238 248
                {
239 249
                    _ProjectNumberFilter = value;
240
                    OnPropertyChanged(() => ProjectNumberFilter); 
241
                    CollectionViewSource.GetDefaultView(FilterConvertSource).Refresh();
250
                    OnPropertyChanged(() => ProjectNumberFilter);
251
                    //CollectionViewSource.GetDefaultView(FilterConvertSource).Refresh();
252
                    FilterConvertSourceView.Refresh();
242 253
                }
243 254
            }
244 255
        }
......
253 264
                {
254 265
                    _UniqueKeyFilter = value;
255 266
                    OnPropertyChanged(() => UniqueKeyFilter);
256
                    CollectionViewSource.GetDefaultView(FilterConvertSource).Refresh();
267
                    //CollectionViewSource.GetDefaultView(FilterConvertSource).Refresh();
268
                    FilterConvertSourceView.Refresh();
257 269
                }
258 270
            }
259 271
        }
260 272

  
261
        public string _ConvertStateFilter;
262
        public string ConvertStateFilter
273
        public StatusCodeType _ConvertStateFilter;
274
        public StatusCodeType ConvertStateFilter
263 275
        {
264 276
            get { return _ConvertStateFilter; }
265 277
            set
......
268 280
                {
269 281
                    _ConvertStateFilter = value;
270 282
                    OnPropertyChanged(() => ConvertStateFilter);
271
                    CollectionViewSource.GetDefaultView(FilterConvertSource).Refresh();
283
                    //CollectionViewSource.GetDefaultView(FilterConvertSource).Refresh();
284
                    FilterConvertSourceView.Refresh();
272 285
                }
273 286
            }
274 287
        }
......
283 296
                {
284 297
                    _Docuemnt_NOFilter = value;
285 298
                    OnPropertyChanged(() => Docuemnt_NOFilter);
286
                    CollectionViewSource.GetDefaultView(FilterConvertSource).Refresh();
299
                    //CollectionViewSource.GetDefaultView(FilterConvertSource).Refresh();
300
                    FilterConvertSourceView.Refresh();
287 301
                }
288 302
            }
289 303
        }
......
298 312
                {
299 313
                    _Docuemnt_NameFilter = value;
300 314
                    OnPropertyChanged(() => Docuemnt_NameFilter);
301
                    CollectionViewSource.GetDefaultView(FilterConvertSource).Refresh();
315
                    //CollectionViewSource.GetDefaultView(FilterConvertSource).Refresh();
316
                    FilterConvertSourceView.Refresh();
302 317
                }
303 318
            }
304 319
        }
305 320

  
306
        public string _ReconverterFilter;
307
        public string ReconverterFilter
321
        public int? _ReconverterFilter;
322
        public int? ReconverterFilter
308 323
        {
309 324
            get { return _ReconverterFilter; }
310 325
            set
......
313 328
                {
314 329
                    _ReconverterFilter = value;
315 330
                    OnPropertyChanged(() => ReconverterFilter);
316
                    CollectionViewSource.GetDefaultView(FilterConvertSource).Refresh();
331
                    //CollectionViewSource.GetDefaultView(FilterConvertSource).Refresh();
332
                    FilterConvertSourceView.Refresh();
333

  
317 334
                }
318 335
            }
319 336
        }
......
328 345
                {
329 346
                    _Service_IDFilter = value;
330 347
                    OnPropertyChanged(() => Service_IDFilter);
331
                    CollectionViewSource.GetDefaultView(FilterConvertSource).Refresh();
348
                    //CollectionViewSource.GetDefaultView(FilterConvertSource).Refresh();
349
                    FilterConvertSourceView.Refresh();
332 350
                }
333 351
            }
334 352
        }
......
343 361
                {
344 362
                    _RevisionFilter = value;
345 363
                    OnPropertyChanged(() => RevisionFilter);
346
                    CollectionViewSource.GetDefaultView(FilterConvertSource).Refresh();
364
                    //CollectionViewSource.GetDefaultView(FilterConvertSource).Refresh();
365
                    FilterConvertSourceView.Refresh();
347 366
                }
348 367
            }
349 368
        }
369

  
370
        private DateTime _SelectedCreateTimeBegin = DateTime.Now;
371
        public DateTime SelectedCreateTimeBegin
372
        {
373

  
374
            get { return _SelectedCreateTimeBegin; }
375
            set
376
            {
377
                if (_SelectedCreateTimeBegin == value)
378
                    return;
379
                _SelectedCreateTimeBegin = value;
380
                OnPropertyChanged(() => SelectedCreateTimeBegin);
381
                //CollectionViewSource.GetDefaultView(FilterConvertSource).Refresh();
382
                FilterConvertSourceView.Refresh();
383
                //AddGeneratorBeginFilter();
384

  
385
            }
386
        }
387

  
388
        private DateTime _SelectedCreateTimeEnd = DateTime.Now;
389
        public DateTime SelectedCreateTimeEnd
390
        {
391

  
392
            get { return _SelectedCreateTimeEnd; }
393
            set
394
            {
395
                if (_SelectedCreateTimeEnd == value)
396
                    return;
397
                _SelectedCreateTimeEnd = value;
398
                OnPropertyChanged(() => SelectedCreateTimeEnd);
399
                //CollectionViewSource.GetDefaultView(FilterConvertSource).Refresh();
400
                FilterConvertSourceView.Refresh();
401
                //AddGeneratorBeginFilter();
402

  
403
            }
404
        }
405

  
350 406
        #endregion
351 407

  
352 408
        #region Command
......
356 412
        public DelegateCommand ValidateCommand { get; private set; }
357 413
        public DelegateCommand DataSaveFileGemBoxCommand { get; private set; }
358 414
        public DelegateCommand MarkusLinkCommand { get; private set; }
415
        public DelegateCommand RemoveCreateTimeFilterCommand { get; private set;}
416

  
359 417
        #endregion
360 418

  
361 419
        #region Main Logic
......
478 536
                        _status = (int)SelectedStatus.Value;
479 537
                    }
480 538

  
481
                    //if (ProjectNumberFilter != null)
482
                    //{
483
                    //    from item in FilterConvertSource
484
                    //    where like % item.ProjectNumber
485
                    //}
486

  
487
                    var items = database.GetConvertProjects(_status)//x:database객체 y:statusCodeTypeList의값  Count()안에 predicator 조건 만족하면 count개수안에 넣음
488
                                          .Take(SelectedCount.ValueMember).ToList();
539
                    //var items = database.GetConvertProjects(_status)//x:database객체 y:statusCodeTypeList의값  Count()안에 predicator 조건 만족하면 count개수안에 넣음
540
                    //                      .Take(SelectedCount.ValueMember).ToList();
541
                    var items = database.GetConvertProjects(_status).ToList();
542
                    if (ProjectNumberFilter != null)
543
                    {
544
                        items.Where(x => x.ProjectNumber.Contains("/" + ProjectNumberFilter + "/"));
545
                    }
546
                    if (Docuemnt_NameFilter != null)
547
                    {
548
                        items.Where(x => x.DocumnetName.Contains("/" + Docuemnt_NameFilter + "/"));
549
                    }
550
                    if (Service_IDFilter != null)
551
                    {
552
                        items.Where(x => x.ServiceID.Contains("/" + Service_IDFilter + "/"));
553
                    }
554
                    if (UniqueKeyFilter != null)
555
                    {
556
                        items.Where(x => x.UniqueKey.Contains("/" + UniqueKeyFilter + "/"));
557
                    }
558
                    if (Docuemnt_NOFilter != null)
559
                    {
560
                        items.Where(x => x.DocumnetNo.Contains("/" + Docuemnt_NOFilter + "/"));
561
                    }
562
                    if (ReconverterFilter.HasValue)
563
                    {
564
                        items.Where(x => x.ReConverter == ReconverterFilter.Value);
565
                    }
566
                    if (RevisionFilter != null)
567
                    {
568
                        items.Where(x => x.Revision.Contains("/" + RevisionFilter + "/"));
569
                    }
570
                    items = items.Take(SelectedCount.ValueMember).ToList();
489 571

  
490 572
                    if (collection.Count() == 0)
491 573
                    {
......
917 999

  
918 1000
        #endregion
919 1001

  
920
        #region TestFilter
1002
        #region DetailFilter
921 1003

  
922 1004

  
923 1005
        /// <summary>
924 1006
        /// Grid Filter
925 1007
        /// </summary>
926 1008

  
927
        private bool TestFilter(object item)
1009
        private bool DetailFilter(object item)
928 1010
        {
929 1011
            var Item = item as ConvertItem;
930 1012
            if (ProjectNumberFilter == null) return true;
931 1013
            if (ProjectNumberFilter == Item.ProjectNumber) return true;
1014
            //if (ConvertStateFilter == null) return true;
1015
            //if (ConvertStateFilter == (StatusCodeType)Item.ConvertState) return true;
1016
            if (Docuemnt_NameFilter == null) return true;
1017
            if (Docuemnt_NameFilter == Item.DocumnetName) return true;
1018
            if (Service_IDFilter == null) return true;
1019
            if (Service_IDFilter == Item.ServiceID) return true;
1020
            if (UniqueKeyFilter == null) return true;
1021
            if (UniqueKeyFilter == Item.UniqueKey) return true;
1022
            if (Docuemnt_NOFilter == null) return true;
1023
            if (Docuemnt_NOFilter == Item.DocumnetNo) return true;
1024
            if (ReconverterFilter == null) return true;
1025
            if (ReconverterFilter == Item.ReConverter) return true;
1026
            if (RevisionFilter == null) return true;
1027
            if (RevisionFilter == Item.Revision) return true;
1028

  
932 1029
            return false;
933 1030
        }
934 1031

  
1032
        public void RemoveCreateTimeFilter(object obj)//미완성
1033
        {
1034
            SelectedCreateTimeBegin = DateTime.Now;
1035
            SelectedCreateTimeEnd = DateTime.Now;
1036
        }
1037

  
935 1038
        #endregion
936 1039

  
937 1040
        #endregion

내보내기 Unified diff

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