protected void btnUpdateProfile_Click(object sender, EventArgs e) { int lecturerID = 0; try { lecturerID = Convert.ToInt32(Request.QueryString["id"]); } catch (NullReferenceException) { } LecturerHandler lecturerHandler = new LecturerHandler(); Lecturer lecturer = new Lecturer(); lecturer = lecturerHandler.GetLecturerDetails(lecturerID); lecturer.LecturerID = lecturerID; lecturer.FirstName = txtFirstName.Value; lecturer.Surname = txtSurname.Value; lecturer.Email = txtEmail.Value; lecturer.Password = txtPassword.Value; if (txtPassword.Value == "") lecturerHandler.UpdateLecturer(lecturer); else if (txtPassword.Value != "") lecturerHandler.UpdateLecturerWithPassword(lecturer); Response.Redirect("Profile.aspx?id=" + lecturerID.ToString()); }
protected void Page_Load(object sender, EventArgs e) { int lecturerID = (int)Session["LecturerID"]; if (lecturerID == 0) Response.Redirect("Login.aspx"); LecturerHandler lecturerHandler = new LecturerHandler(); Lecturer lecturer = new Lecturer(); lecturer = lecturerHandler.GetLecturerDetails(lecturerID); if (!IsPostBack) { try { txtEmail.Value = lecturer.Email; txtFirstName.Value = lecturer.FirstName; txtSurname.Value = lecturer.Surname; } catch (NullReferenceException) { Response.Redirect("Default.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { if (Session["FirstName"] == null) { Response.Redirect("Default.aspx"); } Lecturer lecturer = new Lecturer(); LecturerHandler lecturerHandler = new LecturerHandler(); lecturer = lecturerHandler.GetLecturerDetails(Convert.ToInt32(Session["LecturerID"])); if (lecturer.Role != 2) { Response.Redirect("Dashboard.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { int lecturerID = (int)Session["LecturerID"]; if (lecturerID == 0) Response.Redirect("Login.aspx"); LecturerHandler lecturerHandler = new LecturerHandler(); Lecturer lecturer = new Lecturer(); lecturer = lecturerHandler.GetLecturerDetails(lecturerID); litLecturerName.Text = "Profile for " + lecturer.FirstName + " " + lecturer.Surname; txtEmail.Value = lecturer.Email; txtFirstName.Value = lecturer.FirstName; txtSurname.Value = lecturer.Surname; }
protected void Page_Load(object sender, EventArgs e) { if (Session["FirstName"] == null) { Response.Redirect("Default.aspx"); } Lecturer lecturer = new Lecturer(); LecturerHandler lecturerHandler = new LecturerHandler(); lecturer = lecturerHandler.GetLecturerDetails(Convert.ToInt32(Session["LecturerID"])); if (lecturer.Role == 2) { litAdminMenu.Text = "<h3>Admin tools</h3><br /><a href='AddModuleAdmin.aspx' class='btn btn-success'>Add Module</a><br /><br />"; //business button for litAdminMenu //<a href='BusinessSettings.aspx' class='btn btn-success'>Business Settings</a> } }