-
Notifications
You must be signed in to change notification settings - Fork 0
/
Layout.master.cs
52 lines (43 loc) · 1.59 KB
/
Layout.master.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Layout : System.Web.UI.MasterPage
{
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack)
return;
Member member = (Session["member"] as Member);
if(member != null)
{
BulletedListUserMenu.Items.Add(new ListItem(member.Name, "UserCP.aspx"));
if(member.IsAdmin())
{
BulletedListUserMenu.Items.Add(new ListItem("Admin CP", "~/admin/ManageForum.aspx?id=0"));
}
BulletedListUserMenu.Items.Add(new ListItem("Logout", "Login.aspx?do=logout"));
}
else
{
BulletedListUserMenu.Items.Add(new ListItem("Register", "Registration.aspx"));
BulletedListUserMenu.Items.Add(new ListItem("Login", "Login.aspx"));
}
}
public void GenerateBreadCrumb(Forum lastChild)
{
BLForum blForum = new BLForum();
List<ListItem> items = new List<ListItem>();
Forum breadcrumbForum = lastChild;
while (breadcrumbForum != null)
{
items.Add(new ListItem(breadcrumbForum.Name, "ViewForum.aspx?id=" + breadcrumbForum.Id));
breadcrumbForum = breadcrumbForum.ParentForumId.HasValue ? blForum.GetForumById(breadcrumbForum.ParentForumId.Value) : null;
}
items.Add(new ListItem("Forum Index", "Index.aspx"));
items.Reverse();
BulletedListBreadCrumb.Items.AddRange(items.ToArray());
}
}