/// <summary> /// Gets the group types. /// </summary> /// <param name="selectedOnly">if set to <c>true</c> [selected only].</param> /// <returns></returns> public List <CheckInGroupType> GetGroupTypes(bool selectedOnly) { if (selectedOnly) { if (PossibleSchedules.Any()) { var selectedScheduleIds = SelectedSchedules.Select(s => s.Schedule.Id).ToList(); return(GroupTypes.Where(t => t.SelectedForSchedule.Any(s => selectedScheduleIds.Contains(s))).ToList()); } return(GroupTypes.Where(t => t.Selected).ToList()); } return(GroupTypes); }
/// <summary> /// Returns the selected group types. /// </summary> /// <param name="currentSchedule">The current schedule.</param> /// <returns></returns> public List <CheckInGroupType> SelectedGroupTypes(CheckInSchedule currentSchedule) { return((currentSchedule != null && currentSchedule.Schedule != null) ? GroupTypes.Where(t => t.SelectedForSchedule.Contains(currentSchedule.Schedule.Id)).ToList() : GroupTypes.Where(t => t.Selected).ToList()); }
public void Seed() { //Seed Group Types to database GroupTypes.Add(new GroupType { Name = "Tiger" }); GroupTypes.Add(new GroupType { Name = "Wolf" }); GroupTypes.Add(new GroupType { Name = "Bear" }); GroupTypes.Add(new GroupType { Name = "Webelos" }); //Seed test event to database Events.Add(new Event { Name = "Dev Event", Start = new DateTime(2012, 3, 5), End = new DateTime(2012, 3, 9) }); SaveChanges(); //See test TimeSlots to database Event primaryEvent = Events.First(); TimeSlots.Add(new TimeSlot { Event = primaryEvent, Name = "Mon: 9:00AM-10:00AM", Start = new DateTime(2012, 3, 5, 9, 0, 0), End = new DateTime(2012, 3, 5, 10, 00, 0) }); TimeSlots.Add(new TimeSlot { Event = primaryEvent, Name = "Mon: 10:15AM-11:15PM", Start = new DateTime(2012, 3, 5, 10, 15, 0), End = new DateTime(2012, 3, 5, 11, 15, 0) }); TimeSlots.Add(new TimeSlot { Event = primaryEvent, Name = "Mon: 11:30PM-12:30PM", Start = new DateTime(2012, 3, 5, 11, 30, 0), End = new DateTime(2012, 3, 5, 12, 30, 0) }); TimeSlots.Add(new TimeSlot { Event = primaryEvent, Name = "Mon: 1:30PM-2:30PM", Start = new DateTime(2012, 3, 5, 13, 30, 0), End = new DateTime(2012, 3, 5, 14, 30, 0) }); TimeSlots.Add(new TimeSlot { Event = primaryEvent, Name = "Mon: 2:45PM-3:45PM", Start = new DateTime(2012, 3, 5, 14, 45, 0), End = new DateTime(2012, 3, 5, 15, 45, 0) }); TimeSlots.Add(new TimeSlot { Event = primaryEvent, Name = "Tues: 9:00AM-10:00AM", Start = new DateTime(2012, 3, 6, 9, 0, 0), End = new DateTime(2012, 3, 6, 10, 00, 0) }); TimeSlots.Add(new TimeSlot { Event = primaryEvent, Name = "Tues: 10:15AM-11:15PM", Start = new DateTime(2012, 3, 6, 10, 15, 0), End = new DateTime(2012, 3, 6, 11, 15, 0) }); TimeSlots.Add(new TimeSlot { Event = primaryEvent, Name = "Tues: 11:30PM-12:30PM", Start = new DateTime(2012, 3, 6, 11, 30, 0), End = new DateTime(2012, 3, 6, 12, 30, 0) }); TimeSlots.Add(new TimeSlot { Event = primaryEvent, Name = "Tues: 1:30PM-2:30PM", Start = new DateTime(2012, 3, 6, 13, 30, 0), End = new DateTime(2012, 3, 6, 14, 30, 0) }); TimeSlots.Add(new TimeSlot { Event = primaryEvent, Name = "Tues: 2:45PM-3:45PM", Start = new DateTime(2012, 3, 6, 14, 45, 0), End = new DateTime(2012, 3, 6, 15, 45, 0) }); TimeSlots.Add(new TimeSlot { Event = primaryEvent, Name = "Wed: 9:00AM-10:00AM", Start = new DateTime(2012, 3, 7, 9, 0, 0), End = new DateTime(2012, 3, 7, 10, 00, 0) }); TimeSlots.Add(new TimeSlot { Event = primaryEvent, Name = "Wed: 10:15AM-11:15PM", Start = new DateTime(2012, 3, 7, 10, 15, 0), End = new DateTime(2012, 3, 7, 11, 15, 0) }); TimeSlots.Add(new TimeSlot { Event = primaryEvent, Name = "Wed: 11:30PM-12:30PM", Start = new DateTime(2012, 3, 7, 11, 30, 0), End = new DateTime(2012, 3, 7, 12, 30, 0) }); TimeSlots.Add(new TimeSlot { Event = primaryEvent, Name = "Wed: 1:30PM-2:30PM", Start = new DateTime(2012, 3, 7, 13, 30, 0), End = new DateTime(2012, 3, 7, 14, 30, 0) }); TimeSlots.Add(new TimeSlot { Event = primaryEvent, Name = "Wed: 2:45PM-3:45PM", Start = new DateTime(2012, 3, 7, 14, 45, 0), End = new DateTime(2012, 3, 7, 15, 45, 0) }); TimeSlots.Add(new TimeSlot { Event = primaryEvent, Name = "Thurs: 9:00AM-10:00AM", Start = new DateTime(2012, 3, 8, 9, 0, 0), End = new DateTime(2012, 3, 8, 10, 00, 0) }); TimeSlots.Add(new TimeSlot { Event = primaryEvent, Name = "Thurs: 10:15AM-11:15PM", Start = new DateTime(2012, 3, 8, 10, 15, 0), End = new DateTime(2012, 3, 8, 11, 15, 0) }); TimeSlots.Add(new TimeSlot { Event = primaryEvent, Name = "Thurs: 11:30PM-12:30PM", Start = new DateTime(2012, 3, 8, 11, 30, 0), End = new DateTime(2012, 3, 8, 12, 30, 0) }); TimeSlots.Add(new TimeSlot { Event = primaryEvent, Name = "Thurs: 1:30PM-2:30PM", Start = new DateTime(2012, 3, 8, 13, 30, 0), End = new DateTime(2012, 3, 8, 14, 30, 0) }); TimeSlots.Add(new TimeSlot { Event = primaryEvent, Name = "Thurs: 2:45PM-3:45PM", Start = new DateTime(2012, 3, 8, 14, 45, 0), End = new DateTime(2012, 3, 8, 15, 45, 0) }); TimeSlots.Add(new TimeSlot { Event = primaryEvent, Name = "Fri: 9:00AM-10:00AM", Start = new DateTime(2012, 3, 9, 9, 0, 0), End = new DateTime(2012, 3, 9, 10, 00, 0) }); TimeSlots.Add(new TimeSlot { Event = primaryEvent, Name = "Fri: 10:15AM-11:15PM", Start = new DateTime(2012, 3, 9, 10, 15, 0), End = new DateTime(2012, 3, 9, 11, 15, 0) }); TimeSlots.Add(new TimeSlot { Event = primaryEvent, Name = "Fri: 11:30PM-12:30PM", Start = new DateTime(2012, 3, 9, 11, 30, 0), End = new DateTime(2012, 3, 9, 12, 30, 0) }); TimeSlots.Add(new TimeSlot { Event = primaryEvent, Name = "Fri: 1:30PM-2:30PM", Start = new DateTime(2012, 3, 9, 13, 30, 0), End = new DateTime(2012, 3, 9, 14, 30, 0) }); TimeSlots.Add(new TimeSlot { Event = primaryEvent, Name = "Fri: 2:45PM-3:45PM", Start = new DateTime(2012, 3, 9, 14, 45, 0), End = new DateTime(2012, 3, 9, 15, 45, 0) }); SaveChanges(); //create ICollection for time slots for each station ICollection <TimeSlot> timeslots = TimeSlots.ToList(); TimeSlots.Add(new TimeSlot { Event = primaryEvent, Name = "Mon Lunch", Start = new DateTime(2012, 3, 5, 12, 30, 0), End = new DateTime(2012, 3, 5, 13, 30, 0), isGeneral = true }); TimeSlots.Add(new TimeSlot { Event = primaryEvent, Name = "Tues Lunch", Start = new DateTime(2012, 3, 6, 12, 30, 0), End = new DateTime(2012, 3, 6, 13, 30, 0), isGeneral = true }); TimeSlots.Add(new TimeSlot { Event = primaryEvent, Name = "Wed Lunch", Start = new DateTime(2012, 3, 7, 12, 30, 0), End = new DateTime(2012, 3, 7, 13, 30, 0), isGeneral = true }); TimeSlots.Add(new TimeSlot { Event = primaryEvent, Name = "Thurs Lunch", Start = new DateTime(2012, 3, 8, 12, 30, 0), End = new DateTime(2012, 3, 8, 13, 30, 0), isGeneral = true }); TimeSlots.Add(new TimeSlot { Event = primaryEvent, Name = "Fri Lunch", Start = new DateTime(2012, 3, 9, 12, 30, 0), End = new DateTime(2012, 3, 9, 13, 30, 0), isGeneral = true }); SaveChanges(); //Seed testing stations to database Stations.Add(new Station { Event = primaryEvent, Name = "Fishing", Description = "", Location = "", Capacity = 1, AvailableTimeSlots = timeslots }); Stations.Add(new Station { Event = primaryEvent, Name = "Knots", Description = "", Location = "", Capacity = 1, AvailableTimeSlots = timeslots }); Stations.Add(new Station { Event = primaryEvent, Name = "Songs & Skits", Description = "", Location = "", Capacity = 1, AvailableTimeSlots = timeslots }); Stations.Add(new Station { Event = primaryEvent, Name = "Wood Projects", Description = "", Location = "", Capacity = 1, AvailableTimeSlots = timeslots }); Stations.Add(new Station { Event = primaryEvent, Name = "Outdoor Cooking", Description = "", Location = "", Capacity = 1, AvailableTimeSlots = timeslots }); Stations.Add(new Station { Event = primaryEvent, Name = "Arts & Crafts", Description = "", Location = "", Capacity = 1, AvailableTimeSlots = timeslots }); Stations.Add(new Station { Event = primaryEvent, Name = "Creeking", Description = "", Location = "", Capacity = 1, AvailableTimeSlots = timeslots }); Stations.Add(new Station { Event = primaryEvent, Name = "Chess", Description = "", Location = "", Capacity = 1, AvailableTimeSlots = timeslots }); Stations.Add(new Station { Event = primaryEvent, Name = "Knight Training", Description = "", Location = "", Capacity = 1, AvailableTimeSlots = timeslots }); Stations.Add(new Station { Event = primaryEvent, Name = "Volleyball", Description = "", Location = "", Capacity = 1, AvailableTimeSlots = timeslots }); Stations.Add(new Station { Event = primaryEvent, Name = "Flag Football", Description = "", Location = "", Capacity = 1, AvailableTimeSlots = timeslots }); Stations.Add(new Station { Event = primaryEvent, Name = "Trading Post", Description = "", Location = "", Capacity = 1, AvailableTimeSlots = timeslots }); Stations.Add(new Station { Event = primaryEvent, Name = "Craftsman Activity Pin", Description = "", Location = "", Capacity = 1, isActivityPin = true, AvailableTimeSlots = timeslots }); Stations.Add(new Station { Event = primaryEvent, Name = "Forester Activity Pin", Description = "", Location = "", Capacity = 1, isActivityPin = true, AvailableTimeSlots = timeslots }); Stations.Add(new Station { Event = primaryEvent, Name = "Naturalist Activity Pin", Description = "", Location = "", Capacity = 1, isActivityPin = true, AvailableTimeSlots = timeslots }); Stations.Add(new Station { Event = primaryEvent, Name = "Artist Activity Pin", Description = "", Location = "", Capacity = 1, isActivityPin = true, AvailableTimeSlots = timeslots }); Stations.Add(new Station { Event = primaryEvent, Name = "Aquanaut Activity Pin", Description = "", Location = "", Capacity = 1, isActivityPin = true, AvailableTimeSlots = timeslots }); Stations.Add(new Station { Event = primaryEvent, Name = "BB", Description = "", Location = "", Capacity = 1, Category = "Shooting", AvailableTimeSlots = timeslots }); Stations.Add(new Station { Event = primaryEvent, Name = "Archery", Description = "", Location = "", Capacity = 1, Category = "Shooting", AvailableTimeSlots = timeslots }); Stations.Add(new Station { Event = primaryEvent, Name = "Swimming", Description = "", Location = "", Capacity = 1, AvailableTimeSlots = timeslots }); Stations.Add(new Station { Event = primaryEvent, Name = "Kickball", Description = "", Location = "", Capacity = 1, AvailableTimeSlots = timeslots }); Stations.Add(new Station { Event = primaryEvent, Name = "Leaf Rubbing", Description = "", Location = "", Capacity = 1, AvailableTimeSlots = timeslots }); SaveChanges(); ////Seed groups Groups.Add(new Group { Event = primaryEvent, Name = "Sir Tegyr", Type = GroupTypes.Where(t => t.ID == 1).Single(), Preference1 = null, Preference2 = null, Preference3 = null }); Groups.Add(new Group { Event = primaryEvent, Name = "Sir Galahad", Type = GroupTypes.Where(t => t.ID == 2).Single(), Preference1 = null, Preference2 = null, Preference3 = null }); Groups.Add(new Group { Event = primaryEvent, Name = "Sir Gawain", Type = GroupTypes.Where(t => t.ID == 2).Single(), Preference1 = null, Preference2 = null, Preference3 = null }); Groups.Add(new Group { Event = primaryEvent, Name = "Sir Gareth", Type = GroupTypes.Where(t => t.ID == 2).Single(), Preference1 = null, Preference2 = null, Preference3 = null }); Groups.Add(new Group { Event = primaryEvent, Name = "Sir Bors de Ganis", Type = GroupTypes.Where(t => t.ID == 2).Single(), Preference1 = null, Preference2 = null, Preference3 = null }); Groups.Add(new Group { Event = primaryEvent, Name = "Sir Kay", Type = GroupTypes.Where(t => t.ID == 3).Single(), Preference1 = null, Preference2 = null, Preference3 = null }); Groups.Add(new Group { Event = primaryEvent, Name = "Sir Gaheris", Type = GroupTypes.Where(t => t.ID == 3).Single(), Preference1 = null, Preference2 = null, Preference3 = null }); Groups.Add(new Group { Event = primaryEvent, Name = "Sir Percivale", Type = GroupTypes.Where(t => t.ID == 3).Single(), Preference1 = null, Preference2 = null, Preference3 = null }); Groups.Add(new Group { Event = primaryEvent, Name = "Sir Lionel", Type = GroupTypes.Where(t => t.ID == 3).Single(), Preference1 = null, Preference2 = null, Preference3 = null }); Groups.Add(new Group { Event = primaryEvent, Name = "Sir Tristan", Type = GroupTypes.Where(t => t.ID == 4).Single(), Preference1 = null, Preference2 = null, Preference3 = null }); Groups.Add(new Group { Event = primaryEvent, Name = "Sir Bedivere", Type = GroupTypes.Where(t => t.ID == 4).Single(), Preference1 = null, Preference2 = null, Preference3 = null }); Groups.Add(new Group { Event = primaryEvent, Name = "Sir Dagonet", Type = GroupTypes.Where(t => t.ID == 4).Single(), Preference1 = null, Preference2 = null, Preference3 = null }); Groups.Add(new Group { Event = primaryEvent, Name = "Sir Geriant", Type = GroupTypes.Where(t => t.ID == 4).Single(), Preference1 = null, Preference2 = null, Preference3 = null }); Groups.Add(new Group { Event = primaryEvent, Name = "Sir Lamorak", Type = GroupTypes.Where(t => t.ID == 4).Single(), Preference1 = null, Preference2 = null, Preference3 = null }); Groups.Add(new Group { Event = primaryEvent, Name = "Sir Lancelot", Type = GroupTypes.Where(t => t.ID == 4).Single(), Preference1 = null, Preference2 = null, Preference3 = null }); SaveChanges(); // Seed Constraints SchedulingConstraints.Add(new SchedulingConstraint { Event = primaryEvent, GroupType = GroupTypes.Where(t => t.ID == 1).Single(), Group = null, Station = Stations.Where(s => s.ID == 1).Single(), }); SchedulingConstraints.Add(new SchedulingConstraint { Event = primaryEvent, GroupType = null, Group = Groups.Where(g => g.ID == 2).Single(), Station = Stations.Where(s => s.ID == 2).Single(), }); SaveChanges(); }