Example #1
0
    private void quickPin()
    {
        Klant   tmp        = downloadConnection.getKlant(userName);
        String  printnaam  = String.Concat(tmp.Naam + " " + tmp.Achternaam);
        Printer bonPrinter = new Printer(printnaam, 70, rekeningID);

        bonPrinter.printTicket();
        ByeScreen quickBye = new ByeScreen();

        endOfSession = true;
        quickBye.Hide();
    }
Example #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();
    }
Example #3
0
    private void quickPin()
    {
        int amount = 70;

        if (amount > saldo && amount != 0)
        {
            PinError pinError = new PinError();
            cancelled = true;
        }
        uploadConnection.UpdateBalans(Int32.Parse(rekeningID), (saldo - amount));
        uploadConnection.transaction(pasID, rekeningID, amount);
        if (cancelled == false)
        {
            arduino.dispenseMoney("02,00,01*");
        }
        ByeScreen quickBye = new ByeScreen();

        endOfSession = true;
        quickBye.Hide();
    }
Example #4
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;
            }
        }
    }
Example #5
0
    private void pin()
    {
        Boolean printTicket = false;
        Boolean goBack      = true;
        double  amount      = 0;
        String  input;

        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)
            {
                PinError pinError = new PinError();
                cancelled = true;
            }
            if (cancelled == true)
            {
                break;
            }
            else
            {
                uploadConnection.UpdateBalans(Int32.Parse(rekeningID), (saldo - amount));
                uploadConnection.transaction(pasID, rekeningID, amount);
                //Error.show(amount.ToString());
            }
            asker.Show();
            while (true)
            {
                input = arduino.getString();
                if (input.Contains("*"))
                {
                    printTicket = true;
                    goBack      = false;
                    break;
                }
                else if (input.Contains("#"))
                {
                    //Error.show("Geen Bon", "bon");
                    goBack = false;
                    break;
                }
            }
            asker.Hide();
            if (printTicket == true)
            {
                Klant   tmp        = downloadConnection.getKlant(userName);
                String  printnaam  = String.Concat(tmp.Naam + " " + tmp.Achternaam);
                Printer bonPrinter = new Printer(printnaam, amount, rekeningID);
                bonPrinter.printTicket();
            }
            if (goBack == false)
            {
                ByeScreen goAway = new ByeScreen();
            }
        }
    }
Example #6
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();
            }
        }
    }