/// <summary>
        /// Displays all hondas in the DB and displays them in a listBox for selection
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnViewAllHondas_Click(object sender, EventArgs e)
        {
            List <Vehicle> hondas = VehicalDB.GetAllVehicles();

            foreach (Vehicle v in hondas)
            {
                lbDisplayedHondas.Items.Add(v);
            }
        }
Beispiel #2
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            if (ValidateMileage(txtMileage) && ValidatePrice(txtPrice) && ValidateColor(txtColor) && AllComboBoxesAreFilled())
            {
                Vehicle v = new Vehicle();
                v.Model     = Convert.ToString(cmbModel.SelectedItem);
                v.Year      = Convert.ToInt16(cmbYear.SelectedItem);
                v.Mileage   = Convert.ToInt32(txtMileage.Text);
                v.Condition = Convert.ToString(cmbCondition.SelectedItem);
                v.Price     = Convert.ToDouble(txtPrice.Text);
                v.Color     = txtColor.Text;

                VehicalDB.AddVehicle(v);
                ///////////////////////////ADD Vehicle to database!!!!!!! HERE!!!!
                MessageBox.Show("Vehical added");
                CleanForm();
            }
            else
            {
                MessageBox.Show("Invalid Data!");
            }
        }