private void GetAreaListByName(HttpContext context) { //检查是否重复点击 context.Response.Cache.SetCacheability(HttpCacheability.NoCache); //获取城市ID int area_id = DTRequest.GetQueryInt("id"); string json_result = string.Empty; if (area_id == 0) { json_result = "{\"status\":\"false\",\"data\":\"参数不能为0\"}"; context.Response.Write(json_result); context.Response.End(); } DataTable dt_area = null; string json_area = "[]"; BLL.cityinfo bll_city = new BLL.cityinfo(); //获取频道一级分类列表 dt_area = bll_city.GetChildList(area_id, 0); //分类反序列化为JSON if (dt_area != null && dt_area.Rows.Count > 0) { json_area = Common.ObjToJson.ToJson(dt_area, new string[2] { "id", "title" }); } json_result = "{\"status\":\"true\",\"area_data\":" + json_area + "}"; context.Response.Write(json_result); //返回JSON context.Response.End(); return; }
private void CityBind(int _province, int _city) { DataTable dt_province = null; DataTable dt_city = null; DataTable dt_area = null; BLL.cityinfo bll_city = new BLL.cityinfo(); dt_province = bll_city.GetChildList(0, 0); this.ddlProvince.Items.Clear(); //this.ddlProvince.Items.Add(new ListItem("请选择省名称...", "")); foreach (DataRow dr in dt_province.Rows) { string Id = dr["id"].ToString(); int ClassLayer = int.Parse(dr["class_layer"].ToString()); string Title = dr["title"].ToString().Trim(); this.ddlProvince.Items.Add(new ListItem(Title, Id)); } dt_city = bll_city.GetChildList(_province, 0); this.ddlCity.Items.Clear(); foreach (DataRow dr in dt_city.Rows) { string Id = dr["id"].ToString(); int ClassLayer = int.Parse(dr["class_layer"].ToString()); string Title = dr["title"].ToString().Trim(); this.ddlCity.Items.Add(new ListItem(Title, Id)); } dt_area = bll_city.GetChildList(_city, 0); this.ddlArea.Items.Clear(); foreach (DataRow dr in dt_area.Rows) { string Id = dr["id"].ToString(); int ClassLayer = int.Parse(dr["class_layer"].ToString()); string Title = dr["title"].ToString().Trim(); this.ddlArea.Items.Add(new ListItem(Title, Id)); } }
private void TreeBind(int _channel_id) { BLL.category bll = new BLL.category(); BLL.cityinfo bll_city = new BLL.cityinfo(); DataTable dt_grouptype, dt_property, dt_language, dt_pay, dt_account,dt_world = null; DataTable dt_city = null; #region 绑定旅团类型 dt_grouptype = bll.GetList(0, _channel_id, DTEnums.CategoryEnum.tourgroup.ToString()); this.ddlGroupType.Items.Clear(); foreach (DataRow dr in dt_grouptype.Rows) { string Id = dr["id"].ToString(); int ClassLayer = int.Parse(dr["class_layer"].ToString()); string Title = dr["title"].ToString().Trim(); if (ClassLayer == 1) { this.ddlGroupType.Items.Add(new ListItem(Title, Id)); } else { Title = "├ " + Title; Title = Utils.StringOfChar(ClassLayer - 1, " ") + Title; this.ddlGroupType.Items.Add(new ListItem(Title, Id)); } } #endregion #region 绑定语种 dt_language = bll.GetList(0, _channel_id, DTEnums.CategoryEnum.language.ToString()); this.ddlLanguage.Items.Clear(); this.ddlLanguage.Items.Add(new ListItem("请选择语种...", "0")); foreach (DataRow dr in dt_language.Rows) { string Id = dr["id"].ToString(); int ClassLayer = int.Parse(dr["class_layer"].ToString()); string Title = dr["title"].ToString().Trim(); if (ClassLayer == 1) { this.ddlLanguage.Items.Add(new ListItem(Title, Id)); } else { Title = "├ " + Title; Title = Utils.StringOfChar(ClassLayer - 1, " ") + Title; this.ddlLanguage.Items.Add(new ListItem(Title, Id)); } } #endregion #region 绑定账单周期 dt_account = bll.GetList(0, _channel_id, DTEnums.CategoryEnum.period.ToString()); this.ddlAccount.Items.Clear(); this.ddlAccount.Items.Add(new ListItem("请选择账单周期...", "0")); foreach (DataRow dr in dt_account.Rows) { string Id = dr["id"].ToString(); int ClassLayer = int.Parse(dr["class_layer"].ToString()); string Title = dr["title"].ToString().Trim(); if (ClassLayer == 1) { this.ddlAccount.Items.Add(new ListItem(Title, Id)); } else { Title = "├ " + Title; Title = Utils.StringOfChar(ClassLayer - 1, " ") + Title; this.ddlAccount.Items.Add(new ListItem(Title, Id)); } } #endregion #region 绑定支付类型 dt_pay = bll.GetList(0, _channel_id, DTEnums.CategoryEnum.pay.ToString()); this.ddlRestaurant.Items.Clear(); this.ddlRestaurant.Items.Add(new ListItem("请选择餐厅支付类型...", "0")); this.ddlTicketType.Items.Clear(); this.ddlTicketType.Items.Add(new ListItem("请选择门票支付类型...", "0")); foreach (DataRow dr in dt_pay.Rows) { string Id = dr["id"].ToString(); int ClassLayer = int.Parse(dr["class_layer"].ToString()); string Title = dr["title"].ToString().Trim(); if (ClassLayer == 1) { this.ddlRestaurant.Items.Add(new ListItem(Title, Id)); this.ddlTicketType.Items.Add(new ListItem(Title, Id)); } else { Title = "├ " + Title; Title = Utils.StringOfChar(ClassLayer - 1, " ") + Title; this.ddlRestaurant.Items.Add(new ListItem(Title, Id)); this.ddlTicketType.Items.Add(new ListItem(Title, Id)); } } #endregion #region 绑定团属 dt_property = bll.GetList(0, _channel_id, DTEnums.CategoryEnum.groupteam.ToString()); this.ddlProperty.Items.Clear(); this.ddlProperty.Items.Add(new ListItem("请选择团属...", "0")); foreach (DataRow dr in dt_property.Rows) { string Id = dr["id"].ToString(); int ClassLayer = int.Parse(dr["class_layer"].ToString()); string Title = dr["title"].ToString().Trim(); if (ClassLayer == 1) { this.ddlProperty.Items.Add(new ListItem(Title, Id)); } else { Title = "├ " + Title; Title = Utils.StringOfChar(ClassLayer - 1, " ") + Title; this.ddlProperty.Items.Add(new ListItem(Title, Id)); } } #endregion #region 绑定国际线路 //world dt_world = bll.GetList(0, _channel_id, DTEnums.CategoryEnum.world.ToString()); this.ddlLineCity.Items.Clear(); this.ddlLineCity.Items.Add(new ListItem("请选择线路...", "0")); foreach (DataRow dr in dt_world.Rows) { string Id = dr["id"].ToString(); int ClassLayer = int.Parse(dr["class_layer"].ToString()); string Title = dr["title"].ToString().Trim(); if (ClassLayer == 1) { this.ddlLineCity.Items.Add(new ListItem(Title, Id)); } else { Title = "├ " + Title; Title = Utils.StringOfChar(ClassLayer - 1, " ") + Title; this.ddlLineCity.Items.Add(new ListItem(Title, Id)); } } #endregion #region 绑定城市 dt_city = bll_city.GetChildList(0, _channel_id); this.ddlFromCity.Items.Clear(); this.ddlFromCity.Items.Add(new ListItem("请选择省市...", "")); this.ddlToCity.Items.Clear(); this.ddlToCity.Items.Add(new ListItem("请选择省市...", "")); foreach (DataRow dr in dt_city.Rows) { string Id = dr["id"].ToString(); int ClassLayer = int.Parse(dr["class_layer"].ToString()); string Title = dr["title"].ToString().Trim(); if (ClassLayer == 1) { this.ddlFromCity.Items.Add(new ListItem(Title, Id)); this.ddlToCity.Items.Add(new ListItem(Title, Id)); } else { Title = "├ " + Title; Title = Utils.StringOfChar(ClassLayer - 1, " ") + Title; this.ddlFromCity.Items.Add(new ListItem(Title, Id)); this.ddlToCity.Items.Add(new ListItem(Title, Id)); } } #endregion }