///<summary> ///</summary> ///<param name="initialCollection"></param> ///<param name="resultCollection"></param> private void FilterItems(IEnumerable <FlightNumber> initialCollection, ICommonCollection <FlightNumber> resultCollection) { if (_filter == null || _filter.All(i => i.Values.Length == 0)) { resultCollection.Clear(); resultCollection.AddRange(initialCollection); return; } resultCollection.Clear(); foreach (var pd in initialCollection) { if (_filter.FilterTypeAnd) { bool acceptable = true; foreach (ICommonFilter filter in _filter) { acceptable = filter.Acceptable(pd); if (!acceptable) { break; } } if (acceptable) { resultCollection.Add(pd); } } else { bool acceptable = true; foreach (ICommonFilter filter in _filter) { if (filter.Values == null || filter.Values.Length == 0) { continue; } acceptable = filter.Acceptable(pd); if (acceptable) { break; } } if (acceptable) { resultCollection.Add(pd); } } } }
///<summary> ///</summary> ///<param name="initialCollection"></param> ///<param name="resultCollection"></param> private void FilterZeroItems(IEnumerable <IMtopCalc> initialCollection, ICommonCollection <IMtopCalc> resultCollection) { if (_filterZero == null || _filterZero.All(i => i.Values.Length == 0)) { resultCollection.Clear(); resultCollection.AddRange(initialCollection); return; } resultCollection.Clear(); foreach (var pd in initialCollection) { if (_filterZero.FilterTypeAnd) { bool acceptable = true; foreach (ICommonFilter filter in _filterZero) { acceptable = filter.Acceptable((BaseEntityObject)pd); if (!acceptable) { break; } } if (acceptable) { resultCollection.Add(pd); } } else { bool acceptable = true; foreach (ICommonFilter filter in _filterZero) { if (filter.Values == null || filter.Values.Length == 0) { continue; } acceptable = filter.Acceptable((BaseEntityObject)pd); if (acceptable) { break; } } if (acceptable) { resultCollection.Add(pd); } } } }
///<summary> ///</summary> ///<param name="initialCollection"></param> ///<param name="resultCollection"></param> private void FilterItems(IEnumerable <AccessoryRequired> initialCollection, ICommonCollection <AccessoryRequired> resultCollection) { if (_filter == null || _filter.All(i => i.Values.Length == 0)) { resultCollection.Clear(); resultCollection.AddRange(initialCollection); return; } resultCollection.Clear(); foreach (AccessoryRequired pd in initialCollection) { //if (pd.Parent != null && pd.Parent is MaintenanceCheck && ((MaintenanceCheck)pd.Parent).Name == "C02") //{ // pd.ToString(); //} if (_filter.FilterTypeAnd) { bool acceptable = true; foreach (ICommonFilter filter in _filter) { acceptable = filter.Acceptable(pd); if (!acceptable) { break; } } if (acceptable) { resultCollection.Add(pd); } } else { bool acceptable = true; foreach (ICommonFilter filter in _filter) { if (filter.Values == null || filter.Values.Length == 0) { continue; } acceptable = filter.Acceptable(pd); if (acceptable) { break; } } if (acceptable) { resultCollection.Add(pd); } } } }
///<summary> ///</summary> ///<param name="initialCollection"></param> ///<param name="resultCollection"></param> private void FilterItems(IEnumerable <Discrepancy> initialCollection, ICommonCollection <Discrepancy> resultCollection) { if (_filter == null || _filter.All(i => i.Values.Length == 0)) { resultCollection.Clear(); resultCollection.AddRange(initialCollection); return; } resultCollection.Clear(); foreach (Discrepancy pd in initialCollection) { //if (pd.MaintenanceCheck != null && pd.MaintenanceCheck.Name == "2C") //{ // pd.MaintenanceCheck.ToString(); //} if (_filter.FilterTypeAnd) { bool acceptable = true; foreach (ICommonFilter filter in _filter) { acceptable = filter.Acceptable(pd); if (!acceptable) { break; } } if (acceptable) { resultCollection.Add(pd); } } else { bool acceptable = true; foreach (ICommonFilter filter in _filter) { if (filter.Values == null || filter.Values.Length == 0) { continue; } acceptable = filter.Acceptable(pd); if (acceptable) { break; } } if (acceptable) { resultCollection.Add(pd); } } } }
///<summary> ///</summary> ///<param name="initialCollection"></param> ///<param name="resultCollection"></param> private void FilterItems(IEnumerable <ILogistic> initialCollection, ICommonCollection <ILogistic> resultCollection) { if (_filter == null || _filter.All(i => i.Values.Length == 0)) { resultCollection.Clear(); resultCollection.AddRange(initialCollection); return; } resultCollection.Clear(); foreach (var pd in initialCollection) { if (_filter.FilterTypeAnd) { var acceptable = true; foreach (var filter in _filter) { acceptable = filter.Acceptable(pd as BaseEntityObject); } if (!acceptable) { break; } if (acceptable) { resultCollection.Add(pd); } } else { var acceptable = true; foreach (var filter in _filter) { if (filter.Values == null || filter.Values.Length == 0) { continue; } acceptable = filter.Acceptable(pd as BaseEntityObject); if (acceptable) { break; } } if (acceptable) { resultCollection.Add(pd); } } } }
///<summary> ///</summary> ///<param name="initialCollection"></param> ///<param name="resultCollection"></param> private void FilterItems(TransferRecordCollection initialCollection, TransferRecordCollection resultCollection) { if (_filter == null || _filter.All(i => i.Values.Length == 0)) { resultCollection.Clear(); resultCollection.AddRange(initialCollection.ToArray()); return; } resultCollection.Clear(); foreach (var pd in initialCollection) { if (_filter.FilterTypeAnd) { bool acceptable = true; foreach (ICommonFilter filter in _filter) { acceptable = filter.Acceptable(pd); if (!acceptable) { break; } } if (acceptable) { resultCollection.Add(pd); } } else { bool acceptable = true; foreach (ICommonFilter filter in _filter) { if (filter.Values == null || filter.Values.Length == 0) { continue; } acceptable = filter.Acceptable(pd); if (acceptable) { break; } } if (acceptable) { resultCollection.Add(pd); } } } }