Ejemplo n.º 1
0
        private void CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            if (!this.dataGridInitialised || e.ColumnIndex <= -1 || e.RowIndex <= -1)
            {
                return;
            }

            DataGridViewCell cell    = dataGrid[e.ColumnIndex, e.RowIndex];
            AbstractMark     mark    = this.markGrid[e.ColumnIndex, e.RowIndex];
            Assignment       task    = this.taskIdToTask[mark.GetTaskId()];
            Student          student = this.studentIdToStudent[mark.GetStudentId()];

            string newValue = cell.EditedFormattedValue.ToString();
            int    newScore = 0;
            bool   isDigit  = Int32.TryParse(newValue, out newScore);

            if (!isDigit || newScore < 0 || newScore > task.maxScore)
            {
                return;
            }

            // Changed mark from N/A
            if (mark.GetFeedback() == null)
            {
                mark.UpdateFeedback("No feedback given.");   // NO API CALLS MADE IN THIS METHOD
            }
            mark.UpdateScore(newScore);                      // NO API CALLS MADE IN THIS METHOD

            this.markGrid[e.ColumnIndex, e.RowIndex] = mark; // Update cell data
            cell.Style.BackColor = ScoreGrade(mark, task.maxScore, student);
            APIHandler.GiveFeedback(student, task, newScore, mark.GetFeedback());
        }
Ejemplo n.º 2
0
        private void CellToolTipTextNeeded(object sender, DataGridViewCellToolTipTextNeededEventArgs e)
        {
            if (e.RowIndex <= -1 || e.ColumnIndex <= -1)
            {
                return;
            }
            AbstractMark mark = this.markGrid[e.ColumnIndex, e.RowIndex];

            if (mark != null)
            {
                Assignment assignment = taskIdToTask[mark.GetTaskId()];
                Student    student    = studentIdToStudent[mark.GetStudentId()];
                e.ToolTipText = "Score: " + mark.GetScore().ToString() + "\nOut of: " + assignment.maxScore + "\nALPs grade: " + student.GetAlpsString() + "\nFeedback provided: " + mark.GetFeedback();
            }
            else
            {
                e.ToolTipText = "Feedback not yet provided";
            }
        }
Ejemplo n.º 3
0
        private void CellValueNeeded(object sender, DataGridViewCellValueEventArgs e)
        {
            if (e.RowIndex <= -1 || e.ColumnIndex <= -1)
            {
                return;
            }
            AbstractMark     mark = this.markGrid[e.ColumnIndex, e.RowIndex];
            DataGridViewCell cell = dataGrid[e.ColumnIndex, e.RowIndex];

            if (mark.HasMarked())
            {
                e.Value = mark.GetScoreString();

                int     maxScore = this.taskIdToTask[mark.GetTaskId()].maxScore;
                Student student  = this.studentIdToStudent[mark.GetStudentId()];
                cell.Style.BackColor = ScoreGrade(mark, maxScore, student);
            }
            else
            {
                cell.Style.BackColor = Color.Gray;
                e.Value = "N/A";
            }
        }