示例#1
0
        public List <ApiServerInfoEntity> GetApiServerInfoList(ApiServerInfoQuery query)
        {
            List <ApiServerInfoEntity> list = new List <ApiServerInfoEntity>();
            StringBuilder sqlCommandText    = new StringBuilder();

            sqlCommandText.Append("SELECT ApiServerID,SiteName,SiteUrl,Status,Note,AddDate FROM dbo.ApiServerInfo WITH(NOLOCK)");
            string whereSQL = ApiServerInfoQueryToSQLWhere(query);
            string orderBy  = ApiServerInfoQueryToSQLOrder(query);

            if (!string.IsNullOrEmpty(whereSQL))
            {
                sqlCommandText.Append(" WHERE " + whereSQL);
            }
            if (!string.IsNullOrEmpty(orderBy))
            {
                sqlCommandText.Append(" ORDER BY " + orderBy);
            }
            DbCommand cmd = db.GetSqlStringCommand(sqlCommandText.ToString());

            using (IDataReader dr = db.ExecuteReader(cmd))
            {
                list = MakeApiServerInfoList(dr);
            }
            return(list);
        }
示例#2
0
        public Pager <ApiServerInfoEntity> GetApiServerInfoPageList(ApiServerInfoQuery query)
        {
            int     recordCount = 0;
            string  whereSQL    = ApiServerInfoQueryToSQLWhere(query);
            string  orderBy     = ApiServerInfoQueryToSQLOrder(query);
            DataSet ds          = db.GetPagingData("ApiServerInfo", "ApiServerID,SiteName,SiteUrl,Status,Note,AddDate", orderBy, whereSQL, query.CurrentPage, query.PageSize, out recordCount);
            Pager <ApiServerInfoEntity> pager = new Pager <ApiServerInfoEntity>();

            if (ds != null && ds.Tables.Count > 0)
            {
                pager.ItemList = MakeApiServerInfoList(ds.Tables[0]);
            }
            pager.CurrentPage  = query.CurrentPage;
            pager.PageSize     = query.PageSize;
            pager.TotalRecords = recordCount;
            return(pager);
        }
示例#3
0
        /// <summary>
        /// 将查询实体转换为Where语句
        /// <param name="query">查询实体</param>
        /// <returns>获取Where语句,不包含Where</returns>
        /// </summary>
        public string ApiServerInfoQueryToSQLWhere(ApiServerInfoQuery query)
        {
            StringBuilder sbWhere = new StringBuilder(" 1=1 ");

            if (query.Status != null)
            {
                sbWhere.Append(" AND Status= ").Append(query.Status.Value);
            }
            if (!string.IsNullOrEmpty(query.SiteName))
            {
                sbWhere.AppendFormat(" AND SiteName='{0}'", WKT.Common.Security.SecurityUtils.SafeSqlString(query.SiteName));
            }
            if (sbWhere.ToString() == " 1=1 ")
            {
                return(string.Empty);
            }
            else
            {
                return(sbWhere.ToString());
            }
        }
示例#4
0
 /// <summary>
 /// 将查询实体转换为Order语句
 /// <param name="query">查询实体</param>
 /// <returns>获取Order语句,不包含Order</returns>
 /// </summary>
 public string ApiServerInfoQueryToSQLOrder(ApiServerInfoQuery query)
 {
     return(" ApiServerID DESC");
 }
示例#5
0
 /// <summary>
 /// 分页获取符合查询条件的数据
 /// </summary>
 /// <param name="apiServerInfoQuery">ApiServerInfoQuery查询实体对象</param>
 /// <returns>Pager<ApiServerInfoEntity></returns>
 public Pager <ApiServerInfoEntity> GetApiServerInfoPageList(ApiServerInfoQuery apiServerInfoQuery)
 {
     return(ApiServerInfoDataAccess.Instance.GetApiServerInfoPageList(apiServerInfoQuery));
 }
示例#6
0
 /// <summary>
 /// 获取所有符合查询条件的数据
 /// </summary>
 /// <param name="apiServerInfoQuery">ApiServerInfoQuery查询实体对象</param>
 /// <returns>List<ApiServerInfoEntity></returns>
 public List <ApiServerInfoEntity> GetApiServerInfoList(ApiServerInfoQuery apiServerInfoQuery)
 {
     return(ApiServerInfoBusProvider.GetApiServerInfoList(apiServerInfoQuery));
 }