public void CreateRentalRecord(RentalRecord record)
        {
            RentalDAO rentalDAO = RentalDAO.Instance;

            try
            {
                rentalDAO.OpenConnection();
                rentalDAO.InsertRentalRecord(record);
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                rentalDAO.CloseConnection();
            }
        }
Beispiel #2
0
        public void InsertRentalRecord(RentalRecord record)
        {
            SqlParameter pCustomerId =
                new SqlParameter("@CustomerID", SqlDbType.BigInt, 8);
            SqlParameter pPlateNum =
                new SqlParameter("@PlateNum", SqlDbType.NVarChar, 10);
            SqlParameter pRentalPeriod =
                new SqlParameter("@RentalPeriod", SqlDbType.SmallInt, 2);
            SqlParameter pRentStartDate =
                new SqlParameter("@RentStartDate", SqlDbType.Date, 3);

            cmInsertRentalRecord.Parameters.Clear();
            cmInsertRentalRecord.Parameters.AddRange(new SqlParameter[]
                                                     { pCustomerId, pPlateNum, pRentalPeriod, pRentStartDate });

            pCustomerId.Value    = record.RentingCustomer.CustomerID;
            pPlateNum.Value      = record.RentedVehicle.PlateNum;
            pRentalPeriod.Value  = record.RentalPeriod;
            pRentStartDate.Value = record.RentStartDate;

            cmInsertRentalRecord.ExecuteNonQuery();
        }
Beispiel #3
0
 public FormRentDetails(RentVehicleControl rentvehiclecontrol)
 {
     InitializeComponent();
     this.rentvehiclecontrol = rentvehiclecontrol;
     record = new RentalRecord();
 }