private void FormListStudents_Load(object sender, EventArgs e)
 {
     using (ModelTD db = new ModelTD())
     {
         CrystalReportListStudents crystalReport = new CrystalReportListStudents();
         crystalReport.SetDataSource(db.Students);
         crystalReportViewer1.ReportSource = crystalReport;
     }
 }
 private void ListGroups_Load(object sender, EventArgs e)
 {
     using (ModelTD db = new ModelTD())
     {
         CrystalReportListGroup crystalReportListGroup = new CrystalReportListGroup();
         crystalReportListGroup.SetDataSource(db.Groups);
         crystalReportViewer1.ReportSource = crystalReportListGroup;
     }
 }
        private void FormListStudentWithQuery_Load(object sender, EventArgs e)
        {
            using (ModelTD db = new ModelTD())
            {
                CrystalReportQuery crystalReportQuery = new CrystalReportQuery();

                var query = from s in db.Students.Include("Group")
                            select new { s.LastName, Name = s.Group.Name, s.GroupId };
                crystalReportQuery.SetDataSource(query);
                crystalReportViewer1.ReportSource = crystalReportQuery;
            }
        }