Exemplo n.º 1
0
 public TableAddEditViewModel(ITableRepo tableRepository)
 {
     _tablesRepository = tableRepository;
     _cancelCommand    = new RelayCommand(Cancel);
     _saveCommand      = new RelayCommand(Save, CanSave);
     _deleteCommand    = new RelayCommand(Delete);
 }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Commands are initialized and for the right methods.
        /// Repositories are set.
        /// </summary>
        /// <param name="reservationRepo"><inheritdoc cref="_reservationRepo"/></param>
        /// <param name="tableRepo"><inheritdoc cref="_tableRepo"/></param>
        public ReservationAddEditViewModel(IReservationRepo reservationRepo, ITableRepo tableRepo)
        {
            CancelCommand = new RelayCommand(Cancel);
            SaveCommand   = new RelayCommand(Save, CanSave);

            _reservationRepo = reservationRepo;
            _tableRepo       = tableRepo;
            AllTables        = new ObservableCollection <Table>();
            CalculateAvailableTablesCommand = new RelayCommand <EventArgs>(CalculateAvailableTablesEvent);
        }
 public TablesController(ITableRepo tableRepo, IMapper mapper)
 {
     _tableRepo = tableRepo;
     _mapper    = mapper;
 }
Exemplo n.º 5
0
 public TableViewModel(ITableRepo tableRepo)
 {
     _tableRepo = tableRepo;
     ToTableOccupancyViewCommand = new RelayCommand <Data.Table>(ToTableOccupancyView, (x) => x != null);
     AddCommand = new RelayCommand(Add);
 }
Exemplo n.º 6
0
 public TableController(ITableRepo repository, IMapper mapper)
 {
     _repository = repository;
     _mapper     = mapper;
 }