forked from gajjarpratik/digicourse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MasterPage.master.cs
127 lines (105 loc) · 4.91 KB
/
MasterPage.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;
using System.Security;
public partial class MasterPage : System.Web.UI.MasterPage
{
protected void Page_Load(object sender, EventArgs e)
{
//Stop Caching in IE
Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
// Stop Caching in Firefox
Response.Cache.SetNoStore();
if (HttpContext.Current.User.Identity.IsAuthenticated)
{
HyperLink change = (HyperLink)Page.Master.FindControl("HyperLink7");
change.NavigateUrl = "~/common/ChangePassword.aspx";
change.Text = "Change Password";
string name = HttpContext.Current.User.Identity.Name;
if (Roles.IsUserInRole(name, "admin"))
{
//Change MenuBar Links
HyperLink menu = (HyperLink)Page.Master.FindControl("HyperLink1");
menu.NavigateUrl = "~/admin/Dashboard.aspx";
menu.Text = "Dashboard";
menu = (HyperLink)Page.Master.FindControl("HyperLink2");
menu.NavigateUrl = "~/admin/assignments.aspx";
menu.Text = "Assignments";
menu = (HyperLink)Page.Master.FindControl("HyperLink3");
menu.NavigateUrl = "~/admin/assignments.aspx";
menu.Text = "Assignments";
menu = (HyperLink)Page.Master.FindControl("HyperLink4");
menu.NavigateUrl = "~/admin/assignments.aspx";
menu.Text = "Assignments";
}
else if (Roles.IsUserInRole(name, "professor"))
{
//Change MenuBar Links
HyperLink menu = (HyperLink)Page.Master.FindControl("HyperLink1");
menu.NavigateUrl = "~/professor/Dashboard.aspx";
menu.Text = "Dashboard";
menu = (HyperLink)Page.Master.FindControl("HyperLink2");
menu.NavigateUrl = "~/professor/assignments.aspx";
menu.Text = "Assignments";
menu = (HyperLink)Page.Master.FindControl("HyperLink3");
menu.NavigateUrl = "~/professor/studentAssignments.aspx";
menu.Text = "Grading";
menu = (HyperLink)Page.Master.FindControl("HyperLink4");
menu.NavigateUrl = "~/professor/announcements.aspx";
menu.Text = "Announcements";
menu = (HyperLink)Page.Master.FindControl("HyperLink5");
menu.NavigateUrl = "~/professor/attendance.aspx";
menu.Text = "Attendance";
menu = (HyperLink)Page.Master.FindControl("HyperLink6");
menu.NavigateUrl = "~/professor/other.aspx";
menu.Text = "Other";
}
else if (Roles.IsUserInRole(name, "ta"))
{
//Change MenuBar Links
HyperLink menu = (HyperLink)Page.Master.FindControl("HyperLink1");
menu.NavigateUrl = "~/ta/Dashboard.aspx";
menu.Text = "Dashboard";
menu = (HyperLink)Page.Master.FindControl("HyperLink2");
menu.NavigateUrl = "~/ta/studentAssignments.aspx";
menu.Text = "Grading";
menu = (HyperLink)Page.Master.FindControl("HyperLink3");
menu.NavigateUrl = "~/ta/assignments.aspx";
menu.Text = "Assignments";
menu = (HyperLink)Page.Master.FindControl("HyperLink4");
menu.NavigateUrl = "~/ta/announcements.aspx";
menu.Text = "Announcements";
menu = (HyperLink)Page.Master.FindControl("HyperLink5");
menu.NavigateUrl = "~/ta/course_material.aspx";
menu.Text = "Course Material";
}
else if (Roles.IsUserInRole(name, "student"))
{
//Change MenuBar Links
HyperLink menu = (HyperLink)Page.Master.FindControl("HyperLink1");
menu.NavigateUrl = "~/student/Dashboard.aspx";
menu.Text = "Dashboard";
menu = (HyperLink)Page.Master.FindControl("HyperLink2");
menu.NavigateUrl = "~/student/courseDescription.aspx";
menu.Text = "Course Description";
menu = (HyperLink)Page.Master.FindControl("HyperLink3");
menu.NavigateUrl = "~/student/assignments.aspx";
menu.Text = "Assignments";
menu = (HyperLink)Page.Master.FindControl("HyperLink5");
menu.NavigateUrl = "~/student/course_material.aspx";
menu.Text = "Course Material";
}
else
{ }
}
}
//after logout redirect to default
protected void OnLogout(object sender, EventArgs e)
{
Response.Redirect("~/Default.aspx");
}
}