Пример #1
0
        private void Save()
        {
            try
            {
                if (IsNewTable == false)
                {
                    Data.Table table = _tablesRepository.GetTableById(ManipulatedTable.Id);
                    table.Name     = ManipulatedTable.Name;
                    table.Capacity = ManipulatedTable.Capacity;

                    _tablesRepository.UpdateTable(table);
                    CancelRequested?.Invoke();
                    MessageHandler.InvokeSuccessMessage(Resources.InformationUpdateTable, Resources.InformationTableUpdated);
                }
                else
                {
                    _tablesRepository.AddTable(new Table
                    {
                        Capacity = ManipulatedTable.Capacity, Name = ManipulatedTable.Name, IsOccupied = ManipulatedTable.IsOccupied, Id = ManipulatedTable.Id
                    });

                    ToTableViewRequested?.Invoke();
                    MessageHandler.InvokeSuccessMessage(Resources.InformationAddTable, Resources.InformationTableAdded);
                }
            }

            catch (Exception e)
            {
                ErrorHandler.ThrowError(0, e.Message);
            }
        }
Пример #2
0
 public void Delete()
 {
     if (!ManipulatedTable.IsOccupied)
     {
         if (MessageBoxResult.Yes == MessageBox.Show(Properties.Resources.ConfirmationRemoveTable, Properties.Resources.ConfirmationRemoveTableCaption, MessageBoxButton.YesNo, MessageBoxImage.Exclamation, MessageBoxResult.No))
         {
             Data.Table dataTable = Tables.FirstOrDefault(x => x.Id == ManipulatedTable.Id);
             _tablesRepository.DeleteTable(dataTable);
             ToTableViewRequested?.Invoke();
         }
     }
     else
     {
         ErrorHandler.ThrowError(0, Properties.Resources.CannotRemoveOccupiedTable);
     }
 }
Пример #3
0
 /// <summary>
 /// Invokes the event when a user wants to change to the TableView.
 /// </summary>
 private void ToTableView(Data.User user)
 {
     ToTableViewRequested?.Invoke();
 }