//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"); } } }
/// <summary> /// Creates a new Shift from the given node. /// </summary> /// <param name="validator">The validator to use for validation.</param> /// <param name="node">The "shift" node.</param> internal Shift(NodeValidator validator, Node node) : base(validator, node) { if (!string.IsNullOrEmpty(node.Tag)) { uuid = new Guid(node.Tag); } if (node.Attributes.ContainsKey(NAME_ATTRIBUTE)) { name = node.Attributes[NAME_ATTRIBUTE]; } if (node.Attributes.ContainsKey(FALLBACK_ATTRIBUTE)) { fallback = new Guid(node.Attributes[FALLBACK_ATTRIBUTE]); } foreach (var child in node.Children) { switch (child.Name.ToUpperInvariant()) { case SELECTIONSET_CHILD_NODE: selectionset = child; break; case ASSIGNMENTS_CHILD_NODE: assignments = new AssignmentList(validator, child); break; } } if (assignments == null) { assignments = new AssignmentList(); } }
/// <summary> /// Instructor grade assignment individually /// </summary> /// <param name="assignmentId"></param> /// <returns></returns> public ActionResult GradeAssignment(int assignmentGradeId) { gds = new LMS_GRINDEntities1(); //Populate the page with individual assignment information StudentAssignment stuAssignment = gds.StudentAssignments.Where(x => x.assignment_grade_id == assignmentGradeId).FirstOrDefault(); int student_id = gds.StudentAssignments.Where(x => x.assignment_grade_id == assignmentGradeId).Select(x => x.student_id).FirstOrDefault(); int assignmentId = gds.StudentAssignments.Where(x => x.assignment_grade_id == assignmentGradeId).Select(x => x.assignment_id).FirstOrDefault(); Assignment thisAssignment = gds.Assignments.Where(x => x.assignment_id == assignmentId).FirstOrDefault(); String assignmentName = gds.Assignments.Where(x => x.assignment_id == assignmentId).Select(x => x.assignment_name).FirstOrDefault(); String firstName = gds.ulUsers.Where(x => x.ulUser_id == student_id).Select(x => x.first_name).FirstOrDefault(); String lastName = gds.ulUsers.Where(x => x.ulUser_id == student_id).Select(x => x.last_name).FirstOrDefault(); int courseId = gds.StudentCourses.Where(x => x.student_id == student_id).Select(x => x.course_id).FirstOrDefault(); int ic_id = gds.InstructorCourses.Where(x => x.course_id == courseId).Select(x => x.instructor_course_id).FirstOrDefault(); AssignmentList.GenerateThisStudentsSubmissionsForCourse(student_id, ic_id); ViewBag.AssignmentName = assignmentName; ViewBag.StudentName = firstName + " " + lastName; ViewBag.StudentId = stuAssignment.student_id; ViewBag.SubmissionDate = stuAssignment.submission_date; ViewBag.TextSubmission = stuAssignment.text_submission; ViewBag.FileSubmission = stuAssignment.file_submission; ViewBag.DueDate = thisAssignment.due_date; ViewBag.MaxPoints = thisAssignment.max_points; ViewBag.AssignmentGradeId = stuAssignment.assignment_grade_id; ViewBag.AssignmentId = assignmentId; ViewBag.CurrentGrade = stuAssignment.grade; ViewBag.Feedback = stuAssignment.instructor_feedback; return(View("GradeAssignmentView")); }
public ActionResult SubmitGradeAssignment(int assignmentGradeId, int grade, string instructorFeedback) { gds = new LMS_GRINDEntities1(); //Save grade to database StudentAssignment stuAssignment = gds.StudentAssignments.Where(x => x.assignment_grade_id == assignmentGradeId).FirstOrDefault(); int?id = gds.StudentAssignments.Where(x => x.assignment_grade_id == assignmentGradeId).Select(x => x.assignment_id).FirstOrDefault(); int ic_id = gds.Assignments.Where(x => x.assignment_id == id).Select(x => x.instructor_course_id).FirstOrDefault(); try { stuAssignment.grade = grade; stuAssignment.instructor_feedback = instructorFeedback; gds.SaveChanges(); AssignmentList.GenerateThisStudentsSubmissionsForCourse(stuAssignment.student_id, ic_id); } catch (System.Data.Entity.Validation.DbEntityValidationException dbEx) { foreach (var validationErrors in dbEx.EntityValidationErrors) { foreach (var validationError in validationErrors.ValidationErrors) { System.Console.WriteLine("Property: {0} Error: {1}", validationError.PropertyName, validationError.ErrorMessage); } } } catch { return(View("GradeAssignmentView")); } return(RedirectToAction("InstructorGrading", new { assignmentId = id })); }
/// <summary> /// Update a table - This function is different because it accepts AssignmentList instead of Field[] for conditions and fields /// </summary> /// <param name="tablename">Table name</param> /// <param name="assignmentList">The fields you would like to update</param> /// <param name="conditions">The conditions that must be met in order to Update</param> public void Update(string tablename, AssignmentList assignmentList, AssignmentList conditions) { Field[] fields = assignmentList.Fields; Field[] conds = conditions.Fields; Update(tablename, fields, conds); }
/// <summary> /// Gets a list of Assignments /// </summary> /// <returns>List of Assignments</returns> public static AssignmentList GetItem(string courseID) { AssignmentList myAssignmentList = null; using (SqlConnection myConnection = new SqlConnection(AppSettings.ConnectionString)) { SqlCommand myCommand = new SqlCommand("spGetAssignmentByCourse", myConnection); myCommand.CommandType = CommandType.StoredProcedure; myCommand.Parameters.AddWithValue("@courseID", courseID); myConnection.Open(); using (SqlDataReader myDataReader = myCommand.ExecuteReader()) { if (myDataReader.HasRows) { myAssignmentList = new AssignmentList(); while (myDataReader.Read()) { myAssignmentList.Add(FillRecord(myDataReader)); } } myDataReader.Close(); } myConnection.Close(); } return(myAssignmentList); }
/// <summary> /// Gets a list of Assignments /// </summary> /// <returns>List of Assignments</returns> public static AssignmentList GetItem(string courseID) { AssignmentList myAssignmentList = null; using (SqlConnection myConnection = new SqlConnection(AppSettings.ConnectionString)) { SqlCommand myCommand = new SqlCommand("spGetAssignmentByCourse", myConnection); myCommand.CommandType = CommandType.StoredProcedure; myCommand.Parameters.AddWithValue("@courseID", courseID); myConnection.Open(); using (SqlDataReader myDataReader = myCommand.ExecuteReader()) { if (myDataReader.HasRows) { myAssignmentList = new AssignmentList(); while (myDataReader.Read()) { myAssignmentList.Add(FillRecord(myDataReader)); } } myDataReader.Close(); } myConnection.Close(); } return myAssignmentList; }
public async Task <IActionResult> OnGetAsync(int?id) { int ID = (int)id; CurrentCourse = await courseDbContext.Courses.SingleOrDefaultAsync(m => m.ID == ID); if (CurrentCourse != null) { CurrentProfile = await profileDbContext.Profiles.SingleOrDefaultAsync(m => m.ID == CurrentCourse.SupervisorID); TAs = JsonConvert.DeserializeObject <List <string> >(CurrentCourse.TeachingAssistants); var tempList = await assignmentDbContext.Assignments.ToListAsync(); foreach (var assignment in tempList) { if (assignment.CourseID == ID) { AssignmentList.Add(assignment); } } return(Page()); } else { return(RedirectToPage("/NotFound")); } }
private void TypesOfData(int data, int noOfEntries) { for (int i = 0; i < noOfEntries; i++) { if (data == 1) { List <Trainer> trainers = new List <Trainer>(); TrainersList trainerList = new TrainersList(); trainers.Add(trainerList.GetTrainerDetails()); trainerList.PrintTrainersList(trainers); } else if (data == 2) { List <Students> students = new List <Students>(); StudentsList studentsList = new StudentsList(); students.Add(studentsList.GetStudentDetails()); studentsList.PrintStudentList(students); } else if (data == 3) { List <Courses> courses = new List <Courses>(); CoursesList courseList = new CoursesList(); courses.Add(courseList.GetCourseDetails()); courseList.PrintCoursesList(courses); } else { List <Assignments> Assignment = new List <Assignments>(); AssignmentList assignmentList = new AssignmentList(); Assignment.Add(assignmentList.GetAssignmentDetails()); assignmentList.PrintAssignmentList(Assignment); } } }
private void BindActivities() { DataTable dt = new DataTable(); dt.Locale = CultureInfo.InvariantCulture; dt.Columns.Add("Subject", typeof(string)); dt.Columns.Add("User", typeof(string)); dt.Columns.Add("State", typeof(int)); dt.Columns.Add("Result", typeof(int)); dt.Columns.Add("FinishDate", typeof(string)); dt.Columns.Add("Comment", typeof(string)); dt.Columns.Add("Indent", typeof(int)); dt.Columns.Add("ClosedBy", typeof(string)); dt.Columns.Add("PlanFinishDate", typeof(string)); dt.Columns.Add("ReadOnly", typeof(bool)); ProcessCollection(dt, info.Activities, 0); AssignmentList.DataSource = dt; AssignmentList.DataBind(); if (dt.Rows.Count > 0) { AssignmentList.Visible = true; NoAssignmentsLabel.Visible = false; } else { AssignmentList.Visible = false; NoAssignmentsLabel.Visible = true; NoAssignmentsLabel.Text = GetGlobalResourceObject("IbnFramework.BusinessProcess", "NoAssignments").ToString(); } }
/// <summary> /// Display course details for student /// </summary> /// <param name="id"></param> /// <returns>Display details of the selected course</returns> public ActionResult StudentCourseDetail(int id) { gds = new LMS_GRINDEntities1(); Cours course = gds.Courses.Where(x => x.course_id == id).FirstOrDefault(); int ic_id = gds.InstructorCourses.Where(x => x.course_id == id).Select(x => x.instructor_course_id).FirstOrDefault(); Department department = gds.Departments.Where(x => x.dept_id == course.dept_id).FirstOrDefault(); int instructorId = gds.InstructorCourses.Where(x => x.instructor_course_id == ic_id).Select(x => x.instructor_id).FirstOrDefault(); String instructorFirstName = gds.ulUsers.Where(x => x.ulUser_id == instructorId).Select(x => x.first_name).FirstOrDefault(); String instructorLastName = gds.ulUsers.Where(x => x.ulUser_id == instructorId).Select(x => x.last_name).FirstOrDefault(); CourseCardList.GenerateStudentCourseList(); AssignmentList.GenerateStudentAssignmentList(id); AssignmentList.GenerateThisStudentsSubmissions(Name.user_id); AssignmentList.GenerateThisStudentsSubmissionsForCourse(Name.user_id, ic_id); StudentCours studentCours = gds.StudentCourses.Where(x => (x.course_id == course.course_id) && (x.student_id == Name.user_id)).FirstOrDefault(); // Calculate overall points int maxPoints = 0; int points = 0; double?gradePoints = 0; if (AssignmentList.StudentAssignments.Any()) { foreach (var assignment in AssignmentList.StudentAssignments) { AssignmentList.GenerateThisStudentsSubmissionForAssignment(assignment.AssignmentId); if (AssignmentList.StudentAssignmentSubmission.isGraded) { points += (int)AssignmentList.StudentAssignmentSubmission.Grade; maxPoints += (int)assignment.MaxPoints; } } ViewBag.points = points; ViewBag.maxPoints = maxPoints; // Get letter grade gradePoints = ((double)points / maxPoints) * 100; // Display 2 decimal places gradePoints = Math.Truncate(100 * (double)gradePoints) / 100; if (gradePoints >= 0) { ViewBag.gradePercentage = gradePoints + "%"; // Display percentage } else { ViewBag.gradePercentage = " "; } } AssignmentList.GenerateThisStudentsSubmissionsForCourse(Name.user_id, ic_id); ViewBag.letterGrade = studentCours.letter_grade; // Display letter grade ViewBag.selectedCourse = course; ViewBag.courseDepartment = department; ViewBag.InstructorName = instructorFirstName + " " + instructorLastName; return(View("StudentCourseDetailView")); }
/// <summary> /// Initializes a new instance of the <see cref="CSharpInitializedObjectExpression"/> class. /// </summary> /// <param name="context">The creation context.</param> /// <param name="source">The Easly expression from which the C# expression is created.</param> protected CSharpInitializedObjectExpression(ICSharpContext context, IInitializedObjectExpression source) : base(context, source) { Class = context.GetClass(source.ResolvedClassType.Item.BaseClass); foreach (IAssignmentArgument Argument in source.AssignmentList) { ICSharpAssignmentArgument NewAssignment = CSharpAssignmentArgument.Create(context, Argument); AssignmentList.Add(NewAssignment); } }
public ActionResult InstructorAssignment(int id) { gds = new LMS_GRINDEntities1(); var courseNum = gds.Courses.Where(x => x.course_id == id).Select(x => x.course_num).FirstOrDefault(); var courseName = gds.Courses.Where(x => x.course_id == id).Select(x => x.course_name).FirstOrDefault(); CourseCardList.GenerateInstructorCourseList(); AssignmentList.GenerateInstructorAssignmentList(id); @ViewBag.CourseId = id; @ViewBag.CourseNum = courseNum; @ViewBag.CourseName = courseName; return(View("InstructorAssignmentView")); }
/*protected void ClassList_SelectedIndexChanged1(object sender, EventArgs e) * { * int currentRowIndex = Int32.Parse(e.CommandArgument.ToString()); * GridViewRow selectedRow = AssignmentList.Rows[currentRowIndex]; * int assignmentID = Int32.Parse(AssignmentList.DataKeys[selectedRow.RowIndex].Values[0].ToString()); * CurrentSelectedClass = Convert.ToInt32(ClassList.SelectedRow.Cells[1].Text); * UpdateTestList(); * }*/ // Database procedure with parameters and fill a gridview private void UpdateTestList() { // Retrieve the connection string stored in the Web.config file. String connectionString = ConfigurationManager.ConnectionStrings["CS414_FasTestConnectionString"].ConnectionString; try { // Connect to the database and run the query. SqlConnection con = new SqlConnection(connectionString); using (con) { using (SqlCommand getcmd = new SqlCommand("Get_Class_Tests", con)) { //Assign the connection to the command getcmd.Connection = con; //Open a connection try { con.Open(); } catch (SqlException) { con.Close(); } debug.InnerHtml = ""; // Assign the procedure and connection to an adapter using (SqlDataAdapter da = new SqlDataAdapter("Get_Class_Tests", con)) { int currentUser; bool parseUser = int.TryParse(HttpContext.Current.User.Identity.Name.ToString(), out currentUser); da.SelectCommand.CommandType = CommandType.StoredProcedure; da.SelectCommand.Parameters.AddWithValue("@pClassID", CurrentSelectedClass); da.SelectCommand.Parameters.AddWithValue("@pStudentID", currentUser); DataSet ds = new DataSet(); da.Fill(ds, "Test"); AssignmentList.DataSource = ds.Tables["Test"]; AssignmentList.DataBind(); da.Dispose(); con.Close(); } } } } catch (Exception) { // The connection failed. Display an error message. debug.InnerHtml = "Unable to connect to the database."; } }
public override void DataBind() { DataTable dt = new DataTable(); dt.Locale = CultureInfo.InvariantCulture; dt.Columns.Add("AssignmentId", typeof(string)); dt.Columns.Add("Subject", typeof(string)); dt.Columns.Add("User", typeof(string)); dt.Columns.Add("State", typeof(string)); dt.Columns.Add("Result", typeof(int)); dt.Columns.Add("FinishDate", typeof(string)); dt.Columns.Add("Comment", typeof(string)); dt.Columns.Add("Indent", typeof(int)); dt.Columns.Add("ClosedBy", typeof(string)); WorkflowInstanceEntity wfEntity = (WorkflowInstanceEntity)DataItem; // Filter: // 1: WorkflowInstanceId = wfEntity.PrimaryKeyId, // 2: ParentAssignmentId IS NULL (other elements we'll get via the recursion) FilterElementCollection fec = new FilterElementCollection(); fec.Add(FilterElement.EqualElement(AssignmentEntity.FieldWorkflowInstanceId, wfEntity.PrimaryKeyId.Value)); fec.Add(FilterElement.IsNullElement(AssignmentEntity.FieldParentAssignmentId)); // Sorting SortingElementCollection sec = new SortingElementCollection(); sec.Add(new SortingElement(AssignmentEntity.FieldCreated, SortingElementType.Asc)); EntityObject[] assignments = BusinessManager.List(AssignmentEntity.ClassName, fec.ToArray(), sec.ToArray()); ProcessCollection(dt, assignments, wfEntity, 0); AssignmentList.DataSource = dt; AssignmentList.DataBind(); if (dt.Rows.Count > 0) { AssignmentList.Visible = true; NoAssignmentsLabel.Visible = false; } else { AssignmentList.Visible = false; NoAssignmentsLabel.Visible = true; NoAssignmentsLabel.Text = GetGlobalResourceObject("IbnFramework.BusinessProcess", "NoAssignments").ToString(); } }
public ActionResult SaveAssignment(string assignmentName, string assignmentDesc, int maxPoints, DateTime dueDate, string assignmentType, string submissionType) { var courseId = int.Parse(Request.Form["CourseId"]); var courseNum = Request.Form["CourseNum"]; var courseName = Request.Form["CourseName"]; gds = new LMS_GRINDEntities1(); Assignment newAssignment = new Assignment(); var query = from course in gds.Courses join insCourse in gds.InstructorCourses on course.course_id equals insCourse.course_id where course.course_id == courseId select new { instructorCourseID = insCourse.instructor_course_id }; foreach (var insCourse in query) { newAssignment.instructor_course_id = insCourse.instructorCourseID; } newAssignment.assignment_name = assignmentName; newAssignment.assignment_desc = assignmentDesc; newAssignment.max_points = maxPoints; newAssignment.due_date = dueDate; newAssignment.assignment_type = assignmentType; newAssignment.submission_type = submissionType; gds.Assignments.Add(newAssignment); gds.SaveChanges(); AssignmentList.GenerateInstructorAssignmentList(courseId); CourseCardList.GenerateInstructorCourseList(); @ViewBag.CourseNum = courseNum; @ViewBag.CourseName = courseName; @ViewBag.CourseId = courseId; ToDoList.GenerateInstructorToDoList(); return(RedirectToAction("InstructorCourseDetail", "CoursesAndRegistration", new { id = courseId })); }
/// <summary> /// Display assignment List for student course view based on particular assignment selected /// </summary> /// Parameter = assignmentId /// <returns>StudentAssignmentView</returns> public ActionResult StudentAssignment(int?id) { gds = new LMS_GRINDEntities1(); AssignmentList.GenerateThisStudentsSubmissionForAssignment(id); AssignmentList.GenerateSingleAssignmentItem(id); //check StudentAssignmentSubmissionItem attribute (filesubmission & textsubmission) if (AssignmentList.StudentAssignmentSubmission.FileSubmission == null && AssignmentList.StudentAssignmentSubmission.TextSubmission == null) { ViewBag.IsSubmitted = false; } else { ViewBag.IsSubmitted = true; } //Calculate grade stats int studentScore = 0; LetterGradeList.GenerateStudentAssignmentGradePerformance((int)id); if (gds.StudentAssignments.Where(x => (x.student_id == Name.user_id) && (x.assignment_id == id)).Select(x => x.grade).FirstOrDefault() == null) { studentScore = 0; } else { studentScore = (int)gds.StudentAssignments.Where(x => (x.student_id == Name.user_id) && (x.assignment_id == id)).Select(x => x.grade).FirstOrDefault(); } int maxPoints = (int)gds.Assignments.Where(x => x.assignment_id == id).Select(x => x.max_points).FirstOrDefault(); ViewBag.HighScore = LetterGradeList.HighScore; ViewBag.LowScore = LetterGradeList.LowScore; ViewBag.StudentScore = studentScore; ViewBag.MaxPoints = maxPoints; return(View("StudentAssignmentView")); }
/// <summary> /// Display course details for instructor /// </summary> /// <param name="id"></param> /// <returns>Display details of the selected course</returns> public ActionResult InstructorCourseDetail(int id) { gds = new LMS_GRINDEntities1(); Cours course = gds.Courses.Where(x => x.course_id == id).FirstOrDefault(); Department department = gds.Departments.Where(x => x.dept_id == course.dept_id).FirstOrDefault(); int ic_id = gds.InstructorCourses.Where(x => x.course_id == id).Select(x => x.instructor_course_id).FirstOrDefault(); CourseCardList.GenerateInstructorCourseList(); AssignmentList.GenerateInstructorAssignmentList(id); // Calculate overall spread of letter grades for students in course LetterGradeList.GenerateCourseLetterGrades(id); ViewBag.percentA = LetterGradeList.PercentA; ViewBag.percentB = LetterGradeList.PercentB; ViewBag.percentC = LetterGradeList.PercentC; ViewBag.percentD = LetterGradeList.PercentD; ViewBag.percentF = LetterGradeList.PercentF; ViewBag.percentUngraded = LetterGradeList.PercentUngraded; ViewBag.selectedCourse = course; ViewBag.courseDepartment = department; return(View("InstructorCourseDetailView")); }
public ActionResult DeleteAssignment(int id) { gds = new LMS_GRINDEntities1(); Assignment assignment = gds.Assignments.Where(x => x.assignment_id == id).FirstOrDefault(); int insCourse = gds.Assignments.Where(x => x.assignment_id == id).Select(x => x.instructor_course_id).FirstOrDefault(); int courseId = gds.InstructorCourses.Where(x => x.instructor_course_id == insCourse).Select(x => x.course_id).FirstOrDefault(); var courseNum = gds.Courses.Where(x => x.course_id == courseId).Select(x => x.course_num).FirstOrDefault(); var courseName = gds.Courses.Where(x => x.course_id == courseId).Select(x => x.course_name).FirstOrDefault(); gds.Assignments.Remove(assignment); gds.SaveChanges(); //Delete from assignments table, and student assignments table //TODO: implement delete from studentAssignments table' ViewBag.CourseNum = courseNum; ViewBag.CourseName = courseName; ViewBag.CourseId = courseId; AssignmentList.GenerateInstructorAssignmentList(courseId); CourseCardList.GenerateInstructorCourseList(); ToDoList.GenerateInstructorToDoList(); return(RedirectToAction("InstructorCourseDetail", "CoursesAndRegistration", new { id = courseId })); }
public ActionResult UpdateAssignment(int id, string assignmentName, string assignmentDesc, int maxPoints, DateTime dueDate, string assignmentType, string submissionType) { gds = new LMS_GRINDEntities1(); Assignment assignment = gds.Assignments.Where(x => x.assignment_id == id).FirstOrDefault(); int insCourse = gds.Assignments.Where(x => x.assignment_id == id).Select(x => x.instructor_course_id).FirstOrDefault(); int courseId = gds.InstructorCourses.Where(x => x.instructor_course_id == insCourse).Select(x => x.course_id).FirstOrDefault(); try { assignment.assignment_name = assignmentName; assignment.assignment_desc = assignmentDesc; assignment.max_points = maxPoints; assignment.due_date = dueDate; assignment.assignment_type = assignmentType; assignment.submission_type = submissionType; gds.SaveChanges(); } catch (System.Data.Entity.Validation.DbEntityValidationException dbEx) { foreach (var validationErrors in dbEx.EntityValidationErrors) { foreach (var validationError in validationErrors.ValidationErrors) { System.Console.WriteLine("Property: {0} Error: {1}", validationError.PropertyName, validationError.ErrorMessage); } } } catch { return(View("EditAssignmentView")); } AssignmentList.GenerateInstructorAssignmentList(courseId); return(RedirectToAction("InstructorCourseDetail", "CoursesAndRegistration", new { id = courseId })); }
private void userAssignmentsRefresh() { //Check to make sure that there was a Assignment ID on the query string if (!assignmentId.Equals(0)) { //Load all user assignments for the given assignmentID AssignmentList assignList = AssignmentList.GetSubmissionsForAssignment(assignmentId); //Make sure that you got at least one row back 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) == "") { assignList.SetOverallGradeForItem(i, SharedSupport.GetLocalizedString("FacultySubmissions_n/a")); } } //Populate DataList dlUserAssignments.DataSource = assignList.GetDataSource(Server); dlUserAssignments.DataBind(); dlUserAssignments.Visible = true; } else { //The assignment for the given AssignmentID did not exist. blankForm(); throw new Exception(_INVALID_ASSIGNMENT_ID_ERROR); } } else { //The assignment for the given AssignmentID did not exist. blankForm(); throw new Exception(_INVALID_ASSIGNMENT_ID_ERROR); } }
public ActionResult InstructorGrading(int?assignmentId) { gds = new LMS_GRINDEntities1(); Assignment thisAssignment = gds.Assignments.Where(x => x.assignment_id == assignmentId).FirstOrDefault(); int assignId = gds.Assignments.Where(x => x.assignment_id == assignmentId).Select(x => x.assignment_id).FirstOrDefault(); int instructorCourseId = gds.Assignments.Where(x => x.assignment_id == assignmentId).Select(x => x.instructor_course_id).FirstOrDefault(); int courseId = gds.InstructorCourses.Where(x => x.instructor_course_id == instructorCourseId).Select(x => x.course_id).FirstOrDefault(); string courseNum = gds.Courses.Where(x => x.course_id == courseId).Select(x => x.course_num).FirstOrDefault(); string courseName = gds.Courses.Where(x => x.course_id == courseId).Select(x => x.course_name).FirstOrDefault(); Cours course = gds.Courses.Where(x => x.course_id == courseId).FirstOrDefault(); int ic_id = gds.InstructorCourses.Where(x => x.course_id == courseId).Select(x => x.instructor_course_id).FirstOrDefault(); int instructorId = gds.InstructorCourses.Where(x => x.instructor_course_id == ic_id).Select(x => x.instructor_id).FirstOrDefault(); String instructorLastName = gds.ulUsers.Where(x => x.ulUser_id == instructorId).Select(x => x.last_name).FirstOrDefault(); ViewBag.AssignmentName = thisAssignment.assignment_name; ViewBag.AssignmentId = thisAssignment.assignment_id; ViewBag.CourseId = courseId; ViewBag.CourseNum = courseNum; ViewBag.CourseName = courseName; ViewBag.AssignmentDueDate = thisAssignment.due_date; ViewBag.MaxPoints = thisAssignment.max_points; ViewBag.SubmissionType = thisAssignment.submission_type; ViewBag.Description = thisAssignment.assignment_desc; //Calculate grade stats AssignmentList.GenerateAllSubmissions(assignmentId); double numA = 0.0; double numB = 0.0; double numC = 0.0; double numD = 0.0; double numF = 0.0; double ungraded = 0.0; double totalSubmissions = 0.0; double thisPercent = 0.0; for (int i = 0; i < AssignmentList.AllStudentSubmissions.Count; i++) { double maxPoints = (double)gds.Assignments.Where(x => x.assignment_id == assignmentId).Select(x => x.max_points).FirstOrDefault(); if (AssignmentList.AllStudentSubmissions[i].Grade != null) { thisPercent = (double)AssignmentList.AllStudentSubmissions[i].Grade / maxPoints * 100.0; if (thisPercent >= 90.0) { numA++; } else if (thisPercent >= 80.0 && thisPercent < 90.0) { numB++; } else if (thisPercent >= 70.0 && thisPercent < 80.0) { numC++; } else if (thisPercent >= 60.0 && thisPercent < 70.0) { numD++; } else if (thisPercent < 60.0) { numF++; } } else { ungraded++; } totalSubmissions++; } if (totalSubmissions != 0) { ViewBag.percentA = numA; ViewBag.percentB = numB; ViewBag.percentC = numC; ViewBag.percentD = numD; ViewBag.percentF = numF; ViewBag.percentUngraded = ungraded; } return(View("InstructorGradingView")); }
public ActionResult EditAssignment(int id) { gds = new LMS_GRINDEntities1(); Assignment assignment = gds.Assignments.Where(x => x.assignment_id == id).FirstOrDefault(); int insCourse = gds.Assignments.Where(x => x.assignment_id == id).Select(x => x.instructor_course_id).FirstOrDefault(); int courseId = gds.InstructorCourses.Where(x => x.instructor_course_id == insCourse).Select(x => x.course_id).FirstOrDefault(); var courseNum = gds.Courses.Where(x => x.course_id == courseId).Select(x => x.course_num).FirstOrDefault(); var courseName = gds.Courses.Where(x => x.course_id == courseId).Select(x => x.course_name).FirstOrDefault(); ViewBag.selectedAssignment = assignment; bool[] assignmentType = new bool[8]; bool[] submissionType = new bool[2]; for (int i = 0; i < 8; i++) { switch (assignment.assignment_type) { case "Quiz": assignmentType[0] = true; break; case "Test": assignmentType[1] = true; break; case "Project": assignmentType[2] = true; break; case "Homework": assignmentType[3] = true; break; case "Participation": assignmentType[4] = true; break; case "Presentation": assignmentType[5] = true; break; case "Discussion": assignmentType[6] = true; break; default: assignmentType[7] = false; break; } } for (int i = 0; i < 3; i++) { switch (assignment.submission_type) { case "File": submissionType[0] = true; break; case "Text": submissionType[1] = true; break; default: submissionType[2] = false; break; } } ViewBag.submissionType = submissionType; ViewBag.assignmentType = assignmentType; ViewBag.CourseNum = courseNum; ViewBag.CourseName = courseName; ViewBag.CourseId = courseId; ViewBag.DueDate = assignment.due_date; AssignmentList.GenerateInstructorAssignmentList(id); return(View("EditAssignmentView")); }
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 BindIndividualAssignments() { assignments = AssignmentList.AssignedPersonnel(training.Ident); assigned = (ArrayList)assignments[1]; dlAssigned.DataSource = assigned; dlAssigned.DataBind(); if (assigned.Count > 0) { lblAssignments.Text = assigned.Count.ToString() + " individuals are assigned this training."; } else { lblAssignments.Text = "No one is assigned this training."; } notassigned = (ArrayList)assignments[0]; ArrayList subnotassigned = new ArrayList(); if (rblPersonnelType.SelectedItem.Value == " All ") { subnotassigned = notassigned; //notassigned 0 } else { foreach (Person userType in notassigned) { if (((userType.EmployeeType != null) && ((userType.EmployeeType.ToUpper() == rblPersonnelType.SelectedItem.Value.ToUpper()))) || ((userType.EmployeeType != null) && ((rblPersonnelType.SelectedItem.Value.ToUpper() == "V") && (userType.EmployeeType.ToUpper() == "A")))) { subnotassigned.Add(userType); } } } ArrayList alFromSelectedMajorCommand = new ArrayList(); if (ddlMajorCommands.SelectedItem.Value == " All ") { alFromSelectedMajorCommand = subnotassigned; } else { foreach (Person userMajorCommands in subnotassigned) { if (userMajorCommands.MajorCommand.ToUpper() == ddlMajorCommands.SelectedItem.Value.ToUpper()) { alFromSelectedMajorCommand.Add(userMajorCommands); } } } ArrayList alFromSelectedCommand = new ArrayList(); if (ddlCommands.SelectedItem.Value == " All ") { alFromSelectedCommand = alFromSelectedMajorCommand; } else { foreach (Person userCommands in alFromSelectedMajorCommand) { if (userCommands.Command.ToUpper() == ddlCommands.SelectedItem.Value.ToUpper()) { alFromSelectedCommand.Add(userCommands); } } } ArrayList alFromSelectedOrganization = new ArrayList(); if (ddlOrgainizations.SelectedItem.Value == " All ") { alFromSelectedOrganization = alFromSelectedCommand; } else { foreach (Person userOfficeSymbols in alFromSelectedCommand) { if (userOfficeSymbols.Organization.ToUpper() == ddlOrgainizations.SelectedItem.Value.ToUpper()) { alFromSelectedOrganization.Add(userOfficeSymbols); } } } dlNotAssigned.DataSource = alFromSelectedOrganization; dlNotAssigned.DataBind(); }
/// <summary> /// Delete row(s) from a table /// </summary> /// <param name="tablename">Table name</param> /// <param name="conditions">The conditions that must be met in order to delete; this function accepts AssignmentList as a paramer instead of Field[]</param> public void Delete(string tablename, AssignmentList conditions) { Field[] conds = conditions.Fields; Delete(tablename, conds); }
/// <summary> /// The following are rules for C expressions. /// </summary> public static void SetExpressionRules() { // expression // : assignment-expression [ ',' assignment-expression ]* Expression.Is( AssignmentExpression .OneOrMore(Comma) .Then(exprs => { if (exprs.Count == 1) { return(exprs[0]); } return(AssignmentList.Create(exprs)); }) ); // primary-expression // : identifier # Cannot be a typedef name. // | constant // | string-literal // | '(' expression ')' PrimaryExpression.Is( Either(Variable) .Or(Constant) .Or(StringLiteral) .Or( (LeftParen).Then(Expression).Then(RightParen) ) ); // An identifier for a variable must not be defined as a typedef name. Variable.Is( Identifier.Check(result => !result.Environment.IsTypedefName(result.Result)).Then(AST.Variable.Create) ); // constant // : const-char // : const-int // : const-float Constant.Is( Either(ConstChar) .Or(ConstInt) .Or(ConstFloat) ); // constant-expression // : conditional-expression // // Note: // The size of an array should be a constant. // Note that the check is actually performed in semantic analysis. ConstantExpression.Is( ConditionalExpression ); // conditional-expression // : logical-or-expression [ '?' expression ':' conditional-expression ]? ConditionalExpression.Is( (LogicalOrExpression) .Then( Given <Expr>() .Then(Question) .Then(Expression) .Then(Colon) .Then(ConditionalExpression) .Then(AST.ConditionalExpression.Create) .Optional() ) ); // assignment-expression // : unary-expression assignment-operator assignment-expression # first-set = first-set(unary-expression) // | conditional-expression # first-set = first-set(cast-expression) = first-set(unary-expression) ++ { '(' } // // Note: // Assignment operators are: // '=', '*=', '/=', '%=', '+=', '-=', '<<=', '>>=', '&=', '^=', '|=' AssignmentExpression.Is( Either( AssignmentOperator( UnaryExpression, AssignmentExpression, BinaryOperatorBuilder.Create(Assign, Assignment.Create), BinaryOperatorBuilder.Create(MultAssign, AST.MultAssign.Create), BinaryOperatorBuilder.Create(DivAssign, AST.DivAssign.Create), BinaryOperatorBuilder.Create(ModAssign, AST.ModAssign.Create), BinaryOperatorBuilder.Create(AddAssign, AST.AddAssign.Create), BinaryOperatorBuilder.Create(SubAssign, AST.SubAssign.Create), BinaryOperatorBuilder.Create(LeftShiftAssign, LShiftAssign.Create), BinaryOperatorBuilder.Create(RightShiftAssign, RShiftAssign.Create), BinaryOperatorBuilder.Create(BitwiseAndAssign, AST.BitwiseAndAssign.Create), BinaryOperatorBuilder.Create(XorAssign, AST.XorAssign.Create), BinaryOperatorBuilder.Create(BitwiseOrAssign, AST.BitwiseOrAssign.Create) ) ).Or( ConditionalExpression ) ); // postfix-expression // : primary-expression [ // '[' expression ']' # Get element from array // | '(' [argument-expression-list]? ')' # Function call // | '.' identifier # Get member from struct/union // | '->' identifier # Get member from struct/union // | '++' # Increment // | '--' # Decrement // ]* PostfixExpression.Is( PrimaryExpression .Then( Either( Given <Expr>() .Then(LeftBracket) .Then(Expression) .Then(RightBracket) .Then((array, index) => Dereference.Create(AST.Add.Create(array, index))) ).Or( Given <Expr>() .Then(LeftParen) .Then(ArgumentExpressionList.Optional(ImmutableList <Expr> .Empty)) .Then(RightParen) .Then(FuncCall.Create) ).Or( Given <Expr>() .Then(Period) .Then(Identifier) .Then(Attribute.Create) ).Or( Given <Expr>() .Then(RightArrow) .Then(Identifier) .Then((expr, member) => Attribute.Create(Dereference.Create(expr), member)) ).Or( Given <Expr>() .Then(Increment) .Then(PostIncrement.Create) ).Or( Given <Expr>() .Then(Decrement) .Then(PostDecrement.Create) ).ZeroOrMore() ) ); // argument-expression-list // : assignment-expression [ ',' assignment-expression ]* ArgumentExpressionList.Is( AssignmentExpression.OneOrMore(Comma) ); // unary-expression // : postfix-expression # first-set = { id, const, string } // | '++' unary-expression # first-set = { '++' } // | '--' unary-expression # first-set = { '--' } // | unary-operator cast-expression # first-set = { '&', '*', '+', '-', '~', '!' } // | 'sizeof' unary-expression # first-set = { 'sizeof' } // | 'sizeof' '(' Type-name ')' # first-set = { 'sizeof' } // // Notes: // 1. unary-operator can be '&', '*', '+', '-', '~', '!'. // 2. The last two rules are ambiguous: you can't figure out whether the x in sizeof(x) is a typedef of a variable. // I have a parser hack for this: add a parser environment to track all the typedefs. // 3. first_set = first_set(postfix-expression) + { '++', '--', '&', '*', '+', '-', '~', '!', 'sizeof' } // = first_set(primary-expression) + { '++', '--', '&', '*', '+', '-', '~', '!', 'sizeof' } // = { id, const, string, '++', '--', '&', '*', '+', '-', '~', '!', 'sizeof' } UnaryExpression.Is( Either( PostfixExpression ).Or( (Increment).Then(UnaryExpression).Then(PreIncrement.Create) ).Or( (Decrement).Then(UnaryExpression).Then(PreDecrement.Create) ).Or( (BitwiseAnd).Then(CastExpression).Then(Reference.Create) ).Or( (Mult).Then(CastExpression).Then(Dereference.Create) ).Or( (Add).Then(CastExpression).Then(Positive.Create) ).Or( (Sub).Then(CastExpression).Then(Negative.Create) ).Or( (BitwiseNot).Then(CastExpression).Then(AST.BitwiseNot.Create) ).Or( (LogicalNot).Then(CastExpression).Then(AST.LogicalNot.Create) ).Or( (SizeOf).Then(UnaryExpression).Then(SizeofExpr.Create) ).Or( (SizeOf).Then(LeftParen).Then(TypeName).Then(RightParen).Then(SizeofType.Create) ) ); // cast-expression // : unary-expression # first-set = { id, const, string, '++', '--', '&', '*', '+', '-', '~', '!', 'sizeof' } // | '(' type_name ')' cast-expression # first-set = '(' CastExpression.Is( Either( UnaryExpression ).Or( (LeftParen).Then(TypeName).Then(RightParen).Then(CastExpression) .Then(TypeCast.Create) ) ); // multiplicative-expression // : cast-expression [ [ '*' | '/' | '%' ] cast-expression ]* MultiplicativeExpression.Is( BinaryOperator( CastExpression, BinaryOperatorBuilder.Create(Mult, Multiply.Create), BinaryOperatorBuilder.Create(Div, Divide.Create), BinaryOperatorBuilder.Create(Mod, Modulo.Create) ) ); // additive-expression // : multiplicative-expression [ [ '+' | '-' ] multiplicative-expression ]* AdditiveExpression.Is( BinaryOperator( MultiplicativeExpression, BinaryOperatorBuilder.Create(Add, AST.Add.Create), BinaryOperatorBuilder.Create(Sub, AST.Sub.Create) ) ); // shift-expression // : additive-expression [ [ '<<' | '>>' ] additive-expression ]* ShiftExpression.Is( BinaryOperator( AdditiveExpression, BinaryOperatorBuilder.Create(LeftShift, LShift.Create), BinaryOperatorBuilder.Create(RightShift, RShift.Create) ) ); // relational-expression // : shift-expression [ [ '<' | '>' | '<=' | '>=' ] shift-expression ]* RelationalExpression.Is( BinaryOperator( ShiftExpression, BinaryOperatorBuilder.Create(Less, AST.Less.Create), BinaryOperatorBuilder.Create(Greater, AST.Greater.Create), BinaryOperatorBuilder.Create(LessEqual, LEqual.Create), BinaryOperatorBuilder.Create(GreaterEqual, GEqual.Create) ) ); // equality-expression // : relational-expression [ [ '==' | '!=' ] relational-expression ]* EqualityExpression.Is( BinaryOperator( RelationalExpression, BinaryOperatorBuilder.Create(Equal, AST.Equal.Create), BinaryOperatorBuilder.Create(NotEqual, AST.NotEqual.Create) ) ); // and-expression // : equality-expression [ '&' equality-expression ]* AndExpression.Is( BinaryOperator( EqualityExpression, BinaryOperatorBuilder.Create(BitwiseAnd, AST.BitwiseAnd.Create) ) ); // exclusive-or-expression // : and-expression [ '^' and-expression ]* ExclusiveOrExpression.Is( BinaryOperator( AndExpression, BinaryOperatorBuilder.Create(Xor, AST.Xor.Create) ) ); // inclusive-or-expression // : exclusive-or-expression [ '|' exclusive-or-expression ]* InclusiveOrExpression.Is( BinaryOperator( ExclusiveOrExpression, BinaryOperatorBuilder.Create(BitwiseOr, AST.BitwiseOr.Create) ) ); // logical-and-expression // : inclusive-or-expression [ '&&' inclusive-or-expression ]* LogicalAndExpression.Is( BinaryOperator( InclusiveOrExpression, BinaryOperatorBuilder.Create(LogicalAnd, AST.LogicalAnd.Create) ) ); // logical-or-expression // :logical-and-expression [ '||' logical-and-expression ]* LogicalOrExpression.Is( BinaryOperator( LogicalAndExpression, BinaryOperatorBuilder.Create(LogicalOr, AST.LogicalOr.Create) ) ); }