Exemple #1
0
        public CashSelectorState(CashSelector mainForm, string language, Cash cash) : base(mainForm, language)
        {
            //if (language.Equals("CHINESE"))
            //    header.Text = "This is Chinese";
            //else if (language.Equals("MALAY"))
            //    header.Text = "This is Malay";
            //else    //English
            //    header.Text = "This is English";

            if (cash == null)
            {
                c2   = 0;
                c5   = 0;
                c10  = 0;
                c50  = 0;
                c100 = 0;
            }
            else
            {
                c2   = Convert.ToInt32(cash.getNotesQty(0));
                c5   = Convert.ToInt32(cash.getNotesQty(1));
                c10  = Convert.ToInt32(cash.getNotesQty(2));
                c50  = Convert.ToInt32(cash.getNotesQty(3));
                c100 = Convert.ToInt32(cash.getNotesQty(4));

                //label
                c2Cnt.Text   = Convert.ToString(c2);
                c5Cnt.Text   = Convert.ToString(c5);
                c10Cnt.Text  = Convert.ToString(c10);
                c50Cnt.Text  = Convert.ToString(c50);
                c100Cnt.Text = Convert.ToString(c100);
            }
        }
        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);
        }