public int Price() { int sum = 0; for (int i = 0; i < this.Count; i++) { CarExtra carExtra = (this[i] as CarExtra); sum += carExtra.Price; } return(sum); }
public bool DoesExist(CarExtra curCarExtra) { for (int i = 0; i < this.Count; i++) { if ((this[i] as OrderDetailsRent).CarExtra.Id == curCarExtra.Id) { return(true); } } return(false); }
public void Remove(CarExtra carExtra) { //מסירה מהאוסף הנוכחי את הפריט המתקבל for (int i = 0; i < this.Count; i++) { if ((this[i] as CarExtra).Id == carExtra.Id) { this.RemoveAt(i); break; } } }
public bool IsContains(CarExtra carExtra) { //מחזירה האם האוסף מכיל כבר את המוצר for (int i = 0; i < this.Count; i++) { if ((this[i] as CarExtra).Id == carExtra.Id) { return(true); } } return(false); }
public CarExtra GetCarExtraWithMaxId() { CarExtra maxCarExtra = new CarExtra(); for (int i = 0; i < this.Count; i++) { if ((this[i] as CarExtra).Id > maxCarExtra.Id) { maxCarExtra = this[i] as CarExtra; } } return(maxCarExtra); }
public int GetMaxCount() { int MaxCount = 0; for (int i = 0; i < this.Count; i++) { CarExtra carExtra = (this[i] as CarExtra); if (carExtra.Count > MaxCount) { MaxCount = carExtra.Count; } } return(MaxCount); }
public void Fill() { DataTable dataTable = CarExtra_DAL.GetDataTable(); CarExtra carExtra = new CarExtra(); DataRow dataRow; for (int i = 0; i < dataTable.Rows.Count; i++) { dataRow = dataTable.Rows[i]; carExtra = new CarExtra(dataRow); this.Add(carExtra); } }
public int GetMaxPrice() { int maxPrice = 0; for (int i = 0; i < this.Count; i++) { CarExtra carExtra = (this[i] as CarExtra); if (carExtra.Price > maxPrice) { maxPrice = carExtra.Price; } } return(maxPrice); }
public OrderDetailsRentArr Filter(CarExtra carExtra) { OrderDetailsRentArr orderDetailsRentArr = new OrderDetailsRentArr(); for (int i = 0; i < this.Count; i++) { OrderDetailsRent orderDetailsRent = (this[i] as OrderDetailsRent); if ((carExtra == null) || (orderDetailsRent.CarExtra.Id == carExtra.Id)) { orderDetailsRentArr.Add(orderDetailsRent); } } return(orderDetailsRentArr); }
public CarExtraArr Filter(int MaxCount) { CarExtraArr carExtraArr = new CarExtraArr(); for (int i = 0; i < this.Count; i++) { CarExtra carExtra = (this[i] as CarExtra); if ( (carExtra.Count <= MaxCount) ) { carExtraArr.Add(carExtra); } } return(carExtraArr); }
public OrderDetailsBuyArr Filter(CarExtra carExtra, DateTime dt) { OrderDetailsBuyArr orderDetailsBuyArr = new OrderDetailsBuyArr(); for (int i = 0; i < this.Count; i++) { OrderDetailsBuy orderDetailsBuy = (this[i] as OrderDetailsBuy); if ( ((carExtra == null) || (orderDetailsBuy.CarExtra.Id == carExtra.Id)) && (orderDetailsBuy.OrderBuy.DateOfBuy >= dt) ) { orderDetailsBuyArr.Add(orderDetailsBuy); } } return(orderDetailsBuyArr); }
public CarExtraArr Filter(int Id, string Name, int MinPrice, int MaxPrice, int MaxCount) { CarExtraArr carExtraArr = new CarExtraArr(); for (int i = 0; i < this.Count; i++) { CarExtra carExtra = (this[i] as CarExtra); if ( (Id <= 0 || carExtra.Id == Id) && (carExtra.Name.Contains(Name)) && (carExtra.Price >= MinPrice) && (carExtra.Price <= MaxPrice) && (carExtra.Count <= MaxCount) ) { carExtraArr.Add(carExtra); } } return(carExtraArr); }