using System; using System.Web.UI.WebControls; using System.Data; using SuperMap.RealEstate.Web.Utility; using SuperMap.RealEstate.CoreFrameWork.Dictionary.Business; using Business = SuperMap.RealEstate.HighWay.Storage.Business; namespace SuperMap.RealEstate.HighWay.CloudModule.CommoditySymbol { public partial class ServerpartTreeView : BasePage { private Storage.Business.SERVERPART _SERVERPART = null; string FieldExplain_ID { get { FieldExplain _FieldExplain = new FieldExplain(); _FieldExplain.AddSearchParameter("FieldExplain_Field", "DIVISION_CODE"); if (_FieldExplain.Search()) { return _FieldExplain.FieldExplain_ID.ToString(); } else { throw new Exception("未配置对应的服务区数据!"); } } } protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) return; try { this.FixTreeViewDoubleClick(MyTreeView, true); SetControlClientAction(ButtonSearch); TreeViewBinding(true); } catch (Exception ex) { throw ex; } finally { } } private void TreeViewBinding(bool withChildNodes) { _SERVERPART = new Storage.Business.SERVERPART(this.Transaction); MyTreeView.Nodes.Clear(); foreach (Business.SERVERPART _ServerPart in new Business.SERVERPART(Transaction).GetPassportServerPart(PassportInfo.CityAuthority)) { TreeNode _TreeNode = new TreeNode(); _TreeNode.NavigateUrl = UriHelper.AddRequestToUrl("CommodityList.aspx?ID=" + _ServerPart.SERVERPART_ID_Encrypt + "&PROVINCE_CODE=" + _ServerPart.PROVINCE_CODE.ToEncrypt(), null); _TreeNode.Text = _ServerPart.SERVERPART_NAME; _TreeNode.Value = _ServerPart.SERVERPART_ID_Encrypt; MyTreeView.Nodes.Add(_TreeNode); foreach (DataRow dr in (new Storage.Business.COMMODITY(Transaction)).ExecuteDataTable( "SELECT BUSINESSTYPE,FIELDENUM_NAME FROM HIGHWAY_STORAGE.V_BUSINESSTYPE WHERE SERVERPART_ID = " + _ServerPart.SERVERPART_ID + " AND BUSINESSTYPE NOT IN (9032,9990,9999)").Rows) { TreeNode _ChildTreeNode = new TreeNode(); _ChildTreeNode.NavigateUrl = UriHelper.AddRequestToUrl("CommodityList.aspx?ID=" + _ServerPart.SERVERPART_ID_Encrypt + "&BusinessType=" + dr["BUSINESSTYPE"].ToEncrypt() + "&PROVINCE_CODE=" + _ServerPart.PROVINCE_CODE.ToEncrypt(), null); _ChildTreeNode.Text = dr["FIELDENUM_NAME"].ToString(); _ChildTreeNode.Value = dr["BUSINESSTYPE"].ToString(); _TreeNode.ChildNodes.Add(_ChildTreeNode); } } //预留添加全部按钮操作 //_SERVERPART.BindingTreeView_ForServerPartShop(FieldExplain_ID, "-1", MyTreeView.Nodes, TextBoxSearch.Text, withChildNodes, "12"); } protected void MyTreeView_TreeNodePopulate(object sender, TreeNodeEventArgs e) { if (_SERVERPART == null) { _SERVERPART = new Storage.Business.SERVERPART(Transaction); } _SERVERPART.BindingTreeView_ForServerPartShop(FieldExplain_ID, e.Node.Value, e.Node.ChildNodes, TextBoxSearch.Text, false, "12"); } protected void ButtonSearch_Click(object sender, EventArgs e) { TreeViewBinding(false); } protected void Expand_Click(object sender, EventArgs e) { if (Expand.Text == "收起↑") { foreach (TreeNode _TreeNode in MyTreeView.Nodes) { _TreeNode.Expanded = false; } Expand.Text = "展开↓"; } else if (Expand.Text == "展开↓") { MyTreeView.ExpandAll(); Expand.Text = "收起↑"; } } } }