protected void Page_Load(object sender, System.EventArgs e) { if(!Page.IsPostBack) { string id=Request.Params["id"]; if(id==null || id.Trim()=="") { Response.Redirect("treelist.aspx"); Response.End(); } Navigation011.Para_Str="id="+id; Maticsoft.BLL.SysManage sm=new Maticsoft.BLL.SysManage(); SysNode node=sm.GetNode(int.Parse(id)); lblID.Text=id; this.lblOrderid.Text=node.OrderID.ToString(); lblName.Text=node.Text; if(node.ParentID==0) { this.lblTarget.Text="根目录"; } else { lblTarget.Text=sm.GetNode(node.ParentID).Text; } lblUrl.Text=node.Url; lblImgUrl.Text=node.ImageUrl; JiaJiao.Bus.Permissions perm=new JiaJiao.Bus.Permissions(); if(node.PermissionID==-1) { this.lblPermission.Text="没有权限限制"; } else { this.lblPermission.Text=perm.GetPermissionName(node.PermissionID); } lblDescription.Text=node.Comment; // if(node.ModuleID!=-1) // { // this.lblModule.Text=sm.GetModuleName(node.ModuleID); // } // else // { // this.lblModule.Text="未归属任何模块"; // } // // if(node.KeShiDM!=-1) // { // this.lblModuledept.Text=Maticsoft.BLL.PubConstant.GetKeshiName(node.KeShiDM); // } // else // { // this.lblModuledept.Text="未归属任何部门"; // } // if(node.KeshiPublic=="true") // { // this.lblKeshiPublic.Text="作为部门内部公有部分出现"; // } } }
protected void btnAdd_Click(object sender, System.EventArgs e) { string orderid=Maticsoft.Common.PageValidate.InputText(txtId.Text,10); string name=txtName.Text; string url=Maticsoft.Common.PageValidate.InputText(txtUrl.Text,100); //string imgUrl=Maticsoft.Common.PageValidate.InputText(txtImgUrl.Text,100); string imgUrl=this.hideimgurl.Value; string target=this.listTarget.SelectedValue; int parentid=int.Parse(target); string strErr=""; if(orderid.Trim()=="") { strErr+="编号不能为空\\n"; } try { int.Parse(orderid); } catch { strErr+="编号格式不正确\\n"; } if(name.Trim()=="") { strErr+="名称不能为空\\n"; } if(this.listPermission.SelectedItem.Text.StartsWith("╋")) { strErr+="权限类别不能做权限使用\\n"; } if(strErr!="") { Maticsoft.Common.MessageBox.Show(this,strErr); return; } int permission_id=-1; if(this.listPermission.SelectedIndex>0) { permission_id=int.Parse(this.listPermission.SelectedValue); } int moduleid=-1; int keshidm=-1; string keshipublic="false"; string comment=Maticsoft.Common.PageValidate.InputText(txtDescription.Text,100); SysNode node=new SysNode(); node.Text=name; node.ParentID=parentid; node.Location=parentid+"."+orderid; node.OrderID=int.Parse(orderid); node.Comment=comment; node.Url=url; node.PermissionID=permission_id; node.ImageUrl=imgUrl; node.ModuleID=moduleid; node.KeShiDM=keshidm; node.KeshiPublic=keshipublic; Maticsoft.BLL.SysManage sm = new Maticsoft.BLL.SysManage(); if (CheckBox1.Checked) { JiaJiao.Bus.Permissions p = new JiaJiao.Bus.Permissions(); string permissionName = node.Text; int parentID = node.ParentID; if (parentID == 0) { //根目录下不能选择同步创建权限 Maticsoft.Common.MessageBox.Show(this.Page, "根目录不能选择同步创建权限,请您手动创建!"); return; } SysNode parentNode = new SysNode(); parentNode = sm.GetNode(parentID); int catalogID = sm.GetPermissionCatalogID(parentNode.PermissionID); int permissionID = p.Create(catalogID, permissionName); node.PermissionID = permissionID; } sm.AddTreeNode(node); if(chkAddContinue.Checked) { Response.Redirect("Add.aspx"); } else { Response.Redirect("treelist.aspx"); } }