public override State handleLeftPicBoxClick()   //Changing of deposit sequence
        {
            State nextStep = this;

            if (session)
            {
                //counter = 30;   //reset timer counter
                aTimer.Stop();  //Stop timer

                if (language.Equals("MALAY"))
                {
                    if (depositSum == 0)
                    {
                        (new CashSelector(language, selectedCash)).ShowDialog();

                        //New deposit sequence
                        selectedCash = CashSelectorState.cash; //Not Null

                        //calculate cash

                        for (int i = 0; i < selectedCash.getLength(); i++)
                        {
                            depositSum += Convert.ToDouble(selectedCash.getNotesId(i)) * Convert.ToDouble(selectedCash.getNotesQty(i));

                            if (Convert.ToDouble(selectedCash.getNotesId(i)) == 2 && Convert.ToDouble(selectedCash.getNotesQty(i)) > 0)
                            {
                                dollar2 = true;
                            }
                            else if (Convert.ToDouble(selectedCash.getNotesId(i)) == 5 && Convert.ToDouble(selectedCash.getNotesQty(i)) > 0)
                            {
                                dollar5 = true;
                            }
                            else if (Convert.ToDouble(selectedCash.getNotesId(i)) == 10 && Convert.ToDouble(selectedCash.getNotesQty(i)) > 0)
                            {
                                dollar10 = true;
                            }
                            else if (Convert.ToDouble(selectedCash.getNotesId(i)) == 50 && Convert.ToDouble(selectedCash.getNotesQty(i)) > 0)
                            {
                                dollar50 = true;
                            }
                            else if (Convert.ToDouble(selectedCash.getNotesId(i)) == 100 && Convert.ToDouble(selectedCash.getNotesQty(i)) > 0)
                            {
                                dollar100 = true;
                            }
                        }
                        if (depositSum != 0)
                        {
                            bigDisplayLBL.Text = "Setuju untuk masukkan $" + Convert.ToString(depositSum) + " ke " + acctNo;
                        }

                        //Animation (Insert cash)

                        if (dollar100)
                        {
                            theCashDispenser.depositNote100();
                            pauseforMilliseconds(2000);
                            theCashDispenser.withoutCash();
                            dollar100 = false;
                        }
                        else if (dollar50)
                        {
                            theCashDispenser.depositNote50();
                            pauseforMilliseconds(2000);
                            theCashDispenser.withoutCash();
                            dollar50 = false;
                        }
                        else if (dollar10)
                        {
                            theCashDispenser.depositNote10();
                            pauseforMilliseconds(2000);
                            theCashDispenser.withoutCash();
                            dollar10 = false;
                        }
                        else if (dollar5)
                        {
                            theCashDispenser.depositNote5();
                            pauseforMilliseconds(2000);
                            theCashDispenser.withoutCash();
                            dollar5 = false;
                        }
                        else if (dollar2)
                        {
                            theCashDispenser.depositNote2();
                            pauseforMilliseconds(2000);
                            theCashDispenser.withoutCash();
                            dollar2 = false;
                        }
                    }
                }
                else if (language.Equals("CHINESE"))
                {
                    if (depositSum == 0)
                    {
                        (new CashSelector(language, selectedCash)).ShowDialog();

                        //New deposit sequence
                        selectedCash = CashSelectorState.cash; //Not Null

                        //calculate cash

                        for (int i = 0; i < selectedCash.getLength(); i++)
                        {
                            depositSum += Convert.ToDouble(selectedCash.getNotesId(i)) * Convert.ToDouble(selectedCash.getNotesQty(i));

                            if (Convert.ToDouble(selectedCash.getNotesId(i)) == 2 && Convert.ToDouble(selectedCash.getNotesQty(i)) > 0)
                            {
                                dollar2 = true;
                            }
                            else if (Convert.ToDouble(selectedCash.getNotesId(i)) == 5 && Convert.ToDouble(selectedCash.getNotesQty(i)) > 0)
                            {
                                dollar5 = true;
                            }
                            else if (Convert.ToDouble(selectedCash.getNotesId(i)) == 10 && Convert.ToDouble(selectedCash.getNotesQty(i)) > 0)
                            {
                                dollar10 = true;
                            }
                            else if (Convert.ToDouble(selectedCash.getNotesId(i)) == 50 && Convert.ToDouble(selectedCash.getNotesQty(i)) > 0)
                            {
                                dollar50 = true;
                            }
                            else if (Convert.ToDouble(selectedCash.getNotesId(i)) == 100 && Convert.ToDouble(selectedCash.getNotesQty(i)) > 0)
                            {
                                dollar100 = true;
                            }
                        }
                        if (depositSum != 0)
                        {
                            bigDisplayLBL.Text = "确认存款 $" + Convert.ToString(depositSum) + " 至 " + acctNo;
                        }

                        //Animation (Insert cash)

                        if (dollar100)
                        {
                            theCashDispenser.depositNote100();
                            pauseforMilliseconds(2000);
                            theCashDispenser.withoutCash();
                            dollar100 = false;
                        }
                        else if (dollar50)
                        {
                            theCashDispenser.depositNote50();
                            pauseforMilliseconds(2000);
                            theCashDispenser.withoutCash();
                            dollar50 = false;
                        }
                        else if (dollar10)
                        {
                            theCashDispenser.depositNote10();
                            pauseforMilliseconds(2000);
                            theCashDispenser.withoutCash();
                            dollar10 = false;
                        }
                        else if (dollar5)
                        {
                            theCashDispenser.depositNote5();
                            pauseforMilliseconds(2000);
                            theCashDispenser.withoutCash();
                            dollar5 = false;
                        }
                        else if (dollar2)
                        {
                            theCashDispenser.depositNote2();
                            pauseforMilliseconds(2000);
                            theCashDispenser.withoutCash();
                            dollar2 = false;
                        }
                    }
                }
                else //ENGLISH
                {
                    if (depositSum == 0)
                    {
                        (new CashSelector(language, selectedCash)).ShowDialog();

                        //New deposit sequence
                        selectedCash = CashSelectorState.cash; //Not Null

                        //calculate cash

                        for (int i = 0; i < selectedCash.getLength(); i++)
                        {
                            depositSum += Convert.ToDouble(selectedCash.getNotesId(i)) * Convert.ToDouble(selectedCash.getNotesQty(i));

                            if (Convert.ToDouble(selectedCash.getNotesId(i)) == 2 && Convert.ToDouble(selectedCash.getNotesQty(i)) > 0)
                            {
                                dollar2 = true;
                            }
                            else if (Convert.ToDouble(selectedCash.getNotesId(i)) == 5 && Convert.ToDouble(selectedCash.getNotesQty(i)) > 0)
                            {
                                dollar5 = true;
                            }
                            else if (Convert.ToDouble(selectedCash.getNotesId(i)) == 10 && Convert.ToDouble(selectedCash.getNotesQty(i)) > 0)
                            {
                                dollar10 = true;
                            }
                            else if (Convert.ToDouble(selectedCash.getNotesId(i)) == 50 && Convert.ToDouble(selectedCash.getNotesQty(i)) > 0)
                            {
                                dollar50 = true;
                            }
                            else if (Convert.ToDouble(selectedCash.getNotesId(i)) == 100 && Convert.ToDouble(selectedCash.getNotesQty(i)) > 0)
                            {
                                dollar100 = true;
                            }
                        }

                        if (depositSum != 0)
                        {
                            bigDisplayLBL.Text = "Confirm to deposit $" + Convert.ToString(depositSum) + " to " + acctNo;
                        }

                        //Animation (Insert cash)

                        if (dollar100)
                        {
                            theCashDispenser.depositNote100();
                            pauseforMilliseconds(2000);
                            theCashDispenser.withoutCash();
                            dollar100 = false;
                        }
                        else if (dollar50)
                        {
                            theCashDispenser.depositNote50();
                            pauseforMilliseconds(2000);
                            theCashDispenser.withoutCash();
                            dollar50 = false;
                        }
                        else if (dollar10)
                        {
                            theCashDispenser.depositNote10();
                            pauseforMilliseconds(2000);
                            theCashDispenser.withoutCash();
                            dollar10 = false;
                        }
                        else if (dollar5)
                        {
                            theCashDispenser.depositNote5();
                            pauseforMilliseconds(2000);
                            theCashDispenser.withoutCash();
                            dollar5 = false;
                        }
                        else if (dollar2)
                        {
                            theCashDispenser.depositNote2();
                            pauseforMilliseconds(2000);
                            theCashDispenser.withoutCash();
                            dollar2 = false;
                        }

                        aTimer.Start();
                    }
                }
            }
            else
            {
                theCardReader.ejectCard();
            }

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

            if (session)
            {
                if (depositSum != 0)
                {
                    if (depositSum >= minDeposit && depositSum <= maxDeposit)   //check for valid min_max
                    {
                        //Valid
                        double  depositAmt;
                        Account depositToAcct;

                        depositAmt    = depositSum;
                        depositToAcct = theCard.getAcctUsingAcctNo(acctNo);
                        depositToAcct.deposit(depositAmt);

                        selectedCash = CashSelectorState.cash = null;

                        nextStep = new ShowNewBalance(mainForm, language, acctNo);
                    }
                    else
                    {
                        //Error
                        if (language.ToUpper() == "MALAY")
                        {
                            if (depositSum > maxDeposit)
                            {
                                bigDisplayLBL.Text = "Tidak dapat mendeposit $" + depositSum + "\nJumlah deposit maksimum yang diterima adalah $" + string.Format("{0:0.00}", maxDeposit);
                            }
                            else
                            {
                                bigDisplayLBL.Text = "Tidak dapat mendeposit $" + depositSum + "\nJumlah deposit minima yang diterima adalah $" + string.Format("{0:0.00}", minDeposit);
                            }
                        }
                        else if (language.ToUpper() == "CHINESE")
                        {
                            if (depositSum > maxDeposit)
                            {
                                bigDisplayLBL.Text = "无法存款 $" + depositSum + "\n最高存款金额是 $" + string.Format("{0:0.00}", maxDeposit);
                            }
                            else
                            {
                                bigDisplayLBL.Text = "无法存款 $" + depositSum + "\n最低存款金额是 $" + string.Format("{0:0.00}", minDeposit);
                            }
                        }
                        else // ENGLISH
                        {
                            if (depositSum > maxDeposit)
                            {
                                bigDisplayLBL.Text = "Unable to deposit $" + depositSum + "\nMax deposit amount accepted is $" + string.Format("{0:0.00}", maxDeposit);
                            }
                            else
                            {
                                bigDisplayLBL.Text = "Unable to deposit $" + depositSum + "\nMin deposit amount accepted is $" + string.Format("{0:0.00}", minDeposit);
                            }
                        }

                        bigDisplayLBL.Refresh();

                        pauseforMilliseconds(2000);
                        if (language.ToUpper() == "MALAY")
                        {
                            bigDisplayLBL.Text = "Sila masukkan wang tunai untuk deposit";
                        }
                        else if (language.ToUpper() == "CHINESE")
                        {
                            bigDisplayLBL.Text = "请插入现金存款";
                        }
                        else
                        {
                            bigDisplayLBL.Text = "Please insert cash to deposit";
                        }

                        //rest depositSum
                        depositSum = 0;

                        nextStep = this;
                    }
                }
                else
                {
                    //Error -  value = 0
                    if (language.ToUpper() == "MALAY")
                    {
                        bigDisplayLBL.Text = "Sila masukkan tunai sebelum meneruskan";
                    }
                    if (language.ToUpper() == "CHINESE")
                    {
                        bigDisplayLBL.Text = "请在继续之前插入现金";
                    }
                    else
                    {
                        bigDisplayLBL.Text = "Please insert cash before continue";
                    }
                    bigDisplayLBL.Refresh();

                    pauseforMilliseconds(2000);
                    if (language.ToUpper() == "MALAY")
                    {
                        bigDisplayLBL.Text = "Sila masukkan wang tunai untuk deposit";
                    }
                    else if (language.ToUpper() == "CHINESE")
                    {
                        bigDisplayLBL.Text = "请插入现金存款";
                    }
                    else
                    {
                        bigDisplayLBL.Text = "Please insert cash to deposit";
                    }
                    nextStep = this;
                }
            }
            else
            {
                theCardReader.ejectCard();
            }

            return(nextStep);
        }
Exemple #3
0
        public override CashState handleCashOkClick(string language)
        {
            if (language.Equals("MALAY"))
            {
                //Create new class for storing notes' quantity
                if (!c2Cnt.Text.Equals("0") || !c5Cnt.Text.Equals("0") || !c10Cnt.Text.Equals("0") || !c50Cnt.Text.Equals("0") || !c100Cnt.Text.Equals("0"))
                {
                    cash = new Cash(c2Cnt.Text, c5Cnt.Text, c10Cnt.Text, c50Cnt.Text, c100Cnt.Text);
                }
                else
                {
                    //MessageBox.Show("No amount selected, continue?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

                    DialogResult res = MessageBox.Show("Tiada jumlah yang dipilih, teruskan?", "Pengesahan", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                    if (res == DialogResult.Yes)
                    {
                        cash = new Cash(c2Cnt.Text, c5Cnt.Text, c10Cnt.Text, c50Cnt.Text, c100Cnt.Text);
                        mainForm.Close();
                    }
                    if (res == DialogResult.No)
                    {
                        return(this);
                    }
                }
            }
            else if (language.Equals("CHINESE"))
            {
                //Create new class for storing notes' quantity
                if (!c2Cnt.Text.Equals("0") || !c5Cnt.Text.Equals("0") || !c10Cnt.Text.Equals("0") || !c50Cnt.Text.Equals("0") || !c100Cnt.Text.Equals("0"))
                {
                    cash = new Cash(c2Cnt.Text, c5Cnt.Text, c10Cnt.Text, c50Cnt.Text, c100Cnt.Text);
                }
                else
                {
                    //MessageBox.Show("No amount selected, continue?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

                    DialogResult res = MessageBox.Show("没有选择的金额, 继续?", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                    if (res == DialogResult.Yes)
                    {
                        cash = new Cash(c2Cnt.Text, c5Cnt.Text, c10Cnt.Text, c50Cnt.Text, c100Cnt.Text);
                        mainForm.Close();
                    }
                    if (res == DialogResult.No)
                    {
                        return(this);
                    }
                }
            }
            else //ENGLISH
            {
                //Create new class for storing notes' quantity
                if (!c2Cnt.Text.Equals("0") || !c5Cnt.Text.Equals("0") || !c10Cnt.Text.Equals("0") || !c50Cnt.Text.Equals("0") || !c100Cnt.Text.Equals("0"))
                {
                    cash = new Cash(c2Cnt.Text, c5Cnt.Text, c10Cnt.Text, c50Cnt.Text, c100Cnt.Text);
                }
                else
                {
                    //MessageBox.Show("No amount selected, continue?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

                    DialogResult res = MessageBox.Show("No amount selected, continue?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                    if (res == DialogResult.Yes)
                    {
                        cash = new Cash(c2Cnt.Text, c5Cnt.Text, c10Cnt.Text, c50Cnt.Text, c100Cnt.Text);
                        mainForm.Close();
                    }
                    if (res == DialogResult.No)
                    {
                        return(this);
                    }
                }
            }


            mainForm.Close();
            return(this);
        }