private void populateLinkedCurriculumCourses()
        {
            using (var Dbconnection = new MCDEntities())
            {
                List <CurriculumCourse> AllItems = (from a1 in Dbconnection.GetCurriculumCourseInOrder(CurrentEnrollemnt.CurriculumID)
                                                    select a1).Intersect(from a2 in Dbconnection.CurriculumCourseEnrollments
                                                                         where a2.EnrollmentID == CurrentEnrollemnt.EnrollmentID
                                                                         select a2.CurriculumCourse)
                                                   .ToList <CurriculumCourse>();

                curriculumCourseLinkedBindingSource.DataSource = (from a in AllItems
                                                                  orderby a.Course.CourseName
                                                                  select a).ToList();

                foreach (CurriculumCourse CurriculumCourseObj in curriculumCourseLinkedBindingSource.List)
                {
                    if (!Dbconnection.Entry(CurriculumCourseObj).Reference(a => a.Course).IsLoaded)
                    {
                        Dbconnection.Entry(CurriculumCourseObj).Reference(a => a.Course).Load();
                    }
                    if (!Dbconnection.Entry(CurriculumCourseObj).Collection(a => a.CurriculumCourseEnrollments).IsLoaded)
                    {
                        Dbconnection.Entry(CurriculumCourseObj).Collection(a => a.CurriculumCourseEnrollments).Load();
                    }
                }
            };
        }
 private void populateCurriculumCourses(int _CurriculumID)
 {
     using (var Dbconnection = new MCDEntities())
     {
         List <CurriculumCourse> configuredCoures = (from a in Dbconnection.GetCurriculumCourseInOrder(_CurriculumID)
                                                     select a).ToList <CurriculumCourse>();
         curriculumCourseBindingSource.DataSource = (from a in configuredCoures
                                                     where a.Course.CourseName.ToLower().Contains(txtCurriculumCourseFilterCriteria.Text)
                                                     select a).ToList <CurriculumCourse>();
     };
 }
Example #3
0
 private void populateAvailableCurriculumCourses()
 {
     using (var Dbconnection = new MCDEntities())
     {
         curriculumCourseAvailableBindingSource.DataSource = (from a in Dbconnection.GetCurriculumCourseInOrder(CurrentEnrollemnt.CurriculumID)
                                                              // where a.CurriculumID == CurrentEnrollemnt.CurriculumID
                                                              select a).Except(
             from a in Dbconnection.CurriculumCourseEnrollments
             where a.EnrollmentID == CurrentEnrollemnt.EnrollmentID
             select a.CurriculumCourse
             ).ToList();
         //curriculumCourseAvailableBindingSource.DataSource = (from a in Dbconnection.CurriculumCourses
         //                                                     where a.CurriculumID == CurrentEnrollemnt.CurriculumID
         //                                                     select a).Except(
         //   from a in Dbconnection.CurriculumCourseEnrollments
         //   where a.EnrollmentID == CurrentEnrollemnt.EnrollmentID
         //   select a.CurriculumCourse
         //   ).ToList();
     };
 }
        private void populateLinkedCurriculumCourses(int _EnrollmentID, int _CurriculumID)
        {
            using (var Dbconnection = new MCDEntities())
            {
                //List<CurriculumCourse> LinkeCourses = (from a in Dbconnection.CurriculumCourses
                //                                       from b in a.CurriculumCourseEnrollments
                //                                       where b.EnrollmentID == _EnrollmentID
                //                                       select a).ToList<CurriculumCourse>();
                CurriculumCoursesbindingSourceLinkedCourses.DataSource = (from a in Dbconnection.CurriculumCourses
                                                                          from b in a.CurriculumCourseEnrollments
                                                                          where b.EnrollmentID == _EnrollmentID
                                                                          select a).ToList <CurriculumCourse>();;
                curriculumCourseBindingSource.DataSource = (from a in Dbconnection.GetCurriculumCourseInOrder(_CurriculumID)
                                                            from b in a.CurriculumCourseEnrollments
                                                            where b.EnrollmentID == _EnrollmentID
                                                            select a).ToList <CurriculumCourse>();;

                /*
                 * */
            };
        }
Example #5
0
 private void populateLinkedCurriculumCourses()
 {
     using (var Dbconnection = new MCDEntities())
     {
         curriculumCourseLinkedBindingSource.DataSource = (from a1 in Dbconnection.GetCurriculumCourseInOrder(CurrentEnrollemnt.CurriculumID)
                                                           select a1).Intersect(from a2 in Dbconnection.CurriculumCourseEnrollments
                                                                                where a2.EnrollmentID == CurrentEnrollemnt.EnrollmentID
                                                                                select a2.CurriculumCourse)
                                                          .ToList <CurriculumCourse>();
         foreach (CurriculumCourse CurriculumCourseObj in curriculumCourseLinkedBindingSource.List)
         {
             Dbconnection.Entry(CurriculumCourseObj).Reference("Course").Load();
             Dbconnection.Entry(CurriculumCourseObj).Collection("CurriculumCourseEnrollments").Load();
         }
         //curriculumCourseLinkedBindingSource.DataSource = (from a in Dbconnection.CurriculumCourseEnrollments
         //                                                  where a.EnrollmentID == CurrentEnrollemnt.EnrollmentID
         //                                                  select a.CurriculumCourse)
         //                                                  .Include("Course")
         //                                                  .Include("CurriculumCourseEnrollments")
         //                                                  .ToList<CurriculumCourse>();
     };
 }