public void SetHasPrivacyPolicyToTrue_WhenEventsCampaignsOrganizationsPrivacyPolicyIsNotNullOrEmpty_AndConstructingWithNonNullCampaignAndNonNullManagingOrganization()
        {
            var @event = new Models.Event { Campaign = new Models.Campaign { ManagingOrganization = new Organization { PrivacyPolicy = "PrivacyPolicy" }}};
            var sut = new EventViewModel(@event);

            Assert.True(sut.HasPrivacyPolicy);
        }
 public Models.Event GetEvent(string login, string passHash)
 {
     Login = login;
     PassHash = passHash;
     Evt = new Models.Event();
     this.ShowDialog();
     return Evt;
 }
        public void SetOrganizationIdAndOrganizationName_WhenConstructingWithNonNullCampaignAndNonNullManagingOrganization()
        {
            var campaign = new Models.Campaign { ManagingOrganization = new Organization { Id = 1, Name = "OrgName" }};
            var @event = new Models.Event { Campaign = campaign };
            var sut = new EventViewModel(@event);

            Assert.Equal(sut.OrganizationId, campaign.ManagingOrganization.Id);
            Assert.Equal(sut.OrganizationName, campaign.ManagingOrganization.Name);
        }
        public void SetCampaignIdCampaignNameAndTimeZoneId_WhenConstructingWithNonNullCampaign()
        {
            var campaign = new Models.Campaign { Id = 1, Name = "Campaignname", TimeZoneId = "CampaignTimeZoneId" };
            var @event = new Models.Event { Campaign = campaign };
            var sut = new EventViewModel(@event);

            Assert.Equal(sut.CampaignId, campaign.Id);
            Assert.Equal(sut.CampaignName, campaign.Name);
            Assert.Equal(sut.TimeZoneId, campaign.TimeZoneId);
        }
        protected override void LoadTestData()
        {
            var ev = new Models.Event { Name = "Some Event" };

            var dbSet = Context.Events;
            dbSet.Add(ev);


            Context.SaveChanges();
        }
 public void WhenEventCampaignIsLockedReturnsNull()
 {
     var showEventCommand = new ShowEventQuery { EventId = 1 };
     var mockDbAccess = new Mock<IAllReadyDataAccess>();
     var expectedEvent = new Models.Event { Campaign = new Campaign { Locked = true } };
     mockDbAccess.Setup(x => x.GetEvent(showEventCommand.EventId))
                 .Returns(expectedEvent);
     var sut = new ShowEventQueryHandler(mockDbAccess.Object, null, null);
     var viewModel = sut.Handle(showEventCommand);
     viewModel.ShouldBeNull();
 }
 public void HappyPath()
 {
     var showEventCommand = new ShowEventQuery { EventId = 1, User = ClaimsPrincipal.Current };
     var mockDbAccess = new Mock<IAllReadyDataAccess>();
     var expectedEvent = new Models.Event { Campaign = new Campaign { Locked = false } };
     mockDbAccess.Setup(x => x.GetEvent(showEventCommand.EventId))
                 .Returns(expectedEvent);
     var sut = new ShowEventQueryHandler(mockDbAccess.Object, null, null);
     var viewModel = sut.Handle(showEventCommand);
     viewModel.ShouldNotBeNull();
 }
예제 #8
0
        protected override void LoadTestData()
        {
            Context.Users.Add(new ApplicationUser { Id = "abc" });

            var campaignEvent = new Models.Event { Id = 1, Name = "Some Event" };
            Context.Events.Add(campaignEvent);

            Context.Tasks.Add(new AllReadyTask { Id = 1, Name = "Closed Task", EndDateTime = DateTime.UtcNow.AddDays(-100), Event = campaignEvent });
            Context.Tasks.Add(new AllReadyTask { Id = 2, Name = "Open Task", EndDateTime = DateTime.UtcNow.AddDays(100), Event = campaignEvent });

            Context.SaveChanges();
        }
        public void SetLocationToNewLocationViewModelWithCorrectData_WhenEventsLocationIsNotNull_AndConstructingWithNonNullCampaignAndNonNullManagingOrganization()
        {
            var location = new Location { Address1 = "Address1", Address2 = "Address2", City = "City", State = "State", PostalCode = "PostalCode", Country = "Country" };
            var @event = new Models.Event { Location = location };
            var sut = new EventViewModel(@event);

            Assert.Equal(sut.Location.Address1, location.Address1);
            Assert.Equal(sut.Location.Address2, location.Address2);
            Assert.Equal(sut.Location.City, location.City);
            Assert.Equal(sut.Location.State, location.State);
            Assert.Equal(sut.Location.PostalCode, location.PostalCode);
            Assert.Equal(sut.Location.Country, location.Country);
        }
        protected override void LoadTestData()
        {
            var context = ServiceProvider.GetService<AllReadyContext>();

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

            var firePrev = new Campaign()
            {
                Name = "Neighborhood Fire Prevention Days",
                ManagingOrganization = htb
            };

            var queenAnne = new Models.Event()
            {
                Id = 1,
                Name = "Queen Anne Fire Prevention Day",
                Campaign = firePrev,
                CampaignId = firePrev.Id,
                StartDateTime = new DateTime(2015, 7, 4, 10, 0, 0).ToUniversalTime(),
                EndDateTime = new DateTime(2015, 12, 31, 15, 0, 0).ToUniversalTime(),
                Location = new Location { Id = 1 },
                RequiredSkills = new List<EventSkill>(),
            };

            var username1 = $"*****@*****.**";
            var username2 = $"*****@*****.**";

            var user1 = new ApplicationUser { UserName = username1, Email = username1, EmailConfirmed = true };
            context.Users.Add(user1);
            var user2 = new ApplicationUser { UserName = username2, Email = username2, EmailConfirmed = true };
            context.Users.Add(user2);

            htb.Campaigns.Add(firePrev);
            context.Organizations.Add(htb);
            context.Events.Add(queenAnne);

            var eventSignups = new List<EventSignup>();
            eventSignups.Add(new EventSignup { Event = queenAnne, User = user1, SignupDateTime = DateTime.UtcNow });
            eventSignups.Add(new EventSignup { Event = queenAnne, User = user2, SignupDateTime = DateTime.UtcNow });

            context.EventSignup.AddRange(eventSignups);
            context.SaveChanges();
        }
        protected override void LoadTestData()
        {
            var user = new ApplicationUser { Id = "abc" };
            Context.Users.Add(user);

            var campaignEvent = new Models.Event { Id = 1, Name = "Some Event" };
            Context.Events.Add(campaignEvent);

            var task = new AllReadyTask { Id = 1, Name = "Some Task", EndDateTime = DateTime.UtcNow.AddDays(100), Event = campaignEvent };
            Context.Tasks.Add(task);
           
            Context.TaskSignups.Add(new TaskSignup { Task = task, User = user });
        
            Context.SaveChanges();
        }
        public void SetRequiredSkillsToListOfSkillViewModelsForEventsRequiredSkills_WhenEventsRequiredSkillsIsNotNull()
        {
            var @event = new Models.Event {
                RequiredSkills = new List <EventSkill> {
                    new EventSkill {
                        Skill = new Skill()
                    }, new EventSkill {
                        Skill = new Skill()
                    }
                }
            };
            var sut = new EventViewModel(@event);

            Assert.IsType <List <SkillViewModel> >(sut.RequiredSkills);
            Assert.True(sut.RequiredSkills.Count > 0);
        }
        public void SetTasksToListOfTaskViewModelsInAscendingOrderByStartDateTime_WhenEventsTasksAreNotNull()
        {
            var @event = new Models.Event {
                Tasks = new List <AllReadyTask> {
                    new AllReadyTask {
                        StartDateTime = DateTimeOffset.UtcNow.AddDays(2)
                    }, new AllReadyTask {
                        StartDateTime = DateTimeOffset.UtcNow.AddDays(1)
                    }
                }
            };
            var sut = new EventViewModel(@event);

            Assert.IsType <List <TaskViewModel> >(sut.Tasks);
            Assert.Equal(sut.Tasks.IsOrderedByAscending(x => x.StartDateTime), true);
        }
예제 #14
0
        public async Task <ActionResult> UpdateEvent(Models.Event eventModel)
        {
            if (ModelState.IsValid)
            {
                var result = await eventService.UpdateEvent(eventModel);

                if (result == null)
                {
                    return(NotFound());
                }

                return(Ok(result));
            }

            return(BadRequest());
        }
예제 #15
0
        public ActionResult CompanySubmitEvent(Models.Event e)
        {
            Company c = (Company)HttpContext.Session["currentCompany"];

            e.CompanyId = c.ID;

            bool success = _securityService.CompanySubmitEvent(e);

            if (success)
            {
                return(View("CompanyEventCreationSuccess", e));
            }
            else
            {
                return(View("EventCreationFailed"));
            }
        }
예제 #16
0
        public ActionResult SubmitEvent(Models.Event e)
        {
            int currentUsersCompanyID = _securityService.FetchAssociatedCompanyID((User)HttpContext.Session["currentUser"]);

            e.CompanyId = currentUsersCompanyID;

            bool success = _securityService.SubmitEvent(e);

            if (success)
            {
                return(View("EventCreationSuccess", e));
            }
            else
            {
                return(View("EventCreationFailed"));
            }
        }
        public async Task <Models.Event> GetGeoCode(Models.Event groupChatEvent)
        {
            string     address    = GoogleAddressParser(groupChatEvent);
            Uri        geocodeURL = new Uri("https://maps.googleapis.com/maps/api/geocode/json?address=" + address + "&key=" + API_KEYS.googleMapsApi);
            HttpClient httpClient = new HttpClient();
            var        response   = await httpClient.GetAsync(geocodeURL);

            if (response.IsSuccessStatusCode)
            {
                var     task     = response.Content.ReadAsStringAsync().Result;
                JObject mapsData = JsonConvert.DeserializeObject <JObject>(task);
                groupChatEvent.Latitude  = Convert.ToDecimal(mapsData["results"][0]["geometry"]["location"]["lat"]);
                groupChatEvent.Longitude = Convert.ToDecimal(mapsData["results"][0]["geometry"]["location"]["lng"]);
            }

            return(groupChatEvent);
        }
예제 #18
0
        public async Task <IActionResult> OnPostAsync(Guid?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Event = await _context.Event.FindAsync(id);

            if (Event != null)
            {
                _context.Event.Remove(Event);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
예제 #19
0
        public static async System.Threading.Tasks.Task <System.Collections.Generic.List <Models.Event> > FetchEventsAsync()
        {
            // Create an HTTP web request using the URL:
            System.Net.HttpWebRequest request = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(new Uri(url1 + "events"));
            request.ContentType = "application/json";
            request.Method      = "GET";

            // Send the request to the server and wait for the response:
            using (System.Net.WebResponse response = await request.GetResponseAsync())
            {
                // Get a stream representation of the HTTP web response:
                using (Stream stream = response.GetResponseStream())
                {
                    // Use this stream to build a JSON document object:
                    System.Json.JsonValue jsonDoc = await System.Threading.Tasks.Task.Run(() => System.Json.JsonObject.Load(stream));

                    Console.Out.WriteLine("Response: {0}", jsonDoc.ToString());

                    // Return the JSON document:
                    System.Collections.Generic.List <Models.Event> lista = new System.Collections.Generic.List <Models.Event>();
                    for (int i = 0; i != jsonDoc.Count; i++)
                    {
                        Models.Event e = new Models.Event
                        {
                            Name        = jsonDoc[i]["Name"],
                            Id          = Int32.Parse(jsonDoc[i]["Id"].ToString()),
                            Description = jsonDoc[i]["Description"],
                            Place       = jsonDoc[i]["Place"]
                        };

                        var      start     = double.Parse(jsonDoc[i]["StartDate"].ToString().Replace('/', ' ').Replace('"', ' ').Replace(')', ' ').Replace("Date(", "").Trim());
                        TimeSpan time      = TimeSpan.FromMilliseconds(start);
                        DateTime startdate = new DateTime(1970, 1, 1) + time;

                        e.StartDate = startdate;
                        var      end     = double.Parse(jsonDoc[i]["EndDate"].ToString().Replace('/', ' ').Replace('"', ' ').Replace(')', ' ').Replace("Date(", "").Trim());
                        TimeSpan time1   = TimeSpan.FromMilliseconds(start);
                        DateTime enddate = new DateTime(1970, 1, 1) + time;

                        e.EndDate = enddate;
                        lista.Add(e);
                    }
                    return(lista);
                }
            }
        }
        public ActionResult CreateUserAndDraw(Models.User user)
        {
            Models.Admin a_user         = (Models.Admin)Session["admin"];
            Models.Event luckydrawevent = (Models.Event)Session["event"];

            if (a_user == null || luckydrawevent == null)
            {
                return(RedirectToAction("AdminIndex", "Login"));
            }

            if (user != null)
            {
                if (DuplicateUserExists(user))
                {
                    return(Json(new
                    {
                        success = false,
                        draw = -1,
                        message = "This unit has already been purchased by another buyer!"
                    }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    Tuple <int, int> results = CreateNewUser(user, luckydrawevent.EventID);

                    return(Json(new
                    {
                        success = true,
                        draw = results,
                        urllink = Url.Action("LuckyDrawAnimation", "Home", new { id = results.Item1 }, "https"),
                        message = user.Name.ToUpper() + " has been registered successfully!"
                    }, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                response_message = "User is null!";

                return(Json(new
                {
                    success = false,
                    draw = -1,
                    message = user.Name.ToUpper() + " cannot be registered! Error: " + response_message
                }, JsonRequestBehavior.AllowGet));
            }
        }
예제 #21
0
        public static async Task <IActionResult> Run(
            [HttpTrigger(AuthorizationLevel.Function, "post", Route = null)] HttpRequest req,
            Binder binder,
            ILogger log)
        {
            log.LogInformation("C# HTTP trigger function processed a request.");

            var requestBody = await new StreamReader(req.Body).ReadToEndAsync();
            var data        = JsonConvert.DeserializeObject <Model>(requestBody);

            if (data.Year == default(int))
            {
                return(new BadRequestObjectResult("Please provide year"));
            }
            if (data.WeekNumber == default(int))
            {
                return(new BadRequestObjectResult("Please provide year"));
            }

            if (string.IsNullOrEmpty(data.Title))
            {
                return(new BadRequestObjectResult("Please provide event title"));
            }
            if (string.IsNullOrEmpty(data.Description))
            {
                return(new BadRequestObjectResult("Please provide event description"));
            }
            if (string.IsNullOrEmpty(data.ImageUrl))
            {
                return(new BadRequestObjectResult("Please provide event image url"));
            }

            var newEvent = new Models.Event();

            newEvent.Title       = data.Title;
            newEvent.Description = data.Description;
            newEvent.ImageUrl    = data.ImageUrl;

            var week = Models.Week.FromYearAndWeekNumber(data.Year, data.WeekNumber);

            var repository = new WeeklyActivityRepository(week, binder, log);

            await repository.Update(x => x.AddEvent(newEvent));

            return(new StatusCodeResult(201));
        }
예제 #22
0
        public async Task <Models.Event> CreateEvent(EventDTO eventModel)
        {
            var _event = new Models.Event()
            {
                Name          = eventModel.Name,
                Description   = eventModel.Description,
                CreationDate  = DateTime.Now,
                StartDate     = eventModel.StartDate,
                LastDate      = eventModel.LastDate,
                CreatorUserId = eventModel.CreatorUserId
            };
            await context.Events.AddAsync(_event);

            await context.SaveChangesAsync();

            return(_event);
        }
예제 #23
0
        public void SetLocationToNewLocationViewModelWithCorrectData_WhenEventsLocationIsNotNull_AndConstructingWithNonNullCampaignAndNonNullManagingOrganization()
        {
            var location = new Location {
                Address1 = "Address1", Address2 = "Address2", City = "City", State = "State", PostalCode = "PostalCode", Country = "Country"
            };
            var @event = new Models.Event {
                Location = location
            };
            var sut = new EventViewModel(@event);

            Assert.Equal(sut.Location.Address1, location.Address1);
            Assert.Equal(sut.Location.Address2, location.Address2);
            Assert.Equal(sut.Location.City, location.City);
            Assert.Equal(sut.Location.State, location.State);
            Assert.Equal(sut.Location.PostalCode, location.PostalCode);
            Assert.Equal(sut.Location.Country, location.Country);
        }
예제 #24
0
        public void Add_Event_should_return_one()
        {
            var testEvent = new Models.Event
            {
                Start          = DateTime.UtcNow,
                End            = DateTime.UtcNow.AddDays(1),
                Name           = "UnitTest",
                Id             = Guid.NewGuid().ToString(),
                Place          = "Pernik",
                TotalTickets   = 100,
                PricePerTicket = 1
            };

            eventsService.Setup(x => x.AddEvent(testEvent, null)).Returns(1);

            Assert.Equal("1", eventsService.Object.AddEvent(testEvent, null).ToString());
        }
예제 #25
0
        public EventViewModel(Models.Event @event)
        {
            Id = @event.Id;
            if (@event.Campaign != null)
            {
                CampaignId   = @event.Campaign.Id;
                CampaignName = @event.Campaign.Name;
                TimeZoneId   = @event.Campaign.TimeZoneId;
                if (@event.Campaign.ManagingOrganization != null)
                {
                    OrganizationId   = @event.Campaign.ManagingOrganization.Id;
                    OrganizationName = @event.Campaign.ManagingOrganization.Name;
                    HasPrivacyPolicy = !string.IsNullOrEmpty(@event.Campaign.ManagingOrganization.PrivacyPolicy);
                }
            }

            Title         = @event.Name;
            Description   = @event.Description;
            EventType     = @event.EventType;
            StartDateTime = @event.StartDateTime;
            EndDateTime   = @event.EndDateTime;

            if (@event.Location != null)
            {
                Location = new LocationViewModel(@event.Location);
            }

            IsClosed = EndDateTime.UtcDateTime < DateTimeOffset.UtcNow;

            ImageUrl = @event.ImageUrl;

            Tasks = @event.Tasks != null
                 ? new List <TaskViewModel>(@event.Tasks.Select(data => new TaskViewModel(data)).OrderBy(task => task.StartDateTime))
                 : new List <TaskViewModel>();

            SignupModel = new EventSignupViewModel();

            //mgmccarthy: this check doesn't make much sense unless you explicitly set @event.RequiredSkills to null. If you look at the Event model, you'll see that RequireSkills is instaniated with
            //a new empty list: "public List<EventSkill> RequiredSkills { get; set; } = new List<EventSkill>();". I think this can go away?
            RequiredSkills = @event.RequiredSkills?.Select(ek => new SkillViewModel(ek.Skill)).ToList();

            IsLimitVolunteers = @event.IsLimitVolunteers;
            IsAllowWaitList   = @event.IsAllowWaitList;
            Headline          = @event.Headline;
        }
        public void FiltersEventsCorrectly()
        {
            var may  = new DateTimeOffset(2016, 5, 1, 0, 0, 0, new TimeSpan());
            var june = new DateTimeOffset(2016, 6, 1, 0, 0, 0, new TimeSpan());

            var message = new EventByDateRangeQuery {
                StartDate = may, EndDate = june
            };
            var dataAccess = new Mock <IAllReadyDataAccess>();

            var inRange = new Models.Event {
                Id = 2, StartDateTime = may, EndDateTime = june
            };
            var startBeforeRangeEndsInRange = new Models.Event {
                Id = 1, StartDateTime = may.AddMonths(-1), EndDateTime = june
            };
            var startInRangeEndsAfterRange = new Models.Event {
                Id = 3, StartDateTime = may, EndDateTime = june.AddMonths(1)
            };
            var startsAndEndsAfterRange = new Models.Event {
                Id = 4, StartDateTime = may.AddMonths(2), EndDateTime = june.AddMonths(2)
            };
            var startsAndEndsBeforRange = new Models.Event {
                Id = 0, StartDateTime = may.AddMonths(-2), EndDateTime = june.AddMonths(-2)
            };

            var events = new List <Models.Event>
            {
                startsAndEndsBeforRange,
                startBeforeRangeEndsInRange,
                inRange,
                startInRangeEndsAfterRange,
                startsAndEndsAfterRange,
            };

            dataAccess.Setup(x => x.Events).Returns(events);

            var sut    = new EventByDateRangeQueryHandler(dataAccess.Object);
            var result = sut.Handle(message).ToArray();

            Assert.Equal(3, result.Length);
            Assert.Equal(1, result[0].Id);
            Assert.Equal(2, result[1].Id);
            Assert.Equal(3, result[2].Id);
        }
예제 #27
0
        private Data.Event _Map(Models.Event evnt)
        {
            var data = new Data.Event {
                ID          = evnt.Id,
                Title       = evnt.Title,
                StartDate   = evnt.StartDate,
                EndDate     = evnt.EndDate,
                Type_ID     = evnt.Type_ID,
                Description = evnt.Description,
                Owner_ID    = evnt.Owner_ID,
                Logo_Path   = evnt.Logo_Path,
                Location    = evnt.Location,
                Status      = evnt.Status,
                Category_ID = 1
            };

            return(data);
        }
예제 #28
0
        // GET: Tournaments
        public async Task <ActionResult> Index()
        {
            var pubg = new Models.Event()
            {
                Categories = Models.Categories.PUBGM,
                TitleEvent = "TURNAMEN PUBG MOBILE - AIROKES SEASON 1"
            };
            var ml = new Models.Event()
            {
                Categories = Models.Categories.ML,
                TitleEvent = "TURNAMEN MOBILE LEGENDS - WKS PROJECT SEASON 7"
            };
            var listEvents = new List <Models.Event>();

            listEvents.Add(ml);
            listEvents.Add(pubg);
            return(View(listEvents));
        }
예제 #29
0
        private static List<Models.Event> GetEvents(DateTimeOffset may, DateTimeOffset june)
        {
            var inRange = new Models.Event { StartDateTime = may, EndDateTime = june };
            var startBeforeRangeEndsInRange = new Models.Event { StartDateTime = may.AddMonths(-1), EndDateTime = june };
            var startInRangeEndsAfterRange = new Models.Event { StartDateTime = may, EndDateTime = june.AddMonths(1) };
            var startsAndEndsAfterRange = new Models.Event { StartDateTime = may.AddMonths(2), EndDateTime = june.AddMonths(2) };
            var startsAndEndsBeforRange = new Models.Event { StartDateTime = may.AddMonths(-2), EndDateTime = june.AddMonths(-2) };

            var events = new List<Models.Event>
            {
                startsAndEndsBeforRange,
                startBeforeRangeEndsInRange,
                inRange,
                startInRangeEndsAfterRange,
                startsAndEndsAfterRange,
            };
            return events;
        }
예제 #30
0
        public async Task LogCustomEventAsync(string actingUserId, string customData)
        {
            var loginEvent = new Models.Event();

            loginEvent.DateTime    = DateTime.UtcNow;
            loginEvent.Type        = Enums.EventType.CustomEvent.ToString();
            loginEvent.ActedByUser = actingUserId;
            loginEvent.Data        = customData;

            await _dbContext.Events.AddAsync(loginEvent);

            var updatedRowCount = await _dbContext.SaveChangesAsync();

            if (updatedRowCount > 1)
            {
                // we have a problem
            }
        }
예제 #31
0
        public void InvokeGetEventSignupsWithCorrectParameters_WhenEventIsNotNullAndEventsCampaignIsUnlocked()
        {
            const string userId = "1";
            var message = new ShowEventQuery { User = new ClaimsPrincipal() };
            var @event = new Models.Event { Campaign = new Campaign { Locked = false }};

            var dataAccess = new Mock<IAllReadyDataAccess>();
            dataAccess.Setup(x => x.GetEvent(It.IsAny<int>())).Returns(@event);
            dataAccess.Setup(x => x.GetUser(It.IsAny<string>())).Returns(new ApplicationUser());

            var userManager = CreateUserManagerMock();
            userManager.Setup(x => x.GetUserId(It.IsAny<ClaimsPrincipal>())).Returns(userId);

            var sut = new ShowEventQueryHandler(dataAccess.Object, userManager.Object);
            sut.Handle(message);

            dataAccess.Verify(x => x.GetEventSignups(@event.Id, userId), Times.Once);
        }
        private static List<Models.Event> GetEvents(DateTimeOffset may, DateTimeOffset june)
        {
            var inRange = new Models.Event { StartDateTime = may, EndDateTime = june };
            var startBeforeRangeEndsInRange = new Models.Event { StartDateTime = may.AddMonths(-1), EndDateTime = june };
            var startInRangeEndsAfterRange = new Models.Event { StartDateTime = may, EndDateTime = june.AddMonths(1) };
            var startsAndEndsAfterRange = new Models.Event { StartDateTime = may.AddMonths(2), EndDateTime = june.AddMonths(2) };
            var startsAndEndsBeforRange = new Models.Event { StartDateTime = may.AddMonths(-2), EndDateTime = june.AddMonths(-2) };

            var events = new List<Models.Event>
            {
                startsAndEndsBeforRange,
                startBeforeRangeEndsInRange,
                inRange,
                startInRangeEndsAfterRange,
                startsAndEndsAfterRange,
            };
            return events;
        }
예제 #33
0
        public void ConstructEventViewModel_WithTheCorrectData()
        {
            var campaign = new Models.Campaign { Id = 1, Name = "Campaignname", TimeZoneId = "CampaignTimeZoneId" };
            var location = new AllReady.ViewModels.Shared.LocationViewModel { City = "Amsterdam" };
            var skills = new List<SkillViewModel>() { new SkillViewModel { Name = "F sharp" } };
            var userSkills = new List<SkillViewModel> { new SkillViewModel { Name = "Medic", Description = "first aid helper", HierarchicalName = "med01", Id = 1 } };
            var signup =  new AllReady.ViewModels.Shared.TaskSignupViewModel() { Name = "task1", TaskId = 1 };
            var @event = new Models.Event { Campaign = campaign, TimeZoneId = "EventTimeZoneId" };
           
            var sut = new EventViewModel(@event);
            var task = new TaskViewModel { CampaignName = sut.CampaignName, CampaignId = sut.CampaignId, eventName = sut.Title, Name = "tasks" };
            var tasks = new List<TaskViewModel> { task };
          
            sut.Description = "Testing the allReady from htbox";
            sut.EndDateTime = DateTimeOffset.Now.AddDays(3650);
            sut.EventType = EventType.Rally;
            sut.HasPrivacyPolicy = false;
            sut.Headline = "the Already test campaing";
            sut.Id = 1;
            sut.ImageUrl = "http://www.htbox.org/";
            sut.IsAllowWaitList = false;
            sut.IsClosed = false;
            sut.IsLimitVolunteers = true;
            sut.Location = location;
            sut.OrganizationId = 1;
            sut.OrganizationName = "TestOrg";
            sut.RequiredSkills = skills;
            sut.SignupModel = signup;
            sut.StartDateTime = DateTimeOffset.Now.AddDays(365);
            sut.Tasks = tasks;
            sut.TimeZoneId = "US Mountain Standard Time";
            sut.Title = "Test Event";
            sut.UserId = "99";
            sut.UserSkills = userSkills;
            sut.UserTasks = tasks;

            Assert.Equal(sut.CampaignId, campaign.Id);
            Assert.Equal(sut.CampaignName, campaign.Name);
            Assert.Equal(sut.Location, location);
            Assert.Equal(sut.UserSkills, userSkills);
            Assert.Equal(sut.UserTasks, tasks);
            Assert.Equal(sut.SignupModel, signup);
            Assert.Equal(sut.RequiredSkills, skills);
        }
예제 #34
0
        public void HappyPath()
        {
            var showEventCommand = new ShowEventQuery {
                EventId = 1, User = ClaimsPrincipal.Current
            };
            var mockDbAccess  = new Mock <IAllReadyDataAccess>();
            var expectedEvent = new Models.Event {
                Campaign = new Campaign {
                    Locked = false
                }
            };

            mockDbAccess.Setup(x => x.GetEvent(showEventCommand.EventId))
            .Returns(expectedEvent);
            var sut       = new ShowEventQueryHandler(mockDbAccess.Object);
            var viewModel = sut.Handle(showEventCommand);

            viewModel.ShouldNotBeNull();
        }
예제 #35
0
        public Event AddEvent(Models.Event @event)
        {
            var dbNewEvent = new Event()
            {
                Name           = @event.Name,
                Description    = @event.Description,
                Avatar         = @event.Avatar,
                EventDate      = @event.EventDate,
                AddedDate      = @event.AddedDate,
                OrganisationId = @event.OrganisationId
            };

            _copDbContext.Add(dbNewEvent);
            _copDbContext.SaveChanges();

            return(_copDbContext.Events
                   .Include(e => e.organisation)
                   .SingleOrDefault(e => e.Id == dbNewEvent.Id));
        }
예제 #36
0
        /// <summary>
        /// Logs a project archive event
        /// </summary>
        /// <param name="projectId">The ID of the project to archive</param>
        /// <param name="actingUserId">The id of the ApplicationUser performing the action</param>
        /// <param name="remoteIpAddress">The IP address of the user calling the action</param>
        /// <returns>A Task result</returns>
        public async Task LogArchiveProjectEventAsync(int projectId, int actingUserId, string remoteIpAddress)
        {
            var archiveEvent = new Models.Event();

            archiveEvent.DateTime        = DateTime.UtcNow;
            archiveEvent.Type            = Enums.EventType.ArchiveProject.ToString();
            archiveEvent.RemoteIpAddress = remoteIpAddress;
            archiveEvent.ActedByUser     = actingUserId.ToString();
            archiveEvent.ProjectId       = projectId;

            await _dbContext.Events.AddAsync(archiveEvent);

            var updatedRowCount = await _dbContext.SaveChangesAsync();

            if (updatedRowCount > 1)
            {
                // we have a problem
            }
        }
예제 #37
0
        private Models.Event _Map(Data.Event source)
        {
            var model = new Models.Event
            {
                Id          = source.ID,
                Title       = source.Title,
                StartDate   = source.StartDate,
                EndDate     = source.EndDate,
                Type_ID     = source.Type_ID,
                Description = source.Description,
                Owner_ID    = source.Owner_ID,
                Logo_Path   = source.Logo_Path,
                Location    = source.Location,
                Status      = source.Status,
                Category_ID = 1,
            };

            return(model);
        }
예제 #38
0
        public void WhenEventCampaignIsLockedReturnsNull()
        {
            var showEventCommand = new ShowEventQuery {
                EventId = 1
            };
            var mockDbAccess  = new Mock <IAllReadyDataAccess>();
            var expectedEvent = new Models.Event {
                Campaign = new Campaign {
                    Locked = true
                }
            };

            mockDbAccess.Setup(x => x.GetEvent(showEventCommand.EventId))
            .Returns(expectedEvent);
            var sut       = new ShowEventQueryHandler(mockDbAccess.Object);
            var viewModel = sut.Handle(showEventCommand);

            viewModel.ShouldBeNull();
        }
        public ActionResult ModifyUser(Models.User user)
        {
            Models.Admin a_user         = (Models.Admin)Session["admin"];
            Models.Event luckydrawevent = (Models.Event)Session["event"];

            if (a_user == null || luckydrawevent == null)
            {
                return(RedirectToAction("AdminIndex", "Login"));
            }

            if (user != null)
            {
                if (DuplicateUserExistsForModification(user))
                {
                    return(Json(new
                    {
                        success = false,
                        message = "This unit has already been purchased by another buyer!"
                    }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    ModifyExistingUser(user, luckydrawevent.EventID);
                    return(Json(new
                    {
                        success = true,
                        url = Url.Action("Users", "Admin"),
                        message = user.Name.ToUpper() + " has been successfully modified!"
                    }, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                response_message = "User is null!";

                return(Json(new
                {
                    success = false,
                    draw = -1,
                    message = user.Name.ToUpper() + " cannot be modified! Error: " + response_message
                }, JsonRequestBehavior.AllowGet));
            }
        }
        public ActionResult StaffLuckyDraw()
        {
            Models.Admin a_user         = (Models.Admin)Session["admin"];
            Models.Event luckydrawevent = (Models.Event)Session["event"];

            if (a_user == null || luckydrawevent == null)
            {
                return(RedirectToAction("AdminIndex", "Login"));
            }

            if (luckydrawevent == null)
            {
                return(RedirectToAction("Index", "Login"));
            }

            ViewBag.Name = a_user.Name;

            return(View());
        }
        public ActionResult LuckyDrawAnimation(int id)
        {
            Models.Admin a_user         = (Models.Admin)Session["admin"];
            Models.Event luckydrawevent = (Models.Event)Session["event"];

            if (a_user == null || luckydrawevent == null)
            {
                return(RedirectToAction("AdminIndex", "Login"));
            }


            Models.User user = GetUser(id);

            ViewBag.Name        = a_user.Name;
            ViewBag.WinnerName  = user.Name;
            ViewBag.WinnerPrize = user.PrizeWon;

            return(View());
        }
예제 #42
0
        public EventViewModel(Models.Event campaignEvent)
        {
            Id = campaignEvent.Id;
            if (campaignEvent.Campaign != null)
            {
                CampaignId   = campaignEvent.Campaign.Id;
                CampaignName = campaignEvent.Campaign.Name;
                TimeZoneId   = campaignEvent.Campaign.TimeZoneId;
                if (campaignEvent.Campaign.ManagingOrganization != null)
                {
                    OrganizationId   = campaignEvent.Campaign.ManagingOrganization.Id;
                    OrganizationName = campaignEvent.Campaign.ManagingOrganization.Name;
                    HasPrivacyPolicy = !string.IsNullOrEmpty(campaignEvent.Campaign.ManagingOrganization.PrivacyPolicy);
                }
            }

            Title         = campaignEvent.Name;
            Description   = campaignEvent.Description;
            EventType     = campaignEvent.EventType;
            StartDateTime = campaignEvent.StartDateTime;
            EndDateTime   = campaignEvent.EndDateTime;

            if (campaignEvent.Location != null)
            {
                Location = new LocationViewModel(campaignEvent.Location);
            }

            IsClosed = EndDateTime.UtcDateTime < DateTimeOffset.UtcNow;

            ImageUrl = campaignEvent.ImageUrl;

            //TODO Location
            Tasks = campaignEvent.Tasks != null
                 ? new List <TaskViewModel>(campaignEvent.Tasks.Select(data => new TaskViewModel(data)).OrderBy(task => task.StartDateTime))
                 : new List <TaskViewModel>();

            SignupModel = new EventSignupViewModel();

            RequiredSkills    = campaignEvent.RequiredSkills?.Select(acsk => new SkillViewModel(acsk.Skill)).ToList();
            IsLimitVolunteers = campaignEvent.IsLimitVolunteers;
            IsAllowWaitList   = campaignEvent.IsAllowWaitList;
            Headline          = campaignEvent.Headline;
        }
예제 #43
0
        public IEnumerable <TCMI.Models.Event> setEvent(IEnumerable <TCMIContentServices.Event> events)
        {
            List <Models.Event> result = new List <Models.Event>();

            foreach (var item in events)
            {
                Models.Event e = new Models.Event
                {
                    id          = item.id,
                    Title       = item.Title,
                    Venue       = item.Venue,
                    Description = item.Description,
                    DateOfEvent = item.DateOfEvent,
                    Time        = item.Time,
                    Expired     = item.Expired
                };
                result.Add(e);
            }
            return(result);
        }
예제 #44
0
 private void DeleteEvent_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         using (Models.OrganizerDB dc = new Models.OrganizerDB())
         {
             Models.Event work = dc.Event.Find(index);
             dc.Event.Remove(work);
             dc.SaveChanges();
             FillTable();
             DeleteEvent.IsEnabled = false;
             FlowDocument flow = new FlowDocument(new Paragraph(new Run("")));
             EventText.Document = flow;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
예제 #45
0
        public IEnumerable<TCMI.Models.Event> setEvent(IEnumerable<TCMIContentServices.Event> events)
        {
            List<Models.Event> result = new List<Models.Event>();
            foreach (var item in events)
            {
                Models.Event e = new Models.Event
                {
                    id = item.id,
                    Title = item.Title,
                    Venue = item.Venue,
                    Description = item.Description,
                    DateOfEvent = item.DateOfEvent,
                    Time = item.Time,
                    Expired = item.Expired
                };
                result.Add(e);
            }
            return result;

        }
예제 #46
0
        public void SetTasksToListOfTaskViewModelsInAscendingOrderByStartDateTime_WhenEventsTasksAreNotNull()
        {
            var @event = new Models.Event { Tasks = new List<AllReadyTask> { new AllReadyTask { StartDateTime = DateTimeOffset.UtcNow.AddDays(2)}, new AllReadyTask { StartDateTime = DateTimeOffset.UtcNow.AddDays(1) }}};
            var sut = new EventViewModel(@event);

            Assert.IsType<List<TaskViewModel>>(sut.Tasks);
            Assert.Equal(sut.Tasks.IsOrderedByAscending(x => x.StartDateTime), true);
        }
        public EventDetailQueryHandlerShould()
        {
            var org = new Organization
            {
                Id = 1,
                Name = "Organization"
            };

            var campaign = new Campaign
            {
                Id = 1,
                Name = "Campaign",
                ManagingOrganization = org
            };

            var campaignEvent = new Models.Event
            {
                Id = 1,
                Name = "Event",
                Campaign = campaign
            };

            var task1 = new AllReadyTask
            {
                Id = 1,
                Name = "Task 1",
                Event = campaignEvent,
                NumberOfVolunteersRequired = 22
            };

            var task2 = new AllReadyTask
            {
                Id = 2,
                Name = "Task 2",
                Event = campaignEvent,
                NumberOfVolunteersRequired = 8
            };

            var user = new ApplicationUser { Id = Guid.NewGuid().ToString(), Email = "[email protected] " };
            var user2 = new ApplicationUser { Id = Guid.NewGuid().ToString(), Email = "[email protected] " };

            var taskSignup1 = new TaskSignup
            {
                User = user,
                Task = task1,
                Status = TaskStatus.Accepted.ToString()
            };

            var taskSignup2 = new TaskSignup
            {
                User = user2,
                Task = task1,
                Status = TaskStatus.Accepted.ToString()
            };

            var taskSignup3 = new TaskSignup
            {
                User = user,
                Task = task2,
                Status = TaskStatus.Accepted.ToString()
            };

            Context.Add(campaign);
            Context.Add(campaignEvent);
            Context.Add(task1);
            Context.Add(task2);
            Context.Add(user);
            Context.Add(user2);
            Context.Add(taskSignup1);
            Context.Add(taskSignup2);
            Context.Add(taskSignup3);
            Context.SaveChanges();
        }
예제 #48
0
        public static List<Models.Event> UpcomingEvents(int parentNode)
        {
            var events = new List<Models.Event>();

            var umbracoHelper = new UmbracoHelper(UmbracoContext.Current);
            var eventOverview = umbracoHelper.TypedContent(parentNode);

            foreach (var publishedEvent in eventOverview.Children.Where(e => e.DocumentTypeAlias == "Event"))
            {
                var startDateTime = publishedEvent.GetPropertyValue<DateTime>("start");
                if (startDateTime.Date < DateTime.Today)
                    continue;

                var endDateTime = publishedEvent.GetPropertyValue<DateTime>("end");

                var venueCapacity = publishedEvent.GetPropertyValue<int>("capacity");
                var signedUpCount = publishedEvent.GetPropertyValue<int>("signedup");
                var ownerId = publishedEvent.GetPropertyValue<int>("owner");

                var ownerName = string.Empty;

                var member = Member.GetMemberFromCache(ownerId);
                if (member != null)
                    ownerName = member.Text;

                var ev = new Models.Event
                {
                    Id = publishedEvent.Id.ToString(CultureInfo.InvariantCulture),
                    Name = publishedEvent.Name,
                    Description = publishedEvent.GetPropertyValue<string>("description"),
                    StartDateTime = startDateTime,
                    EndDateTime = endDateTime,
                    Link = library.NiceUrl(int.Parse(publishedEvent.Id.ToString(CultureInfo.InvariantCulture))),
                    Venue = publishedEvent.GetPropertyValue<string>("venue"),
                    VenueLongitude = publishedEvent.GetPropertyValue<string>("longitude"),
                    VenueLatitude = publishedEvent.GetPropertyValue<string>("latitude"),
                    VenueCapacity = venueCapacity,
                    SignedUpCount = signedUpCount,
                    OwnerName = ownerName
                };

                events.Add(ev);
            }

            var meetupController = new MeetupController();
            var meetups = meetupController.GetAllFromFile();
            if (meetups != null)
            {
                foreach (var meetupEventSearchResult in meetups.Results.Where(m => m.Time.Date >= DateTime.Now.Date))
                {
                    var venueNameAddress = string.Empty;
                    if (meetupEventSearchResult.Venue != null)
                    {
                        venueNameAddress = meetupEventSearchResult.Venue.Name;
                        if (string.IsNullOrWhiteSpace(meetupEventSearchResult.Venue.Address_1) == false)
                            venueNameAddress = venueNameAddress + ", " + meetupEventSearchResult.Venue.Address_1;
                        if (string.IsNullOrWhiteSpace(meetupEventSearchResult.Venue.Zip) == false)
                            venueNameAddress = venueNameAddress + ", " + meetupEventSearchResult.Venue.Zip;
                        if (string.IsNullOrWhiteSpace(meetupEventSearchResult.Venue.City) == false)
                            venueNameAddress = venueNameAddress + ", " + meetupEventSearchResult.Venue.City;
                        if (string.IsNullOrWhiteSpace(meetupEventSearchResult.Venue.Country) == false)
                            venueNameAddress = venueNameAddress + ", " + meetupEventSearchResult.Venue.Country;
                    }

                    var ev = new Models.Event();

                    ev.Id = meetupEventSearchResult.Id;
                    ev.Name = meetupEventSearchResult.Name ?? string.Empty;
                    ev.Description = meetupEventSearchResult.Description ?? string.Empty;
                    ev.StartDateTime = meetupEventSearchResult.Time;
                    ev.EndDateTime = meetupEventSearchResult.Time;
                    ev.IsExternal = true;
                    ev.Link = meetupEventSearchResult.Event_Url ?? string.Empty;
                    ev.OwnerName = meetupEventSearchResult.Group.Name ?? string.Empty;
                    ev.SignedUpCount = meetupEventSearchResult.Yes_Rsvp_Count;
                    ev.Venue = venueNameAddress;
                    ev.VenueLongitude = meetupEventSearchResult.Venue == null ? string.Empty : meetupEventSearchResult.Venue.Lon.ToString(CultureInfo.InvariantCulture);
                    ev.VenueLatitude = meetupEventSearchResult.Venue == null ? string.Empty : meetupEventSearchResult.Venue.Lat.ToString(CultureInfo.InvariantCulture);
                    ev.VenueCapacity = meetupEventSearchResult.Rsvp_Limit;

                    events.Add(ev);
                }
            }

            return events;
        }
예제 #49
0
        public ActionResult Create(CreateEventViewModel model, FormCollection form)
        {
            ViewBag.Country = new SelectList(UoW.Countries.GetAll().ToList(), "CountryId", "Name");
            ViewBag.Province = new SelectList(UoW.ProvinceStates.GetAll().OrderBy(p => p.ProvinceStateId).Take(13), "ProvinceStateId", "Name");
            ViewBag.State = new SelectList(UoW.ProvinceStates.GetAll().OrderBy(p => p.ProvinceStateId).Skip(13), "ProvinceStateId", "Name");

            // grab the form's dropdown lists selected value.
            var Country = Int32.Parse(form["Country"]);
            var Province = Int32.Parse(form["Province"]);
            var State = Int32.Parse(form["State"]);

            // check which country is selected. If shipping and home addresses are the same Country,
            // some of the form collection attributes will bu null/zero.
            int CountryId = Country;
            int ProvinceOrState = CountryId == 1 ? Province : State;

            var Address = new Address()
            {
                Street1 = model.Address.Street1,
                Street2 = model.Address.Street2,
                City = model.Address.City,
                PostalZipCode = model.Address.PostalZipCode,
                ProvinceStateId = ProvinceOrState,
                CountryId = Country
            };
            var Event = new Models.Event()
            {
                Address = Address,
                Date = model.Date,
                Name = model.Name,
                EventDetails = model.EventDetails
            };

            if (ModelState.IsValid)
            {

                try
                {
                    db.Events.Add(Event);
                    db.SaveChanges();
                    TempData["toast"] = "<script> $(document).ready(function () {" +
                       "toastr.options = { 'positionClass': 'toast-bottom-right' };" +
                       "toastr.success('Event was created successfully!');});</script>";
                    return RedirectToAction("EmployeeEventsIndex", "Events");
                }
                catch (Exception)
                {
                    TempData["toast"] = "<script> $(document).ready(function () {" +
                      "toastr.options = { 'positionClass': 'toast-bottom-right' };" +
                      "toastr.error('Error saving the event. Please try again.');});</script>";
                    return View("Create", model);
                }
            }

            return View("Create", model);
        }
 public EventCreateViewModel()
 {
     Event = new Models.Event();
 }
        protected override void LoadTestData()
        {
            var testOrg = new Organization
            {
                Name = "My Test Campaign",
                LogoUrl = "http://www.htbox.org/testCampaign",
                WebUrl = "http://www.htbox.org",
                Campaigns = new List<Campaign>()
            };

            var testCampaign1 = new Campaign
            {
                Name = "Test Campaign 1",
                ManagingOrganization = testOrg,
                CampaignContacts = new List<CampaignContact>()
            };

            var testCampaign2 = new Campaign
            {
                Name = "Test Campaign 2",
                ManagingOrganization = testOrg,
                CampaignContacts = new List<CampaignContact>()
            };

            var primaryCampaignContact1 = new CampaignContact
            {
                ContactType = (int)ContactTypes.Primary,
                Contact = new Contact
                {
                    Email = "*****@*****.**"
                }
            };

            var primaryCampaignContact2 = new CampaignContact
            {
                ContactType = (int)ContactTypes.Primary,
                Contact = new Contact()
            };

            var testEvent1 = new Models.Event
            {
                Id = 5,
                Name = "Test Event Name",
                Campaign = testCampaign1,
                CampaignId = testCampaign1.Id,
                StartDateTime = DateTime.UtcNow.AddDays(10),
                EndDateTime = DateTime.UtcNow.AddDays(10).AddHours(8),
                Location = new Location { Id = 2 },
                RequiredSkills = new List<EventSkill>()
            };

            var testEvent2 = new Models.Event
            {
                Id = 7,
                Name = "Test Event 2",
                Campaign = testCampaign2,
                CampaignId = testCampaign2.Id,
                StartDateTime = DateTime.UtcNow.AddDays(3),
                EndDateTime = DateTime.UtcNow.AddDays(3).AddHours(4),
                Location = new Location { Id = 5 },
                RequiredSkills = new List<EventSkill>()
            };

            var username1 = $"*****@*****.**";
            var user1 = new ApplicationUser { UserName = username1, Email = username1, EmailConfirmed = true };
            Context.Users.Add(user1);

            var username2 = $"*****@*****.**";
            var user2 = new ApplicationUser { UserName = username2, Email = username2, EmailConfirmed = true };
            Context.Users.Add(user2);

            testCampaign1.CampaignContacts.Add(primaryCampaignContact1);
            testCampaign2.CampaignContacts.Add(primaryCampaignContact2);

            testOrg.Campaigns.Add(testCampaign1);
            testOrg.Campaigns.Add(testCampaign2);

            Context.Organizations.Add(testOrg);
            Context.Events.Add(testEvent1);
            Context.Events.Add(testEvent2);

            var testTask1 = new AllReadyTask
            {
                Id = 7,
                Event = testEvent1,
                EventId = testEvent1.Id
                // Required Skills?
            };

            var testTask2 = new AllReadyTask
            {
                Id = 9,
                Event = testEvent2,
                EventId = testEvent2.Id
                // Required Skills?
            };

            Context.Tasks.Add(testTask1);
            Context.Tasks.Add(testTask2);

            Context.SaveChanges();
        }
예제 #52
0
        public void SetRequiredSkillsToListOfSkillViewModelsForEventsRequiredSkills_WhenEventsRequiredSkillsIsNotNull()
        {
            var @event = new Models.Event { RequiredSkills = new List<EventSkill> { new EventSkill { Skill = new Skill() }, new EventSkill { Skill = new Skill() }}};
            var sut = new EventViewModel(@event);

            Assert.IsType<List<SkillViewModel>>(sut.RequiredSkills);
            Assert.True(sut.RequiredSkills.Count > 0);
        }
        protected override void LoadTestData()
        {
            var context = ServiceProvider.GetService<AllReadyContext>();

            _user1 = new ApplicationUser
            {
                UserName = "******",
                Name = "John Doe",
                Email = "*****@*****.**"
            };

            _contact1 = new Contact
            {
                Id = 1,
                FirstName = "Jerry",
                LastName = "Rodgers",
                Email = "*****@*****.**",
                PhoneNumber = "555.555.1234"
            };

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

            _firePrev = new Campaign
            {
                Name = "Neighborhood Fire Prevention Days",
                ManagingOrganization = _htb,
                CampaignContacts = new List<CampaignContact>()
            };

            _firePrev.CampaignContacts.Add(new CampaignContact
            {
                Campaign = _firePrev,
                Contact = _contact1,
                ContactType = (int)ContactTypes.Primary
            });

            _htb.Campaigns.Add(_firePrev);

            _queenAnne = new Models.Event
            {
                Id = 1,
                Name = "Queen Anne Fire Prevention Day",
                Campaign = _firePrev,
                CampaignId = _firePrev.Id,
                StartDateTime = new DateTime(2015, 7, 4, 10, 0, 0).ToUniversalTime(),
                EndDateTime = new DateTime(2015, 12, 31, 15, 0, 0).ToUniversalTime(),
                Location = new Location { Id = 1 },
                RequiredSkills = new List<EventSkill>(),
                Tasks = new List<AllReadyTask>(),
                UsersSignedUp = new List<EventSignup>
                {
                    new EventSignup
                    {
                        Id = 1,
                        PreferredEmail = "*****@*****.**",
                        PreferredPhoneNumber = "(555)555-1234",
                        User = _user1
                    }
                }
            };

            _task1 = new AllReadyTask
            {
               Id = 1,
               Event = _queenAnne,
               Name = "Task 1",
                StartDateTime = new DateTime(2015, 7, 4, 10, 0, 0).ToUniversalTime(),
                EndDateTime = new DateTime(2015, 12, 31, 15, 0, 0).ToUniversalTime(),
                Organization = _htb
            };

            _task1.AssignedVolunteers = new List<TaskSignup>
            {
                new TaskSignup
                {
                    Id = 1,
                    User = _user1,
                    Task = _task1,
                    Status = "Assigned",
                    StatusDateTimeUtc = new DateTime(2015, 7, 4, 10, 0, 0).ToUniversalTime()
                }
            };

            _queenAnne.Tasks.Add(_task1);
            context.Users.Add(_user1);
            context.Contacts.Add(_contact1);
            context.Organizations.Add(_htb);
            context.Events.Add(_queenAnne);
            context.SaveChanges();
        }