Exemplo n.º 1
0
        // DAO -- insert Rent
        public bool DAOinsertRent(Rent rent, ArrayList detaillist)
        {
            try
            {
                // connect
                GetConnection();

                // insert rent
                SqlCommand cmd;
                cmd = new SqlCommand(insertRentQuery, con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@CustomerID", rent.CustomerID);
                cmd.Parameters.AddWithValue("@RentDate", rent.RentDate);
                cmd.Parameters.AddWithValue("@TotalAmount", rent.TotalAmount);
                cmd.ExecuteNonQuery();
                cmd.Dispose();

                // insert Employee
                foreach (RentDetail detail in detaillist)
                {
                    cmd = new SqlCommand(insertRentDetailQuery, con);
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@IndCanoeID", detail.IndCanoeID);
                    cmd.Parameters.AddWithValue("@ReturnDueDate", detail.ReturnDueDate);
                    cmd.Parameters.AddWithValue("@PenaltyAmount", detail.PenaltyAmount);
                    cmd.Parameters.AddWithValue("@Quantity", detail.Quantity);
                    cmd.Parameters.AddWithValue("@LIAmountTotal", detail.LIAmountTotal);
                    cmd.ExecuteNonQuery();
                    cmd.Dispose();

                    cmd = new SqlCommand(updateIndStatusQuery, con);
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@Status", "loan");
                    cmd.Parameters.AddWithValue("@IndCanoeID", detail.IndCanoeID);
                    cmd.ExecuteNonQuery();
                    cmd.Dispose();
                }

                // close
                con.Close();
                con.Dispose();

                return true;
            }
            catch (Exception ex)
            {
                throw new CanoeException("DAOinsertRent", ex.Message);
            }
        }
Exemplo n.º 2
0
 // insert Rent
 public bool insertDAORent(Rent rent, ArrayList detaillist)
 {
     db = new DatabaseAccess();
     db.DAOinsertRent(rent, detaillist);
     return true;
 }
Exemplo n.º 3
0
 // Rent make instance  
 private void makeReturnInstance()
 {
     manage.rentlist = manage.makeRentList();
     rent = manage.makeRent(customer.CID, manage.getMinRentDay(), null, totalAmount);
 }
Exemplo n.º 4
0
 // make Rent instance
 public Rent makeRent(int customerID, DateTime? rentDate, DateTime? returnDate, decimal totalAmount)
 {
     Rent rent = new Rent(
         customerID,
         rentDate,
         returnDate,
         totalAmount
     );
     return rent;
 }
Exemplo n.º 5
0
 // Rent make instance  
 private void makeRentInstance()
 {
     DateTime? d = DateTime.Parse(rentDate);
     rent = manage.makeRent(customer.CID, d, null, manage.totalAmount);
     manage.rentlist = manage.makeRentList();
 }