private void AddTicket()
        {
#if DEMO
            IEnumerable <Ticket> tickets = TicketManager.GetPartyTickets(ParentTicket.PartyId);
            int count = tickets.Count <Ticket>();
            if (count >= 2)
            {
                PosDialogWindow.ShowDialog(Window.GetWindow(this),
                                           Types.Strings.YouCanOnlyHave2PartyTicketsInTheDemoVersion,
                                           Types.Strings.DemoRestriction);
                return;
            }
#endif
            // Create a new ticket with the same data as the current ticket
            Ticket newTicket = TicketManager.Add(OriginalTicket.Type,
                                                 OriginalTicket.PartyId, OriginalTicket.SeatingId,
                                                 OriginalTicket.EmployeeId, OriginalTicket.CustomerId);

            newTicket.SetStartTime(OriginalTicket.StartTime);
            newTicket.SetPrepareTime(OriginalTicket.PrepareTime);
            newTicket.SetReadyTime(OriginalTicket.ReadyTime);
            newTicket.Update();

            string text = Types.Strings.Ticket + ": " + newTicket.PrimaryKey.Id;
            // Add the new ticket to the source list
            listboxSourceTicket.Items.Add(
                new FormattedListBoxItem(newTicket.PrimaryKey, text, true));

            if ((receiptTape.SelectedItems != null) && (receiptTape.SelectedItems.Count > 0))
            {
                //listBoxDestinationTicket.Items.Add(new FormattedListBoxItem(newTicket.Id, text, 280));
                PopulateDestinationList();
            }
        }
Example #2
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     TicketManager.Add(CurrentUser.User.Id, txtFirstName.Text, txtLastName.Text, rdbMale.Checked, txtTell.Text, txtAddress.Text, (int)cmbOrigin.SelectedValue, (int)cmbDestination.SelectedValue, Convert.ToInt32(txtPrice.Text));
     txtAddress.Text              =
         txtFirstName.Text        =
             txtLastName.Text     = txtPrice.Text = txtTell.Text = "";
     rdbMale.Checked              = true;
     cmbDestination.SelectedIndex = 0;
     cmbOrigin.SelectedIndex      = 0;
     MessageBox.Show("بلیط صادر گردید");
 }
        private void CreateTicketCommand()
        {
            // Make sure that start-of-day has occured
            if (DayOfOperation.Today == null)
            {
                PosDialogWindow.ShowDialog(
                    Types.Strings.YouCanNotCreateTicketsUntilStartOfDayHasBeenCompleted,
                    Types.Strings.RequiresStartOfDay, DialogButtons.Ok);
                return;
            }

            // Create the seating selection control
            if (ConfigurationManager.UseSeating)
            {
                PosDialogWindow window  = SeatingSelectionControl.CreateInDefaultWindow();
                var             control = window.DockedControl as SeatingSelectionControl;
                if (control == null)
                {
                    return;
                }
                control.InitializeFromTicket(null);

                // Show the dialog
                PosDialogWindow.ShowPosDialogWindow(window);

                if (!window.ClosedByUser)
                {
                    SessionManager.ActiveTicket =
                        TicketManager.Add(control.TicketType, Party.NoPartyId,
                                          control.SelectedSeatingId, SessionManager.ActiveEmployee.Id,
                                          ((control.SelectedCustomer != null) ?
                                           control.SelectedCustomer.Id : Customer.NoCustomerId));
                    SelectedTicket = SessionManager.ActiveTicket;
                    OrderEntryControl.SetAndLoadActiveTicket(SessionManager.ActiveTicket);
                }
                MainWindow.ShowWindowShadingOverlay = false;
            }
            else
            {
                SessionManager.ActiveTicket = TicketManager.Add(TicketType.DineIn,
                                                                Party.NoPartyId, Seating.NoSeatingId, SessionManager.ActiveEmployee.Id,
                                                                Customer.NoCustomerId);
                SelectedTicket = SessionManager.ActiveTicket;
                OrderEntryControl.SetAndLoadActiveTicket(SessionManager.ActiveTicket);
            }

            // Stop auto-logoff timer, if it should be disabled
            StoreSetting setting =
                SettingManager.GetStoreSetting("EnableAutoLogoffWhileInOrderEntry");

            if ((setting.IntValue == null) || (setting.IntValue.Value == 0))
            {
                LoginControl.StopAutoLogoutTimer();
            }

            // Need to change displayed tickets to open tickets, otherwise it will cause
            //  an exception in the TicketCashoutControl when cashing-out from in-order
            if ((TicketFilterControl.CurrentFilter != TicketSelectionShow.MyOpen) &&
                (TicketFilterControl.CurrentFilter != TicketSelectionShow.AllOpen) &&
                (TicketFilterControl.CurrentFilter != TicketSelectionShow.AllDay) &&
                (TicketFilterControl.CurrentFilter != TicketSelectionShow.All))
            {
                TicketFilterControl.CurrentFilter = TicketSelectionShow.MyOpen;
            }
            UpdateTickets();
        }