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(); } }
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; } }