Ejemplo n.º 1
0
        //private static ITaskIdProvider _taskIdProvider = new TaskIdProvider();
        public void InsertTestData()
        {
            // Avoid polluting the database if there's already something in there.
            if (_context.Locations.Any() ||
                _context.Organizations.Any() ||
                _context.Tasks.Any() ||
                _context.Campaigns.Any() ||
                _context.Activities.Any() ||
                _context.ActivitySkills.Any() ||
                _context.Skills.Any() ||
                _context.Resources.Any())
            {
                return;
            }

            #region postalCodes
            var existingPostalCode = _context.PostalCodes.ToList();
            _context.PostalCodes.AddRange(GetPostalCodes(existingPostalCode));
            #endregion

            List <Organization>    organizations      = new List <Organization>();
            List <Skill>           organizationSkills = new List <Skill>();
            List <Location>        locations          = GetLocations();
            List <ApplicationUser> users           = new List <ApplicationUser>();
            List <TaskSignup>      taskSignups     = new List <TaskSignup>();
            List <Activity>        activities      = new List <Activity>();
            List <ActivitySkill>   activitySkills  = new List <ActivitySkill>();
            List <Campaign>        campaigns       = new List <Campaign>();
            List <AllReadyTask>    tasks           = new List <AllReadyTask>();
            List <Resource>        resources       = new List <Resource>();
            List <ActivitySignup>  activitySignups = new List <ActivitySignup>();
            List <Contact>         contacts        = GetContacts();
            var skills = new List <Skill>();

            #region Skills
            var medical = new Skill()
            {
                Name = "Medical", Description = "specific enough, right?"
            };
            var cprCertified = new Skill()
            {
                Name = "CPR Certified", ParentSkill = medical, Description = "ha ha ha ha, stayin alive"
            };
            var md = new Skill()
            {
                Name = "MD", ParentSkill = medical, Description = "Trust me, I'm a doctor"
            };
            var surgeon = new Skill()
            {
                Name = "Surgeon", ParentSkill = md, Description = "cut open; sew shut; play 18 holes"
            };
            skills.AddRange(new[] { medical, cprCertified, md, surgeon });
            #endregion

            #region Organization

            Organization htb = new Organization()
            {
                Name                 = "Humanitarian Toolbox",
                LogoUrl              = "http://www.htbox.org/upload/home/ht-hero.png",
                WebUrl               = "http://www.htbox.org",
                Location             = locations.FirstOrDefault(),
                Campaigns            = new List <Campaign>(),
                OrganizationContacts = new List <OrganizationContact>(),
            };

            #endregion

            #region Organization Skills

            organizationSkills.Add(new Skill()
            {
                Name               = "Code Ninja",
                Description        = "Ability to commit flawless code without review or testing",
                OwningOrganization = htb
            });

            #endregion

            #region Campaign

            Campaign firePrev = new Campaign()
            {
                Name = "Neighborhood Fire Prevention Days",
                ManagingOrganization = htb,
                TimeZoneId           = "Central Standard Time"
            };
            htb.Campaigns.Add(firePrev);
            var smokeDetImpact = new CampaignImpact
            {
                ImpactType         = ImpactType.Numeric,
                NumericImpactGoal  = 10000,
                CurrentImpactLevel = 6722,
                Display            = true,
                TextualImpactGoal  = "Total number of smoke detectors installed."
            };
            _context.CampaignImpacts.Add(smokeDetImpact);
            Campaign smokeDet = new Campaign()
            {
                Name = "Working Smoke Detectors Save Lives",
                ManagingOrganization = htb,
                StartDateTime        = DateTime.Today.AddMonths(-1).ToUniversalTime(),
                EndDateTime          = DateTime.Today.AddMonths(1).ToUniversalTime(),
                CampaignImpact       = smokeDetImpact,
                TimeZoneId           = "Central Standard Time"
            };
            htb.Campaigns.Add(smokeDet);
            Campaign financial = new Campaign()
            {
                Name = "Everyday Financial Safety",
                ManagingOrganization = htb,
                TimeZoneId           = "Central Standard Time"
            };
            htb.Campaigns.Add(financial);
            Campaign safetyKit = new Campaign()
            {
                Name = "Simple Safety Kit Building",
                ManagingOrganization = htb,
                TimeZoneId           = "Central Standard Time"
            };
            htb.Campaigns.Add(safetyKit);
            Campaign carSafe = new Campaign()
            {
                Name = "Family Safety In the Car",
                ManagingOrganization = htb,
                TimeZoneId           = "Central Standard Time"
            };
            htb.Campaigns.Add(carSafe);
            Campaign escapePlan = new Campaign()
            {
                Name = "Be Ready to Get Out: Have a Home Escape Plan",
                ManagingOrganization = htb,
                TimeZoneId           = "Central Standard Time"
            };
            htb.Campaigns.Add(escapePlan);
            #endregion

            #region Activity
            Activity queenAnne = new Activity()
            {
                Name           = "Queen Anne Fire Prevention Day",
                StartDateTime  = new DateTime(2015, 7, 4, 10, 0, 0).ToUniversalTime(),
                EndDateTime    = new DateTime(2015, 12, 31, 15, 0, 0).ToUniversalTime(),
                Location       = GetRandom <Location>(locations),
                RequiredSkills = new List <ActivitySkill>()
            };
            queenAnne.Tasks = GetSomeTasks(queenAnne, htb);
            var ask = new ActivitySkill()
            {
                Skill = surgeon, Activity = queenAnne
            };
            queenAnne.RequiredSkills.Add(ask);
            activitySkills.Add(ask);
            ask = new ActivitySkill()
            {
                Skill = cprCertified, Activity = queenAnne
            };
            queenAnne.RequiredSkills.Add(ask);
            activitySkills.Add(ask);
            tasks.AddRange(queenAnne.Tasks);

            Activity ballard = new Activity()
            {
                Name          = "Ballard Fire Prevention Day",
                StartDateTime = new DateTime(2015, 7, 4, 10, 0, 0).ToUniversalTime(),
                EndDateTime   = new DateTime(2015, 12, 31, 14, 0, 0).ToUniversalTime(),
                Location      = GetRandom <Location>(locations),
                Campaign      = firePrev
            };
            ballard.Tasks = GetSomeTasks(ballard, htb);
            tasks.AddRange(ballard.Tasks);
            Activity madrona = new Activity()
            {
                Name          = "Madrona Fire Prevention Day",
                StartDateTime = new DateTime(2015, 7, 4, 10, 0, 0).ToUniversalTime(),
                EndDateTime   = new DateTime(2015, 12, 31, 14, 0, 0).ToUniversalTime(),
                Location      = GetRandom <Location>(locations),
                Campaign      = firePrev
            };
            madrona.Tasks = GetSomeTasks(madrona, htb);
            tasks.AddRange(madrona.Tasks);
            Activity southLoopSmoke = new Activity()
            {
                Name          = "Smoke Detector Installation and Testing-South Loop",
                StartDateTime = new DateTime(2015, 7, 6, 10, 0, 0).ToUniversalTime(),
                EndDateTime   = new DateTime(2015, 12, 31, 17, 0, 0).ToUniversalTime(),
                Location      = GetRandom <Location>(locations),
                Campaign      = smokeDet
            };
            southLoopSmoke.Tasks = GetSomeTasks(southLoopSmoke, htb);
            tasks.AddRange(southLoopSmoke.Tasks);
            Activity northLoopSmoke = new Activity()
            {
                Name          = "Smoke Detector Installation and Testing-Near North Side",
                StartDateTime = new DateTime(2015, 7, 6, 10, 0, 0).ToUniversalTime(),
                EndDateTime   = new DateTime(2015, 12, 31, 17, 0, 0).ToUniversalTime(),
                Location      = GetRandom <Location>(locations),
                Campaign      = smokeDet
            };
            northLoopSmoke.Tasks = GetSomeTasks(northLoopSmoke, htb);
            tasks.AddRange(northLoopSmoke.Tasks);
            Activity rentersInsurance = new Activity()
            {
                Name          = "Renters Insurance Education Door to Door and a bag of chips",
                Description   = "description for the win",
                StartDateTime = new DateTime(2015, 7, 11, 8, 0, 0).ToUniversalTime(),
                EndDateTime   = new DateTime(2015, 7, 11, 17, 0, 0).ToUniversalTime(),
                Location      = GetRandom <Location>(locations),
                Campaign      = financial
            };
            rentersInsurance.Tasks = GetSomeTasks(rentersInsurance, htb);
            tasks.AddRange(rentersInsurance.Tasks);
            Activity rentersInsuranceEd = new Activity()
            {
                Name          = "Renters Insurance Education Door to Door (woop woop)",
                Description   = "another great description",
                StartDateTime = new DateTime(2015, 7, 12, 8, 0, 0).ToUniversalTime(),
                EndDateTime   = new DateTime(2015, 12, 12, 17, 0, 0).ToUniversalTime(),
                Location      = GetRandom <Location>(locations),
                Campaign      = financial
            };
            rentersInsuranceEd.Tasks = GetSomeTasks(rentersInsuranceEd, htb);
            tasks.AddRange(rentersInsuranceEd.Tasks);
            Activity safetyKitBuild = new Activity()
            {
                Name          = "Safety Kit Assembly Volunteer Day",
                Description   = "Full day of volunteers building kits",
                StartDateTime = new DateTime(2015, 7, 11, 8, 0, 0).ToUniversalTime(),
                EndDateTime   = new DateTime(2015, 12, 11, 16, 30, 0).ToUniversalTime(),
                Location      = GetRandom <Location>(locations),
                Campaign      = safetyKit
            };
            safetyKitBuild.Tasks = GetSomeTasks(safetyKitBuild, htb);
            tasks.AddRange(safetyKitBuild.Tasks);

            Activity safetyKitHandout = new Activity()
            {
                Name          = "Safety Kit Distribution Weekend",
                Description   = "Handing out kits at local fire stations",
                StartDateTime = new DateTime(2015, 7, 11, 8, 0, 0).ToUniversalTime(),
                EndDateTime   = new DateTime(2015, 12, 11, 16, 30, 0).ToUniversalTime(),
                Location      = GetRandom <Location>(locations),
                Campaign      = safetyKit
            };
            safetyKitHandout.Tasks = GetSomeTasks(safetyKitHandout, htb);
            tasks.AddRange(safetyKitHandout.Tasks);
            Activity carSeatTest1 = new Activity()
            {
                Name          = "Car Seat Testing-Naperville",
                Description   = "Checking car seats at local fire stations after last day of school year",
                StartDateTime = new DateTime(2015, 7, 10, 9, 30, 0).ToUniversalTime(),
                EndDateTime   = new DateTime(2015, 12, 10, 15, 30, 0).ToUniversalTime(),
                Location      = GetRandom <Location>(locations),
                Campaign      = carSafe
            };
            carSeatTest1.Tasks = GetSomeTasks(carSeatTest1, htb);
            tasks.AddRange(carSeatTest1.Tasks);
            Activity carSeatTest2 = new Activity()
            {
                Name          = "Car Seat and Tire Pressure Checking Volunteer Day",
                Description   = "Checking those things all day at downtown train station parking",
                StartDateTime = new DateTime(2015, 7, 11, 8, 0, 0).ToUniversalTime(),
                EndDateTime   = new DateTime(2015, 12, 11, 19, 30, 0).ToUniversalTime(),
                Location      = GetRandom <Location>(locations),
                Campaign      = carSafe
            };
            carSeatTest2.Tasks = GetSomeTasks(carSeatTest2, htb);
            tasks.AddRange(carSeatTest2.Tasks);
            Activity homeFestival = new Activity()
            {
                Name          = "Park District Home Safety Festival",
                Description   = "At downtown park district(adjacent to pool)",
                StartDateTime = new DateTime(2015, 7, 11, 12, 0, 0).ToUniversalTime(),
                EndDateTime   = new DateTime(2015, 12, 11, 16, 30, 0).ToUniversalTime(),
                Location      = GetRandom <Location>(locations),
                Campaign      = safetyKit
            };
            homeFestival.Tasks = GetSomeTasks(homeFestival, htb);
            tasks.AddRange(homeFestival.Tasks);
            Activity homeEscape = new Activity()
            {
                Name          = "Home Escape Plan Flyer Distribution",
                Description   = "Handing out flyers door to door in several areas of town after school/ work hours.Streets / blocks will vary but number of volunteers.",
                StartDateTime = new DateTime(2015, 7, 15, 15, 30, 0).ToUniversalTime(),
                EndDateTime   = new DateTime(2015, 12, 15, 20, 30, 0).ToUniversalTime(),
                Location      = GetRandom <Location>(locations),
                Campaign      = escapePlan
            };
            homeEscape.Tasks = GetSomeTasks(homeEscape, htb);
            tasks.AddRange(homeEscape.Tasks);
            #endregion
            #region Link campaign and activity
            firePrev.Activities = new List <Activity>();
            firePrev.Activities.Add(queenAnne);
            firePrev.Activities.Add(ballard);
            firePrev.Activities.Add(madrona);
            smokeDet.Activities = new List <Activity>();
            smokeDet.Activities.Add(southLoopSmoke);
            smokeDet.Activities.Add(northLoopSmoke);
            financial.Activities = new List <Activity>();
            financial.Activities.Add(rentersInsurance);
            financial.Activities.Add(rentersInsuranceEd);
            safetyKit.Activities = new List <Activity>();
            safetyKit.Activities.Add(safetyKitBuild);
            safetyKit.Activities.Add(safetyKitHandout);
            carSafe.Activities = new List <Activity>();
            carSafe.Activities.Add(carSeatTest1);
            carSafe.Activities.Add(carSeatTest2);
            escapePlan.Activities = new List <Activity>();
            escapePlan.Activities.Add(homeFestival);
            escapePlan.Activities.Add(homeEscape);
            #endregion
            #region Add Campaigns and Activities
            organizations.Add(htb);
            campaigns.Add(firePrev);
            campaigns.Add(smokeDet);
            campaigns.Add(financial);
            campaigns.Add(escapePlan);
            campaigns.Add(safetyKit);
            campaigns.Add(carSafe);

            activities.AddRange(firePrev.Activities);
            activities.AddRange(smokeDet.Activities);
            activities.AddRange(financial.Activities);
            activities.AddRange(escapePlan.Activities);
            activities.AddRange(safetyKit.Activities);
            activities.AddRange(carSafe.Activities);
            #endregion

            #region Insert Resource items into Resources
            resources.Add(new Resource
            {
                Name             = "allReady Partner Name",
                Description      = "allready Partner Description",
                PublishDateBegin = DateTime.Today,
                PublishDateEnd   = DateTime.Today.AddDays(14),
                MediaUrl         = "",
                ResourceUrl      = "",
                CategoryTag      = "Partners"
            });
            resources.Add(new Resource
            {
                Name             = "allReady Partner Name 2",
                Description      = "allready Partner Description 2",
                PublishDateBegin = DateTime.Today.AddDays(-3),
                PublishDateEnd   = DateTime.Today.AddDays(-1),
                MediaUrl         = "",
                ResourceUrl      = "",
                CategoryTag      = "Partners"
            });
            #endregion

            #region Insert into DB
            _context.Skills.AddRange(skills);
            _context.Contacts.AddRange(contacts);
            _context.ActivitySkills.AddRange(activitySkills);
            _context.Locations.AddRange(locations);
            _context.Organizations.AddRange(organizations);
            _context.Tasks.AddRange(tasks);
            _context.Campaigns.AddRange(campaigns);
            _context.Activities.AddRange(activities);
            _context.Resources.AddRange(resources);
            //_context.SaveChanges();
            #endregion

            #region Users for Activities
            var username1 = $"{_settings.DefaultUsername}1.com";
            var username2 = $"{_settings.DefaultUsername}2.com";
            var username3 = $"{_settings.DefaultUsername}3.com";

            var user1 = new ApplicationUser {
                UserName = username1, Email = username1, EmailConfirmed = true, TimeZoneId = _generalSettings.DefaultTimeZone
            };
            _userManager.CreateAsync(user1, _settings.DefaultAdminPassword).GetAwaiter().GetResult();
            users.Add(user1);
            var user2 = new ApplicationUser {
                UserName = username2, Email = username2, EmailConfirmed = true, TimeZoneId = _generalSettings.DefaultTimeZone
            };
            _userManager.CreateAsync(user2, _settings.DefaultAdminPassword).GetAwaiter().GetResult();
            users.Add(user2);
            var user3 = new ApplicationUser {
                UserName = username3, Email = username3, EmailConfirmed = true, TimeZoneId = _generalSettings.DefaultTimeZone
            };
            _userManager.CreateAsync(user3, _settings.DefaultAdminPassword).GetAwaiter().GetResult();
            users.Add(user3);
            #endregion

            #region ActvitySignups
            activitySignups.Add(new ActivitySignup {
                Activity = madrona, User = user1, SignupDateTime = DateTime.UtcNow
            });
            activitySignups.Add(new ActivitySignup {
                Activity = madrona, User = user2, SignupDateTime = DateTime.UtcNow
            });
            activitySignups.Add(new ActivitySignup {
                Activity = madrona, User = user3, SignupDateTime = DateTime.UtcNow
            });
            #endregion

            #region TaskSignups
            int i = 0;
            foreach (var task in tasks.Where(t => t.Activity == madrona))
            {
                for (var j = 0; j < i; j++)
                {
                    taskSignups.Add(new TaskSignup()
                    {
                        Task = task, User = users[j], Status = Areas.Admin.Features.Tasks.TaskStatus.Assigned.ToString()
                    });
                }

                i = (i + 1) % users.Count;
            }
            _context.TaskSignups.AddRange(taskSignups);
            #endregion

            #region TennatContacts
            htb.OrganizationContacts.Add(new OrganizationContact {
                Contact = contacts.First(), Organization = htb, ContactType = 1                                                    /*Primary*/
            });
            #endregion

            #region Wrap Up DB
            _context.ActivitySignup.AddRange(activitySignups);
            _context.SaveChanges();
            #endregion
        }
Ejemplo n.º 2
0
        public static void InsertTestData(AllReadyContext dbContext)
        {
            _taskIdProvider.Reset();
            // Avoid polluting the database if there's already something in there.
            if (dbContext.Locations.Any() ||
                dbContext.Tenants.Any() ||
                dbContext.Tasks.Any() ||
                dbContext.Campaigns.Any() ||
                dbContext.Activities.Any() ||
                dbContext.Resources.Any())
            {
                return;
            }

            List <Tenant> tenants = new List <Tenant>();

            dbContext.PostalCodes.AddRange(GetPostalCodes(dbContext));
            dbContext.SaveChanges();
            List <Location>     locations  = GetLocations(dbContext);
            List <TaskUsers>    users      = new List <TaskUsers>();
            List <Activity>     activities = new List <Activity>();
            List <Campaign>     campaigns  = new List <Campaign>();
            List <AllReadyTask> tasks      = new List <AllReadyTask>();
            List <Resource>     resources  = new List <Resource>();

            #region Tenant
            Tenant htb = new Tenant()
            {
                Name      = "Humanitarian Toolbox",
                LogoUrl   = "http://www.htbox.org/upload/home/ht-hero.png",
                WebUrl    = "http://www.htbox.org",
                Campaigns = new List <Campaign>()
            };
            #endregion
            #region Campaign

            Campaign firePrev = new Campaign()
            {
                Name           = "Neighborhood Fire Prevention Days",
                ManagingTenant = htb
            };
            htb.Campaigns.Add(firePrev);
            Campaign smokeDet = new Campaign()
            {
                Name             = "Working Smoke Detectors Save Lives",
                ManagingTenant   = htb,
                StartDateTimeUtc = DateTime.Today.AddMonths(-1).ToUniversalTime(),
                EndDateTimeUtc   = DateTime.Today.AddMonths(1).ToUniversalTime()
            };
            htb.Campaigns.Add(smokeDet);
            Campaign financial = new Campaign()
            {
                Name           = "Everyday Financial Safety",
                ManagingTenant = htb
            };
            htb.Campaigns.Add(financial);
            Campaign safetyKit = new Campaign()
            {
                Name           = "Simple Safety Kit Building",
                ManagingTenant = htb
            };
            htb.Campaigns.Add(safetyKit);
            Campaign carSafe = new Campaign()
            {
                Name           = "Family Safety In the Car",
                ManagingTenant = htb
            };
            htb.Campaigns.Add(carSafe);
            Campaign escapePlan = new Campaign()
            {
                Name           = "Be Ready to Get Out: Have a Home Escape Plan",
                ManagingTenant = htb
            };
            htb.Campaigns.Add(escapePlan);
            #endregion
            #region Activity
            Activity queenAnne = new Activity()
            {
                Name             = "Queen Anne Fire Prevention Day",
                StartDateTimeUtc = new DateTime(2015, 7, 4, 10, 0, 0).ToUniversalTime(),
                EndDateTimeUtc   = new DateTime(2015, 7, 4, 15, 0, 0).ToUniversalTime(),
                Location         = GetRandom <Location>(locations),
                Tenant           = htb
            };
            queenAnne.Tasks = GetSomeTasks(queenAnne, htb);
            tasks.AddRange(queenAnne.Tasks);
            Activity ballard = new Activity()
            {
                Name             = "Ballard Fire Prevention Day",
                StartDateTimeUtc = new DateTime(2015, 7, 4, 10, 0, 0).ToUniversalTime(),
                EndDateTimeUtc   = new DateTime(2015, 7, 4, 14, 0, 0).ToUniversalTime(),
                Location         = GetRandom <Location>(locations),
                Tenant           = htb
            };
            ballard.Tasks = GetSomeTasks(ballard, htb);
            tasks.AddRange(ballard.Tasks);
            Activity madrona = new Activity()
            {
                Name             = "Madrona Fire Prevention Day",
                StartDateTimeUtc = new DateTime(2015, 7, 4, 10, 0, 0).ToUniversalTime(),
                EndDateTimeUtc   = new DateTime(2015, 7, 4, 14, 0, 0).ToUniversalTime(),
                Location         = GetRandom <Location>(locations),
                Tenant           = htb
            };
            madrona.Tasks = GetSomeTasks(madrona, htb);
            tasks.AddRange(madrona.Tasks);
            Activity southLoopSmoke = new Activity()
            {
                Name             = "Smoke Detector Installation and Testing-South Loop",
                StartDateTimeUtc = new DateTime(2015, 7, 6, 10, 0, 0).ToUniversalTime(),
                EndDateTimeUtc   = new DateTime(2015, 7, 11, 17, 0, 0).ToUniversalTime(),
                Location         = GetRandom <Location>(locations),
                Tenant           = htb
            };
            southLoopSmoke.Tasks = GetSomeTasks(southLoopSmoke, htb);
            tasks.AddRange(southLoopSmoke.Tasks);
            Activity northLoopSmoke = new Activity()
            {
                Name             = "Smoke Detector Installation and Testing-Near North Side",
                StartDateTimeUtc = new DateTime(2015, 7, 6, 10, 0, 0).ToUniversalTime(),
                EndDateTimeUtc   = new DateTime(2015, 7, 11, 17, 0, 0).ToUniversalTime(),
                Location         = GetRandom <Location>(locations),
                Tenant           = htb
            };
            northLoopSmoke.Tasks = GetSomeTasks(northLoopSmoke, htb);
            tasks.AddRange(northLoopSmoke.Tasks);
            Activity rentersInsurance = new Activity()
            {
                Name             = "Renters Insurance Education Door to Door and a bag of chips",
                Description      = "description for the win",
                StartDateTimeUtc = new DateTime(2015, 7, 11, 8, 0, 0).ToUniversalTime(),
                EndDateTimeUtc   = new DateTime(2015, 7, 11, 17, 0, 0).ToUniversalTime(),
                Location         = GetRandom <Location>(locations),
                Tenant           = htb
            };
            rentersInsurance.Tasks = GetSomeTasks(rentersInsurance, htb);
            tasks.AddRange(rentersInsurance.Tasks);
            Activity rentersInsuranceEd = new Activity()
            {
                Name             = "Renters Insurance Education Door to Door (woop woop)",
                Description      = "another great description",
                StartDateTimeUtc = new DateTime(2015, 7, 12, 8, 0, 0).ToUniversalTime(),
                EndDateTimeUtc   = new DateTime(2015, 7, 12, 17, 0, 0).ToUniversalTime(),
                Location         = GetRandom <Location>(locations),
                Tenant           = htb
            };
            rentersInsuranceEd.Tasks = GetSomeTasks(rentersInsuranceEd, htb);
            tasks.AddRange(rentersInsuranceEd.Tasks);
            Activity safetyKitBuild = new Activity()
            {
                Name             = "Safety Kit Assembly Volunteer Day",
                Description      = "Full day of volunteers building kits",
                StartDateTimeUtc = new DateTime(2015, 7, 11, 8, 0, 0).ToUniversalTime(),
                EndDateTimeUtc   = new DateTime(2015, 7, 11, 16, 30, 0).ToUniversalTime(),
                Location         = GetRandom <Location>(locations),
                Tenant           = htb
            };
            safetyKitBuild.Tasks = GetSomeTasks(safetyKitBuild, htb);
            tasks.AddRange(safetyKitBuild.Tasks);

            Activity safetyKitHandout = new Activity()
            {
                Name             = "Safety Kit Distribution Weekend",
                Description      = "Handing out kits at local fire stations",
                StartDateTimeUtc = new DateTime(2015, 7, 11, 8, 0, 0).ToUniversalTime(),
                EndDateTimeUtc   = new DateTime(2015, 7, 11, 16, 30, 0).ToUniversalTime(),
                Location         = GetRandom <Location>(locations),
                Tenant           = htb
            };
            safetyKitHandout.Tasks = GetSomeTasks(safetyKitHandout, htb);
            tasks.AddRange(safetyKitHandout.Tasks);
            Activity carSeatTest1 = new Activity()
            {
                Name             = "Car Seat Testing-Naperville",
                Description      = "Checking car seats at local fire stations after last day of school year",
                StartDateTimeUtc = new DateTime(2015, 7, 10, 9, 30, 0).ToUniversalTime(),
                EndDateTimeUtc   = new DateTime(2015, 7, 10, 15, 30, 0).ToUniversalTime(),
                Location         = GetRandom <Location>(locations),
                Tenant           = htb
            };
            carSeatTest1.Tasks = GetSomeTasks(carSeatTest1, htb);
            tasks.AddRange(carSeatTest1.Tasks);
            Activity carSeatTest2 = new Activity()
            {
                Name             = "Car Seat and Tire Pressure Checking Volunteer Day",
                Description      = "Checking those things all day at downtown train station parking",
                StartDateTimeUtc = new DateTime(2015, 7, 11, 8, 0, 0).ToUniversalTime(),
                EndDateTimeUtc   = new DateTime(2015, 7, 11, 19, 30, 0).ToUniversalTime(),
                Location         = GetRandom <Location>(locations),
                Tenant           = htb
            };
            carSeatTest2.Tasks = GetSomeTasks(carSeatTest2, htb);
            tasks.AddRange(carSeatTest2.Tasks);
            Activity homeFestival = new Activity()
            {
                Name             = "Park District Home Safety Festival",
                Description      = "At downtown park district(adjacent to pool)",
                StartDateTimeUtc = new DateTime(2015, 7, 11, 12, 0, 0).ToUniversalTime(),
                EndDateTimeUtc   = new DateTime(2015, 7, 11, 16, 30, 0).ToUniversalTime(),
                Location         = GetRandom <Location>(locations),
                Tenant           = htb
            };
            homeFestival.Tasks = GetSomeTasks(homeFestival, htb);
            tasks.AddRange(homeFestival.Tasks);
            Activity homeEscape = new Activity()
            {
                Name             = "Home Escape Plan Flyer Distribution",
                Description      = "Handing out flyers door to door in several areas of town after school/ work hours.Streets / blocks will vary but number of volunteers.",
                StartDateTimeUtc = new DateTime(2015, 7, 15, 15, 30, 0).ToUniversalTime(),
                EndDateTimeUtc   = new DateTime(2015, 7, 15, 20, 30, 0).ToUniversalTime(),
                Location         = GetRandom <Location>(locations),
                Tenant           = htb
            };
            homeEscape.Tasks = GetSomeTasks(homeEscape, htb);
            tasks.AddRange(homeEscape.Tasks);
            #endregion
            #region Link campaign and activity
            firePrev.Activities = new List <Activity>();
            firePrev.Activities.Add(queenAnne);
            firePrev.Activities.Add(ballard);
            firePrev.Activities.Add(madrona);
            smokeDet.Activities = new List <Activity>();
            smokeDet.Activities.Add(southLoopSmoke);
            smokeDet.Activities.Add(northLoopSmoke);
            financial.Activities = new List <Activity>();
            financial.Activities.Add(rentersInsurance);
            financial.Activities.Add(rentersInsuranceEd);
            safetyKit.Activities = new List <Activity>();
            safetyKit.Activities.Add(safetyKitBuild);
            safetyKit.Activities.Add(safetyKitHandout);
            carSafe.Activities = new List <Activity>();
            carSafe.Activities.Add(carSeatTest1);
            carSafe.Activities.Add(carSeatTest2);
            escapePlan.Activities = new List <Activity>();
            escapePlan.Activities.Add(homeFestival);
            escapePlan.Activities.Add(homeEscape);
            #endregion
            #region Add Campaigns and Activities
            tenants.Add(htb);
            campaigns.Add(firePrev);
            campaigns.Add(smokeDet);
            campaigns.Add(financial);
            campaigns.Add(escapePlan);
            campaigns.Add(safetyKit);
            campaigns.Add(carSafe);

            activities.AddRange(firePrev.Activities);
            activities.AddRange(smokeDet.Activities);
            activities.AddRange(financial.Activities);
            activities.AddRange(escapePlan.Activities);
            activities.AddRange(safetyKit.Activities);
            activities.AddRange(carSafe.Activities);
            #endregion

            #region Insert Resource items into Resources
            resources.Add(new Resource
            {
                Id               = 1,
                Name             = "allReady Partner Name",
                Description      = "allready Partner Description",
                PublishDateBegin = DateTime.Today,
                PublishDateEnd   = DateTime.Today.AddDays(14),
                MediaUrl         = "",
                ResourceUrl      = "",
                CategoryTag      = "Partners"
            });
            resources.Add(new Resource
            {
                Id               = 2,
                Name             = "allReady Partner Name 2",
                Description      = "allready Partner Description 2",
                PublishDateBegin = DateTime.Today.AddDays(-3),
                PublishDateEnd   = DateTime.Today.AddDays(-1),
                MediaUrl         = "",
                ResourceUrl      = "",
                CategoryTag      = "Partners"
            });
            #endregion

            #region Insert into DB
            dbContext.Locations.AddRange(locations);
            dbContext.Tenants.AddRange(tenants);
            dbContext.Tasks.AddRange(tasks);
            dbContext.Campaigns.AddRange(campaigns);
            dbContext.Activities.AddRange(activities);
            dbContext.Resources.AddRange(resources);
            dbContext.SaveChanges();
            #endregion
        }