private void OfficeAssignment_Load(object sender, EventArgs e)
        {
            schoolContext = new SchoolEntities();
            var instrQuery = schoolContext.People.OfType <Instructor>();

            officeGridView.DataSource = instrQuery.ToList();
            officeGridView.Columns["HireDate"].Visible       = false;
            officeGridView.Columns["Timestamp"].Visible      = false;
            officeGridView.Columns["PersonID"].Visible       = false;
            officeGridView.Columns["EnrollmentDate"].Visible = false;
            officeGridView.Columns["StudentGrades"].Visible  = false;
            officeGridView.Columns["Courses"].Visible        = false;
        }
Beispiel #2
0
        private void CourseViewer_Load(object sender, EventArgs e)
        {
            schoolContext = new SchoolEntities();
            var departments = from d in schoolContext.Departments.Include("Courses")
                              orderby d.Name
                              select d;

            try
            {
                this.departmentList.DisplayMember = "Name";
                this.departmentList.DataSource    = departments.ToList();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }