Example #1
0
        private void Delete()
        {
            bool confirmed = false;

            if (listBox1.SelectedItem == null)
            {
                return;
            }
            FormattedListBoxItem selectedItem =
                listBox1.SelectedItem as FormattedListBoxItem;

            if (selectedItem == null)
            {
                return;
            }

            if (ViewMode == SeatingViewMode.Rooms)
            {
                string message = (buttonEditToggle.IsEnabled ?
                                  Strings.AreYouSureYouWantToDeleteTheSelectedRoomAndAllItsSeatings :
                                  Strings.AreYouSureYouWantToDeleteTheSelectedRoom);
                if (PosDialogWindow.ShowDialog(
                        message, Strings.ConfirmDeletion, DialogButtons.OkCancel) == DialogButton.Ok)
                {
                    Room room = selectedItem.ReferenceObject as Room;
                    if (room != null)
                    {
                        SeatingManager.DeleteRoom(room.Id);
                        SeatingManager.DeleteAllSeating(room.Id);
                    }
                    buttonEditToggle.IsEnabled  = false;
                    roomEditorControl.IsEnabled = false;
                    SelectedRoom    = null;
                    SelectedSeating = null;
                    confirmed       = true;
                }
            }
            else if (ViewMode == SeatingViewMode.Seating)
            {
                if (PosDialogWindow.ShowDialog(
                        Strings.AreYouSureYouWantToDeleteTheSelectedSeating,
                        Strings.ConfirmDeletion, DialogButtons.OkCancel) == DialogButton.Ok)
                {
                    Seating seating = selectedItem.ReferenceObject as Seating;
                    if (seating != null)
                    {
                        SeatingManager.DeleteSeating(seating.Id);
                    }
                    seatingEditorControl.IsEnabled = false;
                    SelectedSeating = null;
                    confirmed       = true;
                }
            }
            if (confirmed)
            {
                listBox1.Items.Remove(selectedItem);
                listBox1.SelectedItem  = null;
                buttonDelete.IsEnabled = false;
            }
        }
Example #2
0
 // ToDo: These are needed per-say, but what if someone create
 // Multiple Rooms with TicketingTypes of the same value, then this
 // could be useful, otherwise should prevent adding multiple rooms
 // of these types
 private void SetDefaultSeating(Room room)
 {
     SeatingManager.DeleteAllSeating(room.Id);
     if (room.TicketingType == PosModels.Types.TicketType.DriveThru)
     {
         SeatingManager.AddSeating(room.Id, Strings.DriveThru, 0);
     }
     if (room.TicketingType == PosModels.Types.TicketType.Delivery)
     {
         SeatingManager.AddSeating(room.Id, Strings.Delivery, 0);
     }
     if (room.TicketingType == PosModels.Types.TicketType.Pickup)
     {
         SeatingManager.AddSeating(room.Id, Strings.Carryout, 0);
     }
     if (room.TicketingType == PosModels.Types.TicketType.Catering)
     {
         SeatingManager.AddSeating(room.Id, Strings.Catering, 0);
     }
 }