public SlidingSupportCycleFactory(int cycle, int slotsInADay, ISupportSlotRepository supportSlotRepository, IEngineerRepository engeneerRepository) { _cycle = cycle; _slotsInADay = slotsInADay; _supportSlotRepository = supportSlotRepository; _engeneerRepository = engeneerRepository; }
public static void AddSupportDay(this ISupportSlotRepository supportSlotRepository, SupportDay supportDay) { foreach (var slot in supportDay.Slots) { supportSlotRepository.AddSupportSlot(slot); } }
public static SupportDay GetSupportDay(this ISupportSlotRepository supportSlotRepository, DateTime date) { var slots = supportSlotRepository.GetSupportSlots().Where(x => x.Date.Date.Equals(date.Date)); if (!slots.Any()) { return(null); } return(new SupportDay(slots)); }
public static SupportDay GetLastSupportDay(this ISupportSlotRepository supportSlotRepository) { if (!supportSlotRepository.GetSupportSlots().Any()) { return(null); } var lastSlotDateTime = supportSlotRepository.GetSupportSlots().Max(x => x.Date); var lastDaySlots = supportSlotRepository.GetSupportSlots().Where(x => x.Date.Date.Equals(lastSlotDateTime.Date)); if (!lastDaySlots.Any()) { return(null); } var lastSupportDay = new SupportDay(lastDaySlots); return(lastSupportDay); }
public SlidingSupportCycle(int cycle, int slotsInADay, ISupportSlotRepository supportSlotRepository, IEngineerRepository engeneerRepository) { _cycle = cycle; _supportSlotRepository = supportSlotRepository; _supportEngeneers = new Lazy <List <SupportEngineer> >(() => { return(engeneerRepository.GetEngeneers().ToList()); }); _slotsInADay = slotsInADay; var lastScheduledSupportDay = _supportSlotRepository.GetLastSupportDay(); if (lastScheduledSupportDay == null) { _curentDate = DateTime.UtcNow.Date; } else { _curentDate = lastScheduledSupportDay.Date.Date; } }
public ScheduleService(ISupportSlotRepository supportSlotRepo, IEngineerRepository engineerRepo) { // Constructor Injection _supportSlotRepo = supportSlotRepo; _engineerRepo = engineerRepo; }
public SupportDayController(ISupportSlotRepository supportSlotRepository, IEngineerRepository engeneerRepository, ISupportCycleFactory supportCycleFactory) { _supportSlotRepository = supportSlotRepository; _engeneerRepository = engeneerRepository; _supportCycleFactory = supportCycleFactory; }