Пример #1
0
        /// <summary>
        /// Instantiates TableOccupancyViewModel;
        /// Instantiates a new list of SelectedSales; Updates the private _table variable through it's property.
        /// Enables commands and links them to it's specified method.
        /// PaySelectedSalesCommand and RemoveSelectedSalesCommand requires items to be selected in the ListView on TableOccupancyView. The button won't be enabled otherwise.
        /// </summary>
        /// <param name="table">The Table that has been selected in the TableViewModel.</param>
        public TableOccupancyViewModel(Data.Table table, IOccupanciesRepo occupanciesRepo, ITableRepo tablesRepo, IReservationRepo reservationsRepo)
        {
            SelectedSales = new List <Data.Sale>();

            Table = table;

            PayAllCommand = new RelayCommand <Data.Occupancy>(PayAll, CanPayAll);

            _occupanciesRepository  = occupanciesRepo;
            _tablesRepository       = tablesRepo;
            _reservationsRepository = reservationsRepo;

            FutureReservations = new ObservableCollection <Data.Reservation>();

            ViewBackCommand = new RelayCommand(ViewBack);
            SalesViewSelectionChangedCommand = new RelayCommand <SelectionChangedEventArgs>(SalesViewSelectionChanged);
            EditTableCommand          = new RelayCommand(EditTable);
            ToTableAddSaleViewCommand = new RelayCommand <Data.Table>(ToTableAddSaleView, TableIsOccupied);
            StartOccupancyCommand     = new RelayCommand <Data.Occupancy>(StartOccupancy, (_) => Table.IsOccupied == false);
            EndOccupancyCommand       = new RelayCommand <Data.Occupancy>(EndOccupancy, (_) => Table.IsOccupied == true);
            PrintReceiptCommand       = new RelayCommand <Data.Occupancy>(PrintReceipt, ReceiptCanBePrinted);
            PaySelectedSalesCommand   = new RelayCommand <object>(PaySelectedSales, SelectedSalesCanBePaid);

            //If necessary to convert back to IList later on: https://stackoverflow.com/questions/1877949/how-to-cast-a-system-windows-controls-selecteditemcollection
            RemoveSelectedSalesCommand = new RelayCommand <object>(RemoveSelectedSales, SelectedSalesCanBeRemoved);
        }
Пример #2
0
        public AnalyticsViewModel(IProductRepo productRepo, IOccupanciesRepo occupancieRepo)
        {
            _productRepo            = productRepo;
            _occupancieRepo         = occupancieRepo;
            ToProductAddViewCommand = new RelayCommand(ToReservationAddView);

            UpdateDataCommand = new RelayCommand(UpdateData);
        }
Пример #3
0
        //private Data.Occupancy _selectedOccupancy;
        //public Data.Occupancy SelectedOccupancy
        //{
        //    get { return _selectedOccupancy; }
        //    set { SetValue(ref _selectedOccupancy, value); }
        //}

        #endregion

        #region Constructor
        public WaiterViewModel(ISaleRepo saleRepo, IOccupanciesRepo occupanciesRepo, ICategoryRepo categoryRepo)
        {
            _saleRepo        = saleRepo;
            _occupanciesRepo = occupanciesRepo;
            _categoryRepo    = categoryRepo;

            // .Where(sale => sale.Cooked.Equals("0"))         (ObservableCollection < Data.Sale > )
            //EditReservationCommand = new RelayCommand<CurrentCellEndEditEventArgs>(EditReservation);
            DeliverdCommand = new RelayCommand <WaiterSale>(Delivered, (_) => SelectedSale != null);
        }
Пример #4
0
        public TableAddSaleProductViewModel(Data.Occupancy occupancy, Data.SubCategory subCategory, IRecipeRepo recipeRepo, IIngredientRepo ingredientRepo, IProductRepo productRepo, IOccupanciesRepo iOccupanciesRepo, ObservableCollection <SuggestedProducts> suggestedProducts)
        {
            _suggestedProducts        = suggestedProducts;
            _occupancy                = occupancy;
            _iOccupanciesRepo         = iOccupanciesRepo;
            _iRecipeRepo              = recipeRepo;
            _iIngredientRepo          = ingredientRepo;
            _iProductRepo             = productRepo;
            SubCategory               = subCategory;
            MinusAmountCommand        = new RelayCommand(MinusAmount);
            PlusAmountCommand         = new RelayCommand(PlusAmount);
            SetSelectedProductCommand = new RelayCommand <Business.Product>(SetSelectedProduct);

            AddSaleCommand  = new RelayCommand(AddSale, CanAddSale);
            ViewBackCommand = new RelayCommand(ViewBack);
        }