//return to main form
        private void CancelButton_Click(object sender, EventArgs e)
        {
            //Log current operation:
            s3log.logOperation(sender);

            Form ATM6 = new ATM6(); // Instantiate a Form object.

            ATM6.Show();            //show the new Form
            this.Visible = false;   //Hide the old form
        }
        private void metroButton2_Click(object sender, EventArgs e)
        {
            //continue to Main form
            Form ATM6 = new ATM6(); // Instantiate a Form object.

            ATM6.Show();            //show the new Form

            this.Visible = false;

            //Log current operation:
            s3log.logOperation(sender);
        }
        //Quick jump to current Form:
        private void metroButton1_Click(object sender, EventArgs e)
        {
            if (Pinger("stackoverflow.com", 5) > 29)
            {
                MetroFramework.MetroMessageBox.Show(this, "the connection is lost");
            }
            else
            {
                MetroFramework.Forms.MetroForm ATM6 = new ATM6(); // Instantiate a Form object.
                ATM6.Show();                                      //show the new Form
                this.timer2.Stop();

                this.Visible = false; //Hide the old form
            }
        }
        private void withdrawPrintReceipt(int WithdrawAmount)
        {
            //Dispense WithdrawAmount
            AutoClosingMessageBox.Show("Requested amount of " + WithdrawAmount + " Pesos is available in slot now", "Info", 1500, this);

            //Ask & send receipt

            var result = MetroMessageBox.Show(this, "Do you want to print a receipt?", "Receipt", MessageBoxButtons.YesNo);

            if (result == DialogResult.Yes)
            {
                //Doing Assans AWS Printing magic here


                String body  = headz(WithdrawAmount);
                String title = "Thank you for using HELIOS Banking";
                Lib.sendMail(title, body);
                AutoClosingMessageBox.Show("Finished AWS printing magic.", "Info", 1500, this);
            }

            //Asking for Performing other transaction
            result = MetroMessageBox.Show(this, "Do you to perform another transaction?", "Return to main menu", MessageBoxButtons.YesNo);
            if (result == DialogResult.Yes)
            {
                //Return to main menu for other transaction
                Form ATM6 = new ATM6(); // Instantiate a Form object.
                ATM6.Show();            //show the new Form

                this.Visible = false;   //Hide the old form
            }
            else
            {
                AutoClosingMessageBox.Show("Finished current operation. Ejecting card and restarting...", "Restarting", 1500, this);
                //return to initial screen

                Form ATM1 = new ATM1(); // Instantiate a Form object.
                ATM1.Show();            //show the new Form

                this.Visible = false;   //Hide the old form
            }
        }
        private void ConfirmPINentry_Click(object sender, EventArgs e)
        {
            //Log current operation:
            s3log.logOperation(sender);

            if (ConfirmNewPinEntry.Enabled == true)
            {
                if (newPIN == newPIN2)
                {
                    AutoClosingMessageBox.Show("PIN successful changed.", "Success", 1000, this);
                    correctPIN = newPIN2;
                    //Going back to first form (restart)
                    Form ATM6 = new ATM6(); // Instantiate a Form object.
                    ATM6.Show();            //show the new Form
                    this.Visible = false;
                }
                else
                {
                    AutoClosingMessageBox.Show("Incorrect re-entry PIN. Please try again.", "Incorrect PIN.", 1000, this);
                    ConfirmNewPinEntry.Enabled = false;
                    NewPinEntry.Enabled        = true;
                    ConfirmNewPinEntry.Text    = "";
                    NewPinEntry.Text           = "";
                }
            }

            if (NewPinEntry.Enabled == true)
            {
                if (newPIN.Length >= 4 && newPIN.Length < 9)
                {
                    AutoClosingMessageBox.Show("Entry success. Please re-enter the new PIN.", "Reentry", 1000, this);
                    ConfirmNewPinEntry.Enabled = true;
                    NewPinEntry.Enabled        = false;
                }
                else
                {
                    AutoClosingMessageBox.Show("Incorrect PIN. Please try again.", "Incorrect PIN", 1000, this);
                    NewPinEntry.Text = "";
                }
            }

            if (OLDPinEntry.Enabled == true)
            {
                //increasing the pin tries 1
                PINentries = PINentries + 1;

                if (PINentries <= 3 & correctPIN == oldPIN)
                {
                    AutoClosingMessageBox.Show("Correct PIN. Please enter the new PIN.", "Nice one", 1000, this);
                    NewPinEntry.Enabled = true;
                    OLDPinEntry.Enabled = false;
                }
                else if (PINentries < 3 & oldPIN != correctPIN)
                {
                    //if incorrect PIN:
                    MetroMessageBox.Show(this, "PIN entry not successful, retry! Left attempts: " + Convert.ToString(3 - PINentries));
                    //Resetting the PIN:
                    oldPIN = "";
                }
                else if (PINentries > 3)
                {
                    //3 times Wrong  PIN:
                    MetroMessageBox.Show(this, "Last PIN entry not successful, no attempts left, no money for you, your card is being captured.");
                    oldPIN = "";
                    this.Close(); //return;
                }
                ;
            }
        }
示例#6
0
        private void ConfirmPINentry_Click_1(object sender, EventArgs e)
        {
            Boolean blocked = false;

            //checking whether PIN is correct:
            PIN = this.PinEntry.Text;

            if (Lib.getBlocked())
            {
                AutoClosingMessageBox.Show("No attempts left, no money for you, your card is being captured.", "Bad news", 2000, Parent: Form.ActiveForm);
                PINentries = 3;
                blocked    = true;
                this.Close();
            }



            //if not CHAR then continue
            else if (!PIN.Any(char.IsLetter)) //Continue if PIN contains only numeric
            {
                blocked = false;
                //increasing the pin tries 1
                PINentries = PINentries + 1;


                //Checking if pin is correct and tries <=3
                if (PINentries <= 3 & PIN == correctPIN)
                {
                    Lib.update(PINentries.ToString(), blocked, Int32.Parse(Lib.getBalance()));
                    //delayed mesgbx
                    AutoClosingMessageBox.Show("PIN entry successful!", "Success", 2000, Parent: Form.ActiveForm);

                    //next screen after messagebox
                    Form ATM6 = new ATM6(); // Instantiate a Form object.
                    ATM6.Show();            //show the new Form
                    //Resetting the PIN:
                    PIN          = "";
                    this.Visible = false;  //Hide the old form
                }
                else if (PINentries < 3 & PIN != correctPIN)
                {
                    Lib.update(PINentries.ToString(), blocked, Int32.Parse(Lib.getBalance()));
                    //if incorrect PIN:
                    AutoClosingMessageBox.Show("PIN entry not successful, retry! Left attempts: " + Convert.ToString(3 - PINentries), "Retry!", 2000, Parent: Form.ActiveForm);
                    //Resetting the PIN:
                    PIN = "";
                }
                else if (PINentries > 3)
                {
                    blocked = true;
                    Lib.update(PINentries.ToString(), blocked, Int32.Parse(Lib.getBalance()));
                    //3 times Wrong PIN entry:
                    AutoClosingMessageBox.Show("Last PIN entry not successful, no attempts left, no money for you, your card is being captured.", "Success", 2000, Parent: Form.ActiveForm);
                    PIN = "";
                    this.Close(); //return;
                }
                ;
            }
            else
            {
                //in case of alphanumeric keyboard:
                AutoClosingMessageBox.Show("Please provide a numercial PIN.", "Error", 2000, Parent: Form.ActiveForm);
                PIN = "";
            }

            //set back to empty box:
            this.PinEntry.Text = "";
        }