public OrderRentArr GetProductsWithLastDate() { OrderRentArr orderRentArr = new OrderRentArr(); for (int i = 0; i < this.Count; i++) { OrderRent orderRent = (this[i] as OrderRent); if ( (!orderRentArr.IsContains(orderRent.Product)) ) { orderRentArr.Add(orderRent); } else { OrderRent new_OrderRent = Contain(orderRent.Product); if (orderRent.DateTo > new_OrderRent.DateTo) { orderRentArr.Remove(new_OrderRent); orderRentArr.Add(orderRent); } } } return(orderRentArr); }
public void FillRentAvailable(DateTime From, DateTime To) { DataTable dataTable = Product_DAL.GetDataTable(); DataRow dataRow; Product product; OrderRentArr orderRentArr = new OrderRentArr(); orderRentArr.Fill(); // orderRentArr = orderRentArr.FilterNoReturned(); orderRentArr = orderRentArr.Filter(From, To); for (int i = 0; i < dataTable.Rows.Count; i++) { dataRow = dataTable.Rows[i]; product = new Product(dataRow); if ( (product.Status == "Rent") && (!orderRentArr.DoesExist(product)) ) { this.Add(product); } } }
public double GetBonus(DateTime dateTime, Employee employee) { double Bonus = 0; OrderBuyArr orderBuyArr = new OrderBuyArr(); orderBuyArr.Fill(); OrderRentArr orderRentArr = new OrderRentArr(); orderRentArr.Fill(); orderBuyArr = orderBuyArr.Filter(employee, dateTime); orderRentArr = orderRentArr.Filter(employee, dateTime); for (int i = 0; i < orderBuyArr.Count; i++) { Bonus += (orderBuyArr[i] as OrderBuy).TotalPrice * 0.01; } for (int i = 0; i < orderRentArr.Count; i++) { Bonus += (orderRentArr[i] as OrderRent).TotalPrice * 0.01; } return(Bonus); }
public OrderRentArr Filter(Client client) { OrderRentArr orderRentArr = new OrderRentArr(); for (int i = 0; i < this.Count; i++) { OrderRent orderRent = (this[i] as OrderRent); if ( ((client == null) || (orderRent.Client.Id == client.Id)) ) { orderRentArr.Add(orderRent); } } return(orderRentArr); }
public OrderRentArr Filter(Product product) { OrderRentArr orderRentArr = new OrderRentArr(); for (int i = 0; i < this.Count; i++) { OrderRent orderRent = (this[i] as OrderRent); if ( ((product == null) || (orderRent.Product.Id == product.Id)) ) { orderRentArr.Add(orderRent); } } return(orderRentArr); }
public OrderRentArr FilterNoReturned() { OrderRentArr orderRentArr = new OrderRentArr(); for (int i = 0; i < this.Count; i++) { OrderRent orderRent = (this[i] as OrderRent); if ( (orderRent.Product.Doesavailable == "InRent") ) { orderRentArr.Add(orderRent); } } return(orderRentArr); }
public OrderRentArr Filter(DateTime dt) { OrderRentArr orderRentArr = new OrderRentArr(); for (int i = 0; i < this.Count; i++) { OrderRent orderRent = (this[i] as OrderRent); if ( (orderRent.DateFrom.Year == dt.Year) && (orderRent.DateFrom.Month == dt.Month) ) { orderRentArr.Add(orderRent); } } return(orderRentArr); }
public OrderRentArr Filter(Employee employee, DateTime dateTime) { OrderRentArr orderRentArr = new OrderRentArr(); for (int i = 0; i < this.Count; i++) { OrderRent orderRent = (this[i] as OrderRent); if ( ((employee == null) || (orderRent.Employee.Id == employee.Id)) && ((orderRent.DateFrom.Month == dateTime.Month) && (orderRent.DateFrom.Year == dateTime.Year)) ) { orderRentArr.Add(orderRent); } } return(orderRentArr); }
public OrderRentArr Filter(DateTime From, DateTime To) { OrderRentArr orderRentArr = new OrderRentArr(); for (int i = 0; i < this.Count; i++) { OrderRent orderRent = (this[i] as OrderRent); if ( (orderRent.DateFrom >= From) && (orderRent.DateTo <= To) ) { orderRentArr.Add(orderRent); } } return(orderRentArr); }
public OrderRentArr Filter(int id, string Client, DateTime From, DateTime To) { OrderRentArr orderRentArr = new OrderRentArr(); for (int i = 0; i < this.Count; i++) { OrderRent orderRent = (this[i] as OrderRent); if ( (id <= 0 || orderRent.Id == id) && orderRent.Client.Fullname.Contains(Client) && (orderRent.DateFrom >= From) && (orderRent.DateTo <= To) ) { orderRentArr.Add(orderRent); } } return(orderRentArr); }
public OrderRentArr Filter(Client client, Product product, DateTime dateTime) { OrderRentArr orderRentArr = new OrderRentArr(); for (int i = 0; i < this.Count; i++) { OrderRent orderRent = (this[i] as OrderRent); if ( ((client == null) || (orderRent.Client.Id == client.Id)) && ((product == null) || (orderRent.Product.Id == product.Id)) && (orderRent.DateTo.Date == dateTime.Date) ) { orderRentArr.Add(orderRent); } } return(orderRentArr); }
public void FillRentAvailable() { DataTable dataTable = Product_DAL.GetDataTable(); //להעביר את הערכים מהטבלה לתוך אוסף הלקוחות //להעביר כל שורה בטבלה ללקוח DataRow dataRow; Product product; OrderRent orderRent; OrderRentArr orderRentArr = new OrderRentArr(); orderRentArr.Fill(); // orderRentArr = orderRentArr.FilterNoReturned(); for (int i = 0; i < dataTable.Rows.Count; i++) { dataRow = dataTable.Rows[i]; product = new Product(dataRow); for (int j = 0; j < orderRentArr.Count; j++) { orderRent = orderRentArr[j] as OrderRent; if ( (product.Status == "Rent") && (orderRent.Product.Id != product.Id) && (orderRent.Product.Doesavailable == "InRent") ) { this.Add(product); } } } }