/// <summary> /// 得到菜单节点 /// </summary> /// <param name="NodeID"></param> /// <returns></returns> public SysNodeModel GetNode(int NodeID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select * from S_Tree "); strSql.Append(" where NodeID=@NodeID"); SqlParameter[] parameters = { new SqlParameter("@NodeID", SqlDbType.Int, 4) }; parameters[0].Value = NodeID; SysNodeModel node = new SysNodeModel(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { node.NodeID = int.Parse(ds.Tables[0].Rows[0]["NodeID"].ToString()); node.Text = ds.Tables[0].Rows[0]["text"].ToString(); if (ds.Tables[0].Rows[0]["ParentID"].ToString() != "") { node.ParentID = int.Parse(ds.Tables[0].Rows[0]["ParentID"].ToString()); } node.Location = ds.Tables[0].Rows[0]["Location"].ToString(); if (ds.Tables[0].Rows[0]["OrderID"].ToString() != "") { node.OrderID = int.Parse(ds.Tables[0].Rows[0]["OrderID"].ToString()); } node.Comment = ds.Tables[0].Rows[0]["comment"].ToString(); node.Url = ds.Tables[0].Rows[0]["url"].ToString(); if (ds.Tables[0].Rows[0]["PermissionID"].ToString() != "") { node.PermissionID = int.Parse(ds.Tables[0].Rows[0]["PermissionID"].ToString()); } node.ImageUrl = ds.Tables[0].Rows[0]["ImageUrl"].ToString(); return(node); } else { return(null); } }
public void UpdateNode(SysNodeModel model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update S_Tree set "); strSql.Append("Text=@Text,"); strSql.Append("ParentID=@ParentID,"); strSql.Append("Location=@Location,"); strSql.Append("OrderID=@OrderID,"); strSql.Append("comment=@comment,"); strSql.Append("Url=@Url,"); strSql.Append("PermissionID=@PermissionID,"); strSql.Append("ImageUrl=@ImageUrl"); strSql.Append(" where NodeID=@NodeID"); SqlParameter[] parameters = { new SqlParameter("@NodeID", SqlDbType.Int, 4), new SqlParameter("@Text", SqlDbType.VarChar, 100), new SqlParameter("@ParentID", SqlDbType.Int, 4), new SqlParameter("@Location", SqlDbType.VarChar, 50), new SqlParameter("@OrderID", SqlDbType.Int, 4), new SqlParameter("@comment", SqlDbType.VarChar, 50), new SqlParameter("@Url", SqlDbType.VarChar, 100), new SqlParameter("@PermissionID", SqlDbType.Int, 4), new SqlParameter("@ImageUrl", SqlDbType.VarChar, 100) }; parameters[0].Value = model.NodeID; parameters[1].Value = model.Text; parameters[2].Value = model.ParentID; parameters[3].Value = model.Location; parameters[4].Value = model.OrderID; parameters[5].Value = model.Comment; parameters[6].Value = model.Url; parameters[7].Value = model.PermissionID; parameters[8].Value = model.ImageUrl; DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); }
public int AddTreeNode(SysNodeModel model) { model.NodeID = GetMaxId(); StringBuilder strSql = new StringBuilder(); strSql.Append("insert into S_Tree("); strSql.Append("NodeID,Text,ParentID,Location,OrderID,comment,Url,PermissionID,ImageUrl)"); strSql.Append(" values ("); strSql.Append("@NodeID,@Text,@ParentID,@Location,@OrderID,@comment,@Url,@PermissionID,@ImageUrl)"); // SqlParameter[] parameters = { new SqlParameter("@NodeID", SqlDbType.Int, 4), new SqlParameter("@Text", SqlDbType.VarChar, 100), new SqlParameter("@ParentID", SqlDbType.Int, 4), new SqlParameter("@Location", SqlDbType.VarChar, 50), new SqlParameter("@OrderID", SqlDbType.Int, 4), new SqlParameter("@comment", SqlDbType.VarChar, 50), new SqlParameter("@Url", SqlDbType.VarChar, 100), new SqlParameter("@PermissionID", SqlDbType.Int, 4), new SqlParameter("@ImageUrl", SqlDbType.VarChar, 100) }; parameters[0].Value = model.NodeID; parameters[1].Value = model.Text; parameters[2].Value = model.ParentID; parameters[3].Value = model.Location; parameters[4].Value = model.OrderID; parameters[5].Value = model.Comment; parameters[6].Value = model.Url; parameters[7].Value = model.PermissionID; parameters[8].Value = model.ImageUrl; DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); return(model.NodeID); }
public void UpdateNode(SysNodeModel node) { dal.UpdateNode(node); }
public int AddTreeNode(SysNodeModel node) { return(dal.AddTreeNode(node)); }
private void ShowInfo(string id) { Navigation011.Para_Str = "id=" + id; Maticsoft.BLL.SysManageBLL sm = new Maticsoft.BLL.SysManageBLL(); SysNodeModel node = sm.GetNode(int.Parse(id)); this.lblID.Text = id; this.txtOrderid.Text = node.OrderID.ToString(); this.txtName.Text = node.Text; //menu if (node.ParentID == 0) { this.listTarget.SelectedIndex = 0; } else { for (int m = 0; m < this.listTarget.Items.Count; m++) { if (this.listTarget.Items[m].Value == node.ParentID.ToString()) { this.listTarget.Items[m].Selected = true; } } } this.txtUrl.Text = node.Url; // this.txtImgUrl.Text=node.ImageUrl; this.txtDescription.Text = node.Comment; //Permission for (int n = 0; n < this.listPermission.Items.Count; n++) { if ((this.listPermission.Items[n].Value == node.PermissionID.ToString()) && (this.listPermission.Items[n].Value != "-1")) { this.listPermission.Items[n].Selected = true; } } // //module // for(int n=0;n<this.dropModule.Items.Count;n++) // { // if(this.dropModule.Items[n].Value==node.ModuleID.ToString()) // { // this.dropModule.Items[n].Selected=true; // } // } // // //module // for(int n=0;n<this.Dropdepart.Items.Count;n++) // { // if(this.Dropdepart.Items[n].Value==node.KeShiDM.ToString()) // { // this.Dropdepart.Items[n].Selected=true; // } // } //image for (int n = 0; n < this.imgsel.Items.Count; n++) { if (this.imgsel.Items[n].Value == node.ImageUrl) { this.imgsel.Items[n].Selected = true; this.hideimgurl.Value = node.ImageUrl; } } // if(node.KeshiPublic=="true") // { // this.chkPublic.Checked=true; // } }
protected void btnAdd_Click(object sender, System.EventArgs e) { string id = Maticsoft.Common.PageValidate.InputText(this.lblID.Text, 10); string orderid = Maticsoft.Common.PageValidate.InputText(this.txtOrderid.Text, 5); 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; // if(this.dropModule.SelectedIndex>0) // { // moduleid=int.Parse(this.dropModule.SelectedValue); // } // int moduledeptid=-1; // if(this.dropModuleDept.SelectedIndex>0) // { // moduledeptid=int.Parse(this.dropModuleDept.SelectedValue); // } int keshidm = -1; // if(this.Dropdepart.SelectedIndex>0) // { // keshidm=int.Parse(this.Dropdepart.SelectedValue); // } string keshipublic = "false"; // if(this.chkPublic.Checked) // { // keshipublic="true"; // } string comment = Maticsoft.Common.PageValidate.InputText(txtDescription.Text, 100); SysNodeModel node = new SysNodeModel(); node.NodeID = int.Parse(id); node.OrderID = int.Parse(orderid); node.Text = name; node.ParentID = parentid; node.Location = parentid + "." + 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.SysManageBLL sm = new Maticsoft.BLL.SysManageBLL(); sm.UpdateNode(node); Response.Redirect("show.aspx?id=" + id); }
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); SysNodeModel node = new SysNodeModel(); 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.SysManageBLL sm = new Maticsoft.BLL.SysManageBLL(); if (CheckBox1.Checked) { LTP.Accounts.Bus.Permissions p = new LTP.Accounts.Bus.Permissions(); string permissionName = node.Text; int parentID = node.ParentID; if (parentID == 0) { //根目录下不能选择同步创建权限 Maticsoft.Common.MessageBox.Show(this.Page, "根目录不能选择同步创建权限,请您手动创建!"); return; } SysNodeModel parentNode = new SysNodeModel(); 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"); } }
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.SysManageBLL sm = new Maticsoft.BLL.SysManageBLL(); SysNodeModel 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; LTP.Accounts.Bus.Permissions perm = new LTP.Accounts.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="作为部门内部公有部分出现"; // } } }