private void OnPrintTicket()
        {
            List <Spot> spots = new List <Spot>();

            if (SelectedSpot.Status == ItemStatus.Printed)
            {
                ConfirmationBox cb = new ConfirmationBox
                {
                    Message = String.Format(
                        "Вы действительно желаете перепечатать билет № {0}, {1}, {2}, {3} ряд, {4} место?\nБланк {5} будет аннулирован.",
                        SelectedSpot.Id, SelectedSpot.SideName, SelectedSpot.SectorName, SelectedSpot.RowNum,
                        SelectedSpot.SeatNum, SelectedSpot.Blank.Key)
                };
                bool?result = cb.ShowDialog();
                if (result ?? false)
                {
                    SelectedSpot.Blank  = Access.Annul(SelectedSpot.Blank);
                    SelectedSpot.Status = ItemStatus.Sold;
                    spots.Add(SelectedSpot);
                    ProcessPrint(spots);
                }
            }

            if (SelectedSpot.Status == ItemStatus.Sold)
            {
                spots.Add(SelectedSpot);
                ProcessPrint(spots);
            }
        }
Beispiel #2
0
        private void saveButton_Click(object sender, EventArgs e)
        {
            Object o = comboBox1.SelectedItem;

            // if user hasn't chosen a rating - not allowed
            if (o == null)
            {
                MessageBox.Show("Būtina pasirinkti įvertinimą.");
            }

            // if rating was chosen - checks if a comment was added
            else
            {
                if (richTextBox1.Text != "")
                {
                    ConfirmReview();
                }

                // if no comment found - asks to confirm the decision
                else
                {
                    ConfirmationBox confirmationBox = new ConfirmationBox(this);
                    confirmationBox.Show();
                }
            }
        }
        private void OnCancelTicket()
        {
            Ticket t = SelectedTicket;

            if (t != null)
            {
                ConfirmationBox cb = new ConfirmationBox
                {
                    Message =
                        String.Format(
                            "Вы действительно желаете аннулировать билет № {0}, {1}, {2}, {3} ряд, {4} место?",
                            t.Id, t.SideName, t.SectorName, t.RowNum, t.SeatNum)
                };
                bool?result = cb.ShowDialog();
                if (result ?? false)
                {
                    Customer.Order.Seats = new List <Seat> {
                        new Seat()
                        {
                            Id = t.Id
                        }
                    };
                    Customer.Order = Customer.Order = Access.Cancel(Customer.Order);
                    ReloadOrder();
                }
            }
        }
        private void RevertExecute()
        {
            ConfirmationBox box = new ConfirmationBox();

            box.Message          = DEFAULT_SETTINGS_MESSAGE;
            box.DialogCompleted += this.OnDialogCompleted;
            box.Show();
        }
Beispiel #5
0
    void Start()
    {
        anim = GetComponent<Animator>();

        if (anim == null)
            enabled = false;

        instance = this;
    }
        private void OnCancelBlank()
        {
            ConfirmationBox cb = new ConfirmationBox
            {
                Message = String.Format("Функция отключена до выяснения подробностей аннулирования свободного бланка. Выбран бланк № {0}", SelectedBlank.Key)
            };
            bool?result = cb.ShowDialog();

            if (result ?? false)
            {
                SelectedBlank = Access.Annul(SelectedBlank);
            }
        }
        private void OnCancelOrder()
        {
            ConfirmationBox cb = new ConfirmationBox
            {
                Message = String.Format("Вы действительно желаете отменить заказ № {0}?", Customer.Order.Id)
            };
            bool?result = cb.ShowDialog();

            if (result ?? false)
            {
                Customer.Order = Customer.Order = Access.Cancel(Customer.Order);
                ReloadOrder();
            }
        }
        private void OnRemoveTicket()
        {
            Spot            spot = SelectedSpot;
            ConfirmationBox cb   = new ConfirmationBox
            {
                Message =
                    String.Format(
                        "Вы действительно желаете удалить билет № {0}, {1}, {2}, {3} ряд, {4} место из списка билетов заказа?",
                        spot.Id, spot.SideName, spot.SectorName, spot.RowNum, spot.SeatNum)
            };


            bool?result = cb.ShowDialog();

            if (result ?? false)
            {
                //First we cancel ticket in the order
                Customer.Order.Seats = new List <Seat> {
                    new Seat()
                    {
                        Id = spot.Id
                    }
                };
                Customer.Order = Data.Access.Cancel(Customer.Order);

                // Then we remove a seat from selected seats collection
                SelectedSpots.Remove(spot);
                // and mark spot as unselected on the map
                foreach (Spot s in Spots)
                {
                    if (s.Id == spot.Id)
                    {
                        s.IsSelected = false;
                        s.Width      = 20;
                        s.Height     = 20;
                    }
                }

                // At last we again lock seats
                if (SelectedSpots.Count > 0)
                {
                    LockSeats(SelectedSpots.ToArray());
                }
            }
        }
Beispiel #9
0
        ///updates the selected row of the database with the new edits provided
        private void SaveChanges()
        {
            if (CheckForChanges())
            {
                if (ValidateInputEntry())
                {
                    if (ConfirmationBox.Show("Are you sure you wish to make these changes?"))
                    {
                        StringBuilder sb = new StringBuilder();
                        sb.Append("UPDATE Cars SET ");
                        sb.Append("[Manufacturer] = '" + manufacturerTextBox.Text + "', ");
                        sb.Append("[Model] = '" + modelTextBox.Text + "', ");
                        sb.Append("[Color] = '" + colorTextBox.Text + "', ");
                        sb.Append("[Petrol] = " + petrolCheckBox.Checked + ", ");
                        sb.Append("[EngineSize] = " + engineSizeTextBox.Text + " ");

                        DataTable table = connection.GetTable();

                        sb.Append("WHERE ");
                        sb.Append("[OrderNumber] = " + table.Rows[listBoxDataBaseTable.SelectedIndex][0].ToString());

                        connection.SQLQuery(sb.ToString());

                        MessageBox.Show("Changes Saved!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);

                        PREVIOUSLY_SELECTED_ROW = listBoxDataBaseTable.SelectedIndex;

                        PopulateListBox();
                        listBoxDataBaseTable.TopIndex = PREVIOUSLY_SELECTED_ROW;

                        SwitchMode(EditMode.VIEW_MODE);
                    }
                    else
                    {
                        SwitchMode(EditMode.VIEW_MODE);
                    }
                }
            }
            else
            {
                MessageBox.Show("No changes were found.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
        public static void Setup()
        {
            MessageBox.Setup();
            ConfirmationBox.Setup();
            ContextMenu.Setup();
            var window = IoC.Get <IWindow>();
            var items  = GameCollections.Items;

            var menu = CreateMenu(window);

            window.AddControl(menu);

            var leftPanel   = new Panel(window, null, new Rectangle(0, 20, 300, window.Width));
            var statusLabel = new Label(window, leftPanel, Color.LimeGreen, new Rectangle(15, 10, 100, 16),
                                        "Position:");

            leftPanel.AddControl(statusLabel);

            var statusTextLabel = new Label(window, leftPanel, Color.White, new Rectangle(15, 26, 100, 16));

            leftPanel.AddControl(statusTextLabel);
            Ui.StatusTextLabel = statusTextLabel;

            // var paletteBox = new PaletteBox<int>(window, leftPanel, new Rectangle(150, 50, 120, 100), 5);
            // for (int i = 0; i < 20; i++)
            // {
            //     paletteBox.AddItem(new ImageBox(items.GetItem((uint)(1408 + i)).GetSprite(), new Point(32,32)), 1408 + i);
            // }
            //
            // paletteBox.OnSelect = item =>
            // {
            //     MessageBox.Show(window.Center(), $"You selected item with id {item}");
            // };
            // leftPanel.AddControl(paletteBox);

            /* Category list box */
            Categories.List = new ListBox <string>(
                window, leftPanel, new Rectangle(10, 50, 120, 116));
            Categories.List.AddItem(Categories.NoCategory, Categories.NoCategory);
            Categories.List.Select(Categories.NoCategory);

            leftPanel.AddControl(Categories.List);
Beispiel #11
0
        //prompts the user whehter they wish to delete their selected row from the database
        private void buttonDelete_Click(object sender, EventArgs e)
        {
            try {
                if (ConfirmationBox.Show("Do you really want to Delete this Record?"))
                {
                    StringBuilder sb = new StringBuilder();
                    sb.Append("DELETE FROM Cars WHERE [OrderNumber]=");

                    DataTable table = connection.GetTable();
                    sb.Append(table.Rows[listBoxDataBaseTable.SelectedIndex][0].ToString());

                    PREVIOUSLY_SELECTED_ROW = listBoxDataBaseTable.SelectedIndex;

                    connection.SQLQuery(sb.ToString());

                    PopulateListBox();

                    //moves the selected item to the item directly below the now deleted item
                    if (listBoxDataBaseTable.Items.Count > 0)
                    {
                        if (listBoxDataBaseTable.Items.Count >= PREVIOUSLY_SELECTED_ROW + 1)
                        {
                            listBoxDataBaseTable.SelectedIndex = PREVIOUSLY_SELECTED_ROW;
                        }
                        else
                        {
                            listBoxDataBaseTable.SelectedIndex = listBoxDataBaseTable.Items.Count - 1;
                        }
                        FillInputBoxes();
                    }
                    else
                    {
                        SwitchMode(EditMode.VIEW_MODE);
                    }

                    MessageBox.Show("Record Successfully Deleted", "Help", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            } catch (Exception err) {
                SwitchMode(EditMode.NO_CONNECTION);
                MessageBox.Show(err.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        /// <summary>
        /// Handles OrderWindow PrintReservedTicket button event
        /// </summary>
        private void OnPrintReservedTicket()
        {
            List <Spot> spots = new List <Spot>();

            if (SelectedTicket.BlankId > 0)
            {
                ConfirmationBox cb = new ConfirmationBox
                {
                    Message = String.Format(
                        "Вы действительно желаете перепечатать билет № {0}, {1}, {2}, {3} ряд, {4} место?\nБланк № {5} будет аннулирован.",
                        SelectedTicket.Id, SelectedTicket.SideName, SelectedTicket.SectorName, SelectedTicket.RowNum,
                        SelectedTicket.SeatNum, SelectedTicket.BlankId)
                };
                bool?result = cb.ShowDialog();
                if (result ?? false)
                {
                    Blank blank = new Blank()
                    {
                        Id = SelectedTicket.BlankId
                    };
                    Access.Annul(blank);
                    SelectedTicket.BlankId = 0;
                }
            }

            if (SelectedTicket.Status == ItemStatus.Sold && SelectedTicket.BlankId == 0)
            {
                Blank[] blanks = Access.GetBlanks(0, 1, ItemStatus.OnSale);
                Spot    spot   = new Spot
                {
                    Id     = SelectedTicket.Id,
                    Status = SelectedTicket.Status,
                    Blank  = blanks[0]
                };
                SelectedTicket.BlankId = spot.Blank.Id;
                spots.Add(spot);
                ProcessPrint(spots);
            }

            ReloadOrder();
        }
Beispiel #13
0
    public void OnBuyButtonPress()
    {
        if (!isBought)
        {
            confirmationPanel.SetActive(true);
            //this should be the price tag
            Text   nameText = unitbutt.GetComponentInChildren <Text>();
            string name     = nameText.text;


            Button[] buttons   = unitbutt.GetComponentsInChildren <Button>();
            Text     priceText = nameText;//temp
            foreach (Button b in buttons)
            {
                if (b.name == "BuyButton")
                {
                    priceText = b.GetComponentInChildren <Text>();
                }
            }
            string costString = priceText.text.Substring(0, priceText.text.IndexOf(" "));
            int    cost       = int.Parse(costString);//safeer

            Text[] confirmationTextes = confirmationPanel.GetComponentsInChildren <Text>();
            foreach (Text t in confirmationTextes)
            {
                if (t.name == "NameText")
                {
                    t.text = name;
                }
                else if (t.name == "PriceText")
                {
                    t.text = cost.ToString();
                }
            }

            //Now the confirmation box is open
            ConfirmationBox cscript = confirmationPanel.GetComponent <ConfirmationBox>();
            cscript.AssignUnitButton(this);
        }
    }
        private void OnRemoveSeat()
        {
            if (SelectedSpot != null)
            {
                Spot            spot = SelectedSpot;
                ConfirmationBox cb   = new ConfirmationBox
                {
                    Message = String.Format(
                        "Вы действительно желаете удалить место № {0}, {1}, {2}, {3} ряд, {4} место из списка выбранных мест?",
                        spot.Id, spot.SideName, spot.SectorName, spot.RowNum, spot.SeatNum)
                };
                bool?result = cb.ShowDialog();
                if (result ?? false)
                {
                    // First we release all the selected seats
                    List <Seat> seats = ReleaseSeats(SelectedSpots.ToArray());
                    if (seats != null)
                    {
                        // Then we remove a seat from selected seats collection
                        SelectedSpots.Remove(spot);
                        // and mark spot as unselected on the map
                        foreach (Spot s in Spots)
                        {
                            if (s.Id == spot.Id)
                            {
                                s.IsSelected = false;
                                s.Width      = 20;
                                s.Height     = 20;
                            }
                        }

                        // At last we again lock seats
                        if (SelectedSpots.Count > 0)
                        {
                            LockSeats(SelectedSpots.ToArray());
                        }
                    }
                }
            }
        }
Beispiel #15
0
        internal void UploadToService()
        {
            this.BusyCount++;
            Locator.NavigationStatic.NavigateToSaveResponsesCommand.IsExecutedNow = false;
            ConfirmationBox box = new ConfirmationBox();

            string message = string.Empty;

            if (this.currentResponseSet.IsCompleted)
            {
                message = UPLOAD_SERVICE_TEXT;
            }
            else
            {
                message = NOT_COMPLETED_RESPONSE_TEXT;
            }


            box.Message          = message;
            box.DialogCompleted += this.OnDialogCompleted;
            box.Show();
        }
Beispiel #16
0
        protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
        {
            base.OnClosing(e);
            if (!VM.Instance.SaveRequired)
            {
                return;
            }

            var result = ConfirmationBox.Show();

            switch (result)
            {
            case ConfirmationResult.Cancel:
                e.Cancel = true;
                break;

            case ConfirmationResult.Quit:
                break;

            default:
                throw new NotImplementedException();
            }
        }
        /// <summary>
        /// Handles OrderWindow PrintTickets button event
        /// </summary>
        private void OnPrintReservedTickets()
        {
            foreach (Ticket ticket in Tickets)
            {
                if (ticket.BlankId > 0)
                {
                    ConfirmationBox cb = new ConfirmationBox
                    {
                        Message = String.Format(
                            "Вы действительно желаете перепечатать билет № {0}, {1}, {2}, {3} ряд, {4} место?\nБланк № {5} будет аннулирован.",
                            ticket.Id, ticket.SideName, ticket.SectorName, ticket.RowNum, ticket.SeatNum, ticket.BlankId)
                    };
                    bool?result = cb.ShowDialog();
                    if (result ?? false)
                    {
                        Blank blank = new Blank()
                        {
                            Id = ticket.BlankId
                        };
                        Access.Annul(blank);
                        ticket.BlankId = 0;
                    }
                }
            }

            int validTickets = Tickets.Where(x => x.BlankId == 0).Count(x => x.Status == ItemStatus.Sold);

            Blank[] blanks = Access.GetBlanks(0, validTickets, ItemStatus.OnSale);

            if (blanks != null)
            {
                if (blanks.Length != validTickets)
                {
                    BlankStatus = "Количество бланков недостаточно для печати заказа";
                    return;
                }
            }
            else
            {
                BlankStatus = "У вас отсутствуют бланки";
                return;
            }
            List <Spot>          spots   = new List <Spot>();
            IEnumerable <Ticket> tickets = Tickets.Where(x => x.BlankId == 0 && x.Status == ItemStatus.Sold);
            int counter = 0;

            foreach (Ticket ticket in tickets)
            {
                if (blanks.Length > counter)
                {
                    Spot spot = new Spot
                    {
                        Id     = ticket.Id,
                        Status = ticket.Status,
                        Blank  = blanks[counter]
                    };
                    ticket.BlankId = spot.Blank.Id;
                    spots.Add(spot);
                    counter++;
                }
            }

            ProcessPrint(spots);
            ReloadOrder();
        }