/// <summary> /// 初始化列表 /// </summary> void initlist() { var sermodel = new ChouJiangSer() { CaoZuoRenID = m.UserID }; var list = new Eyousoft_yhq.BLL.BChouJiang().GetList(sermodel); var sum = new Eyousoft_yhq.BLL.BChouJiang().getSumMoney(sermodel); if (list != null && list.Count > 0) { rptlist.DataSource = list; rptlist.DataBind(); } ltrSumMoney.Text = sum.ToString("F2"); }
/// <summary> /// 获取分页数据 /// </summary> /// <param name="PageSize"></param> /// <param name="PageIndex"></param> /// <param name="RecordCount"></param> /// <param name="serModel"></param> /// <returns></returns> public IList<ChouJiang> GetList(int PageSize, int PageIndex, ref int RecordCount, ChouJiangSer serModel) { IList<ChouJiang> list = new List<ChouJiang>(); string tableName = "view_ChouJiang"; string fileds = " * "; string orderByString = "ChouJiangShiJian desc"; StringBuilder query = new StringBuilder(); query.AppendFormat(" 1=1 "); if (serModel != null) { if (!string.IsNullOrEmpty(serModel.CaoZuoRenID)) { query.AppendFormat(" and CaoZuoRenID = '{0}' ", serModel.CaoZuoRenID); } } using (IDataReader dr = DbHelper.ExecuteReader1(this._db, PageSize, PageIndex, ref RecordCount, tableName, fileds, query.ToString(), orderByString, null)) { while (dr.Read()) { ChouJiang model = new ChouJiang(); model.CaoZuoRenID = dr.GetString(dr.GetOrdinal("CaoZuoRenID")); model.ChouJiangID = dr.GetString(dr.GetOrdinal("ChouJiangID")); model.ChouJiangShiJian = dr.GetDateTime(dr.GetOrdinal("ChouJiangShiJian")); model.ContactName = dr.GetString(dr.GetOrdinal("ContactName")); model.DianShu = dr.GetDecimal(dr.GetOrdinal("DianShu")); model.ID = dr.GetString(dr.GetOrdinal("ID")); model.JieGuo = (ChouJiangJieGuo)dr.GetByte(dr.GetOrdinal("JieGuo")); model.LiuShuiHao = dr.GetString(dr.GetOrdinal("LiuShuiHao")); model.UserName = dr.GetString(dr.GetOrdinal("UserName")); model.FangShi = (JiangLiFangShi)dr.GetByte(dr.GetOrdinal("FangShi")); list.Add(model); } } return list; }
/// <summary> /// 获取列表数据 /// </summary> /// <param name="PageSize"></param> /// <param name="PageIndex"></param> /// <param name="RecordCount"></param> /// <param name="serModel"></param> /// <returns></returns> public decimal getSumMoney(ChouJiangSer serModel) { return dal.getSumMoney(serModel); }
/// <summary> /// 获取列表数据 /// </summary> /// <param name="serModel"></param> /// <returns></returns> public IList<ChouJiang> GetList(ChouJiangSer serModel) { return dal.GetList(serModel); }
/// <summary> /// 获取分页数据 /// </summary> /// <param name="PageSize"></param> /// <param name="PageIndex"></param> /// <param name="RecordCount"></param> /// <param name="serModel"></param> /// <returns></returns> public IList<ChouJiang> GetList(int PageSize, int PageIndex, ref int RecordCount, ChouJiangSer 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> /// <returns></returns> public decimal getSumMoney(ChouJiangSer serModel) { IList<ChouJiang> list = new List<ChouJiang>(); StringBuilder strSql = new StringBuilder(); strSql.Append("SELECT sum(DianShu) FROM view_ChouJiang WHERE 1=1 "); if (serModel == null) { if (!string.IsNullOrEmpty(serModel.CaoZuoRenID)) { strSql.AppendFormat(" and CaoZuoRenID = '{0}' ", serModel.CaoZuoRenID); } } DbCommand cmd = this._db.GetSqlStringCommand(strSql.ToString()); decimal sum = Convert.ToDecimal(DbHelper.GetSingle(cmd, this._db)); return sum; }
/// <summary> /// 获取列表数据 /// </summary> /// <param name="PageSize"></param> /// <param name="PageIndex"></param> /// <param name="RecordCount"></param> /// <param name="serModel"></param> /// <returns></returns> public IList<ChouJiang> GetList(ChouJiangSer serModel) { IList<ChouJiang> list = new List<ChouJiang>(); StringBuilder strSql = new StringBuilder(); strSql.Append("SELECT * FROM view_ChouJiang WHERE 1=1 "); if (serModel != null) { if (!string.IsNullOrEmpty(serModel.CaoZuoRenID)) { strSql.AppendFormat(" and CaoZuoRenID = '{0}' ", serModel.CaoZuoRenID); } if (!string.IsNullOrEmpty(serModel.ID)) { strSql.AppendFormat(" and ID = '{0}' ", serModel.ID); } } strSql.Append(" order by ChouJiangShiJian desc "); DbCommand cmd = this._db.GetSqlStringCommand(strSql.ToString()); using (IDataReader dr = DbHelper.ExecuteReader(cmd, this._db)) { while (dr.Read()) { ChouJiang model = new ChouJiang(); model.CaoZuoRenID = dr.GetString(dr.GetOrdinal("CaoZuoRenID")); model.ChouJiangID = dr.GetString(dr.GetOrdinal("ChouJiangID")); model.ChouJiangShiJian = dr.GetDateTime(dr.GetOrdinal("ChouJiangShiJian")); model.ContactName = dr.GetString(dr.GetOrdinal("ContactName")); model.DianShu = dr.GetDecimal(dr.GetOrdinal("DianShu")); model.ID = dr.GetString(dr.GetOrdinal("ID")); model.JieGuo = (ChouJiangJieGuo)dr.GetByte(dr.GetOrdinal("JieGuo")); model.LiuShuiHao = dr.GetString(dr.GetOrdinal("LiuShuiHao")); model.UserName = dr.GetString(dr.GetOrdinal("UserName")); list.Add(model); } } return list; }