left.aspx.cs
(开头部分) 4KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Data;
using System.Web.UI.WebControls;
public partial class left : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{// 下载于www.51aspx.com
if (Request.Cookies["roleid"] != null)
{
if (!IsPostBack)
{
#region 获取当前权限表
Role myrole = new Role();
myrole.RoleID = Convert.ToInt16(Server.HtmlEncode(Request.Cookies["roleid"].Value));
myrole.GetModel(myrole.RoleID);
//获取整个表,里面包含当前所有权限的moduleid
DataSet ds = new DataSet();
Authority myauthority = new Authority();
ds = myauthority.GetList("RoleID=" + myrole.RoleID + " ");
#endregion
#region 父节点添加
//建立int来防止fathermoduleid相同来判断并且只建立一个fathernode
int fathermoduleid = 100;
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
Module mymodule = new Module();
//设立查询的moduleid
mymodule.ModuleID = Convert.ToInt16(ds.Tables[0].Rows[i].ItemArray[2]);
//获取实例module
mymodule.GetModel(mymodule.ModuleID);
//查询父节点
//获取父节点编号
int Ofathernodeid = Convert.ToInt16(mymodule.ModuleFatherID);
//查询所有父节点的模块
Module fathermodule = new Module();
fathermodule.ModuleID = Ofathernodeid;
fathermodule.GetModel(fathermodule.ModuleID);
//查询结果中有重复取消在循环中进行判断,将重复的不执行
if (fathermoduleid != fathermodule.ModuleID)
{ //将当前查询到的父节点的id负值给Ofathernodeid
fathermoduleid = fathermodule.ModuleID;
//实例化本父节点
TreeNode FatherNode = new TreeNode(fathermodule.ModuleName, fathermodule.ModuleID.ToString(), "");
this.Tree_left.Nodes.Add(FatherNode);
FatherNode.SelectAction = TreeNodeSelectAction.Expand;
}
}
#endregion
#region 子节点添加
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
Module mymodule = new Module();
//设立查询的moduleid
后面还有 32 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读 AI
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
