protected void initList(string id) { Eyousoft_yhq.BLL.SendMsg bll = new Eyousoft_yhq.BLL.SendMsg(); Eyousoft_yhq.Model.serSendMSG serchModel = new Eyousoft_yhq.Model.serSendMSG(); serchModel.ProductID = id; pageIndex = UtilsCommons.GetPagingIndex("Page"); var list = bll.GetList(pageSize, pageIndex, ref recordCount, serchModel); if (list != null && list.Count > 0) { rpt_list.DataSource = list; rpt_list.DataBind(); BindPage(); litMsg.Visible = false; } else { rpt_list.Visible = false; } }
/// <summary> /// 获取发送列表 /// </summary> /// <param name="PageSize"></param> /// <param name="PageIndex"></param> /// <param name="RecordCount"></param> /// <param name="serModel"></param> /// <param name="i"></param> /// <returns></returns> public IList <Eyousoft_yhq.Model.SendMSG> GetList(int PageSize, int PageIndex, ref int RecordCount, Eyousoft_yhq.Model.serSendMSG serModel) { return(dal.GetList(PageSize, PageIndex, ref RecordCount, serModel)); }
/// <summary> /// 获取发送列表 /// </summary> /// <param name="PageSize"></param> /// <param name="PageIndex"></param> /// <param name="RecordCount"></param> /// <param name="serModel"></param> /// <param name="i"></param> /// <returns></returns> public IList <Eyousoft_yhq.Model.SendMSG> GetList(int PageSize, int PageIndex, ref int RecordCount, Eyousoft_yhq.Model.serSendMSG serModel) { IList <Eyousoft_yhq.Model.SendMSG> list = new List <Eyousoft_yhq.Model.SendMSG>(); string tableName = "tbl_SendMSG"; string fileds = " msgId,sendNum,SendText,issuetime,ProductID "; string orderByString = "msgId desc"; StringBuilder query = new StringBuilder(); query.Append(" 1=1 "); if (serModel != null) { if (!string.IsNullOrEmpty(serModel.ProductID)) { query.AppendFormat(" and ProductID = '{0}' ", serModel.ProductID); } } using (IDataReader dr = DbHelper.ExecuteReader1(this._db, PageSize, PageIndex, ref RecordCount, tableName, fileds, query.ToString(), orderByString, null)) { while (dr.Read()) { Eyousoft_yhq.Model.SendMSG model = new Eyousoft_yhq.Model.SendMSG(); model.MsgID = dr.GetInt32(dr.GetOrdinal("msgId")); model.SendNum = dr.IsDBNull(dr.GetOrdinal("SendNum")) ? "" : dr.GetString(dr.GetOrdinal("SendNum")); model.SendText = dr.IsDBNull(dr.GetOrdinal("SendText")) ? "" : dr.GetString(dr.GetOrdinal("SendText")); model.IssueTime = dr.GetDateTime(dr.GetOrdinal("IssueTime")); model.ProductID = dr.IsDBNull(dr.GetOrdinal("ProductID")) ? "" : dr.GetString(dr.GetOrdinal("ProductID")).ToString(); list.Add(model); } } return(list); }