コード例 #1
0
        public override State handleLeft2BTNClick()
        {
            topupAmt = 50;

            State nextStep = this;

            if (session)
            {
                topupFromAcct = theCard.getAcctUsingAcctNo(acctNo);

                if (language.Equals("MALAY"))
                {
                    if (topupFromAcct.getBalance() - topupAmt < 0)
                    {
                        bigDisplayLBL.Text = "Baki nilai tambah tidak mencukupi\nSila tekan semula jumlah bagi nilai tambah";
                        pauseforMilliseconds(3000);
                        resetDisplay();
                        bigDisplayLBL.Text = "Tekan jumlah bagi nilai tambah";
                    }
                    else
                    {
                        nextStep = new WaitForCashcardState(mainForm, language, acctNo, topupAmt);
                    }
                }
                else if (language.Equals("CHINESE"))
                {
                    if (topupFromAcct.getBalance() - topupAmt < 0)
                    {
                        bigDisplayLBL.Text = "不足以弥补\n请重新输入充值的金额";
                        pauseforMilliseconds(3000);
                        resetDisplay();
                        bigDisplayLBL.Text = "输入充值的金额";
                    }
                    else
                    {
                        nextStep = new WaitForCashcardState(mainForm, language, acctNo, topupAmt);
                    }
                }
                else
                {
                    if (topupFromAcct.getBalance() - topupAmt < 0)
                    {
                        bigDisplayLBL.Text = "Insufficent balance to Topup\nPlease re-enter amount to Topup";
                        pauseforMilliseconds(3000);
                        resetDisplay();
                        bigDisplayLBL.Text = "Enter amount to Top up";
                    }
                    else
                    {
                        nextStep = new WaitForCashcardState(mainForm, language, acctNo, topupAmt);
                    }
                }
            }

            return(nextStep);
        }
コード例 #2
0
        public override State handleRight1BTNClick()    //Ok button
        {
            double maxAmountAllowed = 100;
            double minAmountAllowed = 10;
            double validateAmt;

            State nextStep = this;

            if (session)
            {
                topupAmt = Convert.ToDouble(amountEnteredTxt);

                topupFromAcct = theCard.getAcctUsingAcctNo(acctNo);

                validateAmt = topupAmt % 10;

                //check amountEnteredTxt for valid amount and decimal value
                if (validateAmt == 0 && amountEnteredTxt.EndsWith("0"))
                {
                    //check for min max amount allowed
                    if (topupAmt <= maxAmountAllowed && topupAmt >= minAmountAllowed)
                    {
                        //check for valid balance before withdraw
                        if (topupFromAcct.getBalance() - topupAmt < 0)
                        {
                            if (language.Equals("MALAY"))
                            {
                                bigDisplayLBL.Text = "Baki bagi nilai tambah tidak mencukupi \nTekan semula jumlah bagi niai tambah";
                                pauseforMilliseconds(3000);
                                resetDisplay();
                            }
                            else if (language.Equals("CHINESE"))
                            {
                                bigDisplayLBL.Text = "不足以弥补\n请重新输入充值的金额";
                                pauseforMilliseconds(3000);
                                resetDisplay();
                            }
                            else
                            {
                                bigDisplayLBL.Text = "Insufficent balance to Topup\nPlease re-enter amount to Topup";
                                pauseforMilliseconds(3000);
                                resetDisplay();
                            }
                        }
                        else
                        {
                            nextStep = new WaitForCashcardState(mainForm, language, acctNo, topupAmt);
                        }
                    }
                    else
                    {
                        if (language.Equals("MALAY"))
                        {
                            bigDisplayLBL.Text = "Jumlah minimum dibenarkan sebanyak $20\nJumlah maksimum dibenarkan sebanyak $100";
                            pauseforMilliseconds(4000);
                            resetDisplay();
                        }
                        else if (language.Equals("CHINESE"))
                        {
                            bigDisplayLBL.Text = "允许最低金额20美元\n最高允许金额为$ 100";
                            pauseforMilliseconds(4000);
                            resetDisplay();
                        }
                        else
                        {
                            bigDisplayLBL.Text = "Minimum amount of $20 is allowed\nMaximum amount of $100 is allowed";
                            pauseforMilliseconds(4000);
                            resetDisplay();
                        }
                    }
                }
                else
                {
                    if (language.Equals("MALAY"))
                    {
                        bigDisplayLBL.Text = "Jumlah dibenarkan bagi nilai tambah sebanyak $10 - $100 sahaja";
                        pauseforMilliseconds(3000);
                        resetDisplay();
                    }
                    else if (language.Equals("CHINESE"))
                    {
                        bigDisplayLBL.Text = "只能充值$ 10  -  $ 100";
                        pauseforMilliseconds(3000);
                        resetDisplay();
                    }
                    else
                    {
                        bigDisplayLBL.Text = "Can only top-up $10 - $100 only";
                        pauseforMilliseconds(3000);
                        resetDisplay();
                    }
                }
            }

            return(nextStep);
        }