private void AddTimeSlot() { PracticeRoutineTimeSlot timeSlot = new PracticeRoutineTimeSlot("New Time Slot", 300, new List <TimeSlotExercise>()); practiceRoutine.Add(timeSlot); TimeSlots.Add(new TimeSlotViewModel(timeSlot)); }
public BookRessourceViewModel() { proxy = AutofacHelper.Container.Resolve <ApiClientProxy>(); drawBookning = new DrawResourcer(); Date = DateTime.Now; StartTime = DateTime.Now.TimeOfDay; SlutTime = DateTime.Now.TimeOfDay; _hubConnectionRerservation = new HubConnectionBuilder() .WithUrl($"{Resources.SignalRBaseAddress}ReservationHub").Build(); _hubConnectionRerservation.StartAsync(); _hubConnectionResource = new HubConnectionBuilder().WithUrl($"{Resources.SignalRBaseAddress}ResourceHub").Build(); _hubConnectionResource.StartAsync(); //SignalR Client methods for Reservation _hubConnectionRerservation.On <Reservation>("CreateReservation", reservation => { Reservations.Add(reservation); reftesh(reservation.Timeslot.FromDate.DayOfWeek); }); _hubConnectionRerservation.On <Reservation>("UpdateReservation", reservation => { Reservations[Reservations.FindIndex(r => r.Id == reservation.Id)] = reservation; reftesh(); }); _hubConnectionRerservation.On <Reservation>("DeleteReservation", reservation => { Reservations.RemoveAt(Reservations.FindIndex(re => reservation.Id == re.Id)); reftesh(reservation.Timeslot.FromDate.DayOfWeek); }); //SignalR Client methods for Resource _hubConnectionResource.On <Resource>("UpdateResource", resource => { if (resource.Id == Id) { if (resource.TimeSlots == null) { TimeSlots = new List <AvailableTime>(); reftesh(); } foreach (var timeslot in resource.TimeSlots) { if (TimeSlots.Find(r => r.Id == timeslot.Id) != null) { TimeSlots[TimeSlots.FindIndex(r => r.Id == timeslot.Id)] = timeslot; reftesh(); } else { TimeSlots.Add(timeslot); reftesh(); } } } }); }
private void GenerateTimeSlots() { // Generate a time slot for each time interval based on duration length this.TimeSlots = new List <TimeSlot>(); int totalHours = StartingHour; for (int i = 0; i < NumberOfSlots; i++) { var slot = new TimeSlot(Date.AddHours(totalHours)); totalHours += int.Parse(SlotDurationInHours.ToString()); TimeSlots.Add(slot); } }
public bool CreateTimeSlot(TimeSlot timeSlot) { bool isError = false; try { db.addTimeSlot(timeSlot); } catch (Exception ex) { isError = true; Console.WriteLine(ex); Console.WriteLine("Failed to update the Database --- check error ABOVE"); } TimeSlots.Add(timeSlot); return(isError); }
public void StartEdit(PracticeRoutine practiceRoutine) { this.practiceRoutine = practiceRoutine ?? throw new ArgumentNullException("PracticeRoutine must be provided."); LifeCycleState = practiceRoutine.Id > 0 ? EntityLifeCycleState.AsExistingEntity : EntityLifeCycleState.AsNewEntity; if (TimeSlots != null) { TimeSlots.ListChanged -= (s, e) => RaisePropertyChanged(() => TotalTimeDisplay); TimeSlots.Clear(); } foreach (var timeSlot in practiceRoutine) { TimeSlotViewModel timeSlotViewModel = new TimeSlotViewModel(timeSlot); TimeSlots.Add(timeSlotViewModel); } TimeSlots.ListChanged += (s, e) => RaisePropertyChanged(() => TotalTimeDisplay); }
public void AddTimeSlot(TimeSlot slot) { TimeSlots.Add(slot); NotifyPropertyChanged("Avaliability"); NotifyTimeSlotsChanged(); }
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(); }