103 lines
2.6 KiB
C#
103 lines
2.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using Matomat.Output;
|
|
using Matomat.Database.Tables;
|
|
using Matomat.Helper;
|
|
|
|
namespace Matomat.Data
|
|
{
|
|
class EAN13
|
|
{
|
|
private long prodId;
|
|
private bool found;
|
|
private ProdType type;
|
|
private int price;
|
|
private string name;
|
|
private string function;
|
|
private int id;
|
|
public enum ProdType
|
|
{
|
|
product,
|
|
instruction
|
|
}
|
|
|
|
public EAN13(long prodId)
|
|
{
|
|
this.prodId = prodId;
|
|
this.load();
|
|
}
|
|
|
|
private void load()
|
|
{
|
|
TProduct t = new Tables().getProdTable(this.prodId);
|
|
if (t == null)
|
|
{
|
|
this.found = false;
|
|
return;
|
|
}
|
|
|
|
this.found = true;
|
|
if (t.iscommand)
|
|
{
|
|
this.type = ProdType.instruction;
|
|
this.function = t.name;
|
|
}
|
|
else
|
|
{
|
|
this.type = ProdType.product;
|
|
this.name = t.name;
|
|
}
|
|
this.price = t.cost;
|
|
this.id = t.id;
|
|
}
|
|
|
|
internal bool vaild()
|
|
{
|
|
LCDDisplay lcd = Factory.getLCD();
|
|
if (!found)
|
|
{
|
|
lcd.printb("Produkt wurde nich gefunden\nEAN13: " + this.GetProdId().ToString() + " unbekannt", LCDDisplay.Status.Error, 5);
|
|
/*lcd.print("²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²"+
|
|
"² Produkt wurde nich gefunden ²"+
|
|
"² EAN13: "+(this.GetProdId().ToString()+" unbekannt").PadRight(29,' ')+" ²"+
|
|
"²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²", LCDDisplay.Status.Error, 5);*/
|
|
System.Threading.Thread.Sleep(4500);
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
internal ProdType GetProdType()
|
|
{
|
|
return this.type;
|
|
}
|
|
|
|
internal long GetProdId()
|
|
{
|
|
return this.prodId;
|
|
}
|
|
|
|
internal double GetProdPrice()
|
|
{
|
|
return this.price;
|
|
}
|
|
|
|
internal string GetProdName()
|
|
{
|
|
return this.name;
|
|
}
|
|
|
|
internal string GetFunctName()
|
|
{
|
|
return this.function;
|
|
}
|
|
|
|
public int GetDbId()
|
|
{
|
|
return this.id;
|
|
}
|
|
}
|
|
}
|