Exemplo n.º 1
0
        static void Main(string[] args)
        {
            HibernatingRhinos.Profiler.Appender.EntityFramework.EntityFrameworkProfiler.Initialize();

            using (var context = new SceneCRM()) {
                WipeDatabase(context);

                oneOnOne = context.CourseTypes.FindOrMake("OO", "One on One", context);
                pm1 = context.CourseTypes.FindOrMake("PM1", "Playmaking One", context);
                rp = context.CourseTypes.FindOrMake("RP", "Replay", context);
                s1 = context.CourseTypes.FindOrMake("S1", "Stage One", context);
                pb = context.CourseTypes.FindOrMake("PB", "Playback", context);

                PopulateJobTypes(context);

                var ss = new ChildrenProductionsSpreadsheet(@"C:\Users\dylan.beattie\Documents\Scene & Heard\Children and Productions.xls");

                foreach (var row in ss.Rows) {
                    var student = context.Students.FindOrMake(row.MembershipNumber, row.Forename, row.Surname, context);
                    student.QuestionnaireResponse = row.QuestionnaireResponses;
                    ImportPlaymakingOne(context, student, row);
                    ImportPlayback(context, student, row);
                    ImportReplay(context, student, row);
                    ImportStageOne(context, student, row);
                    ImportOneOnOne(context, student, row);
                    Console.WriteLine("Added " + student.Forename + " " + student.Surname);
                    context.SaveChanges();
                }
                ImportVolunteerDataFromAccessDatabase(context, @"C:\Users\dylan.beattie\Documents\Scene & Heard\Volunteers.mdb", "giraffe");
            }
            Console.ReadKey(false);
        }
Exemplo n.º 2
0
 static void ImportStageOne(SceneCRM context, Student student, ChildrenProductionsSpreadsheet.Row row)
 {
     if (row.AttendedStageOne) {
         ImportPlay(context, student, s1, row.StageOneTerm, row.StageOneYear, String.Empty, String.Empty, String.Empty, String.Empty, row.StageOneActor);
     }
 }
Exemplo n.º 3
0
 static void ImportReplay(SceneCRM context, Student student, ChildrenProductionsSpreadsheet.Row row)
 {
     if (row.AttendedReplay) {
         ImportPlay(context, student, rp, row.ReplayTerm, row.ReplayYear, row.ReplayProduction, row.ReplayPlay, row.ReplayDramaturg, row.ReplayDirector, row.ReplayActor1,
             row.ReplayActor2, row.ReplayActor3);
     }
 }
Exemplo n.º 4
0
        static void ImportPlaymakingOne(SceneCRM context, Student student, ChildrenProductionsSpreadsheet.Row row)
        {
            if (row.AttendedPm1) {
                ImportPlay(context, student, pm1, row.PlaymakingOneTerm, row.PlaymakingOneYear, row.PlaymakingOneProduction, row.PlaymakingOnePlay, row.PlaymakingOneDramaturg, row.PlaymakingOneDirector,
                    row.PlaymakingOneActor1, row.PlaymakingOneActor2, row.PlaymakingOneActor3);

                //var term = context.Terms.FindOrMake(row.PlaymakingOneTerm);
                //var course = context.Courses.FindOrMake(pm1, term, row.PlaymakingOneYear);
                //if (course != null) {
                //    var attendance = new CourseAttendance() {
                //        Student = student,
                //        Course = course,
                //        Completed = true
                //    };
                //    Production production = context.Productions.FindOrMake(row.PlaymakingOneProduction);

                //    if (!String.IsNullOrWhiteSpace(row.PlaymakingOnePlay)) {
                //        var play = new Play() {
                //            Student = student,
                //            Title = row.PlaymakingOnePlay
                //        };
                //        if (production != null) play.Production = production;
                //        attendance.Play = play;
                //        student.Plays.Add(play);
                //        AddPlayVolunteer(context, play, row.PlaymakingOneDramaturg, Jobs.Dramaturg);
                //        AddPlayVolunteer(context, play, row.PlaymakingOneDirector, Jobs.Director);
                //        AddPlayVolunteer(context, play, row.PlaymakingOneActor1, Jobs.Actor);
                //        AddPlayVolunteer(context, play, row.PlaymakingOneActor2, Jobs.Actor);
                //        AddPlayVolunteer(context, play, row.PlaymakingOneActor3, Jobs.Actor);
                //    } else {
                //        AddCourseVolunteer(context, course, row.PlaymakingOneDramaturg, Jobs.Dramaturg);
                //        AddCourseVolunteer(context, course, row.PlaymakingOneActor1, Jobs.Actor);
                //        AddCourseVolunteer(context, course, row.PlaymakingOneActor2, Jobs.Actor);
                //        AddCourseVolunteer(context, course, row.PlaymakingOneActor3, Jobs.Actor);
                //        AddCourseVolunteer(context, course, row.PlaymakingOneDirector, Jobs.Director);
                //    }
                //    student.CourseAttendances.Add(attendance);
            }
        }
Exemplo n.º 5
0
 static void ImportPlayback(SceneCRM context, Student student, ChildrenProductionsSpreadsheet.Row row)
 {
     if (row.AttendedPlayback) {
         ImportPlay(context, student, pb, "Playback", row.PlaybackYear, row.PlaybackProduction, row.PlaybackPlay, row.PlaybackDramaturg, row.PlaybackDirector,
                 row.PlaybackActor
                 );
     }
 }
Exemplo n.º 6
0
 static void ImportOneOnOne(SceneCRM context, Student student, ChildrenProductionsSpreadsheet.Row row)
 {
     if (row.AttendedOneOnOne) {
         ImportPlay(context, student, oneOnOne, row.OneonOneTerm, row.OneonOneYear, row.OneonOneProduction, row.OneonOnePlay, row.OneonOneWriter, row.OneonOneDirector, row.OneonOneActor);
     }
 }