//on Click function. this show a new child form which allow the admin to add a car private void CreateCar(object sender, EventArgs e) { AdminCarEdit EditCarChild = new AdminCarEdit(this.Email, this.PassHash); EditCarChild.MdiParent = this.ParentForm; EditCarChild.FormBorderStyle = FormBorderStyle.None; EditCarChild.Dock = DockStyle.Fill; EditCarChild.Show(); }
//on Click function. this show a new child form which allow the admin to modify the car of the booking private void EditCar(object sender, EventArgs e) { try { CarManagerClient carManager = new CarManagerClient(); var selectedCar = bookingManager.GetBookingByID(Convert.ToInt32(bookingsListView.SelectedItems[0].Text), this.Email, this.PassHash).BookedCar; AdminCarEdit bookingFormChild = new AdminCarEdit(carManager.GetCarByPlate(selectedCar.PlateNumber, this.Email, this.PassHash), this.Email, this.PassHash); bookingFormChild.MdiParent = this.ParentForm; bookingFormChild.FormBorderStyle = FormBorderStyle.None; bookingFormChild.Dock = DockStyle.Fill; bookingFormChild.Show(); }catch (Exception exc) { MessageBox.Show("Errore nella connessione al server.", "Proprio non riesco a mostrare la macchina della prenotazione.", MessageBoxButtons.OK); } }
//on double Click function. this show a new child form which allow the admin to modify a car private void EditCar(object sender, EventArgs e) { if (carListView.SelectedItems.Count == 1) { try { var selectedCar = this.carManager.GetCarByPlate(carListView.SelectedItems[0].Text, this.Email, this.PassHash); AdminCarEdit EditCarChild = new AdminCarEdit(selectedCar, this.Email, this.PassHash); EditCarChild.MdiParent = this.ParentForm; EditCarChild.FormBorderStyle = FormBorderStyle.None; EditCarChild.Dock = DockStyle.Fill; EditCarChild.Show(); }catch (Exception exc) { MessageBox.Show("Errore nella connessione al server.", "Proprio non riesco a farti modificare la macchina.", MessageBoxButtons.OK); } } }