/// <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);
        }
Beispiel #2
0
 public HomeController(UserManager <Person> userManager, IFestivalRepo festivalRepo, IReservationRepo reservationRepo, reservationsController reservationsController)
 {
     _userManager            = userManager;
     _FestivalRepo           = festivalRepo;
     _reservationRepo        = reservationRepo;
     _reservationsController = reservationsController;
 }
Beispiel #3
0
 /// <summary>
 /// Commands are initialized and for the right methods.
 /// Repositories are set.
 /// </summary>
 /// <param name="reservationRepo"><inheritdoc cref="_reservationRepo"/></param>
 public ReservationsViewModel(IReservationRepo reservationRepo)
 {
     _reservationRepo = reservationRepo;
     _editCommand     = new RelayCommand <Data.Reservation>(Edit, (_) => SelectedReservation != null);
     _removeCommand   = new RelayCommand <Data.Reservation>(Remove, (_) => SelectedReservation != null);
     _addCommand      = new RelayCommand(Add);
 }
 public ReservationController(IReservationRepo reservationRepo, ApplicationDbContext context, IScreeningRepo screeningRepo, IMovieRepo movieRepo, IHallRepo hallRepo)
 {
     this._reservationRepo = reservationRepo;
     this._context         = context;
     this._movieRepo       = movieRepo;
     this._hallRepo        = hallRepo;
     this._screeningRepo   = screeningRepo;
 }
 public ReservationsController(IReservationRepo reservationRepo, IGuestRepo guestRepo, IHostRepo hostRepo,
                               IMapper mapper)
 {
     _hostRepo        = hostRepo;
     _guestRepo       = guestRepo;
     _reservationRepo = reservationRepo;
     _mapper          = mapper;
 }
        /// <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 ReservationsController(IReservationRepo reservationRepo, IMapper mapper, IGenericRepo <PriceClass> genericPriceRepo, IGenericRepo <Person> genericPersonRepo, IGenericRepo <ReservedSeat> genericReservedSeatRepo, IFlightRepo flightRepo, IGenericRepo <Seat> genericSeatRepo, IAirplaneRepo airplaneRepo, ISender sender)
 {
     this.reservationRepo         = reservationRepo;
     this.mapper                  = mapper;
     this.genericPriceRepo        = genericPriceRepo;
     this.genericPersonRepo       = genericPersonRepo;
     this.genericReservedSeatRepo = genericReservedSeatRepo;
     this.flightRepo              = flightRepo;
     this.genericSeatRepo         = genericSeatRepo;
     this.airplaneRepo            = airplaneRepo;
     this.sender                  = sender;
 }
Beispiel #8
0
        public static string OverlappingReservationsExist(Reservation reservation, IReservationRepo _repository)
        {
            if (reservation.Status == "Cancelled")
            {
                return(string.Empty);
            }

            var reservations = _repository.GetActiveReservations(1);

            var overlappingReservation =
                reservations.FirstOrDefault(
                    b =>
                    reservation.ArrivalDate < b.DepartureDate && b.ArrivalDate < reservation.DepartureDate);

            return(overlappingReservation == null ? string.Empty
            : overlappingReservation.Reference);
        }
Beispiel #9
0
        /// <summary>
        /// Creates the DashboardViewModel instance.
        /// Sets the commands equal to a method to call.
        /// </summary>
        public DashboardViewModel(IReservationRepo reservationRepo, ISaleRepo saleRepo)
        {
            LocationHandler.Start();
            LocationHandler.statusChanged += LocationHandler_statusChanged;
            weatherHandler = new Weather.WeatherHandler();

            Time = DateTime.Now;
            DispatcherTimer timer = new DispatcherTimer();

            timer.Interval = TimeSpan.FromSeconds(0.3);
            timer.Tick    += Timer_Tick;
            timer.Start();

            _reservationRepo = reservationRepo;
            _saleRepo        = saleRepo;

            ChannelsMusic = MusicPlayer.channels;

            if (!MusicPlayer.channels.ContainsKey(Properties.Settings.Default.FavorityMusic)) // if the saved key of your favorite (last played) channel doens't exist, play Studio Brussel.
            {
                SelectedChannelMusic = getMusicChannelKeyValuePair("Studio Brussel");
            }
            else
            {
                SelectedChannelMusic = getMusicChannelKeyValuePair(Properties.Settings.Default.FavorityMusic);
            }
            LastSelectedChannelMusic = SelectedChannelMusic;

            MusicPlayer.statusChanged += MusicPlayer_statusChanged;

            PlayOrPauseMusicCommand = new RelayCommand(PlayOrPauseMusic);
            VolumeDownMusicCommand  = new RelayCommand(VolumeDownMusic);
            VolumeUpMusicCommand    = new RelayCommand(VolumeUpMusic);
            VolumeMuteMusicCommand  = new RelayCommand(MuteMusic);

            SelectedChannelMusicSelectionChangedCommand = new RelayCommand(SelectedChannelMusicSelectionChanged);
        }
 public ReservationVM(IReservationRepo reservationRepo, IScreeningRepo screeningRepo)
 {
     this.screening = new SelectList(screeningRepo.GetAllScreenings().Result, "Screening", "screening.Movie.Title", Reservation.Screening);
 }
Beispiel #11
0
 public reservationsController(IUserRepo userRepo, IFestivalRepo festivalRepo, IReservationRepo reservationRepo)
 {
     _userRepo        = userRepo;
     _festivalRepo    = festivalRepo;
     _reservationRepo = reservationRepo;
 }
Beispiel #12
0
 public ReservationService()
 {
     Repo = new ReservationRepo();
 }
Beispiel #13
0
 public ReservationController(IReservationRepo repository, IMapper mapper)
 {
     _repository = repository;
     _mapper     = mapper;
 }
 public ReservationService()
 {
     Repo = new ReservationRepo();
 }
Beispiel #15
0
 public ReservationService(IReservationRepo repo)
 {
     Repo = repo;
 }
 public MessagingManager(IReservationRepo resRepo, IMessageRepo mesRepo)
 {
     _reservationRepo = resRepo;
     _messageRepo     = mesRepo;
 }
Beispiel #17
0
 public ReservationController(IReservationRepo repo, AppDbContext context)
 {
     _context = context;
     _repo    = repo;
 }
Beispiel #18
0
 public ReservationController(IReservationRepo repo, IMapper mapper)
 {
     _repo   = repo;
     _mapper = mapper;
 }
Beispiel #19
0
 public GuestController(IReservationRepo reservationRepo, IGuestRepo guestRepo, IRoomRepo roomRepo)
 {
     _reservationRepo = reservationRepo;
     _guestRepo       = guestRepo;
     _roomRepo        = roomRepo;
 }