/// <summary> /// 是否存在该记录 /// </summary> public bool Exists(string userName) { var strSql = new StringBuilder(); strSql.Append("select count(1) from T_Users"); strSql.Append(" where UserName=@UserName"); SqlParameter[] parameters = { new SqlParameter("@UserName", SqlDbType.NVarChar, 50) }; parameters[0].Value = userName; return(DbHelperSql.Exists(strSql.ToString(), parameters)); }
/// <summary> /// 是否存在该记录 /// </summary> public bool Exists(int userId) { var strSql = new StringBuilder(); strSql.Append("select count(1) from T_Users"); strSql.Append(" where UserId=@UserId"); SqlParameter[] parameters = { new SqlParameter("@UserId", SqlDbType.Int, 4) }; parameters[0].Value = userId; return(DbHelperSql.Exists(strSql.ToString(), parameters)); }
public bool CheckLogin(string userName, string pwd) { var strSql = new StringBuilder(); strSql.Append("select count(1) from T_Users"); strSql.Append(" where UserName=@UserName and Pwd=@Pwd"); SqlParameter[] parameters = { new SqlParameter("@UserName", SqlDbType.NVarChar, 50), new SqlParameter("@Pwd", SqlDbType.NVarChar, 32), }; parameters[0].Value = userName; parameters[1].Value = pwd; return(DbHelperSql.Exists(strSql.ToString(), parameters)); }
/// <summary> /// 判断用户原密码是否正确 /// </summary> /// <param name="userId">用户ID</param> /// <param name="pwd">原密码</param> /// <returns></returns> public bool VerifyPassword(int userId, string pwd) { var strSql = new StringBuilder(); strSql.Append("select count(1) from T_Users"); strSql.Append(" where UserId=@UserId and Pwd=@Pwd"); SqlParameter[] parameters = { new SqlParameter("@UserId", SqlDbType.Int, 4), new SqlParameter("@Pwd", SqlDbType.NVarChar, 32) }; parameters[0].Value = userId; parameters[1].Value = pwd; return(DbHelperSql.Exists(strSql.ToString(), parameters)); }