protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { string idValue = Request.Params["id"]; if (idValue != null) { int id = int.Parse(idValue); //删除节点的同时,删除TreeFunction、角色权限、人员权限 STreeData treeData = new STreeData(); STreeBB treeBB = new STreeBB(); STreeFunctionBB treeFunctionBB = new STreeFunctionBB(); PRolePermissionsBB rolePermissionsBB = new PRolePermissionsBB(); PEmpPermissionsBB empPermissionsBB = new PEmpPermissionsBB(); try { treeData = treeBB.GetModel(id); treeBB.DeleteRecord(id); treeFunctionBB.DeleteRecordByNode(id); rolePermissionsBB.DeleteRecordByItem(treeData.itemNo); empPermissionsBB.DeleteRecordByItem(treeData.itemNo); this.RefreshApplicationPageUrlTable(); this.RefreshApplicationTreeTable(); ClientScript.RegisterStartupScript(this.GetType(), "CloseSubmit", "CloseSubmit()", true); } catch (Exception ex) { this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true); return; } finally { treeBB.Dispose(); treeFunctionBB.Dispose(); rolePermissionsBB.Dispose(); empPermissionsBB.Dispose(); } } } }
protected void btnAdd_Click(object sender, EventArgs e) { STreeFunctionData treeFunctionData = new STreeFunctionData(); STreeFunctionBB treeFunctionBB = new STreeFunctionBB(); try { //ɾ����ǰ�˵����й��� treeFunctionBB.DeleteRecordByNode(this.NodeId); //�������� foreach (DataListItem item in this.DataList1.Items) { CheckBox checkBox = (CheckBox)item.FindControl("typeNm"); if (checkBox.Checked) { HtmlInputHidden hid = (HtmlInputHidden)item.FindControl("typeNo"); string typeNo = hid.Value; treeFunctionData.nodeId = this.NodeId; treeFunctionData.functionNo = typeNo; treeFunctionData.functionNm = checkBox.Text; treeFunctionBB.AddRecord(treeFunctionData); } } } catch (Exception ex) { this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true); return; } finally { treeFunctionBB.Dispose(); } this.ClientScript.RegisterStartupScript(this.GetType(), "Close", "window.close();", true); }