private void nut_dang_nhap_Click(object sender, EventArgs e) { string tendang_nhap = ten_dang_nhap.Text.Trim(); string matkhau = mat_khau.Text.Trim(); SqlParameter[] InputParameter = { new SqlParameter("@ID", tendang_nhap), new SqlParameter("@Password", matkhau) }; SqlParameter @out = new SqlParameter("@result", SqlDbType.VarChar, 100); string result = Connect.execProcedure("CheckLogin", @out, InputParameter); DataTable dataTable = SQL_QUERY.getData(tendang_nhap, matkhau); if (result != "tontai") { MessageBox.Show("dang nhap ko thanh cong"); } else { MessageBox.Show("dang nhap thanh cong"); string quyen = dataTable.Rows[0][2].ToString(); quyen = quyen.ToLower(); string userName = dataTable.Rows[0][0].ToString(); LoginInformation.UserName = userName; LoginInformation.Password = matkhau; Banking.Form1 frm1 = new Banking.Form1(quyen, userName); frm1.Show(); this.Hide(); } }
private void btnDoi_Click(object sender, EventArgs e) { List <string> fields = Banking.App_Code.Comment_event.allField(this); bool kiemTra = true; if (fields[1] != fields[2]) { errorProvider.SetError(b_textMatKhauMoi, "Mat khau giong giong nhau"); errorProvider.SetError(c_textNhapLaiMK, "Mat khau khong giong nhau"); kiemTra = false; } else { errorProvider.SetError(b_textMatKhauMoi, ""); errorProvider.SetError(c_textNhapLaiMK, ""); } DataTable data = SQL_QUERY.getData(userName, fields[0]); if (data.Rows.Count == 0) { errorProvider.SetError(a_textMatKhauCu, "Mat khau khong trung voi du lieu"); kiemTra = false; } else { errorProvider.SetError(a_textMatKhauCu, ""); } if (!kiemTra) { return; } LoginInformation.UserName = userName; LoginInformation.Password = fields[1]; #region Procedure Parameters string procedureName = "ChangePassword"; SqlParameter @out = new SqlParameter("@result", SqlDbType.VarChar, 100); SqlParameter[] InputParameters = { new SqlParameter("@ID", LoginInformation.UserName), new SqlParameter("@NewPassword", LoginInformation.Password) }; #endregion string result = Connect.execProcedure(procedureName, @out, InputParameters); if (result == "Cap nhat thanh cong") { MessageBox.Show("Doi mat khau thanh cong"); this.Close(); } else { MessageBox.Show("Co loi trong he thong"); } #region test #endregion }