Beispiel #1
0
        /// <summary>
        /// 获取分页数据
        /// </summary>
        /// <param name="PageSize"></param>
        /// <param name="PageIndex"></param>
        /// <param name="RecordCount"></param>
        /// <param name="serModel"></param>
        /// <returns></returns>
        public IList <MYouJi> GetList(int PageSize, int PageIndex, ref int RecordCount, MYouJiSer serModel)
        {
            IList <MYouJi> list = new List <MYouJi>();


            string tableName     = "tbl_HuiYouYouJi";
            string fileds        = " * ";
            string orderByString = " IssueTime DESC ";

            StringBuilder query = new StringBuilder();

            query.AppendFormat(" 1=1 ");

            if (serModel != null)
            {
                if (!string.IsNullOrEmpty(serModel.HuiYuanId))
                {
                    query.AppendFormat(" AND HuiYuanId='{0}' ", serModel.HuiYuanId);
                }
                if (serModel.YouJiType.HasValue)
                {
                    query.AppendFormat(" AND YouJiLeiXing='{0}' ", (int)serModel.YouJiType.Value);
                }
            }


            using (IDataReader dr = DbHelper.ExecuteReader1(this._db, PageSize, PageIndex, ref RecordCount, tableName, fileds, query.ToString(), orderByString, null))
            {
                while (dr.Read())
                {
                    MYouJi model = new MYouJi();
                    model.YouJiId      = dr.IsDBNull(dr.GetOrdinal("YouJiId")) ? "" : dr.GetString(dr.GetOrdinal("YouJiId"));
                    model.YouJiTitle   = dr.IsDBNull(dr.GetOrdinal("YouJiTitle")) ? "" : dr.GetString(dr.GetOrdinal("YouJiTitle"));
                    model.YouJiContent = dr.IsDBNull(dr.GetOrdinal("YouJiContent")) ? null : getStrJson(dr.GetString(dr.GetOrdinal("YouJiContent")));
                    model.HuiYuanId    = dr.IsDBNull(dr.GetOrdinal("HuiYuanId")) ? "" : dr.GetString(dr.GetOrdinal("HuiYuanId"));
                    model.IssueTime    = dr.GetDateTime(dr.GetOrdinal("IssueTime"));
                    model.ShiPinLink   = dr.IsDBNull(dr.GetOrdinal("ShiPinLink")) ? "" : dr.GetString(dr.GetOrdinal("ShiPinLink"));
                    model.WeiXinMa     = dr.IsDBNull(dr.GetOrdinal("WeiXinMa")) ? "" : dr.GetString(dr.GetOrdinal("WeiXinMa"));
                    list.Add(model);
                }
            }
            return(list);
        }
Beispiel #2
0
 /// <summary>
 /// 获取分页数据
 /// </summary>
 /// <param name="PageSize"></param>
 /// <param name="PageIndex"></param>
 /// <param name="RecordCount"></param>
 /// <param name="serModel"></param>
 /// <returns></returns>
 public IList <MYouJi> GetList(int PageSize, int PageIndex, ref int RecordCount, MYouJiSer serModel)
 {
     return(dal.GetList(PageSize, PageIndex, ref RecordCount, serModel));
 }