Beispiel #1
0
        static void ListTutoringSessions(TutoringContext ctx)
        {
            Console.WriteLine("Tutoring sessions :");

            var tutoringSessions = tutoringSessions.GetAll();

            foreach (var session in tutoringSessions)
            {
                Console.WriteLine(session.ToString());
            }
        }
Beispiel #2
0
        static void ListHelpedStudents(TutoringContext ctx)
        {
            Console.WriteLine("Helped Students :");

            var helpedStudents = helpedStudents.GetAll();

            foreach (var stud in helpedStudents)
            {
                Console.WriteLine(stud.ToString());
            }
        }
Beispiel #3
0
        static void ListTutors(TutoringContext ctx)
        {
            Console.WriteLine("Tutors :");

            var tutors = tutors.GetAll();

            foreach (var tutor in tutors)
            {
                Console.WriteLine(tutor.ToString());
            }
        }
Beispiel #4
0
        static void executeSectionB(TutoringContext ctx)
        {
            // Requete 1
            var tutors = tutors.GetAll().GroupJoin(tutoringSessions.GetAll(),
                                                   tut => tut.Id,
                                                   tutSess => tutSess.TutorId,
                                                   (tut, tutSess) => new
            {
                nom      = tut.LastName,
                prenom   = tut.FirstName,
                courriel = tut.EmailAddress,
                nbHeures = tutSess.Count()
            });

            // Requete 2
            var tutors = tutoringSessions.GetAll()
                         .Where(sess => sess.DateSession > DateTime.Now())
                         .Select(s => new
            {
                nom         = s.TutorId.LastName,
                prenom      = s.TutorId.FirstName,
                date        = s.DateSession,
                heure       = s.TimeSession,
                duree       = s.LengthSession,
                nom_aide    = s.HelpedId.LastName,
                prenom_aide = s.HelpedId.FirstName
            });

            // Requete 3
            var tutors = helpedStudents.GetAll().GroupJoin(tutoringSessions.GetAll(),
                                                           helpStud => helpStud.Id,
                                                           tutSess => tutSess.HelpedId,
                                                           (helpStud, tutSess) => new
            {
                nom      = helpStud.LastName,
                prenom   = helpStud.FirstName,
                courriel = helpStud.EmailAddress
            })
                         .Where(s => s.Count() = 0);

            // Requete 4
            var tutors = tutors.GetAll().Join(tutoringSessions.GetAll(),
                                              tut => tut.Id,
                                              tutSess => tutSess.TutorId,
                                              (tut, tutSess) => new
            {
                nom         = tut.FirstName + " " + tut.LastName,
                dateSession = tutSess.DateSession
            })
                         .Where(s => s.dateSession != DateTime(2015, 06, 02))
                         .GroupBy(s => s.nom);
        }
Beispiel #5
0
        static void Main(string[] args)
        {
            TutoringContext     ctx  = new TutoringContext();
            TutoringInitializer init = new TutoringInitializer();


            Database.SetInitializer <TutoringContext>(init);

            init.InitializeDatabase(ctx);

            ListTutors(ctx);
            ListHelpedStudents(ctx);
            ListTutoringSessions(ctx);

            Console.ReadLine();
        }
Beispiel #6
0
 static void Main(string[] args)
 {
     TutoringContext     ctx = new TutoringContext();
     TutoringApplication app = new TutoringApplication(ctx);
 }
Beispiel #7
0
 public TutoringApplication(TutoringContext ctx)
 {
 }
Beispiel #8
0
 static void executeSectionC(TutoringContext ctx)
 {