private void PageInit() { EyouSoft.BLL.ComStructure.BComArea BLL = new EyouSoft.BLL.ComStructure.BComArea(); pageIndex = Utils.GetInt(Utils.GetQueryStringValue("Page"), 1); MComAreaSearch model = new MComAreaSearch(); model.AreaName = Utils.GetQueryStringValue("txtlineName"); model.Type = Utils.GetQueryStringValue("areaType") == "" ? (AreaType?)null : (AreaType)Utils.GetInt(Utils.GetQueryStringValue("areaType")); IList <EyouSoft.Model.ComStructure.MComArea> lst = BLL.GetList(pageIndex, pageSize, ref recordCount, this.SiteUserInfo.CompanyId, model); if (lst != null && lst.Count > 0) { this.rpt_list.DataSource = lst; this.rpt_list.DataBind(); if (pageSize >= recordCount) { this.ExporPageInfoSelect1.Visible = false; } else { BindPage(); } } else { this.rpt_list.Controls.Add(new Label() { Text = "<tr><td colspan='3' height='23' align='center'>对不起,没有相关数据!</td></tr>" }); this.ExporPageInfoSelect1.Visible = false; } }
/// <summary> /// 分页获取线路区域信息 /// </summary> /// <param name="pageCurrent">当前页</param> /// <param name="pageSize">每页显示记录数</param> /// <param name="pageCount">总记录数</param> /// <param name="companyId">公司编号</param> /// <param name="model">搜索实体</param> /// <returns>线路区域集合</returns> public IList <MComArea> GetList(int pageCurrent, int pageSize, ref int pageCount, string companyId, MComAreaSearch model) { string tableName = "tbl_ComArea"; string primaryKey = "AreaId"; string fields = " AreaId,CompanyId,AreaName,[Type],OperatorId,(select OperatorId as PlanerId,(select ContactName from tbl_ComUser where UserId=tbl_ComAreaPlaner.OperatorId) as Planer from tbl_ComAreaPlaner where AreaId=tbl_ComArea.AreaId for xml raw,root) PlanList "; string query = string.Format(" CompanyId = '{0}' and IsDelete='0'", companyId); string orderBy = " AreaId DESC"; if (model != null) { if (!string.IsNullOrEmpty(model.AreaName)) { query += string.Format(" and AreaName like '%{0}%'", Utils.ToSqlLike(model.AreaName)); } if (model.Type.HasValue) { query += string.Format(" and [Type]={0}", (int)model.Type); } } IList <MComArea> list = new List <MComArea>(); MComArea item = null; string xmlString = string.Empty; using (IDataReader reader = DbHelper.ExecuteReader(this._db, pageSize, pageCurrent, ref pageCount, tableName, primaryKey, fields, query, orderBy)) { while (reader.Read()) { item = new MComArea() { AreaId = (int)reader["AreaId"], CompanyId = reader["CompanyId"].ToString(), AreaName = reader["AreaName"].ToString(), Type = (AreaType)Enum.Parse(typeof(AreaType), reader["Type"].ToString()), OperatorId = reader["OperatorId"].ToString(), Plan = GetPlanByXml(reader["PlanList"].ToString()) }; //计调员 list.Add(item); } } return(list); }
/// <summary> /// 分页获取线路区域信息 /// </summary> /// <param name="pageCurrent">当前页</param> /// <param name="pageSize">每页显示记录数</param> /// <param name="pageCount">总记录数</param> /// <param name="companyId">公司编号</param> /// <param name="model">搜索实体</param> /// <returns>线路区域集合</returns> public IList <MComArea> GetList(int pageCurrent, int pageSize, ref int pageCount, string companyId, MComAreaSearch model) { if (!string.IsNullOrEmpty(companyId)) { return(dal.GetList(pageCurrent, pageSize, ref pageCount, companyId, model)); } return(null); }