Exemple #1
0
        public override void Seed()
        {
            /* ----- USF People Activities ----- */

            {   // Douglas Corarito
                var person = _entities.Get <Person>().Single(x => x.FirstName == "Douglas" && x.LastName == "Corarito");
                var user   = person.User;

                var identity  = new GenericIdentity(user.Name);
                var principal = new GenericPrincipal(identity, null);

                var employeeModuleSettings = _queryProcessor.Execute(new EmployeeModuleSettingsByPersonId(person.RevisionId));
                if (employeeModuleSettings == null)
                {
                    throw new Exception("No EmployeeModuleSettings for USF.");
                }

                CreateActivity createActivity;

                #region Activity 1

                var createActivityValuesCommand = new CreateActivityValues(principal)
                {
                    Title =
                        "Understanding Causation of the Permian/Triassic Boundary, Largest Mass Extinction in Earth History",
                    Content =
                        "Permian/Triassic (P/Tr) Boundary Global Events—The P/Tr boundary represents the largest mass extinction in Earth history, yet its causes remain uncertain. I am investigating critical questions related to the extent and intensity of Permo-Triassic deep-ocean anoxia, patterns of upwelling of toxic sulfidic waters onto shallow-marine shelves and platforms, and the relationship of such events to global C-isotopic excursions and the delayed recovery of marine biotas during the Early Triassic. I am working on the P/Tr boundary globally.",
                    StartsOn = new DateTime(2003, 3, 1),
                };

                var activityExists = _entities.Get <Activity>().Any(x => x.PersonId == person.RevisionId && x.Values.Any(y =>
                                                                                                                         createActivityValuesCommand.Title.Equals(y.Title)));
                if (!activityExists)
                {
                    createActivity = new CreateActivity(principal)
                    {
                        Mode = ActivityMode.Draft,
                    };

                    _createActivity.Handle(createActivity);
                    _unitOfWork.SaveChanges();

                    Activity activity = createActivity.CreatedActivity;

                    createActivityValuesCommand = new CreateActivityValues(principal)
                    {
                        ActivityId = activity.RevisionId,
                        Mode       = activity.Mode,
                        Title      = createActivityValuesCommand.Title,
                        Content    = createActivityValuesCommand.Content,
                        StartsOn   = createActivityValuesCommand.StartsOn,
                    };

                    _createActivityValues.Handle(createActivityValuesCommand);

                    _createActivityType.Handle(new CreateActivityType(principal, activity.RevisionId)
                    {
                        ActivityTypeId = employeeModuleSettings.ActivityTypes.Single(x => x.Type.Contains("Research")).Id,
                    });

                    _createActivityType.Handle(new CreateActivityType(principal, activity.RevisionId)
                    {
                        ActivityTypeId = employeeModuleSettings.ActivityTypes.Single(x => x.Type.Contains("Teaching")).Id,
                    });

                    _createActivityPlace.Handle(new CreateActivityPlace(principal, activity.RevisionId)
                    {
                        PlaceId = _entities.Get <Place>().Single(x => x.OfficialName == "China").RevisionId,
                    });

                    _createActivityPlace.Handle(new CreateActivityPlace(principal, activity.RevisionId)
                    {
                        PlaceId = _entities.Get <Place>().Single(x => x.OfficialName == "Canada").RevisionId,
                    });

                    /* ----- Add Tags ----- */

                    _createActivityTag.Handle(new CreateActivityTag(principal, activity.RevisionId)
                    {
                        Text = "Vietnam",
                    });

                    _createActivityTag.Handle(new CreateActivityTag(principal, activity.RevisionId)
                    {
                        Text = "India",
                    });

                    _createActivityTag.Handle(new CreateActivityTag(principal, activity.RevisionId)
                    {
                        Text = "Japan",
                    });

                    /* ----- Add Documents ----- */

                    Seed(new CreateActivityDocument(principal, activity.RevisionId)
                    {
                        FileName = "02E6D488-B3FA-4D79-848F-303779A53ABE.docx",
                        MimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
                        Title    = "Dissertation Excerpt",
                    });

                    Seed(new CreateActivityDocument(principal, activity.RevisionId)
                    {
                        FileName = "10EC87BD-3A95-439D-807A-0F57C3F89C8A.xls",
                        MimeType = "application/vnd.ms-excel",
                        Title    = "Research Funding Breakdown"
                    });

                    Seed(new CreateActivityDocument(principal, activity.RevisionId)
                    {
                        FileName = "1322FF22-E863-435E-929E-765EB95FB460.ppt",
                        MimeType = "application/vnd.ms-powerpoint",
                        Title    = "Conference Presentation"
                    });

                    _unitOfWork.SaveChanges();
                }

                #endregion
                #region Activity 2

                createActivityValuesCommand = new CreateActivityValues(principal)
                {
                    Title    = "Professional Development Program for Teachers of English at Shandong University",
                    Content  = "In Summer 2008, the Teaching English as a Second Language (TESL) Program delivered a professional development program for teachers of English at Shandong University in Jinan, China. Program instructors included two TESL doctoral students and one colleague living in the Czech Republic. Three courses were offered: Theory to Practice; Research in Second Language Acquisition; and Instructional Technology in English Language Teaching. 48 Chinese teachers completed the program. ",
                    StartsOn = new DateTime(2003, 6, 1)
                };

                activityExists = _entities.Get <Activity>().Any(x => x.PersonId == person.RevisionId && x.Values.Any(y =>
                                                                                                                     createActivityValuesCommand.Title.Equals(y.Title)));
                if (!activityExists)
                {
                    createActivity = new CreateActivity(principal)
                    {
                        Mode = ActivityMode.Draft,
                    };

                    _createActivity.Handle(createActivity);
                    _unitOfWork.SaveChanges();

                    Activity activity = createActivity.CreatedActivity;

                    createActivityValuesCommand = new CreateActivityValues(principal)
                    {
                        ActivityId = activity.RevisionId,
                        Mode       = activity.Mode,
                        Title      = createActivityValuesCommand.Title,
                        Content    = createActivityValuesCommand.Content,
                        StartsOn   = createActivityValuesCommand.StartsOn,
                    };

                    _createActivityValues.Handle(createActivityValuesCommand);
                    _unitOfWork.SaveChanges();

                    _createActivityType.Handle(new CreateActivityType(principal, activity.RevisionId)
                    {
                        ActivityTypeId = employeeModuleSettings.ActivityTypes.Single(x => x.Type.Contains("Service")).Id,
                    });

                    _createActivityPlace.Handle(new CreateActivityPlace(principal, activity.RevisionId)
                    {
                        PlaceId = _entities.Get <Place>().Single(x => x.OfficialName == "China").RevisionId,
                    });

                    _unitOfWork.SaveChanges();
                }

                #endregion
                #region Activity 3

                createActivityValuesCommand = new CreateActivityValues(principal)
                {
                    Title    = "Workshop Preparation: Air pollution and Chinese Historic Site",
                    Content  = "Drs. Tim Keener and Mingming Lu went to China in Oct. of 2006 to plan for an air quality workshop on the impact of air pollution and the Chinese historic sites, to be held in Xi’an, China in the fall of 2008. They have visited Tsinghua Univ., the XISU and discussed the details of the workshop plan with Prof. Wu, Associate Dean in the School of Tourism. they have visted Shanxi Archeology Research Institute, and Chinese Acedemy of Science in Xian, to meet potentail workshop participants. Drs. Lu and Keener is developing a proposal to NSF for the workshop.",
                    StartsOn = new DateTime(2006, 10, 9),
                    EndsOn   = new DateTime(2006, 10, 10)
                };

                activityExists = _entities.Get <Activity>().Any(x => x.PersonId == person.RevisionId && x.Values.Any(y =>
                                                                                                                     createActivityValuesCommand.Title.Equals(y.Title)));
                if (!activityExists)
                {
                    createActivity = new CreateActivity(principal)
                    {
                        Mode = ActivityMode.Draft,
                    };

                    _createActivity.Handle(createActivity);
                    _unitOfWork.SaveChanges();

                    Activity activity = createActivity.CreatedActivity;

                    createActivityValuesCommand = new CreateActivityValues(principal)
                    {
                        ActivityId = activity.RevisionId,
                        Mode       = activity.Mode,
                        Title      = createActivityValuesCommand.Title,
                        Content    = createActivityValuesCommand.Content,
                        StartsOn   = createActivityValuesCommand.StartsOn,
                        EndsOn     = createActivityValuesCommand.EndsOn,
                    };

                    _createActivityValues.Handle(createActivityValuesCommand);
                    _unitOfWork.SaveChanges();

                    _createActivityType.Handle(new CreateActivityType(principal, activity.RevisionId)
                    {
                        ActivityTypeId = employeeModuleSettings.ActivityTypes.Single(x => x.Type.Contains("Conference")).Id,
                    });

                    _createActivityType.Handle(new CreateActivityType(principal, activity.RevisionId)
                    {
                        ActivityTypeId = employeeModuleSettings.ActivityTypes.Single(x => x.Type.Contains("Teaching")).Id,
                    });

                    _createActivityType.Handle(new CreateActivityType(principal, activity.RevisionId)
                    {
                        ActivityTypeId = employeeModuleSettings.ActivityTypes.Single(x => x.Type.Contains("Honor")).Id,
                    });

                    _createActivityPlace.Handle(new CreateActivityPlace(principal, activity.RevisionId)
                    {
                        PlaceId = _entities.Get <Place>().Single(x => x.OfficialName == "China").RevisionId,
                    });

                    Seed(new CreateActivityDocument(principal, activity.RevisionId)
                    {
                        FileName = "817DB81E-53FC-47E1-A1DE-B8C108C7ACD6.pdf",
                        MimeType = "application/pdf",
                        Title    = "Make a contribution form"
                    });

                    _unitOfWork.SaveChanges();
                }

                #endregion
                #region Activity 4

                createActivityValuesCommand = new CreateActivityValues(principal)
                {
                    Title   = "Guest performer and teacher, China Saxophone Festival, Dalian, China",
                    Content = "Adj Professor, Professor EmeritusJazz Studies, Saxophone Studies, Ensembles & Conducting College Conservatory of Music"
                };

                activityExists = _entities.Get <Activity>().Any(x => x.PersonId == person.RevisionId && x.Values.Any(y =>
                                                                                                                     createActivityValuesCommand.Title.Equals(y.Title)));
                if (!activityExists)
                {
                    createActivity = new CreateActivity(principal)
                    {
                        Mode = ActivityMode.Draft,
                    };

                    _createActivity.Handle(createActivity);
                    _unitOfWork.SaveChanges();

                    Activity activity = createActivity.CreatedActivity;

                    createActivityValuesCommand = new CreateActivityValues(principal)
                    {
                        ActivityId = activity.RevisionId,
                        Mode       = activity.Mode,
                        Title      = createActivityValuesCommand.Title,
                        Content    = createActivityValuesCommand.Content,
                    };

                    _createActivityValues.Handle(createActivityValuesCommand);
                    _unitOfWork.SaveChanges();

                    _createActivityType.Handle(new CreateActivityType(principal, activity.RevisionId)
                    {
                        ActivityTypeId = employeeModuleSettings.ActivityTypes.Single(x => x.Type.Contains("Creative")).Id,
                    });

                    _createActivityPlace.Handle(new CreateActivityPlace(principal, activity.RevisionId)
                    {
                        PlaceId = _entities.Get <Place>().Single(x => x.OfficialName == "China").RevisionId,
                    });

                    Seed(new CreateActivityDocument(principal, activity.RevisionId)
                    {
                        FileName = "5C62D74E-E8EE-4B9A-95F3-B2ABB1F6F912.gif",
                        MimeType = "image/gif",
                        Title    = "Photo of the site"
                    });

                    Seed(new CreateActivityDocument(principal, activity.RevisionId)
                    {
                        FileName = "A44FAB3B-DEBA-4F14-8965-E379569066A9.png",
                        MimeType = "image/png",
                        Title    = "Grads working hard"
                    });

                    Seed(new CreateActivityDocument(principal, activity.RevisionId)
                    {
                        FileName = "C0DA4900-762B-4B26-AE03-843CBB7C0E7B.bmp",
                        MimeType = "image/bmp",
                        Title    = "Map of the incident"
                    });

                    Seed(new CreateActivityDocument(principal, activity.RevisionId)
                    {
                        FileName = "E4E53300-08D3-47C0-954C-BF15EF54F0A3.tif",
                        MimeType = "image/tiff",
                        Title    = "Sunrise over the delta"
                    });

                    Seed(new CreateActivityDocument(principal, activity.RevisionId)
                    {
                        FileName = "EE23D741-C50D-40D5-8214-C18DF68CC6D3.jpg",
                        MimeType = "image/jpg",
                        Title    = "Me"
                    });

                    _unitOfWork.SaveChanges();
                }

                #endregion
                #region Activity 5

                createActivityValuesCommand = new CreateActivityValues(principal)
                {
                    Title   = "Fulbright Scholar Award to Research and Teach at Zhejiang University",
                    Content = "I will be conducting research and teaching two courses to medical and public health students at Zhejiang University in Hangzhou China. I will also be working closely with Dr. Tingzhong Yang who directs an institute that studies tobacco related problems in China. Further I wish to explore differences in health knowledge, attitudes and behaviors between Chinese and US college students."
                };

                activityExists = _entities.Get <Activity>().Any(x => x.PersonId == person.RevisionId && x.Values.Any(y =>
                                                                                                                     createActivityValuesCommand.Title.Equals(y.Title)));
                if (!activityExists)
                {
                    createActivity = new CreateActivity(principal)
                    {
                        Mode = ActivityMode.Draft,
                    };

                    _createActivity.Handle(createActivity);
                    _unitOfWork.SaveChanges();

                    Activity activity = createActivity.CreatedActivity;

                    createActivityValuesCommand = new CreateActivityValues(principal)
                    {
                        ActivityId = activity.RevisionId,
                        Mode       = activity.Mode,
                        Title      = createActivityValuesCommand.Title,
                        Content    = createActivityValuesCommand.Content,
                    };

                    _createActivityValues.Handle(createActivityValuesCommand);
                    _unitOfWork.SaveChanges();

                    _createActivityType.Handle(new CreateActivityType(principal, activity.RevisionId)
                    {
                        ActivityTypeId = employeeModuleSettings.ActivityTypes.Single(x => x.Type.Contains("Award")).Id,
                    });

                    _createActivityPlace.Handle(new CreateActivityPlace(principal, activity.RevisionId)
                    {
                        PlaceId = _entities.Get <Place>().Single(x => x.OfficialName == "China").RevisionId,
                    });

                    _unitOfWork.SaveChanges();
                }

                #endregion
            }
        }
        public void Seed()
        {
            /* ----- USF People Activities ----- */

            { // Douglas Corarito
                Person person = _entities.Get<Person>().SingleOrDefault(x => x.FirstName == "Douglas" && x.LastName == "Corarito");
                if (person == null) throw new Exception("USF person Douglas Corarito not found");

                User user = _entities.Get<User>().SingleOrDefault(x => x.Person.RevisionId == person.RevisionId);
                if (user == null) throw new Exception("USF person Douglas Corarito has no User.");

                string[] developerRoles = new string[]
                    {
                        RoleName.AuthorizationAgent,
                        RoleName.EstablishmentLocationAgent,
                        RoleName.EstablishmentAdministrator,
                        RoleName.ElmahViewer,
                        RoleName.InstitutionalAgreementManager,
                        RoleName.InstitutionalAgreementSupervisor,
                        RoleName.EmployeeProfileManager,
                    };
                GenericIdentity identity = new GenericIdentity(user.Name);
                GenericPrincipal principal = new GenericPrincipal(identity, developerRoles);

                EmployeeModuleSettings employeeModuleSettings =
                    _queryProcessor.Execute(new EmployeeModuleSettingsByPersonId(person.RevisionId));
                if (employeeModuleSettings == null) throw new Exception("No EmployeeModuleSettings for USF.");

                CreateMyNewActivity createMyNewActivityCommand;


                // ACTIVITY 1
                Guid entityId = new Guid("95F98FB4-EFB2-4F8E-AE79-E2B23F04D4FE");
                bool activityExists = _entities.Get<Activity>().Count(x => x.EntityId == entityId) > 0;
                if (!activityExists)
                {
                    createMyNewActivityCommand = new CreateMyNewActivity(principal, ActivityMode.Draft.AsSentenceFragment())
                    {
                        EntityId = entityId
                    };

                    _createActivity.Handle(createMyNewActivityCommand);
                    _unitOfWork.SaveChanges();

                    Activity activity = createMyNewActivityCommand.CreatedActivity;

                    CreateActivityValues createActivityValuesCommand = new CreateActivityValues(principal, activity.RevisionId, activity.Mode)
                    {
                        Title =
                            "Understanding Causation of the Permian/Triassic Boundary, Largest Mass Extinction in Earth History",
                        Content =
                            "Permian/Triassic (P/Tr) Boundary Global Events—The P/Tr boundary represents the largest mass extinction in Earth history, yet its causes remain uncertain. I am investigating critical questions related to the extent and intensity of Permo-Triassic deep-ocean anoxia, patterns of upwelling of toxic sulfidic waters onto shallow-marine shelves and platforms, and the relationship of such events to global C-isotopic excursions and the delayed recovery of marine biotas during the Early Triassic. I am working on the P/Tr boundary globally.",
                        StartsOn = new DateTime(2003, 3, 1),
                    };

                    _createActivityValues.Handle(createActivityValuesCommand);
                    _unitOfWork.SaveChanges();

                    ActivityValues activityValues = createActivityValuesCommand.CreatedActivityValues;

                    _createActivityType.Handle(new CreateActivityType(principal, activityValues.RevisionId,
                        employeeModuleSettings.ActivityTypes.Single(x => x.Type.Contains("Research")).Id ));

                    _createActivityType.Handle(new CreateActivityType(principal, activityValues.RevisionId,
                        employeeModuleSettings.ActivityTypes.Single(x => x.Type.Contains("Teaching")).Id ));

                    _createActivityLocation.Handle(new CreateActivityLocation(principal)
                    {
                        ActivityValuesId = activityValues.RevisionId,
                        PlaceId = _entities.Get<Place>().Single(x => x.OfficialName == "China").RevisionId,
                    });

                    _createActivityLocation.Handle(new CreateActivityLocation(principal)
                    {
                        ActivityValuesId = activityValues.RevisionId,
                        PlaceId = _entities.Get<Place>().Single(x => x.OfficialName == "Canada").RevisionId,
                    });

                    /* ----- Add Tags ----- */

                    _createActivityTag.Handle(new CreateActivityTag(principal)
                    {
                        ActivityValuesId = activityValues.RevisionId,
                        Text = "Vietnam",
                        DomainType = ActivityTagDomainType.Place,
                        DomainKey = _entities.Get<Place>().Single(x => x.OfficialName == "Vietnam").RevisionId,
                        Mode = activity.Mode
                    });

                    _createActivityTag.Handle(new CreateActivityTag(principal)
                    {
                        ActivityValuesId = activityValues.RevisionId,
                        Text = "India",
                        DomainType = ActivityTagDomainType.Place,
                        DomainKey = _entities.Get<Place>().Single(x => x.OfficialName == "India").RevisionId,
                        Mode = activity.Mode
                    });

                    _createActivityTag.Handle(new CreateActivityTag(principal)
                    {
                        ActivityValuesId = activityValues.RevisionId,
                        Text = "Japan",
                        DomainType = ActivityTagDomainType.Place,
                        DomainKey = _entities.Get<Place>().Single(x => x.OfficialName == "Japan").RevisionId,
                        Mode = activity.Mode
                    });

                    /* ----- Add Documents ----- */

                    _createActivityDocument.Handle(new CreateActivityDocument(principal)
                    {
                        ActivityValuesId = activityValues.RevisionId,
                        FileId = _entities.Get<LoadableFile>().Single(x => x.Name == "02E6D488-B3FA-4D79-848F-303779A53ABE").Id,
                        Mode = activity.Mode,
                        Title = "Dissertation Excerpt"
                    });

                    _createActivityDocument.Handle(new CreateActivityDocument(principal)
                    {
                        ActivityValuesId = activityValues.RevisionId,
                        FileId = _entities.Get<LoadableFile>().Single(x => x.Name == "10EC87BD-3A95-439D-807A-0F57C3F89C8A").Id,
                        Mode = activity.Mode,
                        Title = "Research Funding Breakdown"
                    });

                    _createActivityDocument.Handle(new CreateActivityDocument(principal)
                    {
                        ActivityValuesId = activityValues.RevisionId,
                        FileId = _entities.Get<LoadableFile>().Single(x => x.Name == "1322FF22-E863-435E-929E-765EB95FB460").Id,
                        Mode = activity.Mode,
                        Title = "Conference Presentation"
                    });

                    _unitOfWork.SaveChanges();
                } // ACTIVITY 1


                // ACTIVITY 2
                entityId = new Guid("894A9E42-F693-4268-826A-C78618D8D6D0");
                activityExists = _entities.Get<Activity>().Count(x => x.EntityId == entityId) > 0;
                if (!activityExists)
                {
                    createMyNewActivityCommand = new CreateMyNewActivity(principal, ActivityMode.Draft.AsSentenceFragment())
                    {
                        EntityId = entityId
                    };

                    _createActivity.Handle(createMyNewActivityCommand);
                    _unitOfWork.SaveChanges();

                    Activity activity = createMyNewActivityCommand.CreatedActivity;

                    CreateActivityValues createActivityValuesCommand = new CreateActivityValues(principal, activity.RevisionId, activity.Mode)
                    {
                        Title = "Professional Development Program for Teachers of English at Shandong University",
                        Content = "In Summer 2008, the Teaching English as a Second Language (TESL) Program delivered a professional development program for teachers of English at Shandong University in Jinan, China. Program instructors included two TESL doctoral students and one colleague living in the Czech Republic. Three courses were offered: Theory to Practice; Research in Second Language Acquisition; and Instructional Technology in English Language Teaching. 48 Chinese teachers completed the program. ",
                        StartsOn = new DateTime(2003, 6, 1)
                    };

                    _createActivityValues.Handle(createActivityValuesCommand);
                    _unitOfWork.SaveChanges();

                    ActivityValues activityValues = createActivityValuesCommand.CreatedActivityValues;

                    _createActivityType.Handle(new CreateActivityType(principal, activityValues.RevisionId,
                        employeeModuleSettings.ActivityTypes.Single(x => x.Type.Contains("Service")).Id ));

                    _createActivityLocation.Handle(new CreateActivityLocation(principal)
                    {
                        ActivityValuesId = activityValues.RevisionId,
                        PlaceId = _entities.Get<Place>().Single(x => x.OfficialName == "China").RevisionId,
                    });

                    //_createActivityDocument.Handle(new CreateActivityDocument
                    //{
                    //    ActivityValuesId = activityValues.RevisionId,
                    //    FileId = _entities.Get<LoadableFile>().Single(x => x.Name == "14E5C461-2E5E-4E63-9701-DC3F009AB98E").Id,
                    //    Mode = activity.Mode,
                    //    Title = "Village Teaching Session"
                    //});

                    _unitOfWork.SaveChanges();
                } // ACTIVITY 2


                // ACTIVITY 3
                entityId = new Guid("6C03F4D0-FBB6-41CB-8E98-D9B129EFF0F8");
                activityExists = _entities.Get<Activity>().Count(x => x.EntityId == entityId) > 0;
                if (!activityExists)
                {
                    createMyNewActivityCommand = new CreateMyNewActivity(principal, ActivityMode.Draft.AsSentenceFragment())
                    {
                        EntityId = entityId
                    };

                    _createActivity.Handle(createMyNewActivityCommand);
                    _unitOfWork.SaveChanges();

                    Activity activity = createMyNewActivityCommand.CreatedActivity;

                    CreateActivityValues createActivityValuesCommand = new CreateActivityValues(principal, activity.RevisionId, activity.Mode)
                    {
                        Title = "Workshop Preparation: Air pollution and Chinese Historic Site",
                        Content = "Drs. Tim Keener and Mingming Lu went to China in Oct. of 2006 to plan for an air quality workshop on the impact of air pollution and the Chinese historic sites, to be held in Xi’an, China in the fall of 2008. They have visited Tsinghua Univ., the XISU and discussed the details of the workshop plan with Prof. Wu, Associate Dean in the School of Tourism. they have visted Shanxi Archeology Research Institute, and Chinese Acedemy of Science in Xian, to meet potentail workshop participants. Drs. Lu and Keener is developing a proposal to NSF for the workshop.",
                        StartsOn = new DateTime(2006, 10, 9),
                        EndsOn = new DateTime(2006, 10, 10)
                    };

                    _createActivityValues.Handle(createActivityValuesCommand);
                    _unitOfWork.SaveChanges();

                    ActivityValues activityValues = createActivityValuesCommand.CreatedActivityValues;

                    _createActivityType.Handle(new CreateActivityType(principal, activityValues.RevisionId,
                        employeeModuleSettings.ActivityTypes.Single(x => x.Type.Contains("Conference")).Id ));

                    _createActivityType.Handle(new CreateActivityType(principal, activityValues.RevisionId,
                        employeeModuleSettings.ActivityTypes.Single(x => x.Type.Contains("Teaching")).Id ));

                    _createActivityType.Handle(new CreateActivityType(principal, activityValues.RevisionId,
                        employeeModuleSettings.ActivityTypes.Single(x => x.Type.Contains("Honor")).Id ));

                    _createActivityLocation.Handle(new CreateActivityLocation(principal)
                    {
                        ActivityValuesId = activityValues.RevisionId,
                        PlaceId = _entities.Get<Place>().Single(x => x.OfficialName == "China").RevisionId,
                    });

                    //_createActivityDocument.Handle(new CreateActivityDocument
                    //{
                    //    ActivityValuesId = activityValues.RevisionId,
                    //    FileId = _entities.Get<LoadableFile>().Single(x => x.Name == "322BF184-32C3-49CA-8C97-18ABE32CFD8A").Id,
                    //    Mode = activity.Mode,
                    //    Title = "Wildlife Sounds Early 2000"
                    //});

                    //_createActivityDocument.Handle(new CreateActivityDocument
                    //{
                    //    ActivityValuesId = activityValues.RevisionId,
                    //    FileId = _entities.Get<LoadableFile>().Single(x => x.Name == "3D3C0976-5117-4D5A-AF25-1B53166C550C").Id,
                    //    Mode = activity.Mode,
                    //    Title = "Factory Activity"
                    //});

                    //_createActivityDocument.Handle(new CreateActivityDocument
                    //{
                    //    ActivityValuesId = activityValues.RevisionId,
                    //    FileId = _entities.Get<LoadableFile>().Single(x => x.Name == "5FE682FD-F161-4669-A2C4-974F5B0F8BB1").Id,
                    //    Mode = activity.Mode,
                    //    Title = "General Movie"
                    //});

                    _createActivityDocument.Handle(new CreateActivityDocument(principal)
                    {
                        ActivityValuesId = activityValues.RevisionId,
                        FileId = _entities.Get<LoadableFile>().Single(x => x.Name == "817DB81E-53FC-47E1-A1DE-B8C108C7ACD6").Id,
                        Mode = activity.Mode,
                        Title = "Make a contribution form"
                    });

                    _unitOfWork.SaveChanges();
                } // ACTIVITY 3


                // ACTIVITY 4
                entityId = new Guid("8ABCB82E-7ACA-41D6-93CD-637C2006804E");
                activityExists = _entities.Get<Activity>().Count(x => x.EntityId == entityId) > 0;
                if (!activityExists)
                {
                    createMyNewActivityCommand = new CreateMyNewActivity(principal, ActivityMode.Draft.AsSentenceFragment())
                    {
                        EntityId = entityId
                    };

                    _createActivity.Handle(createMyNewActivityCommand);
                    _unitOfWork.SaveChanges();

                    Activity activity = createMyNewActivityCommand.CreatedActivity;

                    CreateActivityValues createActivityValuesCommand = new CreateActivityValues(principal, activity.RevisionId, activity.Mode)
                    {
                        Title = "Guest performer and teacher, China Saxophone Festival, Dalian, China",
                        Content = "Adj Professor, Professor EmeritusJazz Studies, Saxophone Studies, Ensembles & Conducting College Conservatory of Music"
                    };

                    _createActivityValues.Handle(createActivityValuesCommand);
                    _unitOfWork.SaveChanges();

                    ActivityValues activityValues = createActivityValuesCommand.CreatedActivityValues;

                    _createActivityType.Handle(new CreateActivityType(principal, activityValues.RevisionId,
                        employeeModuleSettings.ActivityTypes.Single(x => x.Type.Contains("Creative")).Id ));

                    _createActivityLocation.Handle(new CreateActivityLocation(principal)
                    {
                        ActivityValuesId = activityValues.RevisionId,
                        PlaceId = _entities.Get<Place>().Single(x => x.OfficialName == "China").RevisionId,
                    });

                    _createActivityDocument.Handle(new CreateActivityDocument(principal)
                    {
                        ActivityValuesId = activityValues.RevisionId,
                        ImageId = _entities.Get<Image>().Single(x => x.Name == "5C62D74E-E8EE-4B9A-95F3-B2ABB1F6F912").Id,
                        Mode = activity.Mode,
                        Title = "Photo of the site"
                    });

                    _createActivityDocument.Handle(new CreateActivityDocument(principal)
                    {
                        ActivityValuesId = activityValues.RevisionId,
                        ImageId = _entities.Get<Image>().Single(x => x.Name == "A44FAB3B-DEBA-4F14-8965-E379569066A9").Id,
                        Mode = activity.Mode,
                        Title = "Grads working hard"
                    });

                    _createActivityDocument.Handle(new CreateActivityDocument(principal)
                    {
                        ActivityValuesId = activityValues.RevisionId,
                        ImageId = _entities.Get<Image>().Single(x => x.Name == "C0DA4900-762B-4B26-AE03-843CBB7C0E7B").Id,
                        Mode = activity.Mode,
                        Title = "Map of the incident"
                    });

                    _createActivityDocument.Handle(new CreateActivityDocument(principal)
                    {
                        ActivityValuesId = activityValues.RevisionId,
                        ImageId = _entities.Get<Image>().Single(x => x.Name == "E4E53300-08D3-47C0-954C-BF15EF54F0A3").Id,
                        Mode = activity.Mode,
                        Title = "Sunrise over the delta"
                    });

                    _createActivityDocument.Handle(new CreateActivityDocument(principal)
                    {
                        ActivityValuesId = activityValues.RevisionId,
                        ImageId = _entities.Get<Image>().Single(x => x.Name == "EE23D741-C50D-40D5-8214-C18DF68CC6D3").Id,
                        Mode = activity.Mode,
                        Title = "Me"
                    });

                    _unitOfWork.SaveChanges();
                } // ACTIVITY 4


                // ACTIVITY 5
                entityId = new Guid("F0754F12-8E4E-4557-B9E0-32A173CB36DA");
                activityExists = _entities.Get<Activity>().Count(x => x.EntityId == entityId) > 0;
                if (!activityExists)
                {
                    createMyNewActivityCommand = new CreateMyNewActivity(principal, ActivityMode.Draft.AsSentenceFragment())
                    {
                        EntityId = entityId
                    };

                    _createActivity.Handle(createMyNewActivityCommand);
                    _unitOfWork.SaveChanges();

                    Activity activity = createMyNewActivityCommand.CreatedActivity;

                    CreateActivityValues createActivityValuesCommand = new CreateActivityValues(principal, activity.RevisionId, activity.Mode)
                    {
                        Title = "Fulbright Scholar Award to Research and Teach at Zhejiang University",
                        Content = "I will be conducting research and teaching two courses to medical and public health students at Zhejiang University in Hangzhou China. I will also be working closely with Dr. Tingzhong Yang who directs an institute that studies tobacco related problems in China. Further I wish to explore differences in health knowledge, attitudes and behaviors between Chinese and US college students."
                    };

                    _createActivityValues.Handle(createActivityValuesCommand);
                    _unitOfWork.SaveChanges();

                    ActivityValues activityValues = createActivityValuesCommand.CreatedActivityValues;

                    _createActivityType.Handle(new CreateActivityType(principal, activityValues.RevisionId,
                        employeeModuleSettings.ActivityTypes.Single(x => x.Type.Contains("Award")).Id ));

                    _createActivityLocation.Handle(new CreateActivityLocation(principal)
                    {
                        ActivityValuesId = activityValues.RevisionId,
                        PlaceId = _entities.Get<Place>().Single(x => x.OfficialName == "China").RevisionId,
                    });

                    _unitOfWork.SaveChanges();
                } // ACTIVITY 5

            } // Douglas Corarito
        }
        public override void Seed()
        {
            /* ----- USF People Activities ----- */

            {   // Douglas Corarito
                var person = _entities.Get<Person>().Single(x => x.FirstName == "Douglas" && x.LastName == "Corarito");
                var user = person.User;

                var identity = new GenericIdentity(user.Name);
                var principal = new GenericPrincipal(identity, null);

                var employeeModuleSettings = _queryProcessor.Execute(new EmployeeModuleSettingsByPersonId(person.RevisionId));
                if (employeeModuleSettings == null) throw new Exception("No EmployeeModuleSettings for USF.");

                CreateActivity createActivity;

                #region Activity 1

                var createActivityValuesCommand = new CreateActivityValues(principal)
                {
                    Title =
                        "Understanding Causation of the Permian/Triassic Boundary, Largest Mass Extinction in Earth History",
                    Content =
                        "Permian/Triassic (P/Tr) Boundary Global Events—The P/Tr boundary represents the largest mass extinction in Earth history, yet its causes remain uncertain. I am investigating critical questions related to the extent and intensity of Permo-Triassic deep-ocean anoxia, patterns of upwelling of toxic sulfidic waters onto shallow-marine shelves and platforms, and the relationship of such events to global C-isotopic excursions and the delayed recovery of marine biotas during the Early Triassic. I am working on the P/Tr boundary globally.",
                    StartsOn = new DateTime(2003, 3, 1),
                };

                var activityExists = _entities.Get<Activity>().Any(x => x.PersonId == person.RevisionId && x.Values.Any(y =>
                    createActivityValuesCommand.Title.Equals(y.Title)));
                if (!activityExists)
                {
                    createActivity = new CreateActivity(principal)
                    {
                        Mode = ActivityMode.Draft,
                    };

                    _createActivity.Handle(createActivity);
                    _unitOfWork.SaveChanges();

                    Activity activity = createActivity.CreatedActivity;

                    createActivityValuesCommand = new CreateActivityValues(principal)
                    {
                        ActivityId = activity.RevisionId,
                        Mode = activity.Mode,
                        Title = createActivityValuesCommand.Title,
                        Content = createActivityValuesCommand.Content,
                        StartsOn = createActivityValuesCommand.StartsOn,
                    };

                    _createActivityValues.Handle(createActivityValuesCommand);

                    _createActivityType.Handle(new CreateActivityType(principal, activity.RevisionId)
                    {
                        ActivityTypeId = employeeModuleSettings.ActivityTypes.Single(x => x.Type.Contains("Research")).Id,
                    });

                    _createActivityType.Handle(new CreateActivityType(principal, activity.RevisionId)
                    {
                        ActivityTypeId = employeeModuleSettings.ActivityTypes.Single(x => x.Type.Contains("Teaching")).Id,
                    });

                    _createActivityPlace.Handle(new CreateActivityPlace(principal, activity.RevisionId)
                    {
                        PlaceId = _entities.Get<Place>().Single(x => x.OfficialName == "China").RevisionId,
                    });

                    _createActivityPlace.Handle(new CreateActivityPlace(principal, activity.RevisionId)
                    {
                        PlaceId = _entities.Get<Place>().Single(x => x.OfficialName == "Canada").RevisionId,
                    });

                    /* ----- Add Tags ----- */

                    _createActivityTag.Handle(new CreateActivityTag(principal, activity.RevisionId)
                    {
                        Text = "Vietnam",
                    });

                    _createActivityTag.Handle(new CreateActivityTag(principal, activity.RevisionId)
                    {
                        Text = "India",
                    });

                    _createActivityTag.Handle(new CreateActivityTag(principal, activity.RevisionId)
                    {
                        Text = "Japan",
                    });

                    /* ----- Add Documents ----- */

                    Seed(new CreateActivityDocument(principal, activity.RevisionId)
                    {
                        FileName = "02E6D488-B3FA-4D79-848F-303779A53ABE.docx",
                        MimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
                        Title = "Dissertation Excerpt",
                    });

                    Seed(new CreateActivityDocument(principal, activity.RevisionId)
                    {
                        FileName = "10EC87BD-3A95-439D-807A-0F57C3F89C8A.xls",
                        MimeType = "application/vnd.ms-excel",
                        Title = "Research Funding Breakdown"
                    });

                    Seed(new CreateActivityDocument(principal, activity.RevisionId)
                    {
                        FileName = "1322FF22-E863-435E-929E-765EB95FB460.ppt",
                        MimeType = "application/vnd.ms-powerpoint",
                        Title = "Conference Presentation"
                    });

                    _unitOfWork.SaveChanges();
                }

                #endregion
                #region Activity 2

                createActivityValuesCommand = new CreateActivityValues(principal)
                {
                    Title = "Professional Development Program for Teachers of English at Shandong University",
                    Content = "In Summer 2008, the Teaching English as a Second Language (TESL) Program delivered a professional development program for teachers of English at Shandong University in Jinan, China. Program instructors included two TESL doctoral students and one colleague living in the Czech Republic. Three courses were offered: Theory to Practice; Research in Second Language Acquisition; and Instructional Technology in English Language Teaching. 48 Chinese teachers completed the program. ",
                    StartsOn = new DateTime(2003, 6, 1)
                };

                activityExists = _entities.Get<Activity>().Any(x => x.PersonId == person.RevisionId && x.Values.Any(y =>
                    createActivityValuesCommand.Title.Equals(y.Title)));
                if (!activityExists)
                {
                    createActivity = new CreateActivity(principal)
                    {
                        Mode = ActivityMode.Draft,
                    };

                    _createActivity.Handle(createActivity);
                    _unitOfWork.SaveChanges();

                    Activity activity = createActivity.CreatedActivity;

                    createActivityValuesCommand = new CreateActivityValues(principal)
                    {
                        ActivityId = activity.RevisionId,
                        Mode = activity.Mode,
                        Title = createActivityValuesCommand.Title,
                        Content = createActivityValuesCommand.Content,
                        StartsOn = createActivityValuesCommand.StartsOn,
                    };

                    _createActivityValues.Handle(createActivityValuesCommand);
                    _unitOfWork.SaveChanges();

                    _createActivityType.Handle(new CreateActivityType(principal, activity.RevisionId)
                    {
                        ActivityTypeId = employeeModuleSettings.ActivityTypes.Single(x => x.Type.Contains("Service")).Id,
                    });

                    _createActivityPlace.Handle(new CreateActivityPlace(principal, activity.RevisionId)
                    {
                        PlaceId = _entities.Get<Place>().Single(x => x.OfficialName == "China").RevisionId,
                    });

                    _unitOfWork.SaveChanges();
                }

                #endregion
                #region Activity 3

                createActivityValuesCommand = new CreateActivityValues(principal)
                {
                    Title = "Workshop Preparation: Air pollution and Chinese Historic Site",
                    Content = "Drs. Tim Keener and Mingming Lu went to China in Oct. of 2006 to plan for an air quality workshop on the impact of air pollution and the Chinese historic sites, to be held in Xi’an, China in the fall of 2008. They have visited Tsinghua Univ., the XISU and discussed the details of the workshop plan with Prof. Wu, Associate Dean in the School of Tourism. they have visted Shanxi Archeology Research Institute, and Chinese Acedemy of Science in Xian, to meet potentail workshop participants. Drs. Lu and Keener is developing a proposal to NSF for the workshop.",
                    StartsOn = new DateTime(2006, 10, 9),
                    EndsOn = new DateTime(2006, 10, 10)
                };

                activityExists = _entities.Get<Activity>().Any(x => x.PersonId == person.RevisionId && x.Values.Any(y =>
                    createActivityValuesCommand.Title.Equals(y.Title)));
                if (!activityExists)
                {
                    createActivity = new CreateActivity(principal)
                    {
                        Mode = ActivityMode.Draft,
                    };

                    _createActivity.Handle(createActivity);
                    _unitOfWork.SaveChanges();

                    Activity activity = createActivity.CreatedActivity;

                    createActivityValuesCommand = new CreateActivityValues(principal)
                    {
                        ActivityId = activity.RevisionId,
                        Mode = activity.Mode,
                        Title = createActivityValuesCommand.Title,
                        Content = createActivityValuesCommand.Content,
                        StartsOn = createActivityValuesCommand.StartsOn,
                        EndsOn = createActivityValuesCommand.EndsOn,
                    };

                    _createActivityValues.Handle(createActivityValuesCommand);
                    _unitOfWork.SaveChanges();

                    _createActivityType.Handle(new CreateActivityType(principal, activity.RevisionId)
                    {
                        ActivityTypeId = employeeModuleSettings.ActivityTypes.Single(x => x.Type.Contains("Conference")).Id,
                    });

                    _createActivityType.Handle(new CreateActivityType(principal, activity.RevisionId)
                    {
                        ActivityTypeId = employeeModuleSettings.ActivityTypes.Single(x => x.Type.Contains("Teaching")).Id,
                    });

                    _createActivityType.Handle(new CreateActivityType(principal, activity.RevisionId)
                    {
                        ActivityTypeId = employeeModuleSettings.ActivityTypes.Single(x => x.Type.Contains("Honor")).Id,
                    });

                    _createActivityPlace.Handle(new CreateActivityPlace(principal, activity.RevisionId)
                    {
                        PlaceId = _entities.Get<Place>().Single(x => x.OfficialName == "China").RevisionId,
                    });

                    Seed(new CreateActivityDocument(principal, activity.RevisionId)
                    {
                        FileName = "817DB81E-53FC-47E1-A1DE-B8C108C7ACD6.pdf",
                        MimeType = "application/pdf",
                        Title = "Make a contribution form"
                    });

                    _unitOfWork.SaveChanges();
                }

                #endregion
                #region Activity 4

                createActivityValuesCommand = new CreateActivityValues(principal)
                {
                    Title = "Guest performer and teacher, China Saxophone Festival, Dalian, China",
                    Content = "Adj Professor, Professor EmeritusJazz Studies, Saxophone Studies, Ensembles & Conducting College Conservatory of Music"
                };

                activityExists = _entities.Get<Activity>().Any(x => x.PersonId == person.RevisionId && x.Values.Any(y =>
                    createActivityValuesCommand.Title.Equals(y.Title)));
                if (!activityExists)
                {
                    createActivity = new CreateActivity(principal)
                    {
                        Mode = ActivityMode.Draft,
                    };

                    _createActivity.Handle(createActivity);
                    _unitOfWork.SaveChanges();

                    Activity activity = createActivity.CreatedActivity;

                    createActivityValuesCommand = new CreateActivityValues(principal)
                    {
                        ActivityId = activity.RevisionId,
                        Mode = activity.Mode,
                        Title = createActivityValuesCommand.Title,
                        Content = createActivityValuesCommand.Content,
                    };

                    _createActivityValues.Handle(createActivityValuesCommand);
                    _unitOfWork.SaveChanges();

                    _createActivityType.Handle(new CreateActivityType(principal, activity.RevisionId)
                    {
                        ActivityTypeId = employeeModuleSettings.ActivityTypes.Single(x => x.Type.Contains("Creative")).Id,
                    });

                    _createActivityPlace.Handle(new CreateActivityPlace(principal, activity.RevisionId)
                    {
                        PlaceId = _entities.Get<Place>().Single(x => x.OfficialName == "China").RevisionId,
                    });

                    Seed(new CreateActivityDocument(principal, activity.RevisionId)
                    {
                        FileName = "5C62D74E-E8EE-4B9A-95F3-B2ABB1F6F912.gif",
                        MimeType = "image/gif",
                        Title = "Photo of the site"
                    });

                    Seed(new CreateActivityDocument(principal, activity.RevisionId)
                    {
                        FileName = "A44FAB3B-DEBA-4F14-8965-E379569066A9.png",
                        MimeType = "image/png",
                        Title = "Grads working hard"
                    });

                    Seed(new CreateActivityDocument(principal, activity.RevisionId)
                    {
                        FileName = "C0DA4900-762B-4B26-AE03-843CBB7C0E7B.bmp",
                        MimeType = "image/bmp",
                        Title = "Map of the incident"
                    });

                    Seed(new CreateActivityDocument(principal, activity.RevisionId)
                    {
                        FileName = "E4E53300-08D3-47C0-954C-BF15EF54F0A3.tif",
                        MimeType = "image/tiff",
                        Title = "Sunrise over the delta"
                    });

                    Seed(new CreateActivityDocument(principal, activity.RevisionId)
                    {
                        FileName = "EE23D741-C50D-40D5-8214-C18DF68CC6D3.jpg",
                        MimeType = "image/jpg",
                        Title = "Me"
                    });

                    _unitOfWork.SaveChanges();
                }

                #endregion
                #region Activity 5

                createActivityValuesCommand = new CreateActivityValues(principal)
                {
                    Title = "Fulbright Scholar Award to Research and Teach at Zhejiang University",
                    Content = "I will be conducting research and teaching two courses to medical and public health students at Zhejiang University in Hangzhou China. I will also be working closely with Dr. Tingzhong Yang who directs an institute that studies tobacco related problems in China. Further I wish to explore differences in health knowledge, attitudes and behaviors between Chinese and US college students."
                };

                activityExists = _entities.Get<Activity>().Any(x => x.PersonId == person.RevisionId && x.Values.Any(y =>
                    createActivityValuesCommand.Title.Equals(y.Title)));
                if (!activityExists)
                {
                    createActivity = new CreateActivity(principal)
                    {
                        Mode = ActivityMode.Draft,
                    };

                    _createActivity.Handle(createActivity);
                    _unitOfWork.SaveChanges();

                    Activity activity = createActivity.CreatedActivity;

                    createActivityValuesCommand = new CreateActivityValues(principal)
                    {
                        ActivityId = activity.RevisionId,
                        Mode = activity.Mode,
                        Title = createActivityValuesCommand.Title,
                        Content = createActivityValuesCommand.Content,
                    };

                    _createActivityValues.Handle(createActivityValuesCommand);
                    _unitOfWork.SaveChanges();

                    _createActivityType.Handle(new CreateActivityType(principal, activity.RevisionId)
                    {
                        ActivityTypeId = employeeModuleSettings.ActivityTypes.Single(x => x.Type.Contains("Award")).Id,
                    });

                    _createActivityPlace.Handle(new CreateActivityPlace(principal, activity.RevisionId)
                    {
                        PlaceId = _entities.Get<Place>().Single(x => x.OfficialName == "China").RevisionId,
                    });

                    _unitOfWork.SaveChanges();
                }

                #endregion

            }
        }