コード例 #1
0
        public ReturnRentalReceipt(Controller controller, Invoice invoice, Form frm)
        {
            this.controller = controller;
            this.invoice = invoice;
            this.frm = frm;
            account = controller.getAccount(invoice.getAccountID());
            car = controller.getCar(invoice.getCarID());

            InitializeComponent();
            lblLastName.Text = account.getLastName();
            lblFirstName.Text = account.getFirstName();
            lblAccountNumber.Text = account.getDriversLicense();
            lblAddress.Text = account.getAddress();
            lblCity.Text = account.getCity();
            lblState.Text = account.getState();
            lblZip.Text = account.getZip();
            lblDays.Text = invoice.getDuration();
            lblPreCost.Text = String.Format("{0:C}",Double.Parse(invoice.getPreCharge()));
            lblMake.Text = car.getMake();
            lblModel.Text = car.getModel();
            lblModelCost.Text = String.Format("{0:C}", controller.rentalModelCost(car.getRentalModel()));
        }
コード例 #2
0
ファイル: Database.cs プロジェクト: ItzFender/Car-Rental-Lab
        internal void addNewAccount(Account account)
        {
            try
            {
                DateTime dt = DateTime.Parse(account.getDOB());
                string sql = "INSERT INTO Account (DriversLicense, FirstName, LastName, DOB, Address, City, State, Zip) values(@driversLicense, @firstName, @lastName, @dob, @address, @city, @state, @zip)";

                conn = new MySql.Data.MySqlClient.MySqlConnection(myConnectionString);

                MySqlCommand command = new MySqlCommand(sql, conn);
                command.Parameters.AddWithValue("driversLicense", account.getDriversLicense());
                command.Parameters.AddWithValue("firstName", account.getFirstName());
                command.Parameters.AddWithValue("lastName", account.getLastName());
                command.Parameters.AddWithValue("dob", dt.ToString("yyyy-MM-dd"));
                command.Parameters.AddWithValue("address", account.getAddress());
                command.Parameters.AddWithValue("city", account.getCity());
                command.Parameters.AddWithValue("state", account.getState());
                command.Parameters.AddWithValue("zip", account.getZip());

                conn.Open();

                command.ExecuteNonQuery();

                MessageBox.Show("Added new account !!", "message", MessageBoxButtons.OK, MessageBoxIcon.Information);

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                conn.Close();
            }
        }