protected void Page_Load(object sender, System.EventArgs e) { try { Nav1.relativeURL = "../"; if (!IsPostBack) { if (Request["CourseID"] != null && Request["CourseID"] != String.Empty) { System.Guid courseGuid = new System.Guid(Request.QueryString.Get("CourseID").ToString()); CourseM course = CourseM.Load(courseGuid); if (course.IsValid) { Response.Redirect("Assignments.aspx?CourseID=" + course.CourseID, false); } else { Response.Redirect(@"../Error.aspx?ErrorDetail=" + "Global_Unauthorized", false); } } else { //Throw error, there was no CourseID on the query string Response.Redirect(@"../Error.aspx?ErrorDetail=" + "Global_MissingParameter", false); } } } catch (Exception ex) { Nav1.Feedback.Text = ex.Message.ToString(); } }
//First, defines the SectionID for the User and Course //Then, grabs the info for the Assignments and status using the UserID and SectionID protected void BrowseAssignments(CourseM course) { if (courseId.Equals(null)) { Nav1.Feedback.Text = SharedSupport.GetLocalizedString("Assignments_SectionIDError"); } else { int userID = SharedSupport.GetUserIdentity(); AssignmentList assignList = course.GetStudentAssignmentList(userID); if (assignList.Count > 0) { //cycle through all the rows and set n/a for (int i = 0; i < assignList.Count; i++) { if (assignList.GetOverallGradeForItem(i).Equals(String.Empty)) { assignList.SetOverallGradeForItem(i, SharedSupport.GetLocalizedString("GradeDetail_Default")); } } //Populate DataList this.dlAssignments.DataSource = assignList.GetDefaultView(Server); this.dlAssignments.DataBind(); } else { Nav1.Feedback.Text = SharedSupport.GetLocalizedString("Assignments_NoAssignmentError"); } } }
public void btnUpdate_Click(object sender, System.EventArgs e) { try { //Check Security Permissions if (!SharedSupport.SecurityIsAllowed(courseId, SecurityAction.COURSE_EDIT)) { throw new Exception(SharedSupport.GetLocalizedString("Global_Unauthorized")); } CourseM course = CourseM.Load(courseId); if (course.IsValid) { //Update - Load existing Course and populate fields course.Name = txtShortNameValue.Text.ToString(); course.Description = txtDescription.Text.ToString(); course.HomepageURL = txtHomePageURL.Text.ToString(); course.LastUpdatedDate = DateTime.Now; course.LastUpdatedUserID = SharedSupport.GetUserIdentity(); course.Update(); populateControls(course); Response.Redirect(@"./AddEditCourse.aspx?CourseID=" + courseId + "&Action=Update"); } else { // throw error - can't use this page without CourseID int passed in Response.Redirect(@"../Error.aspx?ErrorDetail=" + "AddEditCourse_MissingCourseID&" + Request.QueryString.ToString(), false); } } catch (Exception ex) { Nav1.Feedback.Text = ex.Message.ToString(); } }
private void populateControls(CourseM course) { //Update - Load existing Course and populate fields txtDescription.Text = course.Description; txtHomePageURL.Text = course.HomepageURL; txtShortNameValue.Text = course.Name; // Use the CourseID to create a unique xml filename for the course. string filename = course.CourseID + ".xml"; if (SharedSupport.UsingSsl == true) { txtStudentURL.Text = @"https://" + SharedSupport.BaseUrl + AssignmentManager.Constants.ASSIGNMENTMANAGER_COURSES_DIRECTORY + Server.UrlEncode(filename); } else { txtStudentURL.Text = @"http://" + SharedSupport.BaseUrl + AssignmentManager.Constants.ASSIGNMENTMANAGER_COURSES_DIRECTORY + Server.UrlEncode(filename); } btnUpdate.Text = SharedSupport.GetLocalizedString("AddEditCourse_UpdateText"); }
protected void Page_Load(object sender, EventArgs e) { try { Nav1.relativeURL = "../"; if (!IsPostBack) { // // Evals true first time browser hits the page // if (Request["CourseID"] != null && Request["CourseID"] != String.Empty) { System.Guid courseGuid = new System.Guid(Request.QueryString.Get("CourseID").ToString()); CourseM course = CourseM.Load(courseGuid); if (course.IsValid) { Response.Redirect(@"Assignments.aspx?CourseID=" + course.CourseID, false); } else { // if(!security.IsAllowed(Constants.COURSE_ADD_ACTION) ) // { // // Note that Redirect ends page execution. // Response.Redirect(@"../Error.aspx?ErrorDetail=" + "Global_Unauthorized"); // } //Course needs to be inserted, redirect to AddCourse.aspx Response.Redirect("AddCourse.aspx?" + Request.QueryString.ToString(), false); } } else { //Throw error, there was no CourseID on the query string Response.Redirect(@"../Error.aspx?ErrorDetail=" + "Global_MissingParameter&" + Request.QueryString.ToString(), false); } } } catch (Exception) { Response.Redirect(@"../Error.aspx?ErrorDetail=" + "Global_MissingParameter&" + Request.QueryString.ToString(), false); } }
protected void Page_Load(object sender, EventArgs e) { try { // link to Core Tools this.hlCoreTools.Text = SharedSupport.GetLocalizedString("ErrorPage_BackToStartPage"); this.hlCoreTools.NavigateUrl = AssignmentManager.Common.constants.BACK_TO_CORETOOLS_LINK; //Check Security Permissions if (!SharedSupport.SecurityIsAllowed(SecurityAction.COURSE_DELETE)) { // Note that Redirect ends page execution. Response.Redirect(@"../Error.aspx?ErrorDetail=" + "Global_Unauthorized"); } if (!IsPostBack) { string CourseID = Request.QueryString.Get("CourseID").ToString(); System.Guid courseGuid = new System.Guid(CourseID); CourseM course = CourseM.Load(courseGuid); if (course.IsValid) { string dir = System.Web.HttpContext.Current.Server.MapPath("..\\") + "\\Courses\\"; File.Delete(dir + CourseID + ".xml"); course.Delete(); lblFeedback.Text = SharedSupport.GetLocalizedString("DeleteCourse_FacultyDeleteVerification"); // log off to avoid confusion System.Web.Security.FormsAuthentication.SignOut(); } else { lblFeedback.Text = SharedSupport.GetLocalizedString("DeleteCourse_FacultyAlreadyDeleted"); } } } catch (System.Exception ex) { lblFeedback.Text = ex.Message; } }
protected void Page_Load(object sender, System.EventArgs e) { try { Nav1.relativeURL = "../"; AssignmentManager.Common.Functions func = new AssignmentManager.Common.Functions(); int vsversion = func.ValidateNumericQueryStringParameter(Request, "VSVersion"); if (vsversion < 7.1) { Response.Redirect(@"../Error.aspx?ErrorDetail=" + "AddCourse_WrongVSVersion", false); } //Check Security Permissions if (!IsPostBack) { if (Request["CourseID"] != null && Request["CourseID"] != String.Empty) { System.Guid courseGuid = new System.Guid(Request.QueryString.Get("CourseID").ToString()); CourseM course = CourseM.Load(courseGuid); if (course.IsValid) { Response.Redirect("Assignments.aspx?CourseID=" + course.CourseID, false); } } else { //Throw error, there was no CourseID on the query string Response.Redirect(@"../Error.aspx?ErrorDetail=" + "Global_MissingParameter", false); } } } catch { Response.Redirect(@"../Error.aspx?ErrorDetail=" + "Global_Unauthorized", false); } }
//Browses the CourseResources table by CourseID //If records are returned, fills labels w/ information; else labels are blank. private void CourseResources(CourseM course) { DataSet resourceList = course.ResourceList; if (resourceList.Tables.Count > 0) { for (int i = 0; i < resourceList.Tables[0].Rows.Count; i++) { for (int j = 0; j < resourceList.Tables[0].Columns.Count; j++) { try { resourceList.Tables[0].Rows[i][j] = Server.HtmlEncode(resourceList.Tables[0].Rows[i][j].ToString()); } catch { } } } } this.dlCourseResources.DataSource = resourceList; this.dlCourseResources.DataBind(); this.dlCourseResources.Visible = true; }
private void courseExists(CourseM course) { // build the connect to URL string connectURL; string filename = course.CourseID.ToString() + ".xml"; if (SharedSupport.UsingSsl == true) { connectURL = @"https://" + SharedSupport.BaseUrl + AssignmentManager.Constants.ASSIGNMENTMANAGER_COURSES_DIRECTORY + Server.UrlEncode(filename); } else { connectURL = @"http://" + SharedSupport.BaseUrl + AssignmentManager.Constants.ASSIGNMENTMANAGER_COURSES_DIRECTORY + Server.UrlEncode(filename); } Nav1.Feedback.Text = SharedSupport.GetLocalizedString("AddCourse_CourseExists", new string[] { course.Name }); this.lblPrompt.Text = SharedSupport.GetLocalizedString("AddCourse_WhatDoPrompt", new string[] { connectURL }); this.lblInvalidLink.Text = SharedSupport.GetLocalizedString("AddCourse_InvalidLink"); // retasking the CopyCourse hyperlink for Delete Course this.hlCopyCourse.Text = SharedSupport.GetLocalizedString("AddCourse_DeleteLink"); this.hlWorkWithCourse.Text = SharedSupport.GetLocalizedString("AddCourse_WorkWithCourse"); this.hlWorkWithCourse.NavigateUrl += "vs://custom/faculty/addcourse.html"; this.hlCopyCourse.NavigateUrl += "vs://custom/faculty/deletecourse.html"; this.lblPrompt.Visible = true; this.hlCopyCourse.Visible = true; this.hlWorkWithCourse.Visible = true; }
protected void Page_Load(object sender, System.EventArgs e) { try { // grab CourseID parameter from the querystring AssignmentManager.Common.Functions func = new AssignmentManager.Common.Functions(); courseId = func.ValidateNumericQueryStringParameter(this.Request, "CourseID"); UserM user = UserM.Load(SharedSupport.GetUserIdentity()); if (!user.IsInCourse(courseId)) { Response.Redirect(@"../Error.aspx?ErrorDetail=" + "Global_Unauthorized"); } Nav1.Feedback.Text = String.Empty; Nav1.SideTabId = AssignmentManager.Common.constants.SIDE_NAV_STUDENT_COURSE; Nav1.TopTabId = AssignmentManager.Common.constants.TOP_NAV_STUDENT_COURSE_ASSIGNMENTS; Nav1.relativeURL = @"../"; GoBack1.GoBack_HelpUrl = SharedSupport.HelpRedirect("vstskCheckingAssignmentStatus"); GoBack1.GoBack_HelpUrl = SharedSupport.HelpRedirect("tskUsingAssignmentManagerToCheckAssignmentStatus"); GoBack1.GoBack_top = "-5px"; GoBack1.GoBack_left = "60px"; GoBack1.GoBackIncludeBack = false; if (courseId <= 0) { Nav1.Feedback.Text = SharedSupport.GetLocalizedString("Global_MissingParameter"); } CourseM course = CourseM.Load(courseId); string title = course.Name.Trim(); if (title.Length > 45) { title = title.Substring(0, 45) + SharedSupport.GetLocalizedString("UserControl_Faculty_DotDotDot"); } Nav1.Title = Server.HtmlEncode(title); if (course.IsValid) { Nav1.SubTitle = Server.HtmlEncode(SharedSupport.GetLocalizedString("Assignments_Subtitle") + " " + course.Name); } if (!IsPostBack) { // Evals true first time browser hits the page } Response.Cache.SetNoStore(); int userID = SharedSupport.GetUserIdentity(); //throws an error if either the courseID or userID are empty if (courseId.Equals(null) || userID.Equals(null)) { Nav1.Feedback.Text = SharedSupport.GetLocalizedString("Assignments_CourseIDError"); } else { try { //calls a function to return all the assignments for the course BrowseAssignments(course); } catch (System.Exception ex) { Nav1.Feedback.Text = ex.Message; } } localizeLabels(); } catch (Exception ex) { Nav1.Feedback.Text = ex.Message.ToString(); } }
protected void Page_Load(object sender, System.EventArgs e) { try { // grab CourseID parameter from the querystring AssignmentManager.Common.Functions func = new AssignmentManager.Common.Functions(); courseId = func.ValidateNumericQueryStringParameter(this.Request, "CourseID"); UserM user = UserM.Load(SharedSupport.GetUserIdentity()); if (!user.IsInCourse(courseId)) { Response.Redirect(@"../Error.aspx?ErrorDetail=" + "Global_Unauthorized"); } //display nav bar Nav1.Feedback.Text = String.Empty; Nav1.SideTabId = AssignmentManager.Common.constants.SIDE_NAV_STUDENT_COURSE; Nav1.TopTabId = AssignmentManager.Common.constants.TOP_NAV_STUDENT_COURSE_INFO; Nav1.relativeURL = @"../"; GoBack1.GoBack_left = "450px"; GoBack1.GoBack_top = "5px"; GoBack1.GoBack_HelpUrl = SharedSupport.HelpRedirect("tskViewingCourseInformationWithAssignmentManager"); GoBack1.GoBackIncludeBack = false; if (courseId.Equals(null)) { throw(new ArgumentException(SharedSupport.GetLocalizedString("Global_MissingParameter"))); } CourseM course = CourseM.Load(courseId); if (course.IsValid) { Nav1.SubTitle = SharedSupport.GetLocalizedString("Assignments_Subtitle") + " " + Server.HtmlEncode(course.Name); } if (!IsPostBack) { // // Evals true first time browser hits the page // LocalizeLabels(); if (course.IsValid) { this.txtDescriptionText.Text = course.Description; this.lblShortNameValue.Text = Server.HtmlEncode(course.Name); if (course.HomepageURL.Trim() != "") { this.linkHomePageURLText.Text = Server.HtmlEncode(course.HomepageURL); this.linkHomePageURLText.NavigateUrl = course.HomepageURL; } else { this.lblHomePageURL.Text = ""; } string title = course.Name.Trim(); if (title.Length > 45) { title = title.Substring(0, 45) + SharedSupport.GetLocalizedString("UserControl_Faculty_DotDotDot"); } Nav1.Title = Server.HtmlEncode(title); CourseResources(course); } else { // throw error - can't use this page without CourseID int passed in Nav1.Feedback.Text = SharedSupport.GetLocalizedString("AddEditCourse_MissingCourseID"); } } } catch (Exception ex) { Nav1.Feedback.Text = ex.Message.ToString(); } }
protected void Page_Load(object sender, System.EventArgs e) { try { AssignmentManager.Common.Functions func = new AssignmentManager.Common.Functions(); // grab CourseID parameter from the querystring int UserID = func.ValidateNumericQueryStringParameter(this.Request, "UserID"); if (UserID == SharedSupport.GetUserIdentity()) { Nav1.Feedback.Text = String.Empty; Nav1.relativeURL = @"../"; Nav1.SideTabId = AssignmentManager.Common.constants.SIDE_NAV_SERVER_ADMIN; Nav1.TopTabId = AssignmentManager.Common.constants.TOP_NAV_SERVER_MYACCOUNT; Nav1.Title = SharedSupport.GetLocalizedString("MyAccountChangePassword_Title"); Nav1.SubTitle = SharedSupport.GetLocalizedString("MyAccountChangePassword_SubTitle"); } else { Nav1.Feedback.Text = String.Empty; Nav1.SideTabId = AssignmentManager.Common.constants.SIDE_NAV_COURSE_MANAGEMENT; Nav1.TopTabId = AssignmentManager.Common.constants.TOP_NAV_COURSE_USERS; Nav1.relativeURL = @"../"; Nav1.Title = " "; Nav1.SubTitle = SharedSupport.GetLocalizedString("ChangePassword_SubTitle2"); } GoBack1.GoBackIncludeBack = true; GoBack1.GoBack_HelpUrl = SharedSupport.HelpRedirect("vstskAccessingYourAccount"); GoBack1.GoBack_BackURL = "AddEditUser.aspx?" + Request.QueryString.ToString(); courseId = func.ValidateNumericQueryStringParameter(this.Request, "CourseID"); if (courseId <= 0) { throw(new ArgumentException(SharedSupport.GetLocalizedString("Global_MissingParameter"))); } if (!SharedSupport.SecurityIsAllowed(courseId, SecurityAction.USER_EDIT)) { // Note that Redirect ends page execution. Response.Redirect(@"../Error.aspx?ErrorDetail=" + "Global_Unauthorized"); } // if using SSL and the page isn't using a secure connection, redirect to https if (SharedSupport.UsingSsl == true && Request.IsSecureConnection == false) { // Note that Redirect ends page execution. Response.Redirect("https://" + SharedSupport.BaseUrl + "/faculty/ChangePassword.aspx?CourseID=" + courseId.ToString()); } //get Course Short Name to display as title of page CourseM course = CourseM.Load(courseId); if (course.IsValid) { Nav1.Title = course.Name; } if (!IsPostBack) { // Evals true first time browser hits the page LocalizeLabels(); } Response.Cache.SetNoStore(); if (!UserID.Equals(null)) { UserM user = UserM.Load(UserID); if (user.IsValid) { this.lblUserName.Text = Server.HtmlEncode(user.FirstName + " " + user.LastName); } } } catch (Exception ex) { Nav1.Feedback.Text = ex.Message; } }
private void InsertCourseM(CourseM obj) { this.GetCourse(((System.Nullable <int>)(obj.InstituteID))); }
protected void Page_Load(object sender, EventArgs e) { try { //display nav bar Nav1.Feedback.Text = String.Empty; Nav1.SideTabId = AssignmentManager.Common.constants.SIDE_NAV_COURSE_MANAGEMENT; Nav1.TopTabId = AssignmentManager.Common.constants.TOP_NAV_COURSE_INFO; Nav1.relativeURL = @"../"; GoBack1.GoBack_left = "325px"; GoBack1.GoBack_HelpUrl = SharedSupport.HelpRedirect("vstskModifyingCourseInformation"); GoBack1.GoBackIncludeBack = false; Nav1.Feedback.Text = String.Empty; AssignmentManager.Common.Functions func = new AssignmentManager.Common.Functions(); // grab CourseID parameter from the querystring courseId = func.ValidateNumericQueryStringParameter(this.Request, "CourseID"); if (!SharedSupport.SecurityIsAllowed(courseId, SecurityAction.COURSE_VIEW)) { // Note that Redirect ends page execution. Response.Redirect(@"../Error.aspx?ErrorDetail=" + "Global_Unauthorized"); } if (Request.QueryString.Get("Action") == "Update") { Nav1.Feedback.Text = SharedSupport.GetLocalizedString("AddEditCourse_UpdateSuccessful"); //"This course has been updated successfully."; } CourseM course = CourseM.Load(courseId); if (!IsPostBack) { // // Evals true first time browser hits the page // LocalizeLabels(); if (course.IsValid) { populateControls(course); } else { // throw error - can't use this page without CourseID int passed in // Nav1.Feedback.Text = SharedSupport.GetLocalizedString("AddEditCourse_MissingCourseID"); Response.Redirect(@"../Error.aspx?ErrorDetail=" + "AddEditCourse_MissingCourseID&" + Request.QueryString.ToString(), false); } } else { //Check the value of txtCourseResourceID. if (txtCourseResourceID.Value != "" && this.txtDelete.Text == "1") { course.DeleteResource(Convert.ToInt32(txtCourseResourceID.Value)); refreshGrid(course.ResourceList); } //Take care of Course Resource Additions from the "pop-up" form. if (this.txtResourceName.Text != String.Empty && this.txtResourceValue.Text != String.Empty) { string name = txtResourceName.Text; string resourceValue = txtResourceValue.Text; course.AddResource(name, resourceValue); txtResourceName.Text = String.Empty; txtResourceValue.Text = String.Empty; } } //Populate div tag with resources refreshGrid(course.ResourceList); } catch (Exception ex) { Nav1.Feedback.Text = ex.Message.ToString(); } }
protected void Page_Load(object sender, EventArgs e) { try { Nav1.Feedback.Text = String.Empty; Nav1.SideTabId = AssignmentManager.Common.constants.SIDE_NAV_COURSE_MANAGEMENT; Nav1.TopTabId = AssignmentManager.Common.constants.TOP_NAV_COURSE_ASSIGNMENTS; Nav1.relativeURL = @"../"; GoBack1.GoBack_left = "575px"; GoBack1.GoBack_top = "-5px"; GoBack1.GoBack_HelpUrl = SharedSupport.HelpRedirect("vsoriUsingAssignmentManager"); GoBack1.GoBackIncludeBack = false; // grab CourseID parameter AssignmentManager.Common.Functions func = new AssignmentManager.Common.Functions(); courseId = func.ValidateNumericQueryStringParameter(this.Request, "CourseID"); if (!SharedSupport.SecurityIsAllowed(courseId, SecurityAction.ASSIGNMENT_VIEW)) { // Note that Redirect ends page execution. Response.Redirect(@"../Error.aspx?ErrorDetail=" + "Global_Unauthorized"); } if (!SharedSupport.SecurityIsAllowed(courseId, SecurityAction.ASSIGNMENT_ADD)) { hlAddAssignment.Enabled = false; hlAddAssignment.Visible = false; } else { hlAddAssignment.Enabled = true; hlAddAssignment.Visible = true; } // get the courseId based on courseOfferingId CourseM course = CourseM.Load(courseId); if (course.IsValid) { Nav1.SubTitle = SharedSupport.GetLocalizedString("Assignments_Subtitle") + " " + course.Name; } if (!IsPostBack) { // // Evals true first time browser hits the page // //Get localization string for all text displayed on the page LocalizeLabels(); //Initialize the feedback label to nothing. Nav1.Feedback.Text = String.Empty; //Populate the "Add Assignment" link with the courseID from the query string hlAddAssignment.NavigateUrl += "?CourseID=" + course.CourseID; //Grab the assignment information for the given CourseOffering AssignmentList assignList = course.AssignmentList; //If there was at least one assignment, build the table. if (assignList.Count > 0) { dlAssignments.DataSource = assignList.GetDefaultView(Server); dlAssignments.DataBind(); dlAssignments.Visible = true; } else { //The assignment for the given SectionID did not exist. this.hlAddAssignment.Visible = true; throw new Exception(INVALID_SECTION_ID_ERROR); } } } catch (Exception ex) { //catch and add all exception errors to the lblFeedback label and display. Nav1.Feedback.Text = ex.Message.ToString(); } }
protected void Page_Load(object sender, System.EventArgs e) { try { // grab CourseID parameter from the querystring AssignmentManager.Common.Functions func = new AssignmentManager.Common.Functions(); courseId = func.ValidateNumericQueryStringParameter(this.Request, "CourseID"); UserM user = UserM.Load(SharedSupport.GetUserIdentity()); if (!user.IsInCourse(courseId)) { Response.Redirect(@"../Error.aspx?ErrorDetail=" + "Global_Unauthorized"); } // Do not cache this page Response.Cache.SetNoStore(); Nav1.Feedback.Text = String.Empty; Nav1.SideTabId = AssignmentManager.Common.constants.SIDE_NAV_STUDENT_COURSE; Nav1.TopTabId = AssignmentManager.Common.constants.TOP_NAV_STUDENT_COURSE_ASSIGNMENTS; Nav1.relativeURL = @"../"; //GoBack1.GoBack_HelpUrl = SharedSupport.HelpRedirect("vstskCheckingAssignmentStatus"); GoBack1.GoBack_HelpUrl = SharedSupport.HelpRedirect("tskUsingAssignmentManagerToCheckAssignmentStatus"); GoBack1.GoBackIncludeBack = true; GoBack1.GoBack_BackURL = "Assignments.aspx?" + Request.QueryString.ToString(); GoBack1.GoBack_left = "-105px"; if (Request.QueryString.Get("Exp") == "1") { txtDescription.CssClass = "infoTextDisabled"; } else { txtDescription.CssClass = "invisible"; } if (courseId > 0) { //returns the course name to be displayed in the Nav bar title CourseM course = CourseM.Load(courseId); Nav1.Title = Server.HtmlEncode(course.Name); } else { Nav1.Feedback.Text = SharedSupport.GetLocalizedString("Global_MissingParameter"); } // grab assignmentId from querystring assignmentId = func.ValidateNumericQueryStringParameter(this.Request, "assignmentId"); if (!IsPostBack) { // // Evals true first time browser hits the page // } int userID = SharedSupport.GetUserIdentity(); LocalizeLabels(); //checks that assignmentId is not empty then loops through if (assignmentId.Equals(null)) { Nav1.Feedback.Text = SharedSupport.GetLocalizedString("GradeDetail_InvalidassignmentIdError"); } else { AssignmentM assign = AssignmentM.Load(assignmentId); if (assign.IsValid) { txtDescription.Text = assign.Description; lblAssignment.Text = Server.HtmlEncode(assign.ShortName); lblDueDateValue.Text = assign.DueDate.ToShortDateString(); hlAssignmentWebPage.NavigateUrl = assign.AssignmentURL; hlAssignmentWebPage.Text = Server.HtmlEncode(assign.AssignmentURL); } StudentAssignmentM stuAssign = StudentAssignmentM.Load(userID, assignmentId); if (stuAssign == null) { this.lblAssignment.Text = SharedSupport.GetLocalizedString("GradeDetail_NoDetailsAvailable"); } else { //if data is returned, regardless of the Detail Type the LocalizeGeneralLabels //generates text for the header labels. LocalizeGeneralLabels(stuAssign); LocalizeAutoBuildLabels(stuAssign); LocalizeAutoGradeLabels(stuAssign); } } } catch (Exception ex) { Nav1.Feedback.Text = ex.Message.ToString(); } }
protected void Page_Load(object sender, EventArgs e) { try { Nav1.Feedback.Text = String.Empty; Nav1.SideTabId = AssignmentManager.Common.constants.SIDE_NAV_COURSE_MANAGEMENT; Nav1.TopTabId = AssignmentManager.Common.constants.TOP_NAV_COURSE_INFO; Nav1.SubTitle = " "; Nav1.Title = " "; Nav1.relativeURL = @"../"; PermissionsID maxUserPermission; AssignmentManager.Common.Functions func = new AssignmentManager.Common.Functions(); if (!SharedSupport.SecurityIsAllowed(SecurityAction.COURSE_ADD, out maxUserPermission)) { // Note that Redirect ends page execution. Response.Redirect(@"../Error.aspx?ErrorDetail=" + "Global_Unauthorized"); } int vsversion = func.ValidateNumericQueryStringParameter(Request, "VSVersion"); if (vsversion < 7.1) { Response.Redirect(@"../Error.aspx?ErrorDetail=" + "AddCourse_WrongVSVersion", false); } if (!IsPostBack) { // // Evals true first time browser hits the page // if (Request["CourseID"] != null && Request["CourseID"] != String.Empty) { if (Request["CourseName"] != null && Request["CourseName"] != String.Empty) { // Load by GUID string CourseID = Request.QueryString.Get("CourseID").ToString(); courseGuid = new System.Guid(CourseID); txtCourseGUID.Value = courseGuid.ToString(); CourseM course = CourseM.Load(courseGuid); if (course.IsValid) { // course already exists courseExists(course); return; } else { // check the short name for uniqueness string courseShortName = Request.QueryString.Get("CourseName").ToString().Trim(); if (courseShortName == null || courseShortName == String.Empty) { Response.Redirect(@"../Error.aspx?ErrorDetail=" + "AddCourse_MissingCourseShortName", false); return; } else { course = CourseM.Load(courseShortName); if (course.IsValid) { // course short name already exists; prompt: work with? copy? courseExists(course); return; } } // insert bare min. course information course = new CourseM(); course.Name = courseShortName; course.CourseGuid = courseGuid; course.SendEmailRemindersFlag = false; course.LastUpdatedUserID = SharedSupport.GetUserIdentity(); course.StartDate = DateTime.Now.AddMonths(1); course.EndDate = DateTime.Now.AddMonths(1); string fileDir = SharedSupport.RemoveIllegalFilePathCharacters(course.Name).Replace(" ", String.Empty); fileDir = SharedSupport.AddBackSlashToDirectory(Constants.DEFAULT_COURSE_OFFERINGS_ROOT_STORAGE_PATH) + SharedSupport.AddBackSlashToDirectory(fileDir); if (!System.IO.Directory.Exists(fileDir)) { //create directory System.IO.Directory.CreateDirectory(fileDir); } course.RootStoragePath = SharedSupport.AddBackSlashToDirectory(Constants.DEFAULT_COURSE_OFFERINGS_ROOT_STORAGE_PATH) + SharedSupport.AddBackSlashToDirectory(SharedSupport.RemoveIllegalFilePathCharacters(course.Name).Replace(" ", String.Empty)); course.Add(); if (!Directory.Exists(course.RootStoragePath)) { Directory.CreateDirectory(course.RootStoragePath); } UserM user = UserM.Load(SharedSupport.GetUserIdentity()); user.AddToCourse(course.CourseID, maxUserPermission); // redirect for additional maintenance Response.Redirect("AddEditCourse.aspx?CourseID=" + course.CourseID, false); } } else { //Throw error, there was no ShortName on the query string Response.Redirect(@"../Error.aspx?ErrorDetail=" + "AddCourse_MissingCourseShortName", false); } } else { //Throw error, there was no CourseID on the query string Response.Redirect(@"../Error.aspx?ErrorDetail=" + "AddCourse_MissingCourseID", false); } } } catch (Exception ex) { Nav1.Feedback.Text = ex.Message.ToString(); } }
protected void Page_Load(object sender, System.EventArgs e) { try { // set the baseUrl variable baseUrl = AssignmentManager.SharedSupport.BaseUrl.ToString(); // set logoff link dynamically based on if server is using SSL if (Convert.ToBoolean(SharedSupport.UsingSsl) == true) { rootURL = "https://" + baseUrl + @"/"; } else { rootURL = "http://" + baseUrl + @"/"; } // logs user off if actionLogoff hidden input tag = "logoff" (e.g. click on Logoff link) if (Page.Request["actionLogoff"] == "logoff") { // Note that Redirect ends page execution. Response.Redirect(rootURL + "Logoff.aspx"); } // Put user code to initialize the page here userId = SharedSupport.GetUserIdentity(); //Verify that CourseID is present AssignmentManager.Common.Functions fun = new AssignmentManager.Common.Functions(); CourseId = fun.ValidateNumericQueryStringParameter(Request, "CourseID"); //If the title is not already set, set it to the course if (Title == String.Empty || Title == "") { CourseM course = CourseM.Load(CourseId); if (course.IsValid) { Title = course.Name.Trim(); if (Title.Length > 30) { lblTitle.Text = Title = Title.Substring(0, 30) + UserControl_Faculty_DotDotDot; } lblTitle.Text = Server.HtmlEncode(Title); } } else { this.lblTitle.Text = Server.HtmlEncode(this.Title); } //If the subtitle is not already set, set it to the course if (SubTitle == String.Empty || SubTitle == "") { CourseM course = CourseM.Load(CourseId); if (course.IsValid) { this.lblSubTitle.Text = Server.HtmlEncode(SharedSupport.GetLocalizedString("NavBar_SubTitle1") + course.Name); } } else { this.lblSubTitle.Text = Server.HtmlEncode(this.SubTitle); } } catch (Exception ex) { Feedback.Text = ex.Message; } }