Ejemplo n.º 1
0
 private void StudentsListBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     // Load average and predicted for the selected student.
     if (StudentsListBox.Items.Count != 0)
     {
         // Reset labels
         homeworkAverageLabel.Text = "--";
         testsAverageLabel.Text    = "--";
         mtgLabel.Text             = "--";
         predictedGradeLabel.Text  = "--";
         if (StudentsListBox.SelectedIndex != -1)
         {
             // Grab data.
             GradeData Data = GradeUtils.calculateStudentGrades(StudentsListBox.SelectedIndex + 1, GroupId);
             // Only bother showing new data if they have homework and test results.
             if (Data.HwAverage != 0 && Data.TestAverage != 0 && Data.MTG != 0)
             {
                 homeworkAverageLabel.Text = Grades.FirstOrDefault(k => k.Value == Data.HwAverage).Key;
                 testsAverageLabel.Text    = Grades.FirstOrDefault(k => k.Value == Data.TestAverage).Key;
                 mtgLabel.Text             = Grades.FirstOrDefault(k => k.Value == Data.MTG).Key;
                 predictedGradeLabel.Text  = Grades.FirstOrDefault(k => k.Value == Data.Predicted).Key;
             }
         }
     }
 }
Ejemplo n.º 2
0
        public ActionResult GetGradeList()
        {
            List <GradeData> gradeDataList = new List <GradeData>();
            GradeData        extra         = new GradeData();

            extra.Id        = 0;
            extra.GradeName = "不限";
            gradeDataList.Add(extra);
            foreach (Grades grade in db.Grades)
            {
                GradeData gradeData = new GradeData();
                gradeData.Id        = grade.Id;
                gradeData.GradeName = grade.Title;
                gradeDataList.Add(gradeData);
            }
            return(Json(new { data = gradeDataList }));
        }