Exemple #1
0
        public Classroom(string _name)
        {
            DataRow row = SQLFunctions.getClassroomProperties(_name);

            name     = _name;
            capacity = Convert.ToInt32(row["Capacity"]);
        }
Exemple #2
0
        public FormAdmin_ChangePermission()
        {
            InitializeComponent();
            AcceptButton                      = button_Accept;
            textBox_UserID.MaxLength          = 9;
            comboBox_Permission.DropDownStyle = ComboBoxStyle.DropDownList;
            comboBox_users.DropDownStyle      = ComboBoxStyle.DropDownList;
            comboBox_Department.DropDownStyle = ComboBoxStyle.DropDownList;
            comboBox_Year.DropDownStyle       = ComboBoxStyle.DropDownList;
            comboBox_Semester.DropDownStyle   = ComboBoxStyle.DropDownList;
            DataTable users = new DataTable();

            users    = SQLFunctions.getUsers();
            allUsers = users;
            for (int i = 0; i < users.Rows.Count; i++)
            {
                if (users.Rows[i]["Role"].ToString() == "SecretaryA")
                {
                    comboBox_users.Items.Add(users.Rows[i]["LastName"].ToString() + " " + users.Rows[i]["FirstName"].ToString() + " - Students Secretary");
                }
                else if (users.Rows[i]["Role"].ToString() == "Secretary")
                {
                    comboBox_users.Items.Add(users.Rows[i]["LastName"].ToString() + " " + users.Rows[i]["FirstName"].ToString() + " - Department Secretary");
                }
                else
                {
                    comboBox_users.Items.Add(users.Rows[i]["LastName"].ToString() + " " + users.Rows[i]["FirstName"].ToString() + " - " + users.Rows[i]["Role"].ToString());
                }
            }
        }
 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])));
         }
     }
 }
 private void button1_Click(object sender, EventArgs e)
 {
     if (SQLFunctions.checkExistsUsers(Convert.ToInt32(textBox_ID.Text)) == false)
     {
         SQLFunctions.insertUser(Convert.ToInt32(textBox_ID.Text), textBox_Password.Text, textBox_FirstName.Text, textBox_LastName.Text, comboBox_Permission.Text, comboBox_Department.Text);
         if (comboBox_Permission.SelectedIndex == 0 || comboBox_Permission.SelectedIndex == 1)
         {
             MessageBox.Show(textBox_LastName.Text + " " + textBox_FirstName.Text + " was added as a " + comboBox_Permission.Text + " in " + comboBox_Department.Text + " department.");
         }
         else if (comboBox_Permission.SelectedIndex == 3)
         {
             MessageBox.Show(textBox_LastName.Text + " " + textBox_FirstName.Text + " was added as an " + comboBox_Permission.Text);
         }
         else
         {
             MessageBox.Show(textBox_LastName.Text + " " + textBox_FirstName.Text + " was added as an " + comboBox_Permission.Text + " employee");
         }
         this.Hide();
         FormMenuAdmin adminForm = new FormMenuAdmin();
         adminForm.Show();
     }
     else
     {
         MessageBox.Show("Student " + textBox_FirstName.Text + " is already registered in the system");
     }
 }
        public FormMenuAdmin()
        {
            InitializeComponent();

            int       newNotificationCount = 0;
            DataTable notifications        = SQLFunctions.getErrors();

            if (notifications != null)
            {
                for (int i = 0; i < notifications.Rows.Count; i++)
                {
                    if (notifications.Rows[i]["Viewed"].ToString() == "False")
                    {
                        newNotificationCount++;
                    }
                }


                if (newNotificationCount > 0)
                {
                    labelNotificationCount.Text    = newNotificationCount.ToString();
                    labelNotificationCount.Visible = true;
                }
            }
        }
Exemple #6
0
        private void buttonLogin_Click(object sender, EventArgs e)
        {
            if (SQLFunctions.checkLogIn(Convert.ToInt32(textBoxID.Text), textBoxPassword.Text))
            {
                this.Hide();

                if (SQLFunctions.checkRole(Convert.ToInt32(textBoxID.Text)) == "Student")
                {
                    FormMenuStudent mainForm = new FormMenuStudent();
                    mainForm.Show();
                }
                else if (SQLFunctions.checkRole(Convert.ToInt32(textBoxID.Text)) == "Secretary")
                {
                    FormMenuSecretary mainForm = new FormMenuSecretary();
                    mainForm.Show();
                }
                else if (SQLFunctions.checkRole(Convert.ToInt32(textBoxID.Text)) == "Exam Department")
                {
                    FormMenuExamDepratment mainForm = new FormMenuExamDepratment();
                    mainForm.Show();
                }
                else if (SQLFunctions.checkRole(Convert.ToInt32(textBoxID.Text)) == "Admin")
                {
                }
                else
                {
                    MessageBox.Show("Unknown Error");
                }
            }
            else
            {
                MessageBox.Show("Logon Failure: unknown ID or bad password");
            }
        }
 private void buttonSaveChanges_Click(object sender, EventArgs e)
 {
     if (checkTimeTable())
     {
         SQLFunctions.addLecturesToStudent(userStudnet.getUserID(), userStudnet.getRegisteredCoursesIDs(), userStudnet.getSemeterPoints(), userStudnet.getWeaklyHours());
         MessageBox.Show("Timetable was saved");
     }
 }
Exemple #8
0
 private void button_Submit_Click(object sender, EventArgs e)
 {
     SQLFunctions.addError(userID, textBox_title.Text, textBox_description.Text);
     MessageBox.Show("Your error has been submitted");
     textBox_title.Text       = "";
     button_Submit.Enabled    = false;
     textBox_description.Text = "";
     this.Close();
 }
 public FormMenuSecretary(int _id, string _password)
 {
     InitializeComponent();
     id            = _id;
     password      = _password;
     userSecretary = new Users(_id, _password, SQLFunctions.covertStudentIDtoStudentFirstName(_id), SQLFunctions.covertStudentIDtoStudentLastName(_id), SQLFunctions.getStudentDepartment(_id));
     combobox_Year.DropDownStyle     = ComboBoxStyle.DropDownList;
     combobox_Semester.DropDownStyle = ComboBoxStyle.DropDownList;
 }
Exemple #10
0
 public Student(int _id, string _password) : base(_id, _password, SQLFunctions.covertStudentIDtoStudentFirstName(_id), SQLFunctions.covertStudentIDtoStudentLastName(_id), SQLFunctions.getStudentDepartment(_id))
 {
     year                 = SQLFunctions.getStudentYear(_id);
     semester             = SQLFunctions.getStudentSemester(_id);
     failedCoursesID      = SQLFunctions.getStudentFailedCoursesIDs(_id);
     semesterPoints       = SQLFunctions.getStudentSemesterPoints(_id);
     notification         = SQLFunctions.getStudentNotificationsState(_id);
     weeklyHours          = SQLFunctions.getStudentWeeklyHours(_id);
     registeredLessonsIDs = SQLFunctions.findStudentLecturesIDs(_id);
 }
Exemple #11
0
        public Users(int _id)
        {
            DataRow row = SQLFunctions.getUserProperties(_id);

            id         = _id;
            password   = row["Password"].ToString();
            firstName  = row["FirstName"].ToString();
            lastName   = row["LastName"].ToString();
            department = row["Department"].ToString();
        }
Exemple #12
0
        public Lesson(int _id)
        {
            DataRow row = SQLFunctions.getLessonProperties(_id);

            lessonID  = _id;
            day       = row["Day"].ToString();
            starts    = Convert.ToInt32(row["StartHour"]);
            ends      = Convert.ToInt32(row["EndHour"]);
            type      = row["Type"].ToString();
            classroom = new Classroom(row["Classroom"].ToString());
        }
        private void listView1_DoubleClick(object sender, EventArgs e)
        {
            textBox1.Text    = listView1.SelectedItems[0].SubItems[1].Text;
            textBox1.Visible = false;
            List <string> coursesNames = new List <string>();
            List <int>    coursesID    = new List <int>();
            int           flag         = 0;

            if (SQLFunctions.checkExistsUsers(Convert.ToInt32(textBox1.Text)) == true)
            {
                int j = 0;
                comboBox_CourseList.Visible = true;
                label_Course.Visible        = true;
                textBox1.Visible            = false;

                button_Accept.Visible = true;
                AcceptButton          = button_Accept;
                List <int> lecturesList = SQLFunctions.findStudentLecturesIDs(Convert.ToInt32(textBox1.Text));
                if (lecturesList != null)
                {
                    for (int i = 0; i < lecturesList.Count; i++)
                    {
                        flag = 0;
                        for (j = 0; j < coursesID.Count; j++)
                        {
                            if (Convert.ToInt32(SQLFunctions.findLectureProperties(lecturesList[i])[2]) == coursesID[j])
                            {
                                flag = 1;
                            }
                        }
                        if (flag == 0)
                        {
                            coursesID.Add(Convert.ToInt32(SQLFunctions.findLectureProperties(lecturesList[i])[2]));
                            coursesNames.Add(SQLFunctions.findCourseProperties(coursesID[j])[0]);
                        }
                    }
                    comboBox_CourseList.Items.Clear();
                    comboBox_CourseList.ResetText();
                    for (int i = 0; i < coursesNames.Count; i++)
                    {
                        comboBox_CourseList.Items.Add(coursesNames[i]);
                    }
                }
                else
                {
                    MessageBox.Show("The student is not registered to courses");
                }
            }

            else
            {
                MessageBox.Show("This student isnt registered");
            }
        }
Exemple #14
0
        public Student(int _id) : base(_id)
        {
            DataRow row = SQLFunctions.getStudentProperties(_id);

            year                 = Convert.ToInt32(row["Year"]);
            semester             = (row["Semester"]).ToString();
            failedCoursesID      = SQLFunctions.getStudentFailedCoursesIDs(_id);
            semesterPoints       = (float)Convert.ToDouble(row["SemesterPoint"]);
            notification         = Convert.ToBoolean(row["Notification"]);
            weeklyHours          = Convert.ToInt32(row["WeeklyHours"]);
            registeredLessonsIDs = SQLFunctions.findStudentLecturesIDs(_id);
        }
        private void buttonChanges_Click(object sender, EventArgs e)
        {
            //change window + notiication
            FormStudent_ViewChanges viewChange = new FormStudent_ViewChanges(userStudnet.getUserID());

            viewChange.Show();
            userStudnet.setNotification(false);
            pictureBox1.Visible = false;
            SQLFunctions.ChangeStudentNotificationState(new List <int> {
                userStudnet.getUserID()
            }, "False");
        }
Exemple #16
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (SQLFunctions.checkExistsUsers(Convert.ToInt32(textBox_ID.Text)) == false)
            {
                if (!SQLFunctions.checkExistsEmail(textBox_email.Text))
                {
                    if (textBox_email.Text.Contains("@"))
                    {
                        if (comboBox_Permission.Text == "Student Secretary")
                        {
                            SQLFunctions.insertUser(textBox_email.Text, Convert.ToInt32(textBox_ID.Text), textBox_Password.Text, textBox_FirstName.Text, textBox_LastName.Text, "SecretaryA", comboBox_Department.Text);
                        }
                        else if (comboBox_Permission.Text == "Department Secretary")
                        {
                            SQLFunctions.insertUser(textBox_email.Text, Convert.ToInt32(textBox_ID.Text), textBox_Password.Text, textBox_FirstName.Text, textBox_LastName.Text, "Secretary", comboBox_Department.Text);
                        }

                        else
                        {
                            SQLFunctions.insertUser(textBox_email.Text, Convert.ToInt32(textBox_ID.Text), textBox_Password.Text, textBox_FirstName.Text, textBox_LastName.Text, comboBox_Permission.Text, comboBox_Department.Text);
                        }
                        if (comboBox_Permission.SelectedIndex == 3)
                        {
                            MessageBox.Show(textBox_LastName.Text + " " + textBox_FirstName.Text + " was added as an " + comboBox_Permission.Text);
                        }
                        else if (comboBox_Permission.SelectedIndex == 2)
                        {
                            MessageBox.Show(textBox_LastName.Text + " " + textBox_FirstName.Text + " was added as an " + comboBox_Permission.Text + " employee");
                        }
                        else
                        {
                            MessageBox.Show(textBox_LastName.Text + " " + textBox_FirstName.Text + " was added as a " + comboBox_Permission.Text + " in " + comboBox_Department.Text + " department.");
                        }
                        this.Hide();
                        FormMenuAdmin adminForm = new FormMenuAdmin();
                        adminForm.Show();
                    }
                    else
                    {
                        MessageBox.Show("Invalid Email address");
                    }
                }
                else
                {
                    MessageBox.Show("Email " + textBox_email.Text + " is already registered in the system");
                }
            }
            else
            {
                MessageBox.Show("Student " + textBox_FirstName.Text + " is already registered in the system");
            }
        }
Exemple #17
0
 private void buttonLogin_Click(object sender, EventArgs e)
 {
     if (SQLFunctions.checkLogIn(Convert.ToInt32(textBoxID.Text), textBoxPassword.Text))
     {
         this.Hide();
         MenuStudentForm mainForm = new MenuStudentForm();
         mainForm.Show();
     }
     else
     {
         MessageBox.Show("Logon Failure: unknown ID or bad password");
     }
 }
        private bool checkTimeTableAtAdding(int _courseIndex, int _lessonIndex)
        {
            Lesson lessonToAdd = allowedCoursesProperties[_courseIndex].getLessons()[_lessonIndex];

            for (int i = 0; i < allowedCoursesProperties.Count; i++)
            {
                if (allowedCoursesProperties[i].getCourseID() == allowedCoursesProperties[_courseIndex].getCourseID())
                {
                    for (int j = 0; j < allowedCoursesProperties[i].getLessons().Count; j++)
                    {
                        if (allowedCoursesProperties[i].getLessons()[j].getType() == lessonToAdd.getType() &&
                            userStudnet.getRegisteredLessonsIDs().Contains(allowedCoursesProperties[i].getLessons()[j].getLessonID()))
                        {
                            MessageBox.Show("You already added " + allowedCoursesProperties[_courseIndex].getCourseName() + " " + lessonToAdd.getType());
                            return(false);
                        }
                    }
                }
            }

            for (int i = 0; i < allowedCoursesProperties.Count; i++)
            {
                for (int j = 0; j < allowedCoursesProperties[i].getLessons().Count; j++)
                {
                    if (userStudnet.getRegisteredLessonsIDs().Contains(allowedCoursesProperties[i].getLessons()[j].getLessonID()) &&
                        allowedCoursesProperties[i].getLessons()[j].getDay() == lessonToAdd.getDay())
                    {
                        if ((lessonToAdd.getStartTime() >= allowedCoursesProperties[i].getLessons()[j].getStartTime() && lessonToAdd.getStartTime() < allowedCoursesProperties[i].getLessons()[j].getEndTime()) ||
                            (lessonToAdd.getEndTime() > allowedCoursesProperties[i].getLessons()[j].getStartTime() && lessonToAdd.getEndTime() <= allowedCoursesProperties[i].getLessons()[j].getEndTime()))
                        {
                            MessageBox.Show("You already have lesson on these hours");
                            return(false);
                        }
                    }
                }
            }

            if (lessonToAdd.getType() == "Lecture" && userStudnet.getSemeterPoints() + allowedCoursesProperties[_courseIndex].getCredits() > 30)
            {
                MessageBox.Show("Semester points is over");
                return(false);
            }

            if (SQLFunctions.getNumberOfRegisteredStudentsAtLesson(lessonToAdd.getLessonID()) >= new Lesson(lessonToAdd.getLessonID()).getClassroom().getCapacity())
            {
                MessageBox.Show("This class is full");
                return(false);
            }

            return(true);
        }
        private void comboBox_Department_SelectedIndexChanged(object sender, EventArgs e)
        {
            //filter courses by department
            dataGridView_courses.Rows.Clear();
            List <string> row = new List <string>(8);
            int           i = 0, countRows = 0;
            List <string> courseList = SQLFunctions.findCoursePropertiesByDepartment(comboBox_Department.Text);

            countRows = courseList.Count / 8;
            for (i = 0; i < courseList.Count; i += 9)
            {
                dataGridView_courses.Rows.Add(courseList[i], courseList[i + 1], courseList[i + 2], courseList[i + 3], courseList[i + 4], courseList[i + 5], courseList[i + 6], (int)Convert.ToDouble(courseList[i + 7]) / 1, Convert.ToString((Convert.ToDouble(courseList[i + 7]) % 1) * 10));
            }
        }
 private void buttonSaveChanges_Click(object sender, EventArgs e)
 {
     if (checkTimeTableAtSaving())
     {
         buttonSaveChanges.Visible   = false;
         buttonAddCourses.Visible    = false;
         listView1.Visible           = false;
         buttonRemoveCourses.Visible = false;
         comboBox_courses.Visible    = false;
         buttonEditTimeTable.Visible = true;
         SQLFunctions.addLecturesToStudent(userStudnet.getUserID(), userStudnet.getRegisteredLessonsIDs(), userStudnet.getSemeterPoints(), userStudnet.getWeaklyHours());
         MessageBox.Show("Timetable was saved");
     }
 }
 private void button_Accept_Click(object sender, EventArgs e)
 {
     if (SQLFunctions.checkExistsUsers(Convert.ToInt32(listView1.SelectedItems[0].SubItems[0].Text)) == true)
     {
         SQLFunctions.deleteUser(Convert.ToInt32(listView1.SelectedItems[0].SubItems[0].Text));
         MessageBox.Show("User with ID: " + listView1.SelectedItems[0].SubItems[0].Text + " was deleted!");
         this.Hide();
         FormMenuAdmin adminForm = new FormMenuAdmin();
         adminForm.Show();
     }
     else
     {
         MessageBox.Show("User ID could not be located in the database");
     }
 }
Exemple #22
0
 private void button_Accept_Click(object sender, EventArgs e)
 {
     if (SQLFunctions.checkExistsClassroom(listView1.SelectedItems[0].SubItems[0].Text) == true)
     {
         SQLFunctions.deleteClassroom(listView1.SelectedItems[0].SubItems[0].Text);
         MessageBox.Show("Class " + listView1.SelectedItems[0].SubItems[0].Text + " was deleted!");
         this.Hide();
         FormMenuAdmin adminForm = new FormMenuAdmin();
         adminForm.Show();
     }
     else
     {
         MessageBox.Show("Classroom was not found");
     }
 }
Exemple #23
0
 private void button_Accept_Click(object sender, EventArgs e)
 {
     if (SQLFunctions.checkExistsClassroom(textBox_ClassName.Text) == true)
     {
         SQLFunctions.deleteClassroom(textBox_ClassName.Text);
         MessageBox.Show("Class " + textBox_ClassName.Text + " was deleted!");
         this.Hide();
         FormMenuAdmin adminForm = new FormMenuAdmin();
         adminForm.Show();
     }
     else
     {
         MessageBox.Show("Classroom could not be located in the database");
     }
 }
 private void button1_Click(object sender, EventArgs e)
 {
     if (SQLFunctions.checkExistsClassroom(textBox_ClassName.Text) == false)
     {
         SQLFunctions.addClassroom(textBox_ClassName.Text, Convert.ToInt32(textBox_Capacity.Text));
         MessageBox.Show("class " + textBox_ClassName.Text + " was added with " + textBox_Capacity.Text + " seats.");
         this.Hide();
         FormMenuAdmin adminForm = new FormMenuAdmin();
         adminForm.Show();
     }
     else
     {
         MessageBox.Show("class " + textBox_ClassName.Text + " is already exists.");
     }
 }
Exemple #25
0
        private void comboBox_Department_SelectedIndexChanged(object sender, EventArgs e)
        {
            //filter courses by department
            dataGridView_courses.Rows.Clear();
            List <string> row           = new List <string>(8);
            int           i             = 0;
            DataTable     courseList_dt = SQLFunctions.findCoursePropertiesByDepartment(comboBox_Department.Text);

            if (courseList_dt != null)
            {
                for (i = 0; i < courseList_dt.Rows.Count; i++)
                {
                    dataGridView_courses.Rows.Add(courseList_dt.Rows[i]["Name"].ToString(), Convert.ToInt32(courseList_dt.Rows[i]["ID"]), (courseList_dt.Rows[i]["PreReqID"]).ToString(), Convert.ToInt32(courseList_dt.Rows[i]["Credits"]), Convert.ToInt32(courseList_dt.Rows[i]["LectureHour"]), Convert.ToInt32(courseList_dt.Rows[i]["PracticeHour"]), Convert.ToInt32(courseList_dt.Rows[i]["ReceptionHour"]), Convert.ToInt32(courseList_dt.Rows[i]["Year"]), Convert.ToChar(courseList_dt.Rows[i]["Semester"]));
                }
            }
        }
Exemple #26
0
        public FormAdmin_RemoveClassroom()
        {
            InitializeComponent();
            this.AcceptButton = button_Accept;
            DataTable classes = SQLFunctions.getClassrooms();

            if (classes != null)
            {
                for (int i = 0; i < classes.Rows.Count; i++)
                {
                    string[]     row  = { classes.Rows[i]["Name"].ToString(), classes.Rows[i]["Capacity"].ToString(), classes.Rows[i]["Type"].ToString() };
                    ListViewItem item = new ListViewItem(row);
                    listView1.Items.Add(item);
                }
            }
        }
Exemple #27
0
        private void login1()
        {
            if (!link)
            {
                DataRow dataRow = SQLFunctions.checkFbLogIn(fbMail);

                if (dataRow == null)
                {
                    MessageBox.Show("This facebook account is not linked to any system user\nPlease link your Facebook account and try again");
                    B_8.login login = new B_8.login();
                    login.Show();
                }
                else if (SQLFunctions.checkLogIn(Convert.ToInt32(dataRow[0]), dataRow[1].ToString()))
                {
                    if (SQLFunctions.checkRole(Convert.ToInt32(dataRow[0])) == "Student")
                    {
                        FormMenuStudent mainForm = new FormMenuStudent(Convert.ToInt32(dataRow[0]), dataRow[1].ToString());
                        mainForm.Show();
                    }
                    else if (SQLFunctions.checkRole(Convert.ToInt32(dataRow[0])) == "SecretaryA")
                    {
                        FormMenuSecretary mainForm = new FormMenuSecretary(Convert.ToInt32(dataRow[0]), dataRow[1].ToString());
                        mainForm.Show();
                    }
                    else if (SQLFunctions.checkRole(Convert.ToInt32(dataRow[0])) == "Exam Department")
                    {
                        FormMenuExamDepartment mainForm = new FormMenuExamDepartment();
                        mainForm.Show();
                    }
                    else if (SQLFunctions.checkRole(Convert.ToInt32(dataRow[0])) == "Admin")
                    {
                        FormMenuAdmin mainForm = new FormMenuAdmin();
                        mainForm.Show();
                    }
                    else
                    {
                        B_8.login login = new B_8.login(true, SQLFunctions.convertFbMailToMail(fbMail), dataRow[1].ToString());
                    }
                }
            }
            else
            {
                SQLFunctions.linkFbAccount(mail, fbMail);
                MessageBox.Show("Your facebook account was succesfuly linked");
                this.Hide();
            }
        }
        private void button_accept_Click(object sender, EventArgs e)
        {
            int lectureID;

            if ((2000 + Convert.ToInt32(textBox_year.Text) < 2100) && (2000 + Convert.ToInt32(textBox_year.Text) > 2000) && (Convert.ToInt32(textBox_month.Text) < 13) && (Convert.ToInt32(textBox_month.Text) > 0))
            {
                if (!(Convert.ToInt32(textBox_day.Text) > DateTime.DaysInMonth(2000 + Convert.ToInt32(textBox_year.Text), Convert.ToInt32(textBox_month.Text)) || Convert.ToInt32(textBox_day.Text) < 0))
                {
                    if ((Convert.ToInt32(textBox_StartTime.Text) >= 8 && Convert.ToInt32(textBox_StartTime.Text) <= 21) && (Convert.ToInt32(textBox_EndTime.Text) >= 8 && Convert.ToInt32(textBox_EndTime.Text) <= 21) && (Convert.ToInt32(textBox_StartTime.Text) < Convert.ToInt32(textBox_EndTime.Text)))
                    {
                        if (comboBox_AddRemove.SelectedIndex == 0)
                        {
                            if (comboBox_Lectures.SelectedItem.ToString() != "All")
                            {
                                lectureID = lectureIDS[comboBox_Lectures.SelectedIndex];
                                SQLFunctions.addChange(textBox_description.Text, Convert.ToInt32(textBox_StartTime.Text), Convert.ToInt32(textBox_EndTime.Text), Convert.ToInt32(textBox_day.Text), Convert.ToInt32(textBox_month.Text), 2000 + Convert.ToInt32(textBox_year.Text), lectureID);
                            }
                            else
                            {
                                SQLFunctions.addChange(textBox_description.Text, Convert.ToInt32(textBox_StartTime.Text), Convert.ToInt32(textBox_EndTime.Text), Convert.ToInt32(textBox_day.Text), Convert.ToInt32(textBox_month.Text), 2000 + Convert.ToInt32(textBox_year.Text), 0);
                            }
                        }
                        else
                        {
                            lectureID = lectureIDS[comboBox_Lectures.SelectedIndex];
                            SQLFunctions.addChange("Canceled", Convert.ToInt32(textBox_StartTime.Text), Convert.ToInt32(textBox_EndTime.Text), Convert.ToInt32(textBox_day.Text), Convert.ToInt32(textBox_month.Text), 2000 + Convert.ToInt32(textBox_year.Text), lectureID);
                        }
                        FormMenuSecretary secForm = new FormMenuSecretary(id, password);
                        this.Hide();
                        secForm.Show();
                    }

                    else
                    {
                        MessageBox.Show("Incorrect values");
                    }
                }
                else
                {
                    MessageBox.Show("Incorrect values");
                }
            }
            else
            {
                MessageBox.Show("Incorrect values");
            }
        }
        public FormStudent_ViewChanges(int id)
        {
            InitializeComponent();
            int index = 0;

            userStudent = new Student(id);
            DataTable datatable = SQLFunctions.getTimeTableChanges();

            if (datatable != null && userStudent.getRegisteredLessonsIDs() != null)
            {
                for (int i = 0; i < userStudent.getRegisteredLessonsIDs().Count; i++)
                {
                    for (int j = 0; j < datatable.Rows.Count; j++)
                    {
                        if (userStudent.getRegisteredLessonsIDs()[i] == Convert.ToInt32(datatable.Rows[j]["LectureID"]))
                        {
                            List <string> change = new List <string>();
                            change.Add(datatable.Rows[j]["Title"].ToString());
                            change.Add(datatable.Rows[j]["Description"].ToString());
                            change.Add(datatable.Rows[j]["Starts"].ToString());
                            change.Add(datatable.Rows[j]["Ends"].ToString());
                            change.Add(datatable.Rows[j]["day"].ToString());
                            change.Add(datatable.Rows[j]["month"].ToString());
                            change.Add(datatable.Rows[j]["year"].ToString());
                            changes.Add(change);
                            listViewTitle.Items.Add(changes[index++][0]);
                        }
                    }
                }
                for (int i = 0; i < datatable.Rows.Count; i++)
                {
                    if (Convert.ToInt32(datatable.Rows[i]["LectureID"]) == 0)
                    {
                        List <string> change = new List <string>();
                        change.Add(datatable.Rows[i]["Title"].ToString());
                        change.Add(datatable.Rows[i]["Description"].ToString());
                        change.Add(datatable.Rows[i]["Starts"].ToString());
                        change.Add(datatable.Rows[i]["Ends"].ToString());
                        change.Add(datatable.Rows[i]["day"].ToString());
                        change.Add(datatable.Rows[i]["month"].ToString());
                        change.Add(datatable.Rows[i]["year"].ToString());
                        changes.Add(change);
                        listViewTitle.Items.Add(changes[index++][0]);
                    }
                }
            }
        }
 private void button_ClearList_Click(object sender, EventArgs e)
 {
     if (listViewTitle.Items.Count > 0)
     {
         if (MessageBox.Show("Are you sure you want to delete all the errors?", "Clear Errors", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             listViewTitle.Clear();
             SQLFunctions.ClearErrors();
             textBoxFrom.Clear();
             textBoxDescription.Clear();
         }
     }
     else
     {
         MessageBox.Show("There were no errors to delete");
     }
 }