protected void selecteurozone_Load(object sender, EventArgs e) { if (ddlprovince.Value.Equals("0")) { List <tb_LocationEntity> tlist = new List <tb_LocationEntity>(); tb_LocationEntity tmodel = new tb_LocationEntity(); tmodel.LocationName = "县/区"; tmodel.LocationId = 0; tlist.Add(tmodel); ddleurozone.DataSource = tlist; ddleurozone.DataTextField = "LocationName"; ddleurozone.DataValueField = "LocationId"; ddleurozone.DataBind(); } if (!string.IsNullOrEmpty(selecteurozone.Text) && !selecteurozone.Text.Equals("0")) { Exam.Entity.tb_LocationEntity model = Exam.BLL.tb_LocationBLL.GetInstance().GetAdminSingle(int.Parse(ddlcity.Value)); IList <Exam.Entity.tb_LocationEntity> ds = Exam.BLL.tb_LocationBLL.GetInstance().GetLocationInfo(model.LocationPath, 2); if (ds != null) { ddleurozone.DataSource = ds; ddleurozone.DataTextField = "LocationName"; ddleurozone.DataValueField = "LocationId"; ddleurozone.DataBind(); for (int i = 0; i < ddleurozone.Items.Count; i++) { if (ddleurozone.Items[i].Value == selecteurozone.Text) { ddleurozone.Items[i].Selected = true; } } } } }
private void BindData() { string where = ""; if (!string.IsNullOrEmpty(selecteurozone.Text) && !selecteurozone.Text.Equals("0")) { where = "and LocationId=" + selecteurozone.Text.Trim(); } else if (!string.IsNullOrEmpty(selectcity.Text) && !selectcity.Text.Equals("0")) { Exam.Entity.tb_LocationEntity model = Exam.BLL.tb_LocationBLL.GetInstance().GetAdminSingle(int.Parse(ddlcity.Value)); where = " and locationpath like '" + model.LocationPath + "%'"; } else if (!string.IsNullOrEmpty(ddlprovince.Value)) { if (ddlprovince.Value.Equals("0")) { where = " and 1=1"; } else { Exam.Entity.tb_LocationEntity model = Exam.BLL.tb_LocationBLL.GetInstance().GetAdminSingle(int.Parse(ddlprovince.Value)); where = " and locationpath like '" + model.LocationPath + "%'"; } } if (identity != null) { //超级管理员 if (identity._roleID == 4) { if (!string.IsNullOrEmpty(ddlstatus.SelectedValue)) { where += " and status=" + ddlstatus.SelectedValue; } } //代理商 else if (identity._roleID == 5) { where += " and agent=" + identity.UserID; int schoolid = int.Parse(Jnwf.Utils.Config.ConfigurationUtil.GetAppSettingValue("agentid")); if (!string.IsNullOrEmpty(ddlstatus.SelectedValue)) { where += " and status=" + ddlstatus.SelectedValue; } } int allCount; int CurrentPage = 0; CurrentPage = this.pager1.CurrentPageIndex; DataSet ds = Exam.BLL.tb_SchoolBLL.GetInstance().GetList(pager1.PageSize, CurrentPage, " 1=1 " + where, out allCount); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) { rptResultsList.DataSource = ds; rptResultsList.DataBind(); i = 2; } else { rptResultsList.DataSource = string.Empty; rptResultsList.DataBind(); } } }