public CapacitiesController(ICapacityRepository repository, ICapacityEngine engine) { _repository = repository; _engine = engine; }
public JobInfoPageViewModel(IEmailService emailService, ICapacityEngine capacityEngine, ICacheService cacheService) : base(cacheService) { _cacheService = cacheService; _emailService = emailService; _capacityEngine = capacityEngine; JobTypes = new List <string>() { "SF", "MF", "LA" }; Phases = new ObservableCollection <Phase>(); BuildingSystems = new List <BuildingSystem>(); MessagingCenter.Subscribe <PhaseCreationPage>(this, "Phases Saved", (sender) => { var creator = sender as PhaseCreationPage; Phases = creator.JobItem.Phases; OnPropertyChanged(nameof(Phases)); if (Phases != null) { BuildingSystems = Phases.First().BuildingSystems; } OnPropertyChanged(nameof(BuildingSystems)); }); DeliveryDate = DateTime.Today; RoundTripMiles = 0; HasWindows = true; WindowsInstalled = false; WindowDeliveryDate = DateTime.Today; OkClickedCommand = new Command( execute: async() => { JobInfoItem = new JobItem { JobName = JobName, DeliveryDate = DeliveryDate, FloorSquareFeet = FloorSquareFeet, HasWindows = HasWindows, RoundTripMiles = RoundTripMiles, Phases = Phases, //SelectedBuildingSystem = SelectedBuildingSystem, SelectedJobType = SelectedJobType, //SelectedPhase = SelectedPhase, WallBoardFeet = WallBoardFeet, WindowDeliveryDate = WindowDeliveryDate, WindowsInstalled = WindowsInstalled }; await _cacheService.SaveJobItem(JobInfoItem); var schedule = await _capacityEngine.CalculateSchedules(JobInfoItem); await _cacheService.SaveJobSchedule(schedule); await SendCompletionEmail(); await App.Current.MainPage.Navigation.PopModalAsync(); }); CancelClickedCommand = new Command( execute: () => { JobInfoItem = null; App.Current.MainPage.Navigation.PopModalAsync(); } ); }