Esempio n. 1
0
        public static VehicleDAO getInstance()
        {
            if (dbInstance == null)
            {
                dbInstance = new VehicleDAO();
            }

            return(dbInstance);
        }
        public Vehicle RetrieveVehicle(string carPlateNumber)
        {
            VehicleDAO vehicleDAO = VehicleDAO.getInstance();

            try
            {
                vehicleDAO.openConnection();
                Vehicle v = vehicleDAO.RetrieveVehicleDetails(carPlateNumber);
                return(v);
            }
            catch (Exception)
            {
                throw;           // preserve stack trace
            }
            finally
            {
                vehicleDAO.CloseConnection();
            }
        }
        public void ReturnTransaction(string carPlateNumber)
        {
            VehicleDAO dao = VehicleDAO.getInstance();

            try
            {
                int rentalRate;
                dao.openConnection();
                RentalTransactions t = dao.retrieveTransactionRecord(carPlateNumber, out rentalRate);
                CreateTransactionDetailsUI(t, rentalRate);
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                dao.CloseConnection();
            }
        }