Exemplo n.º 1
0
        /// <summary>
        /// Drops a course from both enrolled courses and course history.
        /// </summary>
        /// <param name="courseID">Valid Course ID of a Course</param>
        public void DropCourse(string courseID)
        {
            // try-catch to ensure dictionary contains courseID
            try
            {
                enrolledCourses.Remove(courseID);
                // I love the "this" keyword if you couldn't tell
                RegistrationDatabase.GetCourse(courseID).WithdrawStudent(this);

                // this foreach loop is to make sure that we are removing courses from next term and not this term.
                foreach (Course course in courseHistory)
                {
                    if (course.GetCourseID().Equals(courseID))
                    {
                        if (course.GetCourseTerm().Equals("S15"))
                        {
                            courseHistory.Remove(course);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                return;
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Removes course from RegistrationDatabase
 /// </summary>
 /// <param name="courseID">Valid Course ID of a Course</param>
 public void RemoveCourse(string courseID)
 {
     if (this.GetStatus().Equals("manager"))
     {
         RegistrationDatabase.RemoveCourse(courseID);
     }
 }
Exemplo n.º 3
0
 public void RemoveUser(string userName)
 {
     if (this.GetStatus().Equals("manager"))
     {
         RegistrationDatabase.RemoveUser(userName);
     }
 }
Exemplo n.º 4
0
        private void Form2_Load(object sender, EventArgs e)
        {
            label1.Parent   = pictureBox1;
            label1.Location = new Point(10, label1.Location.Y);
            var course_array = from row in RegistrationDatabase.GetCourses()
                               select new
            {
                Id      = row.Value.GetCourseID(),
                Name    = row.Value.GetCourseName(),
                Faculty = row.Value.GetFaculty().GetUserName(),
                Credits = row.Value.GetCourseCredit(),
                Seats   = row.Value.GetNumSeats(),
                Dates   = String.Join(", ", row.Value.GetDayBlocks()),
                Times   = String.Join(", ", row.Value.GetTimeBlocks())
            };
            var student_array = from row in RegistrationDatabase.GetUserDatabase()
                                where row.Value is Student
                                select new
            {
                First          = row.Value.GetFirstName(),
                Last           = row.Value.GetLastName(),
                Username       = row.Value.GetUserName(),
                CurrentAdvisor = row.Value.GetStatus()
            };
            var faculty_array = from row in RegistrationDatabase.GetUserDatabase()
                                where row.Value is Faculty
                                select new
            {
                First          = row.Value.GetFirstName(),
                Last           = row.Value.GetLastName(),
                Username       = row.Value.GetUserName(),
                CurrentAdvisor = row.Value.GetStatus()
            };

            dataGridView1.DataSource = course_array.ToArray();
            dataGridView2.DataSource = student_array.ToArray();
            dataGridView3.DataSource = faculty_array.ToArray();
            ComboBox comboBox3 = new ComboBox();

            foreach (User user in RegistrationDatabase.GetUserDatabase().Values)
            {
                if (user is Student)
                {
                    comboBox1.Items.Add(user.GetUserName());
                }
                if (user is Faculty)
                {
                    comboBox3.Items.Add(user.GetUserName());
                    comboBox2.Items.Add(user.GetUserName());
                }
            }
            ((DataGridViewComboBoxColumn)dataGridView2.Columns["Advisor"]).DataSource = comboBox3.Items;
            foreach (DataGridViewRow d_row in dataGridView2.Rows)
            {
                d_row.Cells[0].Value = RegistrationDatabase.GetUser((string)d_row.Cells[3].Value).GetStatus();
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// Adds a course directly into course history.
 /// </summary>
 /// <param name="course">Course Object</param>
 public void AddCourseHistory(Course course)
 {
     courseHistory.Add(course);
     if (RegistrationDatabase.GetCourse(course.GetCourseID()) != null && course.GetGrade() == "N")
     {
         if (!enrolledCourses.ContainsKey(course.GetCourseID()))
         {
             enrolledCourses.Add(course.GetCourseID(), RegistrationDatabase.GetCourse(course.GetCourseID()));
         }
     }
 }
Exemplo n.º 6
0
 /// <summary>Accesses database with string userName and string password. </summary>
 /// <param name="userName">The user's username.</param>
 /// <param name="password">The user's password.</param>
 public static User LogIn(string userName, string password)
 {
     try
     {
         return(RegistrationDatabase.GetUser(userName, password));
     }
     catch (Exception e)
     {
         throw new ArgumentNullException("Invalid Username/Password.");
     }
 }
Exemplo n.º 7
0
 private void button13_Click(object sender, EventArgs e)
 {
     foreach (DataGridViewRow d_row in dataGridView1.Rows)
     {
         DataGridViewComboBoxCell cb = (DataGridViewComboBoxCell)d_row.Cells[1];
         if (cb.Value != null)
         {
             RegistrationDatabase.GetCourse((string)d_row.Cells[2].Value).SetFaculty((Faculty)RegistrationDatabase.GetUser((string)cb.Value));
         }
     }
     Form2_Load(sender, e);
 }
Exemplo n.º 8
0
 private void button9_Click(object sender, EventArgs e)
 {
     foreach (DataGridViewRow d_row in dataGridView2.Rows)
     {
         DataGridViewComboBoxCell cb = (DataGridViewComboBoxCell)d_row.Cells[1];
         if (cb.Value != null)
         {
             RegistrationDatabase.GetUser((string)d_row.Cells[4].Value).SetStatus((string)cb.Value);
         }
     }
     Form2_Load(sender, e);
 }
Exemplo n.º 9
0
 private void button6_Click(object sender, EventArgs e)
 {
     try
     {
         LogInScreen.current_user = RegistrationDatabase.GetUser(comboBox1.Text);
         StudentDashboard form2 = new StudentDashboard();
         form2.Show();
     } catch
     {
         Console.WriteLine("Oops");
     }
 }
Exemplo n.º 10
0
 private void button7_Click(object sender, EventArgs e)
 {
     try
     {
         LogInScreen.current_user = RegistrationDatabase.GetUser(comboBox2.Text);
         ProfessorDashboard form2 = new ProfessorDashboard();
         form2.Show();
         comboBox2.SelectedIndex = -1;
     }
     catch
     {
         Console.WriteLine("Oops");
     }
 }
Exemplo n.º 11
0
        static void Main()
        {
            StreamReader userDatabase          = OpenFile(BuildFilePath("userDB.in"));
            StreamReader courseDatabase        = OpenFile(BuildFilePath("courseDB.in"));
            StreamReader courseHistoryDatabase = OpenFile(BuildFilePath("historyDB.in"));

            RegistrationDatabase.Read(userDatabase, RegistrationDatabase.DatabaseType.user);
            RegistrationDatabase.Read(courseDatabase, RegistrationDatabase.DatabaseType.course);
            RegistrationDatabase.Read(courseHistoryDatabase, RegistrationDatabase.DatabaseType.courseHistory);

            RegistrationDatabase.userDatabase.Add("Staff", new Faculty("Staff", "Staff", "Staff", "Staff", "Staff", "faculty"));

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new LogInScreen());
        }
Exemplo n.º 12
0
 private void button12_Click(object sender, EventArgs e)
 {
     try
     {
         RegistrationDatabase.CreateUser(textBox1.Text, textBox2.Text, textBox3.Text, textBox4.Text, textBox5.Text, (string)comboBox9.SelectedItem);
         textBox1.Text           = "";
         textBox2.Text           = "";
         textBox3.Text           = "";
         textBox4.Text           = "";
         textBox5.Text           = "";
         comboBox9.SelectedIndex = -1;
     } catch
     {
         System.Windows.Forms.MessageBox.Show("Error creating user");
     }
     Form2_Load(sender, e);
 }
Exemplo n.º 13
0
        private void dataGridView2_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            var senderGrid = (DataGridView)sender;

            if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn &&
                e.RowIndex >= 0)
            {
                var i = 0;
                foreach (KeyValuePair <string, Course> row in RegistrationDatabase.GetCourses())
                {
                    if (i == e.RowIndex)
                    {
                        current_course = row.Value;
                    }
                    i += 1;
                }

                StudentList form3 = new StudentList();
                form3.Show();
            }
        }
Exemplo n.º 14
0
        /// <summary>
        /// Removes a user from the User Database
        /// </summary>
        /// <param name="userName">Username of a Faculty or Student</param>
        public static void RemoveUser(string userName)
        {
            try
            {
                if (userDatabase[userName].GetStatus().Equals("faculty"))
                {
                    Faculty faculty = (Faculty)userDatabase[userName];

                    foreach (KeyValuePair <string, Course> course in faculty.GetCourses())
                    {
                        course.Value.SetFaculty((Faculty)RegistrationDatabase.GetUser("Staff"));
                    }

                    foreach (Student student in faculty.GetStudentAdvisees())
                    {
                        student.ChangeAdvisor("Staff");
                    }

                    userDatabase.Remove(userName);
                }
                else // if (userDatabase[userName].GetStatus().Equals("student"))
                {
                    Student student = (Student)userDatabase[userName];

                    foreach (KeyValuePair <string, Course> course in student.GetCourses())
                    {
                        course.Value.WithdrawStudent(student);
                        student.DropCourse(course.Value.GetCourseID());
                    }

                    Faculty faculty = (Faculty)userDatabase[student.GetStatus()];
                    faculty.RemoveStudentAdvisee((Student)RegistrationDatabase.GetUser("PRyan"));
                    userDatabase.Remove(userName);
                }
            }
            catch
            {
                Console.WriteLine(String.Format("User \"{0}\" Not Found!", userName));
            }
        }
Exemplo n.º 15
0
        private void button11_Click(object sender, EventArgs e)
        {
            foreach (DataGridViewRow d_row in dataGridView2.Rows)
            {
                object ischecked = d_row.Cells[0].Value;

                if (ischecked == null)
                {
                }
                else
                {
                    try
                    {
                        RegistrationDatabase.RemoveUser((string)d_row.Cells[4].Value);
                    }
                    catch
                    {
                        System.Windows.Forms.MessageBox.Show("Error in removing student");
                    }
                }
            }
            Form2_Load(sender, e);
        }
Exemplo n.º 16
0
        private void Form2_Load(object sender, EventArgs e)
        {
            label1.Parent   = pictureBox1;
            label2.Parent   = pictureBox1;
            label1.Location = new Point(10, label1.Location.Y);
            label2.Location = new Point(10, label2.Location.Y);
            var course_array = from row in RegistrationDatabase.GetCourses() select new { Id    = row.Value.GetCourseID(),
                                                                                          Name  = row.Value.GetCourseName(), Faculty = row.Value.GetFaculty().GetUserName(), Credits = row.Value.GetCourseCredit(),
                                                                                          Seats = row.Value.GetNumSeats(), Dates = String.Join(", ", row.Value.GetDayBlocks()), Times = String.Join(", ", row.Value.GetTimeBlocks()) };

            dataGridView1.DataSource = course_array.ToArray();
            var student_course_array = from row in current_user.GetCourses()
                                       select new
            {
                Id      = row.Value.GetCourseID(),
                Name    = row.Value.GetCourseName(),
                Faculty = row.Value.GetFaculty().GetUserName(),
                Credits = row.Value.GetCourseCredit(),
                Seats   = row.Value.GetNumSeats(),
                Dates   = String.Join(", ", row.Value.GetDayBlocks()),
                Times   = String.Join(", ", row.Value.GetTimeBlocks())
            };

            dataGridView2.DataSource = student_course_array.ToArray();
            var student_course_history_array = from row in current_user.GetCourseHistory()
                                               select new
            {
                Id      = row.GetCourseID(),
                Term    = row.GetCourseTerm(),
                Credits = row.GetCourseCredit(),
                Grade   = row.GetGrade(),
            };

            dataGridView3.DataSource = student_course_history_array.ToArray();
            label3.Text = $"Total Credits: {current_user.GetHistoryCourseCredits():F2} GPA: {current_user.GetGradePointAverage():F2}";
        }
Exemplo n.º 17
0
        private void Form2_Load(object sender, EventArgs e)
        {
            label1.Parent         = pictureBox1;
            label2.Parent         = pictureBox1;
            label1.Location       = new Point(10, label1.Location.Y);
            label2.Location       = new Point(10, label2.Location.Y);
            dataGridView3.Visible = false;
            var course_array = from row in RegistrationDatabase.GetCourses()
                               //where row.Value.GetCourseTerm() == "F14"
                               select new
            {
                Id      = row.Value.GetCourseID(),
                Name    = row.Value.GetCourseName(),
                Faculty = row.Value.GetFaculty().GetUserName(),
                Credits = row.Value.GetCourseCredit(),
                Seats   = row.Value.GetNumSeats(),
                Dates   = String.Join(", ", row.Value.GetDayBlocks()),
                Times   = String.Join(", ", row.Value.GetTimeBlocks())
            };

            dataGridView1.DataSource = course_array.ToArray();
            var faculty_course_array = from row in RegistrationDatabase.GetCourses()
                                       //where row.Value.GetCourseTerm() == "F14" &&
                                       where row.Value.GetFaculty().GetUserName() == current_user.GetUserName()
                                       select new
            {
                Id      = row.Value.GetCourseID(),
                Name    = row.Value.GetCourseName(),
                Faculty = row.Value.GetFaculty().GetUserName(),
                Credits = row.Value.GetCourseCredit(),
                Seats   = row.Value.GetNumSeats(),
                Dates   = String.Join(", ", row.Value.GetDayBlocks()),
                Times   = String.Join(", ", row.Value.GetTimeBlocks())
            };

            dataGridView2.DataSource = faculty_course_array.ToArray();
            var advisees_array = from row in current_user.GetStudentAdvisees()
                                 select new
            {
                First = row.GetFirstName(),
                Last  = row.GetLastName()
            };

            dataGridView3.DataSource = advisees_array.ToArray();
            try
            {
                var student_course_array = from row in current_user.GetStudentAdvisees()[0].GetCourses()
                                           select new
                {
                    Id      = row.Value.GetCourseID(),
                    Name    = row.Value.GetCourseName(),
                    Faculty = row.Value.GetFaculty().GetUserName(),
                    Credits = row.Value.GetCourseCredit(),
                    Seats   = row.Value.GetNumSeats(),
                    Dates   = String.Join(", ", row.Value.GetDayBlocks()),
                    Times   = String.Join(", ", row.Value.GetTimeBlocks())
                };
                dataGridView4.DataSource = student_course_array.ToArray();
            }
            catch
            {
            }
        }
Exemplo n.º 18
0
 /// <summary>
 /// Adds a course to both enrolled courses and course history.
 /// </summary>
 /// <param name="courseID">Valid Course ID of a Course</param>
 public void AddCourse(string courseID)
 {
     enrolledCourses.Add(courseID, RegistrationDatabase.GetCourse(courseID));
     RegistrationDatabase.GetCourse(courseID).EnrollStudent(this);
     courseHistory.Add(RegistrationDatabase.GetCourse(courseID).ConvertToCourseHistory(this));
 }
Exemplo n.º 19
0
 /// <summary>
 /// Adds course into courses taught dictionary.
 /// </summary>
 /// <param name="courseID">Valid Course ID of a Course</param>
 public void AddCourse(string courseID)
 {
     coursesTaught.Add(courseID, RegistrationDatabase.GetCourse(courseID));
 }
Exemplo n.º 20
0
        private void Form2_Load(object sender, EventArgs e)
        {
            var course_array = from row in RegistrationDatabase.GetCourses()
                               select new
            {
                Id      = row.Value.GetCourseID(),
                Name    = row.Value.GetCourseName(),
                Faculty = row.Value.GetFaculty().GetUserName(),
                Credits = row.Value.GetCourseCredit(),
                Seats   = row.Value.GetNumSeats(),
                Dates   = String.Join(", ", row.Value.GetDayBlocks()),
                Times   = String.Join(", ", row.Value.GetTimeBlocks())
            };
            var student_array = from row in RegistrationDatabase.GetUserDatabase()
                                where row.Value is Student
                                select new
            {
                First          = row.Value.GetFirstName(),
                Last           = row.Value.GetLastName(),
                Username       = row.Value.GetUserName(),
                CurrentAdvisor = row.Value.GetStatus()
            };
            var faculty_array = from row in RegistrationDatabase.GetUserDatabase()
                                where row.Value is Faculty
                                select new
            {
                First          = row.Value.GetFirstName(),
                Last           = row.Value.GetLastName(),
                Username       = row.Value.GetUserName(),
                CurrentAdvisor = row.Value.GetStatus()
            };

            dataGridView1.DataSource = course_array.ToArray();
            dataGridView2.DataSource = student_array.ToArray();
            dataGridView3.DataSource = faculty_array.ToArray();
            ComboBox comboBox10 = new ComboBox();

            if (comboBox9.Items.Count > 0)
            {
                comboBox9.Items.Clear();
            }
            if (comboBox8.Items.Count > 0)
            {
                comboBox8.Items.Clear();
            }
            if (comboBox2.Items.Count > 0)
            {
                comboBox2.Items.Clear();
            }
            if (comboBox1.Items.Count > 0)
            {
                comboBox1.Items.Clear();
            }
            foreach (User user in RegistrationDatabase.GetUserDatabase().Values)
            {
                if (user is Student)
                {
                    comboBox1.Items.Add(user.GetUserName());
                }
                if (user is Faculty)
                {
                    comboBox10.Items.Add(user.GetUserName());
                    comboBox9.Items.Add(user.GetUserName());
                    comboBox8.Items.Add(user.GetUserName());
                    comboBox2.Items.Add(user.GetUserName());
                }
            }
            comboBox9.Items.Add("faculty");
            comboBox9.Items.Add("admin");
            ((DataGridViewComboBoxColumn)dataGridView2.Columns["Advisor"]).DataSource = comboBox10.Items;
            foreach (DataGridViewRow d_row in dataGridView2.Rows)
            {
                d_row.Cells[1].Value = RegistrationDatabase.GetUser((string)d_row.Cells[4].Value).GetStatus();
            }
            ((DataGridViewComboBoxColumn)dataGridView1.Columns["ChangeProfessor"]).DataSource = comboBox10.Items;
            foreach (DataGridViewRow d_row in dataGridView1.Rows)
            {
                d_row.Cells[1].Value = (string)d_row.Cells[4].Value;
            }
        }
Exemplo n.º 21
0
        private void button15_Click(object sender, EventArgs e)
        {
            List <string> dayBlocks  = new List <string>();
            List <string> timeBlocks = new List <string>();

            Console.WriteLine(checkedListBox1.CheckedItems.Count);
            Console.WriteLine(comboBox7.SelectedValue);
            if (checkedListBox1.CheckedItems.Count > 0 && comboBox7.SelectedIndex != -1)
            {
                Console.WriteLine("Here Here");
                string days = "";
                foreach (object day in checkedListBox1.CheckedItems)
                {
                    days = days + (string)day;
                }
                dayBlocks.Add(days);
                timeBlocks.Add((string)comboBox7.SelectedItem);
                foreach (int i in checkedListBox1.CheckedIndices)
                {
                    checkedListBox1.SetItemCheckState(i, CheckState.Unchecked);
                }
                comboBox7.SelectedIndex = -1;
            }
            if ((checkedListBox2.CheckedItems).Count > 0 && comboBox6.SelectedIndex != -1)
            {
                string days = "";
                foreach (object day in checkedListBox2.CheckedItems)
                {
                    days = days + (string)day;
                }
                dayBlocks.Add(days);
                timeBlocks.Add((string)comboBox6.SelectedItem);
                foreach (int i in checkedListBox2.CheckedIndices)
                {
                    checkedListBox2.SetItemCheckState(i, CheckState.Unchecked);
                }
                comboBox6.SelectedIndex = -1;
            }
            if ((checkedListBox3.CheckedItems).Count > 0 && comboBox3.SelectedIndex != -1)
            {
                string days = "";
                foreach (object day in checkedListBox3.CheckedItems)
                {
                    days = days + (string)day;
                }
                dayBlocks.Add(days);
                timeBlocks.Add((string)comboBox3.SelectedItem);
                foreach (int i in checkedListBox3.CheckedIndices)
                {
                    checkedListBox3.SetItemCheckState(i, CheckState.Unchecked);
                }
                comboBox3.SelectedIndex = -1;
            }
            if ((checkedListBox4.CheckedItems).Count > 0 && comboBox4.SelectedIndex != -1)
            {
                string days = "";
                foreach (object day in checkedListBox4.CheckedItems)
                {
                    days = days + (string)day;
                }
                dayBlocks.Add(days);
                timeBlocks.Add((string)comboBox4.SelectedItem);
                foreach (int i in checkedListBox4.CheckedIndices)
                {
                    checkedListBox4.SetItemCheckState(i, CheckState.Unchecked);
                }
                comboBox4.SelectedIndex = -1;
            }
            if ((checkedListBox5.CheckedItems).Count > 0 && comboBox5.SelectedIndex != -1)
            {
                string days = "";
                foreach (object day in checkedListBox5.CheckedItems)
                {
                    days = days + (string)day;
                }
                dayBlocks.Add(days);
                timeBlocks.Add((string)comboBox5.SelectedItem);
                foreach (int i in checkedListBox5.CheckedIndices)
                {
                    checkedListBox5.SetItemCheckState(i, CheckState.Unchecked);
                }
                comboBox5.SelectedIndex = -1;
            }
            RegistrationDatabase.CreateCourse(new Course(textBox10.Text, textBox9.Text,
                                                         (Faculty)RegistrationDatabase.GetUser((string)comboBox8.SelectedItem), textBox8.Text, Int32.Parse(textBox7.Text), dayBlocks, timeBlocks), textBox10.Text);
            textBox7.Text           = "";
            textBox8.Text           = "";
            textBox9.Text           = "";
            textBox10.Text          = "";
            comboBox8.SelectedIndex = -1;

            Form2_Load(sender, e);
        }
Exemplo n.º 22
0
        private void button14_Click(object sender, EventArgs e)
        {
            List <string> dayBlocks  = new List <string>();
            List <string> timeBlocks = new List <string>();

            Console.WriteLine(checkedListBox1.CheckedItems.Count);
            Console.WriteLine(comboBox7.SelectedValue);
            if (checkedListBox1.CheckedItems.Count > 0 && comboBox7.SelectedIndex != -1)
            {
                Console.WriteLine("Here Here");
                string days = "";
                foreach (object day in checkedListBox1.CheckedItems)
                {
                    days = days + (string)day;
                }
                dayBlocks.Add(days);
                timeBlocks.Add((string)comboBox7.SelectedItem);
                foreach (int i in checkedListBox1.CheckedIndices)
                {
                    checkedListBox1.SetItemCheckState(i, CheckState.Unchecked);
                }
                comboBox7.SelectedIndex = -1;
            }
            if ((checkedListBox2.CheckedItems).Count > 0 && comboBox6.SelectedIndex != -1)
            {
                string days = "";
                foreach (object day in checkedListBox2.CheckedItems)
                {
                    days = days + (string)day;
                }
                dayBlocks.Add(days);
                timeBlocks.Add((string)comboBox6.SelectedItem);
                foreach (int i in checkedListBox2.CheckedIndices)
                {
                    checkedListBox2.SetItemCheckState(i, CheckState.Unchecked);
                }
                comboBox6.SelectedIndex = -1;
            }
            if ((checkedListBox3.CheckedItems).Count > 0 && comboBox3.SelectedIndex != -1)
            {
                string days = "";
                foreach (object day in checkedListBox3.CheckedItems)
                {
                    days = days + (string)day;
                }
                dayBlocks.Add(days);
                timeBlocks.Add((string)comboBox3.SelectedItem);
                foreach (int i in checkedListBox3.CheckedIndices)
                {
                    checkedListBox3.SetItemCheckState(i, CheckState.Unchecked);
                }
                comboBox3.SelectedIndex = -1;
            }
            if ((checkedListBox4.CheckedItems).Count > 0 && comboBox4.SelectedIndex != -1)
            {
                string days = "";
                foreach (object day in checkedListBox4.CheckedItems)
                {
                    days = days + (string)day;
                }
                dayBlocks.Add(days);
                timeBlocks.Add((string)comboBox4.SelectedItem);
                foreach (int i in checkedListBox4.CheckedIndices)
                {
                    checkedListBox4.SetItemCheckState(i, CheckState.Unchecked);
                }
                comboBox4.SelectedIndex = -1;
            }
            if ((checkedListBox5.CheckedItems).Count > 0 && comboBox5.SelectedIndex != -1)
            {
                string days = "";
                foreach (object day in checkedListBox5.CheckedItems)
                {
                    days = days + (string)day;
                }
                dayBlocks.Add(days);
                timeBlocks.Add((string)comboBox5.SelectedItem);
                foreach (int i in checkedListBox5.CheckedIndices)
                {
                    checkedListBox5.SetItemCheckState(i, CheckState.Unchecked);
                }
                comboBox5.SelectedIndex = -1;
            }
            Console.WriteLine("Here");
            if (dayBlocks.Count > 0)
            {
                Console.WriteLine("And Here");
                foreach (DataGridViewRow d_row in dataGridView1.Rows)
                {
                    object ischecked = d_row.Cells[0].Value;

                    if (ischecked == null)
                    {
                    }
                    else
                    {
                        Console.WriteLine("And And Here");
                        try
                        {
                            RegistrationDatabase.GetCourse((string)d_row.Cells[2].Value).SetDayBlocks(dayBlocks);
                            RegistrationDatabase.GetCourse((string)d_row.Cells[2].Value).SetTimeBlocks(timeBlocks);
                        }
                        catch
                        {
                            System.Windows.Forms.MessageBox.Show("Error in changing course time");
                        }
                    }
                }
                Form2_Load(sender, e);
            }
        }