コード例 #1
0
        private void BtnDongY_Click(object sender, EventArgs e)
        {
            string pass    = user.GetPassword(username);
            string oldPass = txtPassOld.Text;

            if (string.Compare(pass, oldPass) != 0)
            {
                XtraMessageBox.Show("Mật Khẩu cũ không đúng", "Sai Mật Khẩu", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                if (string.Compare(txtNew.Text, txtPass_New.Text) != 0)
                {
                    XtraMessageBox.Show("Mật khẩu nhập lại không trùng khớp!", "Hệ thống", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    int kq = user.CapNhatMatKhau(username, txtNew.Text);

                    if (kq >= 1)
                    {
                        AddNhatKy("Thành Công");
                        MessageBox.Show("Cập nhật Thành Công!");
                    }
                    else
                    {
                        MessageBox.Show("Cập nhật Thất Bại!");
                    }
                }
            }
        }