Esempio n. 1
0
        private void Reload()
        {
            DbContextDal dal = new DbContextDal();

            student = dal.students.Where(x => x.ID == student.ID).FirstOrDefault();
            checkBox_grade.Checked = false;
            checkBox_test.Checked  = false;
            button_confirm.Hide();
            comboBox_Course.Items.Clear();
            studentCourses = SettingDatabase.GetAllLearnedCoursesOfStudent(student);
            foreach (Course item in studentCourses)
            {
                comboBox_Course.Items.Add(item.Name);
            }
            float             studentGrade      = 0;
            int               counter           = 0;
            List <Enrollment> allStudentCourses = student.Enrollments.ToList();

            dataGridView1.Rows.Clear();
            dataGridView1.Refresh();
            foreach (Enrollment item in allStudentCourses)
            {
                DataGridViewRow row = new DataGridViewRow();
                row.CreateCells(dataGridView1);  // this line was missing
                row.Cells[0].Value = item.Course.Name;
                if (item.Grade != null)
                {
                    row.Cells[1].Value = item.Grade;
                    studentGrade       = float.Parse(item.Grade.ToString());
                    counter++;
                }
                if (item.gradeAppeal != null)
                {
                    row.Cells[2].Value = item.gradeAppeal;
                }
                else
                {
                    row.Cells[2].Value = "Not requested";
                }
                if (item.additionalTest != null)
                {
                    row.Cells[3].Value = item.additionalTest;
                }
                else
                {
                    row.Cells[3].Value = "Not requested";
                }
                dataGridView1.Rows.Add(row);
            }

            studentGrade   = studentGrade / counter;
            label_GPA.Text = "GPA: " + studentGrade;
        }
        private void Reload()
        {
            comboBox_pickCourse.Items.Clear();
            foreach (Control c in Schedule.Controls)
            {
                if (c is RichTextBox)
                {
                    ((RichTextBox)c).Clear();
                }
            }

            DbContextDal dal = new DbContextDal();

            student = dal.students.Where(x => x.ID == student.ID).FirstOrDefault();

            lessons = new List <Lesson>();

            enrollments = student.Enrollments.ToList();
            lessons     = SettingDatabase.StudentGetAllMyLesson(student);
            courses     = SettingDatabase.GetAllLearnedCoursesOfStudent(student);

            lessons = lessons.OrderBy(x => x.Start).ToList();

            foreach (Lesson item in lessons)
            {
                int  i   = 1;
                Days day = (Days)Enum.Parse(typeof(Days), item.Day);
                int  j   = (int)day;
                try
                {
                    var c = this.Schedule.GetControlFromPosition(j, i);
                    while (!(String.IsNullOrEmpty(c.Text)))
                    {
                        i++;
                        c = ((RichTextBox)Schedule.GetControlFromPosition(j, i));
                    }
                    Course course = SettingDatabase.getCourseByID(item.LCourseID);
                    c.Text = course.Name + " - " + item.Type + "\n" + item.Start + ":00-" + item.End + ":00 class:" + item.building + item.number + "\n" + getTeacherName(item);
                }
                catch (NullReferenceException ex) { MessageBox.Show(ex.Message); }
            }
            foreach (Course item in courses)
            {
                comboBox_pickCourse.Items.Add(item.Name);
            }
        }
Esempio n. 3
0
 public List <Course> getAllMyCourses()
 {
     return(SettingDatabase.GetAllLearnedCoursesOfStudent(this));
 }
Esempio n. 4
0
 public List <Course> getAllCourseOfStudent(Student s)
 {
     return(SettingDatabase.GetAllLearnedCoursesOfStudent(s));
 }