public UsageEntryViewModel(IMessageBroker messageBroker, IConsumableUsageService usageService, IHenHouseService houseService, IConsumableService consumableService, SaveUsageCommand saveUsageCommand, CancelCommand cancelCommand, ShowUsageCommand showListCommand ) { this.messageBroker = messageBroker; this.usageService = usageService; this.houseService = houseService; this.consumableService = consumableService; this.saveUsageCommand = saveUsageCommand; this.showListCommand = showListCommand; CancelCommand = cancelCommand; PropertiesToValidate = new List<string>() { "Date", "Total", "Details" }; InitializeCommands(); HouseList = new ObservableCollection<HenHouse>(houseService.GetAll()); ConsumableList = new ObservableCollection<Consumable>(consumableService.GetAll()); SubscribeMessages(); }
public HenDepreciationEntryViewModel(IMessageBroker messageBroker, IHenDepreciationService service, IHenHouseService houseService, SaveHenDepreciationCommand saveCommand, CancelCommand cancelCommand, ShowHenDepreciationListCommand showListCommand) { this.broker = messageBroker; this.service = service; ActualSaveCommand = saveCommand; CancelCommand = cancelCommand; CancelCommand.Action = b => showListCommand.Execute(null); RefreshCommand = new DelegateCommand(p => OnRefresh(),p => true) {Text = () => LanguageData.General_Refresh}; ShowListCommand = showListCommand; HenHouses = new ObservableCollection<HenHouse>(houseService.GetAll().OrderBy(h => h.Name)); InitializeCommands(); PropertiesToValidate = new List<string> { "Date", "Details" }; NavigationCommands = new List<CommandBase>(){SaveCommand, CancelCommand, RefreshCommand}; SubscribeMessages(); }
public UsageEntryViewModel(IMessageBroker messageBroker, IConsumableUsageService usageService, IHenHouseService houseService, IConsumableService consumableService, SaveUsageCommand saveUsageCommand, CancelCommand cancelCommand, ShowUsageCommand showListCommand ) { this.messageBroker = messageBroker; this.usageService = usageService; this.houseService = houseService; this.consumableService = consumableService; this.saveUsageCommand = saveUsageCommand; this.showListCommand = showListCommand; CancelCommand = cancelCommand; PropertiesToValidate = new List <string>() { "Date", "Total", "Details" }; InitializeCommands(); HouseList = new ObservableCollection <HenHouse>(houseService.GetAll()); ConsumableList = new ObservableCollection <Consumable>(consumableService.GetAll()); SubscribeMessages(); }
public EggProductionEntryViewModel(IMessageBroker broker, IEggProductionService service, IConsumableUsageService usageService, IHenHouseService houseService, SaveEggProductionCommand saveCommand, CancelCommand cancelCommand, ShowEggProductionListCommand showListCommand) { this.broker = broker; this.service = service; this.usageService = usageService; ActualSaveCommand = saveCommand; CancelCommand = cancelCommand; ShowListCommand = showListCommand; PropertiesToValidate = new List <string> { "Date", "Details" }; InitializeCommands(); NavigationCommands = new List <CommandBase>() { SaveCommand, CancelCommand, RefreshCommand }; CancelCommand.Action = b => showListCommand.Execute(null); HenHouses = new ObservableCollection <HenHouse>(houseService.GetAll().OrderBy(h => h.Name)); SubscribeMessages(); }
void OnHouseRefresh(object param) { var houseList = houseService.GetAll(); if (houseList == null) { houseList = new List <HenHouse>(); } Houses = new ObservableCollection <HenHouse>(houseList); DeleteCommand.EntityId = Guid.Empty; }
void OnHenRefresh(object param) { IList <Hen> henList = null; henList = henService.GetAll(); var henListItem = Mapper.Map <IList <Hen>, IList <HenListItem> >(henList); var houseList = houseService.GetAll(); foreach (var listItem in henListItem) { var house = houseList.FirstOrDefault(h => h.Id == listItem.HouseId); if (house == null) { continue; } listItem.HouseName = house.Name; } Hens = new ObservableCollection <HenListItem>(henListItem); DeleteCommand.EntityId = Guid.Empty; }
public EggProductionEntryViewModel(IMessageBroker broker, IEggProductionService service,IConsumableUsageService usageService, IHenHouseService houseService, SaveEggProductionCommand saveCommand, CancelCommand cancelCommand, ShowEggProductionListCommand showListCommand) { this.broker = broker; this.service = service; this.usageService = usageService; ActualSaveCommand = saveCommand; CancelCommand = cancelCommand; ShowListCommand = showListCommand; PropertiesToValidate = new List<string> { "Date", "Details" }; InitializeCommands(); NavigationCommands =new List<CommandBase>(){SaveCommand, CancelCommand, RefreshCommand}; CancelCommand.Action = b => showListCommand.Execute(null); HenHouses = new ObservableCollection<HenHouse>(houseService.GetAll().OrderBy(h => h.Name)); SubscribeMessages(); }
public HenDepreciationEntryViewModel(IMessageBroker messageBroker, IHenDepreciationService service, IHenHouseService houseService, SaveHenDepreciationCommand saveCommand, CancelCommand cancelCommand, ShowHenDepreciationListCommand showListCommand) { this.broker = messageBroker; this.service = service; ActualSaveCommand = saveCommand; CancelCommand = cancelCommand; CancelCommand.Action = b => showListCommand.Execute(null); RefreshCommand = new DelegateCommand(p => OnRefresh(), p => true) { Text = () => LanguageData.General_Refresh }; ShowListCommand = showListCommand; HenHouses = new ObservableCollection <HenHouse>(houseService.GetAll().OrderBy(h => h.Name)); InitializeCommands(); PropertiesToValidate = new List <string> { "Date", "Details" }; NavigationCommands = new List <CommandBase>() { SaveCommand, CancelCommand, RefreshCommand }; SubscribeMessages(); }
void OnRefreshHouseList(object param) { HenHouses = new ObservableCollection <HenHouse>(houseService.GetAll()); }