Ejemplo n.º 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtPassword.Text == txtConfirmPassword.Text)
                {
                    loAdministration.insertUser(txtUserId.Text, txtPassword.Text, cboRole.SelectedValue.ToString(), cboDefaultSection.SelectedValue.ToString());
                    MessageBox.Show("New user successfully saved!", "Save Successful", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    this.Hide();

                    UserMasterList _parent = Application.OpenForms["UserMasterList"] as UserMasterList;

                    _parent.GetType().GetMethod("refresh").Invoke(_parent, null);

                    ViewUser _viewUser = new ViewUser();
                    _viewUser.UserId = txtUserId.Text;
                    _viewUser.Role = cboRole.Text;
                    _viewUser.DefaultSection = cboDefaultSection.Text;
                    _viewUser.ShowDialog(_parent);
                }
                else
                {
                    MessageBox.Show("Passwords do not match!", "Save Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("An error occurred upon saving new user. Exception: " + ex.Message, "Save Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                Close();
            }
        }
Ejemplo n.º 2
0
 private void gridUsers_DoubleClick(object sender, EventArgs e)
 {
     ViewUser _viewUser = new ViewUser();
     _viewUser.UserId = gridUsers.GetDataDisplay(gridUsers.Row, "userID");
     _viewUser.ShowDialog(this);
 }