public GradingAssignmentForm()
 {
     InitializeComponent();
     currentAssignment = null;
     currentResponseList = null;
     DeletedAdjustments = new LinkedList<int>();
 }
        public void LoadResponseList(Student student, ResponseList responseList)
        {
            if (currentAssignment == null || responseList.AssignmentID != currentAssignment.AssignmentID)
            {
                Debug.WriteLine("The assignment and response list IDs do not match!");
                return;
            }

            currentStudent = student;

            currentResponseList = responseList;

            studentNameLabel.Text = string.Format("{0}, {1}", currentStudent.LastName, currentStudent.FirstName);

            studentIDLabel.Text = currentStudent.StudentSchoolID;

            foreach (KeyValuePair<int, RubricNode> rubricNode in currentAssignment.Rubric.Nodes)
            {
                TreeNode[] rubricTreeNodes = rubricTreeView.Nodes.Find(rubricNode.Value.Criteria.CriteriaID.ToString(),true);

                if (rubricTreeNodes.Length == 1)
                {
                    Response response;

                    if (currentResponseList.Responses.TryGetValue(rubricNode.Value.Criteria.CriteriaID, out response))
                    { // if we have already created a response for this criteria/student
                        if (response.PointsReceived > 0)
                        {
                            rubricTreeNodes[0].Checked = true;
                        }
                        else
                        {
                            // no checkmark if they have received 0 pts
                            rubricTreeNodes[0].Checked = false;
                        }
                    }
                    else if(rubricNode.Value.Children.Count == 0)
                    { // we need to create a response if none exists and this isn't a header
                        response = currentResponseList.Responses[rubricNode.Value.Criteria.CriteriaID] = new Response();
                        rubricTreeNodes[0].Checked = true;
                        response.PointsReceived = rubricNode.Value.Criteria.MaxPoints;
                    }

                    if (rubricNode.Value.Children.Count > 0)
                    {
                        rubricTreeNodes[0].Checked = true;
                        rubricTreeNodes[0].Text = rubricNode.Value.Criteria.Description;
                    }
                    else
                    {
                        rubricTreeNodes[0].Text = string.Format("{0} ({1}): {2}",
                                            rubricNode.Value.Criteria.Description,
                                            rubricNode.Value.Criteria.MaxPoints.ToString(),
                                            response.PointsReceived.ToString());
                    }
                }
                else if (rubricTreeNodes.Length == 0)
                {
                    Debug.WriteLine("The criteria in the rubric does not exist in the treeview.");
                }
                else
                {
                    Debug.WriteLine("Multiple criteria share the same key.");
                }
            }

            rubricTreeView.ExpandAll();

            updateAdjustmentListBox();

            updatePoints();
        }
Example #3
0
        public void SaveResponseList(ResponseList responseList)
        {
            int assignmentID = responseList.AssignmentID;

            int studentID = responseList.StudentID;

            foreach (KeyValuePair<int,Response> responsePair in responseList.Responses)
            {
                int criteriaID = responsePair.Key;
                Response response = responsePair.Value;

                if (response.HasID())
                { // If we have an ID already.
                    UpdateResponse(assignmentID, studentID, criteriaID, response);
                }
                else
                {
                    AddResponse(assignmentID, studentID, criteriaID, response);
                }
            }

            foreach (Adjustment adjustment in responseList.Adjustments)
            {
                if (adjustment.HasID())
                { // If we have an ID already.
                    UpdateAdjustment(assignmentID, studentID, adjustment);
                }
                else
                {
                    AddAdjustment(assignmentID, studentID, adjustment);
                }
            }
        }
Example #4
0
 private void saveResponseList(ResponseList responseList)
 {
     dbConnention.SaveResponseList(responseList);
 }
Example #5
0
        public ResponseList GetResponseList(int assignmentID, int studentID)
        {
            ResponseList responseList = new ResponseList();

            responseList.StudentID = studentID;

            responseList.AssignmentID = assignmentID;

            // Join the Criteria and Response tables on the criteria id
            string responseQuery = String.Format("SELECT R.{0}, R.{1}, R.{2}, R.{3} ", tables.Response.ResponseID, tables.Response.CriteriaID, tables.Response.PointsReceived, tables.Response.GraderComment);
            responseQuery += String.Format("FROM {0} AS R, {1} AS C ", tables.Response.TableName, tables.Criteria.TableName);
            responseQuery += String.Format("WHERE R.{0} = C.{1} ", tables.Response.CriteriaID, tables.Criteria.CriteriaID);
            responseQuery += String.Format("AND {0} = {1} ", tables.Response.StudentID, studentID);
            responseQuery += String.Format("AND {0} = {1} ", tables.Criteria.AssignmentID, assignmentID);

            DataSet responseSet = runQuery(responseQuery);

            if(responseSet.Tables.Count > 0){
                foreach (DataRow row in responseSet.Tables[0].Rows)
                {
                    int responseID = (int)row[tables.Response.ResponseID];
                    int criteriaID = (int)row[tables.Response.CriteriaID];
                    int pointsReceived = (int)row[tables.Response.PointsReceived];
                    string graderComment = row[tables.Response.GraderComment].ToString();
                    responseList.Responses.Add(criteriaID, new Response(responseID, pointsReceived, graderComment));
                }
            }

            // Get all adjustments for current students assignment
            string adjustmentQuery = String.Format("SELECT * FROM {0} ", tables.Adjustment.TableName);
            adjustmentQuery += String.Format("WHERE {0} = {1} ", tables.Adjustment.StudentID, studentID);
            adjustmentQuery += String.Format("AND {0} = {1} ", tables.Adjustment.AssignmentID, assignmentID);

            DataSet adjustmentSet = runQuery(adjustmentQuery);

            if (adjustmentSet.Tables.Count > 0)
            {
                foreach (DataRow row in adjustmentSet.Tables[0].Rows)
                {
                    int adjustmentID = (int)row[tables.Adjustment.AdjustmentID];
                    string comment = row[tables.Adjustment.Comment].ToString();
                    int pointAdjustment = (int)row[tables.Adjustment.PointAdjustment];
                    responseList.Adjustments.Add(new Adjustment(adjustmentID, comment, pointAdjustment));
                }
            }

            return responseList;
        }