示例#1
0
        /// <summary>
        /// 生成拼接sql参数列表
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public List <SqlParameter> ParseToSqlParameters(searchAppUpdateEntity entity)
        {
            List <SqlParameter> paraList = new List <SqlParameter>();

            //table
            paraList.Add(CPTable(entity));

            //fields
            paraList.Add(CPFields(entity));

            //filter_SqlWhere
            paraList.Add(CPWhere(entity));

            //order
            paraList.Add(CPOrder(entity));

            //pagesize
            paraList.Add(new SqlParameter("@pageSize", entity.PageSize));

            //pageindex
            paraList.Add(new SqlParameter("@pageIndex", entity.PageIndex));

            paraList.Add(new SqlParameter()
            {
                ParameterName = "@Records", Value = 0, Direction = ParameterDirection.Output
            });

            return(paraList);
        }
示例#2
0
        public DataTable GetAppUpdateList(searchAppUpdateEntity entity, out int totalcnt)
        {
            DataTable table = null;

            totalcnt = 0;
            try
            {
                SqlParameter[] prms = ParseToSqlParameters(entity).ToArray();

                if (entity.UseDBPagination)
                {
                    table    = SQlHelper.ExecuteDataset(SQlHelper.MyConnectStr, CommandType.StoredProcedure, "sp_pager06", prms).Tables[0];
                    totalcnt = int.Parse(prms[prms.Length - 1].Value.ToString());
                }
                else
                {
                    throw new NotImplementedException();
                }
            }
            catch (Exception ex)
            {
                totalcnt = -1;
                LogUtil.WriteLog(ex);
            }

            return(table);
        }
示例#3
0
        private DataTable GetQueryData(bool isDownload)
        {
            searchAppUpdateEntity entity = new searchAppUpdateEntity();
            int          totalcnt        = 0;
            int          AppType         = 0;
            BCtrl_Common bll             = new BCtrl_Common();

            if (!string.IsNullOrEmpty(txtStartTime))
            {
                string.Format("{0} 00:00:00", txtStartTime);
                entity.txtStartTime = txtStartTime;
            }
            if (!string.IsNullOrEmpty(txtEndTime))
            {
                string.Format("{0} 23:59:59", txtEndTime);
                entity.txtEndTime = txtEndTime;
            }
            if (!string.IsNullOrEmpty(txtVersion))
            {
                entity.txtVersion = txtVersion;
            }
            int.TryParse(selAppType, out AppType);
            entity.selAppType      = AppType;
            entity.PageSize        = base.PageSize;
            entity.PageIndex       = base.PageIndex;
            entity.UseDBPagination = !isDownload;
            entity.OrderfieldType  = OrderFieldType.Desc;
            DataTable db = bll.GetAppUpdateList(entity, out totalcnt);

            base.TotalRecords = totalcnt;
            return(db);
        }
示例#4
0
        /// <summary>
        /// 设置表关联
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        private SqlParameter CPTable(searchAppUpdateEntity entity)
        {
            StringBuilder sbtable = new StringBuilder();

            //基本表
            sbtable.Append(" M_AppUpdate ");
            return(new SqlParameter("@TableName", sbtable.ToString()));
        }
示例#5
0
        /// <summary>
        /// 设置显示字段
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        private SqlParameter CPFields(searchAppUpdateEntity entity)
        {
            StringBuilder sbfileds = new StringBuilder();

            if (entity.UseDBPagination)
            {
                sbfileds.Append(@" appId,appType,version,downloadUrl,forcedUpdate,convert(varchar(19),createTime,121) as createTime,appSize,updateProfile");
            }
            else
            {
                throw new NotImplementedException();
            }
            return(new SqlParameter("@Fields", sbfileds.ToString()));
        }
示例#6
0
        /// <summary>
        /// 设置排序
        /// </summary>
        /// <param name="enity"></param>
        /// <returns></returns>
        private SqlParameter CPOrder(searchAppUpdateEntity enity)
        {
            StringBuilder sborder = new StringBuilder();

            if (enity.OrderfieldType == OrderFieldType.Desc)
            {
                sborder.Append(" createTime  DESC ");
            }
            else
            {
                sborder.Append(" createTime  ASC ");
            }

            return(new SqlParameter("@OrderField", sborder.ToString()));
        }
示例#7
0
        /// <summary>
        /// 查询条件
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        private SqlParameter CPWhere(searchAppUpdateEntity entity)
        {
            StringBuilder sbwhere = new StringBuilder("1=1");

            if (entity.selAppType != 0)
            {
                sbwhere.Append("and appType='" + entity.selAppType + "'");
            }
            if (!string.IsNullOrEmpty(entity.txtVersion))
            {
                sbwhere.Append("and version='" + entity.txtVersion + "'");
            }
            if (!string.IsNullOrEmpty(entity.txtStartTime))
            {
                sbwhere.Append("and createTime >='" + entity.txtStartTime + "'");
            }
            if (!string.IsNullOrEmpty(entity.txtEndTime))
            {
                sbwhere.Append("and createTime <='" + entity.txtEndTime + "'");
            }
            return(new SqlParameter("@sqlWhere", sbwhere.ToString()));
        }
示例#8
0
 public DataTable GetAppUpdateList(searchAppUpdateEntity entity, out int totalcnt)
 {
     return(commonobj.GetAppUpdateList(entity, out totalcnt));
 }