protected void initTreeView() { CourseManager CourseMan = new CourseManager(); AssignmentManager assignmentMan = new AssignmentManager(); List<Course> CourseList = new List<Course>(); List<Assignment> assignmentList = new List<Assignment>(); TreeView1.Nodes.Clear(); CourseList = CourseMan.GetCourseForStudent(stu.username); //设置TreeView的节点,包括课程和相应作业 foreach (Course course in CourseList) { TreeNode node = new TreeNode(); node.Text = course.name; TreeView1.Nodes.Add(node); assignmentList = assignmentMan.getAssignment(course.num); foreach (Assignment assignment in assignmentList) { //未截止 if (DateTime.Now < assignment.end_time) { TreeNode NodeChild = new TreeNode(); NodeChild.Text = assignment.title; node.ChildNodes.Add(NodeChild); NodeChild.NavigateUrl = "SubmitForm.aspx?AssignmentId=" + assignment.id + "&AssignmentTitle=" + assignment.title; ; } } /* TreeView1.Nodes[0].Expanded = firstNodeExpandFlag; TreeView1.Nodes[0].Select(); */ } }
protected void initTreeView() { CourseManager CourseMan = new CourseManager(); AssignmentManager assignmentMan = new AssignmentManager(); List <Course> CourseList = new List <Course>(); List <Assignment> assignmentList = new List <Assignment>(); TreeView1.Nodes.Clear(); CourseList = CourseMan.GetCourseForStudent(stu.username); //设置TreeView的节点,包括课程和相应作业 foreach (Course course in CourseList) { TreeNode node = new TreeNode(); node.Text = course.name; TreeView1.Nodes.Add(node); assignmentList = assignmentMan.getAssignment(course.num); foreach (Assignment assignment in assignmentList) { //未截止 if (DateTime.Now < assignment.end_time) { TreeNode NodeChild = new TreeNode(); NodeChild.Text = assignment.title; node.ChildNodes.Add(NodeChild); NodeChild.NavigateUrl = "SubmitForm.aspx?AssignmentId=" + assignment.id + "&AssignmentTitle=" + assignment.title;; } } /* * TreeView1.Nodes[0].Expanded = firstNodeExpandFlag; * TreeView1.Nodes[0].Select(); */ } }
//this test should be run with specific parameters public static void getAssignmentGradeById() { Assignment ass = AssignmentManager.GetAssignmentGradeById(1); Assert.NotNull(ass); Assert.NotNull(ass.Lecturer_ID); Assert.NotNull(ass.Student_ID); }
public dynamic StartAssignment() { string progTaskString = api.GetAssignment().Result; IncomingProgTask progTask = JsonSerializer.Deserialize <IncomingProgTask>(progTaskString); var returnValues = AssignmentManager.RunAssignment(progTask.IncomingAssignment.ToString()); var resultOnTests = SubmitAssignment(returnValues); return(resultOnTests); }
//this test should be run with specific parameters public static void AddAssignment() { String k = ""; Assignment ass = new Assignment(); ass.Lecturer_ID = 1; ass.Student_ID = 1; ass.Status_ID = 1; Assert.IsTrue(AssignmentManager.AddAssigment(ass, out k)); var assignment = AssignmentManager.GetAssignmentByStudentId(1); Assert.IsTrue(assignment.Lecturer_ID == 1); Assert.IsTrue(assignment.Student_ID == 1); Assert.IsTrue(assignment.Status_ID == 1); }
//this test should be run with specific parameters public static void gradeAssignment() { string k = ""; string feedback = "This is a unit test"; var grade = 90; Assignment ass = new Assignment(); ass.Feedback = feedback; ass.Grade = grade; ass.Asst_ID = 1; AssignmentManager.GradeAssignment(1, ass, out k); var assig = AssignmentManager.GetAssignmentByStudentId(1); Assert.IsTrue(assig.Feedback == feedback); Assert.IsTrue(assig.Grade == grade); }
public AssignemtnsDataController(PageManager pageManager, SiteContext siteContext, AssignmentManager assignmentManager, UserGroupManager userGroupManager, SiteManager siteManager, ILogger<ClientManager> logger, ClientManager clientManager, UserContext userContext, IOptions<RequestLocalizationOptions> localizationOptions) { _pageManager = pageManager; _assignmentManager = assignmentManager; _userGroupManager = userGroupManager; _siteManager = siteManager; _clientManager = clientManager; _userContext = userContext; _localizationOptions = localizationOptions; }
//Problem表插入判断 protected void DetailsView5_ItemInserting(object sender, DetailsViewInsertEventArgs e) { AssignmentManager a = new AssignmentManager(); if (e.Values["assignment"] == null) { ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "msg1", "alert('插入失败!Problem表中assignment字段不能为空');", true); e.Cancel = true; return; } if (a.GetAssignmentByNum(int.Parse(e.Values["assignment"].ToString())) == null) { ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "msg1", "alert('插入失败!Problem表中外键assignment字段不存在');", true); e.Cancel = true; return; } }
protected void Page_Load(object sender, EventArgs e) { // First load tasks if (!IsPostBack) { // Initialize the manager object manager = new AssignmentManager(); // Fetch the page ict_Page page = manager.GetPageByID(pageID); // Configure the page content editor and the user interface if (page != null) { litContent.Text = page.Content; editor.Text = litContent.Text; tbTitle.Text = page.Title; ViewState["PageTitle"] = page.Title; } else { litContent.Text = ""; editor.Text = litContent.Text; tbTitle.Text = ""; ViewState["PageTitle"] = ""; } } Page.Title = ViewState["PageTitle"] as string; // Author tasks if (Page.User.IsInRole("Author")) { // Show the editing control strip pnlControl.Visible = true; // Configure the visibility of the buttons to match the view/edit mode btnEdit.Visible = !pnlEdit.Visible; btnView.Visible = btnPageContent.Visible = btnMediaList.Visible = btnMediaUpload.Visible = pnlEdit.Visible; // Update the user interface lblStatus.Text = ""; // The following block will capture the intent of the editor's "save" icon // Clicking the icon in the CKEditor causes a postback // Therefore, we will check here to see if the content and title have changed // If yes, we will save the changes, and update the user interface string editorText = editor.Text; string literalText = litContent.Text; string textboxTitle = tbTitle.Text.Trim(); string viewstateTitle = ViewState["PageTitle"] as string; if ((editorText != literalText) | (textboxTitle != viewstateTitle)) { // Save the changes manager = new AssignmentManager(); manager.UpdatePageContentByID(pageID, textboxTitle, editorText); // Update the user interface Page.Title = textboxTitle; ViewState["PageTitle"] = textboxTitle; litContent.Text = editorText; lblStatus.Text = "Changes have been saved"; } } // Author tasks }