private void stackHandle(object sender, EventArgs e) { Console.WriteLine("Evento : Stack"); byte[] cash = billAcceptor.getCashDesposite(); if (cash[0] == 244) { billDesposited += 500; } else { billDesposited += (int)cash[0]; } Console.WriteLine("Recibido : {0}", this.billDesposited); }
static void recibirMonedas() { byte[] result; int toPay = 60; int deposited = 0; int contador = 0; while (deposited < toPay) { result = hopperAcceptor.getCashDesposite(contador); if (result[4] != contador) { switch (result[5]) { case 7: deposited += 10; break; case 6: deposited += 5; break; case 5: deposited += 2; break; case 4: deposited += 1; break; } Console.WriteLine("Depositado: " + deposited); Console.WriteLine(" "); contador = result[4]; } Thread.Sleep(500); } }
public int getCash(int total) { byte[] result; int deposited = 0; int contador = 0; components.Message = "Ingrese el efectivo"; messageEvent(this, components); while (deposited < total) { result = hopperAcceptor.getCashDesposite(contador); if (result[1] != contador) { switch (result[0]) { case 10: components.inputR10 += 1; components.listCoins = 10; deposited += 10; this.stored["10"] = components.inputR10; this.updateCashReceived("10"); break; case 5: components.inputR5 += 1; components.listCoins = 5; deposited += 5; this.stored["5"] = components.inputR5; this.updateCashReceived("5"); break; case 2: components.inputR2 += 1; components.listCoins = 2; deposited += 2; this.stored["2"] = components.inputR2; this.updateCashReceived("2"); break; case 1: components.inputR1 += 1; components.listCoins = 1; deposited += 1; this.stored["1"] = components.inputR5; this.updateCashReceived("1"); break; } components.lbIngresado = deposited; lbTransactionEvent(this, components); lbStoresEvent(this, components); contador = result[1]; } else if (this.billDesposited != 0) { switch (this.billDesposited) { case 20: components.inputR20 += 1; components.listBills = 20; this.stored["20"] = components.inputR20; this.updateCashReceived("20"); break; case 50: components.inputR50 += 1; components.listBills = 50; this.stored["50"] = components.inputR50; this.updateCashReceived("50"); break; case 100: components.inputR100 += 1; components.listBills = 100; this.stored["100"] = components.inputR100; this.updateCashReceived("100"); break; case 200: components.inputR200 += 1; components.listBills = 200; this.stored["200"] = components.inputR200; this.updateCashReceived("200"); break; case 500: components.inputR500 += 1; components.listBills = 500; this.stored["500"] = components.inputR500; this.updateCashReceived("500"); break; } lbStoresEvent(this, components); deposited += this.billDesposited; components.lbIngresado = deposited; lbTransactionEvent(this, components); this.billDesposited = 0; } } return(deposited); }