protected void tr_OfficialCity_Selected(object sender, MCSControls.MCSWebControls.SelectedEventArgs e) { cbl_OfficialList.Items.Clear(); DataTable dt = TreeTableBLL.GetAllChildByNodes("MCS_SYS.dbo.Addr_OfficialCity", "ID", "SuperID", tr_OfficialCity.SelectValue); for (int i = 0; i < dt.Rows.Count; i++) { Addr_OfficialCityBLL city = new Addr_OfficialCityBLL((int)dt.Rows[i]["ID"]); if (city.Model.Level == 3) { string fullname = TreeTableBLL.GetFullPathName("MCS_SYS.dbo.Addr_OfficialCity", city.Model.ID); ListItem item = new ListItem(fullname, city.Model.ID.ToString()); IList <Addr_OfficialCityInOrganizeCity> organizecitys = Addr_OfficialCityInOrganizeCityBLL.GetModelList("OfficialCity=" + city.Model.ID.ToString()); if (organizecitys.Count > 0) { Addr_OrganizeCity organizecity = new Addr_OrganizeCityBLL(organizecitys[0].OrganizeCity).Model; if (organizecity != null) { item.Text += "; 已归属于片区:【" + organizecity.Name + "】"; } item.Enabled = false; } cbl_OfficialList.Items.Add(item); } } }
private void BindData(int ID) { ViewState["ID"] = ID; Addr_OrganizeCityBLL _bll = new Addr_OrganizeCityBLL(ID); lbl_ID.Text = _bll.Model.ID.ToString(); tbx_Name.Text = _bll.Model.Name; if (_bll.Model.SuperID != 0) { tree_SuperID.SelectValue = _bll.Model.SuperID.ToString(); } tbx_Code.Text = _bll.Model.Code; if (_bll.Model.Manager != 0) { select_Manager.SelectValue = _bll.Model.Manager.ToString(); select_Manager.SelectText = new Org_StaffBLL(_bll.Model.Manager).Model.RealName; } else { select_Manager.SelectValue = ""; select_Manager.SelectText = ""; } if (_bll.Model.Level != 0) { lbl_LevelName.Text = DictionaryBLL.GetDicCollections("Addr_OrganizeCityLevel")[_bll.Model.Level.ToString()].Name; } tbx_ManageRegion.Text = _bll.Model["ManageRegion"]; if (ID == 1) { btn_Save.Visible = false; btn_Delete.Visible = false; } else { btn_Save.Visible = true; btn_Delete.Visible = true; } bt_AddSub.Visible = true; MessageBox.ShowConfirm(btn_Delete, "数据删除将不可恢复,确定删除么?"); btn_Delete.Visible = Addr_OrganizeCityBLL.GetModelList("SuperID=" + ViewState["ID"].ToString()).Count == 0; lbl_AlertInfo.Text = ""; #region 绑定已关联的行政区县列表 if (_bll.Model.Level.ToString() == ConfigHelper.GetConfigString("OrganizeCity-CityLevel")) { tb_OfficialCityInOrganizeCity.Visible = true; cb_CheckAll.Checked = false; cbl_OfficialList.Items.Clear(); IList <Addr_OfficialCityInOrganizeCity> lists = Addr_OfficialCityInOrganizeCityBLL.GetModelList("OrganizeCity = " + ID.ToString()); foreach (Addr_OfficialCityInOrganizeCity e in lists) { Addr_OfficialCityBLL city = new Addr_OfficialCityBLL(e.OfficialCity); string fullname = TreeTableBLL.GetFullPathName("MCS_SYS.dbo.Addr_OfficialCity", city.Model.ID); ListItem item = new ListItem(fullname, e.ID.ToString()); cbl_OfficialList.Items.Add(item); } bt_AddOfficialCity.OnClientClick = "PopAddOfficialCity(" + ID.ToString() + ")"; } else { tb_OfficialCityInOrganizeCity.Visible = false; } #endregion }