public bool Delete(Reservation reservation)
        {
            try
            {
                _isDirty = true;
                return _reservationDataService.DeleteObject(reservation.ReservationId);
            }
            catch (Exception ex)
            {
                if (this._logger != null)
                {
                    this._logger.Log(ex.Message, Category.Exception, Priority.High);
                }
            }

            return false;
        }
        private void OnAddCommand()
        {
            try
            {
                var selectedReservation = new Reservation();
                selectedReservation.TimeFrom = (ushort)this.FromHour;
                selectedReservation.TimeTo = (ushort)this.ToHour;
                selectedReservation.NoOfPersons = this.NoOfPersons;
                this._container.RegisterInstance<Reservation>("SelectedReservation", selectedReservation);

                var openFileDialogResult = this._dialogBoxService.ShowUserDialog("Add Reservation", Common.ViewNames.ReservationDetailsView);
                if (openFileDialogResult == DialogBoxResult.OK)
                {
                    //
                }
            }
            catch (Exception ex)
            {
                if (this._logger != null)
                {
                    this._logger.Log(ex.Message, Category.Exception, Priority.High);
                }
            }
        }
        public ReservationDetailsViewModel(IUnityContainer container, ILoggerFacade logger, IReservationManager reservationManager, ITableManager tableManager, IMessageBoxService messageBoxService, IDialogBoxService dialogBoxService)
        {
            this._logger = logger;
            this._container = container;
            this._reservationManager = reservationManager;
            this._tableManager = tableManager;
            this._messageBoxService = messageBoxService;
            this._dialogBoxService = dialogBoxService;

            var allTables = this._tableManager.GetAll().ToDictionary(tbl => tbl.TableId, tbl => tbl);

            // Assumption : Reservation duration is between 10 Am and 10 Pm
            this._minFromHour = 10;
            this._maxFromHour = 22;

            this._reservedTables = new ObservableCollection<Table>();
            var currentReservation = this._container.Resolve(typeof(Reservation), "SelectedReservation");
            if (currentReservation != null)
            {
                this.FromHour = (short)(currentReservation as Reservation).TimeFrom;
                this.ToHour = (short)(currentReservation as Reservation).TimeTo;
                this._currentReservation = currentReservation as Reservation;
                this._currentReservation.PropertyChanged += _currentReservation_PropertyChanged;

                foreach (var tableId in this._currentReservation.ReservedTableIds)
                {
                    this._reservedTables.Add(allTables[tableId]);
                }

                this._availableTables = new ObservableCollection<Table>(this.GetAvailableTables((ushort)this._fromHour, (ushort)this._toHour));
                if (this._availableTables != null && this._availableTables.Count > 0)
                {
                    this._selectedAvailableTable = this._availableTables.First();
                }
            }
            else
            {
                this.FromHour = this._minFromHour;
            }

            if (this._reservedTables != null && this._reservedTables.Count > 0)
            {
                this._selectedReservedTable = this._reservedTables.First();
            }

            this.SaveCommand = new DelegateCommand(this.OnSaveCommand, () =>
            {
                return this._currentReservation != null &&
                    this._reservedTables != null &&
                    this._reservedTables.Count > 0 &&
                    !string.IsNullOrEmpty(this._currentReservation.CustomerName) &&
                    !string.IsNullOrEmpty(this._currentReservation.ContactNumber);
            });

            this.CancelCommand = new DelegateCommand(this.OnCancelCommand, () => { return this._currentReservation != null; });

            this.ReserveTableCommand = new DelegateCommand(this.OnReserveTableCommand, () =>
            {
                return this._currentReservation != null &&
                    this._selectedAvailableTable != null &&
                    this._currentReservation.NoOfPersons > this._reservedTables.Sum(tbl => tbl.MaxOccupancy);
            });

            this.UnreserveTableCommand = new DelegateCommand(this.OnUnreserveTableCommand, () =>
            {
                return this._currentReservation != null &&
                    this._selectedReservedTable != null;
            });
        }