Matomat/Matomat/Automat.cs
2011-09-21 22:01:22 +00:00

71 lines
1.8 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Matomat
{
class Automat
{
private User user;
private Prod prod;
private bool shutdown = false;
private LCDDisplay lcd;
private Input inp;
public Automat() {
lcd = Factory.getLCDDisplay();
inp = Factory.getInput();
}
internal void doJob(InputData input)
{
if (input.type == InputData.types.Card)
{
user = this.findUser(input.id);
if (!user.vaild())
return;
this.showUserInfo(user);
lcd.print("Bitte Produkt / Code über den Barcodeleser halten.");
InputData prodid = inp.getProdInput(20);
if (prodid.type == InputData.types.None)
return;
prod = this.findProd(prodid.id);
if(!prod.vaild())
return;
}
else if (input.type == InputData.types.Prod)
{
prod = this.findProd(input.id);
if (!prod.vaild())
return;
this.showProdInfo(prod);
}
}
private void showProdInfo(Prod prod)
{
throw new NotImplementedException();
}
private Prod findProd(int p)
{
throw new NotImplementedException();
}
private void showUserInfo(User user)
{
lcd.print("User x",5);
}
private User findUser(int userId)
{
return new User(userId);
}
internal bool die()
{
return shutdown;
}
}
}