Example #1
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();
            }
        }
Example #2
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();
            }
        }
Example #3
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}";
        }
Example #4
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
            {
            }
        }
Example #5
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;
            }
        }