//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); } }
//initialize text components. private void HydrateFields() { try { this.editingUser = userManager.GetUserByEmail(this.Email, this.Email, this.PassHash); NameUsertextBox.Text = editingUser.Name; EmailUserTextBox.Text = editingUser.Email; EmailUserTextBox.ReadOnly = true; LicenseUserTextBox.Text = editingUser.License; expirationPicker.Value = editingUser.LicenseExpiration; PointsUpDown.Value = editingUser.LicensePoints; PasswordUserTextBox.Text = ""; ConfirmPasswordTextBox.Text = ""; } catch (Exception exc) { MessageBox.Show("Errore nella connessione al server.", "Proprio non riesco a caricare i contenuti.", MessageBoxButtons.OK); } }