void GetFilterNotamCodes() { this.AllNotamCodes.Clear(); var notamCodefilter = new NotamCodesFilter(); notamCodefilter.SubjectFilter = SubjectFilter; notamCodefilter.SubjectDescFilter = SubjectDescFilter; notamCodefilter.ConditionFilter = ConditionFilter; notamCodefilter.ConditionDescFilter = ConditionDescFilter; List<NotamCodeViewModel> all = (from cust in _notamCodeService.GetFilterdNotamCodes(notamCodefilter) select new NotamCodeViewModel(cust, _notamCodeService, parentWorkSpaces)).ToList(); foreach (NotamCodeViewModel cvm in all) { cvm.PropertyChanged += this.OnNotamCodeViewModelPropertyChanged; this.AllNotamCodes.Add(cvm); } this.AllNotamCodes.CollectionChanged += this.OnCollectionChanged; }
public List<NotamCode> GetFilterdNotamCodes(NotamCodesFilter codeFilter) { List<NotamCode> result = null; if (_dataContext != null) { try { result = _NotamCode.Where( n => (String.IsNullOrEmpty(codeFilter.SubjectFilter) || (!String.IsNullOrEmpty(n.Subject) && n.Subject.Contains(codeFilter.SubjectFilter)))).Where( n => (String.IsNullOrEmpty(codeFilter.SubjectDescFilter) || (!String.IsNullOrEmpty(n.Subject_Desc) && n.Subject_Desc.ToUpper().Contains(codeFilter.SubjectDescFilter)))).Where( n => (String.IsNullOrEmpty(codeFilter.ConditionFilter) || (!String.IsNullOrEmpty(n.Condition) && n.Condition.Contains(codeFilter.ConditionFilter)))).Where( n => (String.IsNullOrEmpty(codeFilter.ConditionDescFilter) || (!String.IsNullOrEmpty(n.Condition_Desc) && (n.Condition_Desc).ToUpper().Contains(codeFilter.ConditionDescFilter)))) .ToList(); } catch (System.Exception ex) { string s = ex.Message; } } return result; }