Ejemplo n.º 1
0
        protected void ddl_Rent_SelectedIndexChanged(object sender, EventArgs e)
        {
            decimal     bikeRent = 0;
            List <Rent> Obj_Rent = Rental_BAL.GetRentDetails(ddl_RentID.SelectedValue);

            if (Obj_Rent != null && Obj_Rent.Count > 0)
            {
                for (int i = 0; i < Obj_Rent.Count; i++)
                {
                    List <Customer> Obj_Customer = Customer_BAL.GetCustomerDetails(Obj_Rent[i].CustomerID.ToString());
                    if (Obj_Customer != null && Obj_Customer.Count > 0)
                    {
                        for (int k = 0; k < Obj_Customer.Count; k++)
                        {
                            txtCustomerName.Text = Obj_Customer[k].FirstName;
                        }
                    }

                    List <Bike> Obj_Bike = Bike_BAL.GetBikeDetails(Obj_Rent[i].BikeID.ToString());
                    if (Obj_Bike != null && Obj_Bike.Count > 0)
                    {
                        for (int j = 0; j < Obj_Bike.Count; j++)
                        {
                            txtBikeModel.Text = Obj_Bike[j].Model;
                            bikeRent          = Convert.ToDecimal(Obj_Bike[j].RentPerDay);
                        }
                    }
                    txtIssueDate.Text  = Obj_Rent[i].IssueDate.ToString();
                    txtReturnDate.Text = DateTime.Now.ToString();
                    DateTime issuedate = Convert.ToDateTime(Obj_Rent[i].IssueDate);
                    double   days      = (DateTime.Now - issuedate).TotalDays;
                    txtTotalRent.Text = (bikeRent * Convert.ToDecimal(Math.Round(days))).ToString();
                }
            }
        }
Ejemplo n.º 2
0
        protected void ddl_Customer_SelectedIndexChanged(object sender, EventArgs e)
        {
            List <Customer> Obj_Customer = Customer_BAL.GetCustomerDetails(ddl_Customer.SelectedValue);

            if (Obj_Customer != null && Obj_Customer.Count > 0)
            {
                for (int i = 0; i < Obj_Customer.Count; i++)
                {
                    txtFirstName.Text = Obj_Customer[i].FirstName;
                }
            }
        }