Exemple #1
0
        public override State handleRight4BTNClick()
        {
            State nextStep = this;

            if (session)
            {
                nextStep = new DisplayMainMenuState(mainForm, language);
            }
            else
            {
                theCardReader.ejectCard();
            }
            return(nextStep);
        }
        public override State handleRight1BTNClick()
        {
            //Pay to credit card
            //Deduct amount from account

            payFromAcct.deductToCreditTransferLimit(payAmt);
            payFromAcct.withdraw(payAmt);

            //State nextStep = new PayToCreditCard(mainForm, language, acctNo);
            //return nextStep;

            if (language.Equals("MALAY"))
            {
                bigDisplayLBL.Text   = "Transaksi berjaya\nBaki akaun: $" + string.Format("{0:0.00}", payFromAcct.getBalance());
                left1BTN.Text        = "";
                smallDisplayLBL.Text = "";
            }
            else if (language.Equals("CHINESE"))
            {
                bigDisplayLBL.Text   = "交易成功\n账户余额: $" + string.Format("{0:0.00}", payFromAcct.getBalance());
                left1BTN.Text        = "";
                smallDisplayLBL.Text = "";
            }
            else //ENGLISH
            {
                bigDisplayLBL.Text   = "Transaction successful\nAccount balance: $" + string.Format("{0:0.00}", payFromAcct.getBalance());
                left1BTN.Text        = "";
                smallDisplayLBL.Text = "";
            }



            pauseforMilliseconds(3000);

            State nextStep = new DisplayMainMenuState(mainForm, language);

            return(nextStep);
        }
        public override State handleRight1BTNClick()
        {
            State nextStep = this;

            if (session)
            {
                if (language.Equals("MALAY"))
                {
                    //required 2 sets of pin for confirmation
                    bigDisplayLBL.Text = "Menetapkan PIN baru";

                    if (PINentered.Length == noDigitsForPIN)
                    {
                        if (PIN_One.Equals(""))     //Set 1st PIN
                        {
                            PIN_One              = PINentered;
                            bigDisplayLBL.Text   = "Sila tekan semula nombor PIN untuk pengesahan";
                            PINentered           = "";
                            smallDisplayLBL.Text = PINentered;
                        }
                        else    //Set 2nd PIN
                        {
                            PIN_Two = PINentered;

                            //Check for PIN confirmation
                            if (PIN_One == PIN_Two)
                            {
                                //Set new PIN
                                theCard.setPIN(PIN_Two);
                                bigDisplayLBL.Text = "Nombor PIN baru berjaya ditukar";

                                pauseforMilliseconds(2000);
                                nextStep = new DisplayMainMenuState(mainForm, language);
                            }
                            else
                            {
                                bigDisplayLBL.Text = "PIN baru tidak sepadan dengan PIN pengesahan";

                                pauseforMilliseconds(2000);
                                resetDisplayAndPINValues();
                            }
                        }
                    }
                    else
                    {
                        bigDisplayLBL.Text   = noDigitsForPIN + " nombor diperlukan untuk PIN baru";
                        PINentered           = "";
                        smallDisplayLBL.Text = PINentered;

                        pauseforMilliseconds(2000);
                        if (PIN_One.Equals(""))
                        {
                            bigDisplayLBL.Text = "Sila tekan " + noDigitsForPIN + " nombor PIN baru";
                        }
                        else
                        {
                            bigDisplayLBL.Text = "Sila tekan semula PIN untuk pengesahan";
                        }
                    }
                }
                else if (language.Equals("CHINESE"))
                {
                    //required 2 sets of pin for confirmation
                    bigDisplayLBL.Text = "设置一个新的PIN码";

                    if (PINentered.Length == noDigitsForPIN)
                    {
                        if (PIN_One.Equals(""))     //Set 1st PIN
                        {
                            PIN_One              = PINentered;
                            bigDisplayLBL.Text   = "重新输入密码进行确认";
                            PINentered           = "";
                            smallDisplayLBL.Text = PINentered;
                        }
                        else    //Set 2nd PIN
                        {
                            PIN_Two = PINentered;

                            //Check for PIN confirmation
                            if (PIN_One == PIN_Two)
                            {
                                //Set new PIN
                                theCard.setPIN(PIN_Two);
                                bigDisplayLBL.Text = "新密码成功更改";

                                pauseforMilliseconds(2000);
                                nextStep = new DisplayMainMenuState(mainForm, language);
                            }
                            else
                            {
                                bigDisplayLBL.Text = "新的PIN码与确认PIN码不符\n请重新输入PIN码";

                                pauseforMilliseconds(2000);
                                resetDisplayAndPINValues();
                            }
                        }
                    }
                    else
                    {
                        bigDisplayLBL.Text   = noDigitsForPIN + " 数字密码需要";
                        PINentered           = "";
                        smallDisplayLBL.Text = PINentered;

                        pauseforMilliseconds(2000);
                        if (PIN_One.Equals(""))
                        {
                            bigDisplayLBL.Text = "新的PIN码需要 " + noDigitsForPIN + " 位数字";
                        }
                        else
                        {
                            bigDisplayLBL.Text = "重新输入密码进行确认";
                        }
                    }
                }
                else //ENGLISH
                {
                    //required 2 sets of pin for confirmation
                    bigDisplayLBL.Text = "Setting New PIN";

                    if (PINentered.Length == noDigitsForPIN)
                    {
                        if (PIN_One.Equals(""))     //Set 1st PIN
                        {
                            PIN_One              = PINentered;
                            bigDisplayLBL.Text   = "Please re-enter PIN for confirmation";
                            PINentered           = "";
                            smallDisplayLBL.Text = PINentered;
                        }
                        else    //Set 2nd PIN
                        {
                            PIN_Two = PINentered;

                            //Check for PIN confirmation
                            if (PIN_One == PIN_Two)
                            {
                                //Set new PIN
                                theCard.setPIN(PIN_Two);
                                bigDisplayLBL.Text = "New PIN successfully changed";

                                pauseforMilliseconds(2000);
                                nextStep = new DisplayMainMenuState(mainForm, language);
                            }
                            else
                            {
                                bigDisplayLBL.Text = "New PIN does not match the confirmation PIN\nPlease re-enter PIN";

                                pauseforMilliseconds(3000);
                                resetDisplayAndPINValues();
                            }
                        }
                    }
                    else
                    {
                        bigDisplayLBL.Text   = noDigitsForPIN + " digits required for a new PIN";
                        PINentered           = "";
                        smallDisplayLBL.Text = PINentered;

                        pauseforMilliseconds(2000);
                        if (PIN_One.Equals(""))
                        {
                            bigDisplayLBL.Text = "Please enter your new " + noDigitsForPIN + " digits PIN number";
                        }
                        else
                        {
                            bigDisplayLBL.Text = "Please re-enter PIN for confirmation";
                        }
                    }
                }
            }
            else
            {
                theCardReader.ejectCard();
            }

            return(nextStep);
        }
Exemple #4
0
        public override State handleRight4BTNClick()
        {
            State nextStep = new DisplayMainMenuState(mainForm, language);

            return(nextStep);
        }
        public override State handleRight1BTNClick()
        {
            State nextStep = this;

            if (validatePIN() == true)
            {
                nextStep = new DisplayMainMenuState(mainForm, language);
            }
            else
            {
                if (!theCard.isCardLocked())
                {
                    if (theCard.getAttempt() > 1)
                    {
                        if (language.ToUpper() == "CHINESE")
                        {
                            bigDisplayLBL.Text = "错误密码";
                        }
                        else if (language.ToUpper() == "MALAY")
                        {
                            bigDisplayLBL.Text = "PIN tidak tepat";
                        }
                        else
                        {
                            bigDisplayLBL.Text = "Wrong PIN";
                        }
                        bigDisplayLBL.Refresh();

                        pauseforMilliseconds(1000);
                        if (language.ToUpper() == "CHINESE")
                        {
                            bigDisplayLBL.Text = "请再次输入密码";
                        }
                        else if (language.ToUpper() == "MALAY")
                        {
                            bigDisplayLBL.Text = "Sila tekan PIN sekali lagi";
                        }
                        else
                        {
                            bigDisplayLBL.Text = "Please enter PIN again";
                        }
                        smallDisplayLBL.Text = "";
                        PINentered           = "";
                        nextStep             = this;
                    }
                    else if (theCard.getAttempt() == 1)
                    {
                        if (language.ToUpper() == "CHINESE")
                        {
                            bigDisplayLBL.Text = "错误密码";
                        }
                        else if (language.ToUpper() == "MALAY")
                        {
                            bigDisplayLBL.Text = "PIN tidak tepat";
                        }
                        else
                        {
                            bigDisplayLBL.Text = "Wrong PIN";
                        }
                        bigDisplayLBL.Refresh();

                        pauseforMilliseconds(1000);
                        if (language.ToUpper() == "CHINESE")
                        {
                            bigDisplayLBL.Text = "你的卡之前的最后一次尝试将被锁定";
                        }
                        else if (language.ToUpper() == "MALAY")
                        {
                            bigDisplayLBL.Text = "Percubaan terakhir sebelum kad anda terkunci";
                        }
                        else
                        {
                            bigDisplayLBL.Text = "Last attempt before your card will be lock";
                        }
                        smallDisplayLBL.Text = "";
                        PINentered           = "";
                        nextStep             = this;
                    }
                    else
                    {
                        cardLockout();
                        nextStep = this;
                    }
                }
                // card has been locked
                else
                {
                    cardLockout();
                    nextStep = this;
                }
            }

            return(nextStep);
        }