コード例 #1
0
        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);
        }
コード例 #2
0
        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);
                }
            }
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        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);
        }
コード例 #7
0
        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);
        }
コード例 #8
0
        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);
        }
コード例 #9
0
        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);
        }
コード例 #10
0
        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);
        }
コード例 #11
0
        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);
        }
コード例 #12
0
        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);
                    }
                }
            }
        }