Пример #1
0
        public static VehicleDAO getInstance()
        {
            if (dbInstance == null)
            {
                dbInstance = new VehicleDAO();
            }

            return(dbInstance);
        }
Пример #2
0
        public DataTable RetrieveVehicleList(string type)
        {
            VehicleDAO vehicleDAO = VehicleDAO.getInstance();

            try
            {
                vehicleDAO.openConnection();
                DataTable vehicleList = vehicleDAO.RetrieveCustomerList(type);
                return(vehicleList);
            }
            catch (Exception)
            {
                throw;           // preserve stack trace
            }
            finally
            {
                vehicleDAO.CloseConnection();
            }
        }
Пример #3
0
        public Vehicle RetrieveVehicle(String id)
        {
            VehicleDAO vehicleDAO = VehicleDAO.getInstance();

            try
            {
                vehicleDAO.openConnection();
                Vehicle v = vehicleDAO.RetrieveVehicle(id);
                return(v);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
                throw;           // preserve stack trace
            }
            finally
            {
                vehicleDAO.CloseConnection();
            }
        }
Пример #4
0
        public void ReturnCar(Vehicle v)
        {
            RentRecordsDAO rentRecordsDAO = RentRecordsDAO.getInstance();
            VehicleDAO     vehicleDAO     = VehicleDAO.getInstance();

            try
            {
                rentRecordsDAO.ReturnCar(v);
                vehicleDAO.ReturnCar(v);
                return;
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
                throw;
            }
            finally
            {
                rentRecordsDAO.CloseConnection();
            }
        }
Пример #5
0
        public void CreateRentRecords(RentRecords r)
        {
            RentRecordsDAO rentRecordsDAO = RentRecordsDAO.getInstance();
            VehicleDAO     vehicleDAO     = VehicleDAO.getInstance();

            try
            {
                rentRecordsDAO.openConnection();
                rentRecordsDAO.InsertRentRecord(r);
                //vehicleDAO.RentOut(r.VehiclePlateNumber);
                return;
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
                throw;
            }
            finally
            {
                rentRecordsDAO.CloseConnection();
            }
        }