public FormExamDepartment_ShowCourse(int course_ID)
 {
     InitializeComponent();
     courseID   = course_ID;
     LecturesID = SQLFunctions.getLectureIDByCourseID(courseID);
     courseName = SQLFunctions.covertCourseIDtoCourseName(courseID);
     if (LecturesID != null && StudentsID != null)
     {
         for (int i = 0; i < LecturesID.Count; i++)
         {
             if (SQLFunctions.getStudentsIDfromLectureID(LecturesID[i]) != null)
             {
                 if (StudentsID.Count == 0)
                 {
                     StudentsID = (SQLFunctions.getStudentsIDfromLectureID(LecturesID[i]));
                 }
                 else
                 {
                     StudentsID.Union(SQLFunctions.getStudentsIDfromLectureID(LecturesID[i])).ToList();
                 }
             }
         }
         for (int i = 0; i < StudentsID.Count; i++)
         {
             dataGridView1.Rows.Add(courseID, courseName, StudentsID[i], SQLFunctions.covertStudentIDtoStudentLastName(Convert.ToInt32(StudentsID[i])) + " " + SQLFunctions.covertStudentIDtoStudentFirstName(Convert.ToInt32(StudentsID[i])));
         }
     }
 }
        public FormExamDepartment_GradeStudent(int course_ID = 0, int student_ID = 0)
        {
            InitializeComponent();
            textBox1.Visible                  = false;
            textBox1.MaxLength                = 9;
            textBox_grade.MaxLength           = 3;
            comboBox_CourseList.DropDownStyle = ComboBoxStyle.DropDownList;
            DataTable students = SQLFunctions.getStudents();

            if (students != null)
            {
                for (int i = 0; i < students.Rows.Count; i++)
                {
                    string[]     row  = { students.Rows[i]["LastName"].ToString() + " " + students.Rows[i]["FirstName"].ToString(), students.Rows[i]["ID"].ToString(), students.Rows[i]["Year"].ToString(), students.Rows[i]["Semester"].ToString(), students.Rows[i]["Department"].ToString() };
                    ListViewItem item = new ListViewItem(row);
                    listView1.Items.Add(item);
                }
            }
            if (student_ID != 0 && course_ID != 0)
            {
                listView1.Visible      = false;
                label_headline.Visible = true;

                textBox1.Text    = Convert.ToString(student_ID);
                textBox1.Visible = false;
                comboBox_CourseList.Items.Add(Convert.ToString(SQLFunctions.covertCourseIDtoCourseName(course_ID)));
                comboBox_CourseList.SelectedIndex = 0;
                comboBox_CourseList.Visible       = false;

                textBox_grade.Visible = true;
                label_grade.Visible   = true;
                button_Accept.Visible = true;
            }
        }
Example #3
0
        private void StudentGrades_Load(object sender, EventArgs e)
        {
            DataTable studentsGrades = new DataTable();

            studentsGrades = SQLFunctions.getStudentsGrades(id);
            if (studentsGrades != null)
            {
                int k = 0;
                for (int i = 0; i < studentsGrades.Rows.Count; i++)
                {
                    //marks failed in red (under 56)
                    dataGridView1.Rows.Add(SQLFunctions.covertCourseIDtoCourseName(Convert.ToInt32(studentsGrades.Rows[i]["CourseID"])), studentsGrades.Rows[i]["Grade"]);
                    if (Convert.ToInt32(studentsGrades.Rows[i]["Grade"]) < 56)
                    {
                        dataGridView1.Rows[k].DefaultCellStyle.ForeColor = Color.Red;
                    }
                    k++;
                }
            }
        }
Example #4
0
 public FormExamDepartment_GradeStudent(int course_ID = 0, int student_ID = 0)
 {
     InitializeComponent();
     textBox_studentID.MaxLength       = 9;
     textBox_grade.MaxLength           = 3;
     comboBox_CourseList.DropDownStyle = ComboBoxStyle.DropDownList;
     if (student_ID != 0 && course_ID != 0)
     {
         textBox_studentID.Text    = Convert.ToString(student_ID);
         textBox_studentID.Visible = false;
         comboBox_CourseList.Items.Add(Convert.ToString(SQLFunctions.covertCourseIDtoCourseName(course_ID)));
         comboBox_CourseList.SelectedIndex = 0;
         comboBox_CourseList.Visible       = false;
         label_studentID.Visible           = false;
         textBox_grade.Visible             = true;
         label_grade.Visible   = true;
         button_OK.Visible     = false;
         button_Accept.Visible = true;
     }
 }