//on Click function. this show a new child form which allow the admin to add a user private void AddUser(object sender, EventArgs e) { AdminUserEdit bookingFormChild = new AdminUserEdit(this.Email, this.PassHash); bookingFormChild.MdiParent = this.ParentForm; bookingFormChild.FormBorderStyle = FormBorderStyle.None; bookingFormChild.Dock = DockStyle.Fill; bookingFormChild.Show(); }
//on Click function. this show a new child form which allow the admin to modify the user of the booking private void EditUser(object sender, EventArgs e) { try { UserManagerClient userManager = new UserManagerClient(); var selectedUser = bookingManager.GetBookingByID(Convert.ToInt32(bookingsListView.SelectedItems[0].Text), this.Email, this.PassHash).Booker; AdminUserEdit bookingFormChild = new AdminUserEdit(userManager.GetUserByEmail(selectedUser.Email, 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 l'utente della prenotazione.", MessageBoxButtons.OK); } }
//on Double Click function. this function reidirect the user to another child form which allow the admin to change some details of the user private void UsersListView_DoubleClick(object sender, EventArgs e) { if (usersListView.SelectedItems.Count == 1) { try { var selectedUser = this.userManager.GetUserByEmail(usersListView.SelectedItems[0].Text, this.Email, this.PassHash); AdminUserEdit bookingFormChild = new AdminUserEdit(selectedUser, 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 farti modificare l'utente.", MessageBoxButtons.OK); } } }