public SaveUsageCommand(IMessageBroker messageBroker, IConsumableUsageService usageService)
        {
            Text = () => LanguageData.General_Save;

            this.messageBroker = messageBroker;
            this.usageService = usageService;
        }
        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 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();
        }
        public SaveUsageCommand(IMessageBroker messageBroker, IConsumableUsageService usageService)
        {
            Text = () => LanguageData.General_Save;

            this.messageBroker = messageBroker;
            this.usageService  = usageService;
        }
        public UsageListViewModel(IMessageBroker messageBroker, IClientContext clientContext, IConsumableUsageService usageService,
            NewUsageCommand newCommand, EditUsageCommand editCommand, DeleteUsageCommand deleteCommand,
            RefreshCommand refreshCommand)
        {
            this.messageBroker = messageBroker;
            this.usageService = usageService;

            pageSize = clientContext.PageSize;

            NewCommand = newCommand;
            EditCommand = editCommand;
            DeleteCommand = deleteCommand;
            RefreshCommand = refreshCommand;

            RefreshCommand.MessageName = CommonMessages.RefreshUsageList;

            NavigationCommands = new List<CommandBase>(){NewCommand, DeleteCommand, RefreshCommand};

            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();
        }
        public UsageListViewModel(IMessageBroker messageBroker, IClientContext clientContext, IConsumableUsageService usageService,
                                  NewUsageCommand newCommand, EditUsageCommand editCommand, DeleteUsageCommand deleteCommand,
                                  RefreshCommand refreshCommand)
        {
            this.messageBroker = messageBroker;
            this.usageService  = usageService;

            pageSize = clientContext.PageSize;

            NewCommand     = newCommand;
            EditCommand    = editCommand;
            DeleteCommand  = deleteCommand;
            RefreshCommand = refreshCommand;

            RefreshCommand.MessageName = CommonMessages.RefreshUsageList;

            NavigationCommands = new List <CommandBase>()
            {
                NewCommand, DeleteCommand, RefreshCommand
            };

            SubscribeMessages();
        }
Example #9
0
 public DeleteUsageCommand(IMessageBroker broker, IConsumableUsageService usageService)
 {
     this.broker       = broker;
     this.usageService = usageService;
 }
Example #10
0
 public UsageController(IConsumableUsageService service)
 {
     this.service = service;
 }
 public ConsumableUsageServiceTests()
 {
     factory = DatabaseTestInitializer.GetConnectionFactory();
     service = new ConsumableUsageService(factory);
 }
 public UsageController(IConsumableUsageService service)
 {
     this.service = service;
 }
 public DeleteUsageCommand(IMessageBroker broker, IConsumableUsageService usageService)
 {
     this.broker = broker;
     this.usageService = usageService;
 }
Example #14
0
 public ConsumableUsageServiceTests()
 {
     factory = DatabaseTestInitializer.GetConnectionFactory();
     service = new ConsumableUsageService(factory);
 }