/// <summary> /// 是否存在该记录 /// </summary> public bool Exists(int pk) { StringBuilder strSql = new StringBuilder(); strSql.Append("select count(1) from jt_yh_zl"); strSql.Append(" where pk=@pk "); SqlParameter[] parameters = { new SqlParameter("@pk", SqlDbType.Int, 4) }; parameters[0].Value = pk; return(SQLServerHelper.Exists(strSql.ToString(), parameters)); }
public bool Exists(int ID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select count(1) from SysUser"); strSql.Append(" where "); strSql.Append(" ID = @ID "); SqlParameter[] parameters = { new SqlParameter("@ID", SqlDbType.Int, 4) }; parameters[0].Value = ID; return(SQLServerHelper.Exists(strSql.ToString(), parameters)); }
/* * /// <summary> * /// 分页获取数据列表 * /// </summary> * public DataSet GetList(int PageSize,int PageIndex,string strWhere) * { * SqlParameter[] parameters = { * new SqlParameter("@tblName", SqlDbType.VarChar, 255), * new SqlParameter("@fldName", SqlDbType.VarChar, 255), * new SqlParameter("@PageSize", SqlDbType.Int), * new SqlParameter("@PageIndex", SqlDbType.Int), * new SqlParameter("@IsReCount", SqlDbType.Bit), * new SqlParameter("@OrderType", SqlDbType.Bit), * new SqlParameter("@strWhere", SqlDbType.VarChar,1000), * }; * parameters[0].Value = "jt_yh_zl"; * parameters[1].Value = "pk"; * parameters[2].Value = PageSize; * parameters[3].Value = PageIndex; * parameters[4].Value = 0; * parameters[5].Value = 0; * parameters[6].Value = strWhere; * return SQLServerHelper.RunProcedure("UP_GetRecordByPage",parameters,"ds"); * }*/ #endregion BasicMethod #region ExtensionMethod /// <summary> /// 是否存在该记录 /// </summary> /// /// <param name="account"></param> /// <param name="password"></param> /// <returns></returns> public bool Exists(string account, string password) { StringBuilder strSql = new StringBuilder(); strSql.Append("select count(1) from jt_yh_zl"); strSql.Append(" where v_yh_no=@v_yh_no and v_yh_pwd=@v_yh_pwd "); SqlParameter[] parameters = { new SqlParameter("@v_yh_no", SqlDbType.VarChar, 256), new SqlParameter("@v_yh_pwd", SqlDbType.VarChar, 256) }; parameters[0].Value = account; parameters[1].Value = password; return(SQLServerHelper.Exists(strSql.ToString(), parameters)); }
/// <summary> /// 是否存在该代码集表记录 /// </summary> /// <param name="code">代码编码</param> /// <returns>是否存在该代码集表记录</returns> public bool Exists(string code, int?id = null) { StringBuilder strSql = new StringBuilder(); strSql.Append("select count(1) FROM CodeSetsEntity"); strSql.Append(" where "); strSql.Append(" code = @code "); if (id != null) { strSql.Append(" AND id <> " + id.ToString()); } SqlParameter[] parameters = { new SqlParameter("@code", SqlDbType.NVarChar, 50) }; parameters[0].Value = code; return(SQLServerHelper.Exists(strSql.ToString(), parameters)); }