Exemplo n.º 1
0
 public AddEditVehicle(ManageVehicleListing manageVehicleListing = null)
 {
     InitializeComponent();
     lblTitle.Text         = "Add New Vehicle";
     isEditMode            = false;
     _manageVehicleListing = manageVehicleListing;
     _db = new CarRentalEntities();
 }
        private void manageVehicleListToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var OpenForms = Application.OpenForms.Cast <Form>();
            var isOpen    = OpenForms.Any(q => q.Name == "ManageVehicleListing");

            if (!isOpen)
            {
                var vehicleListing = new ManageVehicleListing();
                vehicleListing.MdiParent = this;
                vehicleListing.Show();
            }
        }
Exemplo n.º 3
0
 //Overload constructor
 public AddEditVehicle(TypesOfCar carToEdit, ManageVehicleListing manageVehicleListing = null)
 {
     InitializeComponent();
     lblTitle.Text         = "Add New Vehicle";
     _manageVehicleListing = manageVehicleListing;
     if (carToEdit == null)
     {
         MessageBox.Show("Please select a vilid record to edit.");
         Close();
     }
     else
     {
         isEditMode = true;
         _db        = new CarRentalEntities();
         PopulateFields(carToEdit);
     }
 }