asp.net 读代码
protected void Page_Load(object sender, EventArgs e){
if (!IsPostBack)
{
if (Session["UsersId"] != null)
{
BLL.Users users = new BLL.Users();
Model.Users user = users.GetModel((int)Session["UsersId"]);
BLL.Roles roles =new BLL.Roles();
Model.Roles role = roles.GetModel(user.Fk_Roles_Id.Value);
BLL.PermisssionsNodes permisssionsNodes = new BLL.PermisssionsNodes();
List<Model.PermisssionsNodes> permisssionsNodesList = permisssionsNodes.GetModelList("Fk_Permissions_Id='" + role.Fk_Permissions_Id + "'");
List<Model.Nodes> nodes = new List<Model.Nodes>();
foreach (Model.PermisssionsNodes pn in permisssionsNodesList)
{
BLL.Nodes nodesBLL = new BLL.Nodes();
Model.Nodes node = nodesBLL.GetModel(pn.Fk_Nodes_Id.Value);
if (node != null)
{
if (node.ParentId == 0 && node.IsVisible == true)
{
nodes.Add(node);
}
}
}
Repeater1.DataSource = nodes.OrderBy(p=>p.Orders).ToList();
Repeater1.DataBind();