Exemplo n.º 1
0
        private void ChangeButton_Click(object sender, EventArgs e)
        {
            try
            {
                //converting text box to integer
                Tendered = Convert.ToDouble(tenderedAmount.Text);

                //if all info is entered right, the change label will be written
                if (billPressed > 0 && Tendered > totalPrice)
                {
                    try
                    {
                        //increasing the number of times the button was pressed
                        changePressed++;


                        //doing the math
                        Change = Tendered - totalPrice;

                        //changing the text in the change label
                        changeLabel.BackColor = Color.AntiqueWhite;
                        changeLabel.Font      = new Font("Lydian Csv BT", 8, FontStyle.Regular);
                        changeLabel.Text      = "Amount Tendered:   " + Tendered.ToString("C");
                        changeLabel.Text     += "\nChange Due:   " + Change.ToString("C");
                    }

                    //error message will be diplayed if the info is wrong
                    catch
                    {
                        changeLabel.BackColor = Color.AntiqueWhite;
                        changeLabel.Font      = new Font("Lydian Csv BT", 12, FontStyle.Bold);
                        changeLabel.Text      = "Please Enter an Available Amount";
                    }
                }

                //if the amount entered is insufficient or there isn't an amount entered, it will ask for correct amount
                else
                {
                    changeLabel.BackColor = Color.White;
                    changeLabel.Font      = new Font("Lydian Csv BT", 12, FontStyle.Bold);
                    changeLabel.Text      = "Please Enter Correct Amounts";
                }
            }

            catch
            {
                changeLabel.BackColor = Color.White;
                changeLabel.Font      = new Font("Lydian Csv BT", 12, FontStyle.Bold);
                changeLabel.Text      = "Please Enter Correct Amounts";
            }
        }
Exemplo n.º 2
0
        private void PrintReciept_Click(object sender, EventArgs e)
        {
            SoundPlayer print = new SoundPlayer(Properties.Resources.print);

            //if both the previous buttons have been pressed, then the reciept will print
            //delay between each line to simulate printing
            //weird printer sound plays
            if (billPressed > 0 && changePressed > 0 && changeLabel.Text != "Please Enter Above Amounts" &&
                bill.Text != "Please Enter Correct Info" && bill.Text != "Please Enter Correct Info")
            {
                reciept.Text = "Number of Swords Ordered: " + numberofSwords + "    " + "at " + PRICE_SWORDS.ToString("C");
                print.Play();
                reciept.Refresh();
                Thread.Sleep(300);

                reciept.Text += "\nNumber of Shields Ordered: " + numberofShields + "    " + "at " + PRICE_SHIELDS.ToString("C");
                reciept.Refresh();
                Thread.Sleep(300);

                reciept.Text += "\nNumber of Suits Ordered: " + numberofSoA + "    " + "at " + PRICE_SUITSofARMOR.ToString("C");
                reciept.Refresh();
                Thread.Sleep(600);

                reciept.Text += "\n\nSub Total:   " + subTotal.ToString("C");
                print.Play();
                reciept.Refresh();
                Thread.Sleep(300);

                reciept.Text += "\nTax:   " + tax.ToString("C");
                reciept.Refresh();
                Thread.Sleep(600);

                reciept.Text += "\n\nTotal:   " + totalPrice.ToString("C");
                print.Play();
                reciept.Refresh();
                Thread.Sleep(600);

                reciept.Text += "\n\nAmount Tendered:   " + Tendered.ToString("C");
                reciept.Refresh();
                Thread.Sleep(300);

                reciept.Text += "\nChange Due:   " + Change.ToString("C");
                print.Play();
                reciept.Refresh();
                Thread.Sleep(600);

                reciept.Text += "\n\nHave a Pleasent Battle! ;)";
                reciept.Refresh();
                Thread.Sleep(600);

                reciept.Text += "\n\nSponsored by Potion Seller's Potions";
                print.Play();
                reciept.Refresh();
                Thread.Sleep(600);

                reciept.Text += "\n\nP.S If you win, you owe me";

                newOrder.Show();
                newOrder.BackColor = Color.AntiqueWhite;
            }

            //if the previous buttons haven't been pressed, the reciept will ask you to enter info and press the buttons
            else
            {
                reciept.Text = "Please Enter the Information Required";
            }
        }