public bool DoesExist(CarColor carColor) { for (int i = 0; i < this.Count; i++) { if ((this[i] as CarDesign).CarColor.Id == carColor.Id) { return(true); } } return(false); }
public CarColor GetColorWithMaxId() { CarColor maxColor = new CarColor(); for (int i = 0; i < this.Count; i++) { if ((this[i] as CarColor).Id > maxColor.Id) { maxColor = this[i] as CarColor; } } return(maxColor); }
public void Fill() { DataTable dataTable = CarColor_DAL.GetDataTable(); CarColor color = new CarColor(); DataRow dataRow; for (int i = 0; i < dataTable.Rows.Count; i++) { dataRow = dataTable.Rows[i]; color = new CarColor(dataRow); this.Add(color); } }
public CarDesignArr Filter(CarColor carColor, ColorType colorTypes, BodyDesign bodyDesign) { CarDesignArr carDesignArr = new CarDesignArr(); for (int i = 0; i < this.Count; i++) { CarDesign carDesign = (this[i] as CarDesign); if ( ((carColor == null) || (carDesign.CarColor.Id == carColor.Id)) && ((colorTypes == null) || (carDesign.ColorType.Id == colorTypes.Id)) && ((bodyDesign == null) || (carDesign.BodyDesign.Id == bodyDesign.Id)) ) { carDesignArr.Add(carDesign); } } return(carDesignArr); }