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

            string tableName = "view_ChongZhi";
            string fileds = "* ";
            string orderByString = "ISSUETIME DESC ";

            StringBuilder query = new StringBuilder();
            query.AppendFormat("  PayState=2   ");

            if (serModel != null)
            {
                if (!string.IsNullOrEmpty(serModel.OrderCode))
                {
                    query.AppendFormat(" and OrderCode  like '%{0}%' ", serModel.OrderCode);
                }
                if (!string.IsNullOrEmpty(serModel.TradeNo))
                {
                    query.AppendFormat(" and TradeNo like '%{0}%' ", serModel.TradeNo);
                }
                if (!string.IsNullOrEmpty(serModel.Account))
                {
                    query.AppendFormat(" and UserName like '%{0}%'  ", serModel.Account);
                }
                if (!string.IsNullOrEmpty(serModel.OperatorID))
                {
                    query.AppendFormat(" and OperatorID = '{0}' ", serModel.OperatorID);
                }
            }

            using (IDataReader dr = DbHelper.ExecuteReader1(this._db, PageSize, PageIndex, ref RecordCount, tableName, fileds, query.ToString(), orderByString, null))
            {
                while (dr.Read())
                {
                    MChongZhi model = new MChongZhi();
                    model.UserName = dr.IsDBNull(dr.GetOrdinal("UserName")) ? "" : dr.GetString(dr.GetOrdinal("UserName"));
                    model.ContactName = dr.IsDBNull(dr.GetOrdinal("ContactName")) ? "" : dr.GetString(dr.GetOrdinal("ContactName"));

                    model.OrderID = dr.GetString(dr.GetOrdinal("OrderID"));
                    model.OperatorID = dr.GetString(dr.GetOrdinal("OperatorID"));
                    model.OptMoney = dr.GetDecimal(dr.GetOrdinal("OptMoney"));
                    model.Issuetime = dr.GetDateTime(dr.GetOrdinal("Issuetime"));
                    model.OrderCode = dr.GetString(dr.GetOrdinal("OrderCode"));
                    model.PayState = (PaymentState)dr.GetByte(dr.GetOrdinal("PayState"));
                    model.TradeNo = dr.IsDBNull(dr.GetOrdinal("TradeNo")) ? "" : dr.GetString(dr.GetOrdinal("TradeNo"));

                    list.Add(model);
                }
            }
            return list;
        }
Example #2
0
 /// <summary>
 /// 获取分页数据
 /// </summary>
 /// <param name="PageSize"></param>
 /// <param name="PageIndex"></param>
 /// <param name="RecordCount"></param>
 /// <param name="serModel"></param>
 /// <returns></returns>
 public IList<MChongZhi> GetList(int PageSize, int PageIndex, ref int RecordCount, MChongZhiSer serModel)
 {
     return dal.GetList(PageSize, PageIndex, ref RecordCount, serModel);
 }