示例#1
0
        private void StartButton_Click(object sender, EventArgs e)
        {
            //Form title is changed to display Server Name
            //along with the table he is serving.
            this.Text = ServerNameTextBox.Text + " @ Table Numer " + TableNoTextBox.Text;

            StartPanel.Visible = false;

            PizzaMenuGroupBox.Visible = true;
            OrderPanel.Visible        = true;
            LogoPictureBox.Visible    = true;

            OrderButton.Enabled       = true;
            PizzaMenuGroupBox.Enabled = true;

            MargheritaPizzaQuantityTextBox.Focus();
            MargheritaPizzaQuantityTextBox.SelectAll();
        }
示例#2
0
        private void OrderButton_Click(object sender, EventArgs e)
        {
            try
            {
                //taking user input
                int MargheritaPizzaQuantity = int.Parse(
                    MargheritaPizzaQuantityTextBox.Text);

                try
                {
                    int PepperoniPizzaQuanity = int.Parse(
                        PepperoniPizzaQuanityTextBox.Text);

                    try
                    {
                        int HamPineappleQuantity = int.Parse(
                            HamPineappleQuantityTextBox.Text);

                        // Calculations for transactions
                        double TotalOrderCost = (MARGHERITAPIZZACOST *
                                                 MargheritaPizzaQuantity) +
                                                (PEPPERONIPIZZACOST *
                                                 PepperoniPizzaQuanity) +
                                                (HAMPINEAPPLECOST *
                                                 HamPineappleQuantity) +
                                                SURCHARGECOST;

                        TotalCompanyReceipts += TotalOrderCost;

                        int SumOrderItems = HamPineappleQuantity +
                                            PepperoniPizzaQuanity +
                                            MargheritaPizzaQuantity;

                        CompanyTotalPizza += SumOrderItems;

                        //Output to transaction lables
                        ServerNameDisplayLabel.Text       = ServerNameTextBox.Text;
                        TotalPizzasOrderedLabel.Text      = SumOrderItems.ToString();
                        TotalTableReceiptsValueLabel.Text = TotalOrderCost.ToString("C");

                        OrderSummaryGroupBox.Visible = true;

                        TotalCompanyTransactions += 1;

                        OrderButton.Enabled       = false;
                        PizzaMenuGroupBox.Enabled = false;
                    }
                    catch
                    {
                        MessageBox.Show("Invalid entry, expecting numarical values, " +
                                        "Please try again!!", "Input Error !",
                                        MessageBoxButtons.OK, MessageBoxIcon.Error);

                        HamPineappleQuantityTextBox.Focus();

                        HamPineappleQuantityTextBox.SelectAll();
                    }
                }
                catch
                {
                    MessageBox.Show("Invalid entry, expecting numarical values, " +
                                    "Please try again!!", "Input Error !",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);

                    PepperoniPizzaQuanityTextBox.Focus();

                    PepperoniPizzaQuanityTextBox.SelectAll();
                }
            }
            catch
            {
                MessageBox.Show("Invalid entry, expecting numarical values, " +
                                "Please try again!!", "Input Error !",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);

                MargheritaPizzaQuantityTextBox.Focus();

                MargheritaPizzaQuantityTextBox.SelectAll();
            }
        }
示例#3
0
 private void MargheritaPizzaQuantityTextBox_MouseClick(object sender,
                                                        MouseEventArgs e)
 {
     MargheritaPizzaQuantityTextBox.SelectAll();
 }
示例#4
0
        /*Select All region Helps to improve the user experience
         * when a user clicks/enters respective text box in the
         * application the text inside it will be selected
         * so that it will assist the user in changing it.
         */
        #region Select All

        private void MargheritaPizzaQuantityTextBox_Enter(object sender,
                                                          EventArgs e)
        {
            MargheritaPizzaQuantityTextBox.SelectAll();
        }