public FormUtente(WIN.BASEREUSE.User user) { InitializeComponent(); _user = user; _role = user.Role as WIN.BASEREUSE.Role; uxUserNameTextBox.Text = user.Username; uxPasswordTextBox.Text = user.Password; uxNameTextBox.Text = user.Name; uxSurnameTextBox.Text = user.SurName; this.Text = this.Text + " " + user.Username; infoLabel.Text = String.Format("L'utente appartiene al ruolo: {0}", user.Role.Description); }
private void cmdOk_Click(object sender, EventArgs e) { try { WIN.BASEREUSE.User user = GetUserByUserName(uxUserNameTextBox.Text) as WIN.BASEREUSE.User; if (user != null) { if (_createNew) { throw new Exception("Username già esistente"); } } if (uxUserNameTextBox.Text == "") { uxUserNameTextBox.Focus(); return; } if (uxPasswordTextBox.Text == "") { uxPasswordTextBox.Focus(); return; } if (_user == null) { _user = new WIN.BASEREUSE.User(_role); } _user.Username = uxUserNameTextBox.Text; _user.Password = uxPasswordTextBox.Text; _user.Name = uxNameTextBox.Text; _user.SurName = uxSurnameTextBox.Text; this.DialogResult = DialogResult.OK; this.Close(); } catch (Exception ex) { ErrorHandler.Show(ex); } }