Ejemplo n.º 1
0
 private void checkSaldo()
 {
     SaldoScreen saldoDisplay = new SaldoScreen(saldo);
     saldoDisplay.Show();
     while (true)
     {
         String input = arduino.getString();
         if (input.Contains("*"))
         {
             saldoDisplay.Hide();
             pin();
             break;
         }
         else if (input.Contains("#"))
         {
             ByeScreen goAway = new ByeScreen();
             endOfSession = true;
             saldoDisplay.Close();
             break;
         }
     }
 }
Ejemplo n.º 2
0
 private void quickPin()
 {
     int amount = 70;
     String dispenserCommand = "";
     if (amount > saldo)
     {
         PinError pinError = new PinError();
         cancelled = true;
     }
     if(stock.checkIfAvailable(2, 0, 1))
     {
         dispenserCommand = "02,00,01,*";
     }
     else if(stock.checkIfAvailable(0, 1, 1))
     {
         dispenserCommand = "00,01,01,*";
     }
     else if(stock.checkIfAvailable(1, 3, 0))
     {
         dispenserCommand = "01,03,00,*";
     }
     else if(stock.checkIfAvailable(7,0,0))
     {
         dispenserCommand = "07,00,00,*";
     }
     else
     {
         cancelled = true;
     }
     if (cancelled == false)
     {
         stock.substractBiljets(dispenserCommand);
         uploadConnection.UpdateBalans(rekeningID, (saldo - amount * 100));
         uploadConnection.transaction(pasID, rekeningID, amount);
         arduino.dispenseMoney(dispenserCommand);
     }
     ByeScreen quickBye = new ByeScreen();
     endOfSession = true;
     quickBye.Hide();
 }
Ejemplo n.º 3
0
    private void pin()
    {
        Boolean printTicket = false;
        Boolean goBack = true;
        int amount = 0;
        String input;
        String dispenserCommand = "00,00,00,*";
        cancelled = false;

        while (goBack == true)
        {
            pinsherm.Show();
            while (true)
            {
                input = arduino.getString();
                if (input.Contains("1"))
                {
                    amount = 10;
                    break;
                }
                else if (input.Contains("2"))
                {
                    amount = 20;
                    break;
                }
                else if (input.Contains("3"))
                {
                    amount = 50;
                    break;
                }
                else if (input.Contains("4"))
                {
                    amount = getAlternativeAmount();
                    break;
                }
                else if (input.Contains("#"))
                {
                    cancelled = true;
                    break;
                }
                else if (input.Contains("C"))
                {
                    cancelled = true;
                    endOfSession = false;
                    break;
                }
            }
            pinsherm.Hide();
            if ((amount > saldo && amount != 0) || amount >= 200)
            {
                PinError pinError = new PinError();
                cancelled = true;
            }
            if (cancelled == true)
            {
                break;
            }
            if (amount == 10 && stock.checkIfAvailable(1, 0 , 0) == true)
            {
                dispenserCommand = "01,00,00,*";
            }
            else if(amount == 10)
            {
                BiljetScreen selector = new BiljetScreen();
                selector.showInsufficient();
                cancelled = true;
            }
            if (amount > 10)
            {
                dispenserCommand = biljetSelection(amount);
                if (dispenserCommand.Equals("00,00,00,*"))
                {
                    cancelled = true;
                    break;
                }
            }
            if (cancelled == true) { break; }
            uploadConnection.UpdateBalans(rekeningID, (saldo - amount*100));
            uploadConnection.transaction(pasID, rekeningID, amount);
            asker.Show();
            while (true)
            {
                input = arduino.getString();
                if (input.Contains("*"))
                {
                    printTicket = true;
                    goBack = false;
                    break;
                }
                else if (input.Contains("#"))
                {
                    goBack = false;
                    break;
                }
                else if (input.Contains("A"))
                {
                    Email mailer = new Email(userName, amount, rekeningID,klantID);
                    mailer.sendEmail();
                    goBack = false;
                    break;
                }
            }
            asker.Hide();
            stock.substractBiljets(dispenserCommand);
            arduino.dispenseMoney(dispenserCommand);
            if (printTicket == true)
            {
                Printer bonPrinter = new Printer(userName, amount, rekeningID);
                bonPrinter.printTicket();
            }
            if (goBack == false)
            {
                ByeScreen goAway = new ByeScreen();
            }
        }
    }