Exemple #1
0
        private void btnDiscontinueProduct_Click(object sender, EventArgs e)
        {
            PopupBoxForm popupDiscontinue = new PopupBoxForm(
                "Are you sure you would like to Discontinue this product?",
                "Discontinue Product", "YesNo"); //create new Popup Box

            popupDiscontinue.ShowDialog(this);   //display Popup Box as child form

            //discontinue product if user clicks "OK"
            //this will occur in the StartupWars class
            if (popupDiscontinue.YesClick)
            {
                Discontinue = true;
            }

            Close();
        }
        private void btnTerminateEmployee_Click(object sender, EventArgs e)
        {
            SetSeveranceAmount(employee);

            PopupBoxForm popupTerminate = new PopupBoxForm(
                "Are you sure you would like to Terminate this employee?\r\n" +
                $"Severance: {Severance.ToString("C")}",
                "Terminate Employee", "YesNo"); // create new PopUpBox

            popupTerminate.ShowDialog(this);    //display Popup box as child form

            //terminate employee if user clicks "OK"
            //this will occur in the StartupWars class
            if (popupTerminate.YesClick)
            {
                Terminate = true;
            }

            Close();
        }
Exemple #3
0
        private void btnPayDebt_Click(object sender, EventArgs e)
        {
            //see if value in text box is valid
            if (Decimal.TryParse(txtboxAmountToPay.Text, out decimal amountTowardsDebt))
            {
                if (amountTowardsDebt <= Debt)
                {
                    PopupBoxForm popupPayDebt = new PopupBoxForm(
                        "Are you sure you would like to pay this amount?\r\n" +
                        $"{amountTowardsDebt.ToString("C")}",
                        "Pay Debt?", "YesNo");     // create new PopUpBox
                    popupPayDebt.ShowDialog(this); //display Popup box as child form

                    //If Yes was clicked...
                    if (popupPayDebt.YesClick)
                    {
                        Debt      -= amountTowardsDebt;
                        AmountPaid = amountTowardsDebt;
                        Close();
                    }
                }
                else
                {
                    PopupBoxForm popupAmountTooHigh = new PopupBoxForm(
                        "The amount entered must be lower than or equal to the total debt.",
                        "OK");                           // create new PopUpBox
                    popupAmountTooHigh.ShowDialog(this); //display Popup box as child form

                    txtboxAmountToPay.Text = "";
                }
            }
            else
            {
                PopupBoxForm popupInvalidInput = new PopupBoxForm(
                    "Invalid input - Please try again.", "OK"); // create new PopUpBox
                popupInvalidInput.ShowDialog(this);             //display Popup box as child form

                txtboxAmountToPay.Text = "";
            }
        }