Beispiel #1
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            if (ValidateInputs())
            {
                BusinessRules objBusinessRules = new BusinessRules();

                using (DataTable dt = objBusinessRules.ChangePassword(User.Instance.User_Name, txtNewPassword.Text))
                {
                    if (!string.IsNullOrEmpty(dt.Rows[0]["User_Name"].ToString()))
                    {
                        User.Instance.User_Name  = Convert.ToString(dt.Rows[0]["User_Name"]);
                        User.Instance.First_Name = Convert.ToString(dt.Rows[0]["First_Name"]);
                        User.Instance.Last_Name  = Convert.ToString(dt.Rows[0]["Last_Name"]);
                        User.Instance.Password   = Convert.ToString(dt.Rows[0]["Password"]);
                        User.Instance.IsAdmin    = Convert.ToBoolean(dt.Rows[0]["IsAdmin"]);

                        MessageBox.Show("Password changed successfully.\n\nYou need to close and re-open the application.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
        }