Beispiel #1
0
 private void HamPineappleQuantityTextBox_MouseClick(object sender,
                                                     MouseEventArgs e)
 {
     HamPineappleQuantityTextBox.SelectAll();
 }
Beispiel #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();
            }
        }
Beispiel #3
0
 private void HamPineappleQuantityTextBox_Enter(object sender,
                                                EventArgs e)
 {
     HamPineappleQuantityTextBox.SelectAll();
 }