diff --git a/Matomat/Automat.cs b/Matomat/Automat.cs index 5353f2d..3923a5e 100644 --- a/Matomat/Automat.cs +++ b/Matomat/Automat.cs @@ -7,36 +7,43 @@ namespace Matomat { class Automat { - private User user; - private Prod prod; private bool shutdown = false; - private LCDDisplay lcd; - private Input inp; public delegate void stopEvent(bool stop); public event stopEvent stopThread; public Automat() { - lcd = Factory.getLCDDisplay(); - inp = Factory.getInput(); + } internal void doJob(InputData input) { + LCDDisplay lcd = Factory.getLCDDisplay(); + Input inp = Factory.getInput(); + if (input.type == InputData.types.Card) { - user = this.findUser(input.id); + User user = new User(input.id); if (!user.vaild()) return; + this.showUserInfo(user); - lcd.print("Bitte Produkt / Code über den Barcodeleser halten."); + + lcd.print("²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²" + + "² Bitte Produkt über den ²" + + "² Barcodeleser halten ²" + + "²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²"); + InputData prodid = inp.getProdInput(20); if (prodid.type == InputData.types.None) return; - prod = this.findProd(prodid.id); + + Prod prod = new Prod(prodid.id); if(!prod.vaild()) return; + this.showProdInfo(prod); + if (prod.GetProdType() == Prod.ProdType.product) { this.sell(prod, user); @@ -46,88 +53,128 @@ namespace Matomat switch (prod.GetFunctName()) { case "exit();": this.stopThread(true); break; - case "aufladen(10);": this.InsAufladen(10); break; - case "aufladen(20);": this.InsAufladen(20); break; - case "aufladen(5);": this.InsAufladen(5); break; - case "addUser();": this.InsAddUser(); break; + case "aufladen(10);": this.InsAufladen(10, user); break; + case "aufladen(20);": this.InsAufladen(20, user); break; + case "aufladen(5);": this.InsAufladen(5, user); break; + /*case "addUser();": this.InsAddUser(); break; case "delUser();": this.InsDelUser(); break; - case "showStats();": this.InsShowStats(); break; + case "showStats();": this.InsShowStats(); break;*/ } } - - } else if (input.type == InputData.types.Prod) { - prod = this.findProd(input.id); + Prod prod = new Prod(input.id); if (!prod.vaild()) return; + + if (prod.GetFunctName().ToLower() == "exit();") + { + this.stopThread(true); + return; + } + this.showProdInfo(prod); } } + private void InsAufladen(int betrag, User admin) + { + LCDDisplay lcd = Factory.getLCDDisplay(); + Input inp = Factory.getInput(); + if (!admin.IsAdmin()) + { + lcd.print("²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²" + + "² Du bist kein Admin, ²" + + "² du kannst nichts Aufladen! ²" + + "²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²", + LCDDisplay.Status.Error, 5); + System.Threading.Thread.Sleep(4500); + return; + } + lcd.print("²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²" + + "² Bitte die Zielkarte auf den ²" + + "² RFID Leser auflegen ²" + + "²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²"); + InputData target = inp.getCardInput(20); + if (target.type == InputData.types.None) + return; + + User user = new User(target.id); + if (!user.vaild()) + return; + + lcd.print("²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²" + + "² Betrag von User " + user.GetUserName().PadRight(8, ' ') + " ²" + + "² um "+betrag.ToString().PadLeft(2, ' ')+" € verringert ²" + + "²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²"); + user.SetUserKonto(user.GetUserKonto()-betrag); + System.Threading.Thread.Sleep(2000); + } + private void sell(Prod prod, User user) { + LCDDisplay lcd = Factory.getLCDDisplay(); if (user.GetUserKonto() > 19) { - this.lcd.print("²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²" + - "² Du hast zu viel Geld auf dem Konto ²" + - "² BITTE bezahlen! | Grenze 20€ ²" + - "²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²", + lcd.print("²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²" + + "² Du hast zu viel Geld auf dem Konto ²" + + "² BITTE bezahlen! | Grenze 20€ ²" + + "²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²", LCDDisplay.Status.Error, 5); } } private void showProdInfo(Prod prod) { + LCDDisplay lcd = Factory.getLCDDisplay(); if (prod.GetProdType() == Prod.ProdType.product) { long id = prod.GetProdId(); double price = prod.GetProdPrice(); string name = prod.GetProdName(); - this.lcd.print("²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²" + - "² Produkt: " + name.PadRight(27, ' ') + " ²" + - "² Preis: " + price.ToString(2).PadLeft(6, ' ') + "€ EAN13: " + id.ToString().PadRight(14, ' ') + " ²" + - "²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²", 2); + lcd.print("²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²" + + "² Produkt: " + name.PadRight(27, ' ') + " ²" + + "² Preis: " + price.ToString(2).PadLeft(6, ' ') + "€ EAN13: " + id.ToString().PadRight(14, ' ') + " ²" + + "²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²", 2); } if (prod.GetProdType() == Prod.ProdType.instruction) { string name = prod.GetFunctName(); - this.lcd.print("²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²" + - "² Instruktion: " + name.PadRight(23, ' ') + " ²" + - "² AdminCard + Instruction + TargetCard ²" + - "²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²", 2); + lcd.print("²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²" + + "² Instruktion: " + name.PadRight(23, ' ') + " ²" + + "² AdminCard + Instruction + TargetCard ²" + + "²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²", 2); } } - private Prod findProd(long prodid) - { - return new Prod(prodid); - } - private void showUserInfo(User user) { + LCDDisplay lcd = Factory.getLCDDisplay(); + string name = user.GetUserName(); int konto = user.GetUserKonto(); long id = user.GetUserId(); - int all = user.GetUserAll(); + long all = user.GetUserAll(); lcd.print("²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²" + "² User: " + name.PadRight(8, ' ') + " Betrag: " + (konto.ToString() + " €").PadRight(7, ' ') + " ²" + "² UserID: " + id.ToString().PadRight(12, ' ') + " Gesamt: " + (all.ToString() + " €").PadRight(7, ' ') + " ²" + "²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²", 5); } - private User findUser(long userId) - { - return new User(userId); - } - internal void GetInitStatus() { - lcd.print("²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²abcdef 321" + - "² MATOMAT Wilkommen! ²ghijkl 123" + - "² Frohes genießen der Mate ²mnopqr 066" + - "²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²stuvwx 001"); + LCDDisplay lcd = Factory.getLCDDisplay(); + List l = new Tables().getBestlist(); + string[] p = new string[4]; + for (int i = 0; i < 4; i++) + { + p[i] = (l.Count >= i + 1) ? l.ElementAt(i).name.PadRight(6, ' ').Substring(0, 6) + " " + (l.ElementAt(i).num % 1000).ToString().PadLeft(3, '0') : " "; + } + lcd.print("²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²" + p[0] + + "² MATOMAT Wilkommen! ²" + p[1] + + "² Frohes genießen der Mate ²" + p[2] + + "²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²" + p[3]); } } } diff --git a/Matomat/BarcodeReader.cs b/Matomat/BarcodeReader.cs index 15879fb..e111a38 100644 --- a/Matomat/BarcodeReader.cs +++ b/Matomat/BarcodeReader.cs @@ -8,22 +8,36 @@ namespace Matomat { class BarcodeReader { - private TextReader r; + private bool _shouldStop; internal long getCodeID() { - r = Console.In; - string str = r.ReadLine(); - try + if (Console.KeyAvailable) { - return Convert.ToInt64(str); + string str = ""; + this._shouldStop = false; + while (!this._shouldStop) + { + if (Console.KeyAvailable) + { + ConsoleKeyInfo k = Console.ReadKey(true); + if (k.Key == ConsoleKey.Enter) + break; + str = str + k.KeyChar.ToString(); + } + System.Threading.Thread.Sleep(10); + } + try + { + return Convert.ToInt64(str); + } + catch (Exception) { } } - catch (Exception) { } return 0; } internal void Abort() { - r.Close(); + this._shouldStop = true; } } } diff --git a/Matomat/DBDriverMysqli.cs b/Matomat/DBDriverMysqli.cs index a25c3f9..ce35dde 100644 --- a/Matomat/DBDriverMysqli.cs +++ b/Matomat/DBDriverMysqli.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text; using MySql.Data; using MySql.Data.MySqlClient; +using System.Threading; namespace Matomat { @@ -14,6 +15,7 @@ namespace Matomat private bool data_b; private MySqlDataReader data; private long id; + private Thread pingThread; public DBDriverMysqli() { } @@ -31,8 +33,23 @@ namespace Matomat } this.query("SET NAMES 'UTF8'"); this.query("SET CHARACTER SET 'UTF8'"); + this.startPing(); return true; } + + private void startPing() + { + this.pingThread = new Thread(this.ping); + this.pingThread.Start(); + } + public void ping() + { + while (true) + { + Thread.Sleep(1 * 60 * 1000); + this.query("SELECT 1"); + } + } public override void query(string sql) { this.err = null; @@ -208,8 +225,9 @@ namespace Matomat { return str; } - ~DBDriverMysqli() + public override void RequestStop() { + this.pingThread.Abort(); if (!this.data.IsClosed) this.data.Close(); this.conn.Close(); diff --git a/Matomat/Database.cs b/Matomat/Database.cs index 372c983..009176b 100644 --- a/Matomat/Database.cs +++ b/Matomat/Database.cs @@ -5,7 +5,7 @@ using System.Text; namespace Matomat { - class Database + abstract class Database { private class instance { @@ -40,36 +40,13 @@ namespace Matomat instances.Add(instance); return instance.iDatabase; } - public virtual bool connect(string server, string dbs, string user, string pw, int port, string driver) - { - return false; - } - public virtual void query(string sql) - { - return; - } - public virtual object[] getResult() - { - return null; - } - public virtual List getResultList() - { - return null; - } - public virtual Exception getError() - { - return null; - } - public virtual long getID() - { - return 0; - } - public virtual string quote(string str) - { - return str; - } - ~Database() - { - } + public abstract bool connect(string server, string dbs, string user, string pw, int port, string driver); + public abstract void query(string sql); + public abstract object[] getResult(); + public abstract List getResultList(); + public abstract Exception getError(); + public abstract long getID(); + public abstract string quote(string str); + public abstract void RequestStop(); } } diff --git a/Matomat/Factory.cs b/Matomat/Factory.cs index 869ed96..61440ac 100644 --- a/Matomat/Factory.cs +++ b/Matomat/Factory.cs @@ -57,5 +57,23 @@ namespace Matomat Config c = Factory.getConfig(); return Database.getInstance(c.mysql_server, c.mysql_db, c.mysql_user, c.mysql_pw, c.mysql_port, c.mysql_driver); } + + internal static void rmDBO() + { + if (dbo_i != null) + { + dbo_i.RequestStop(); + dbo_i = null; + } + } + + internal static void rmLCDDisplay() + { + if (lcd_i != null) + { + lcd_i.RequestStop(); + lcd_i = null; + } + } } } diff --git a/Matomat/Input.cs b/Matomat/Input.cs index e847171..a4b061e 100644 --- a/Matomat/Input.cs +++ b/Matomat/Input.cs @@ -128,5 +128,23 @@ namespace Matomat instances.Add(instance); return instance.input; } + + internal InputData getCardInput(int timeout) + { + if (timeout == 0) + timeout = Int32.MaxValue; + data = new InputData(); + Thread wtCard = new Thread(this.doWorkCard); + wtCard.Start(); + while (!wtCard.IsAlive) ; + DateTime time = DateTime.Now.AddSeconds(timeout); + while (time.Ticks > DateTime.Now.Ticks && data.type == InputData.types.None) + { + Thread.Sleep(1); + } + wtCard.Abort(); + rfid.Abort(); + return data; + } } } diff --git a/Matomat/LCDDisplay.cs b/Matomat/LCDDisplay.cs index 9c28f77..0aa4825 100644 --- a/Matomat/LCDDisplay.cs +++ b/Matomat/LCDDisplay.cs @@ -34,8 +34,20 @@ namespace Matomat this.time = time; } } + private class Beeb + { + public int frequency; + public int duration; + + public Beeb(int frequency, int duration) + { + this.frequency = frequency; + this.duration = duration; + } + } static List instances; private Queue messages; + private Queue beeb; private volatile bool _shouldStop; private SerialPort serialPort; private bool disable = false; @@ -52,12 +64,25 @@ namespace Matomat this.disable = true; } this.createChars(); - messages = new Queue(); - Thread workerThread = new Thread(this.DoWork); - workerThread.Start(); - while (!workerThread.IsAlive); + this.messages = new Queue(); + new Thread(this.DisplayThread).Start(); + this.beeb = new Queue(); + new Thread(this.BeebThread).Start(); } - public void DoWork() + private void BeebThread() + { + Beeb b; + while (!_shouldStop) + { + Thread.Sleep(1); + if (this.beeb.Count != 0) + { + b = this.beeb.Dequeue(); + Console.Beep(b.frequency, b.duration); + } + } + } + private void DisplayThread() { Message m; DateTime timeout = new DateTime(); @@ -76,20 +101,24 @@ namespace Matomat } } - + private void beep(int frequency, int duration) + { + Beeb b = new Beeb(frequency, duration); + this.beeb.Enqueue(b); + } private void display(string text, Status status) { if (status == Status.Warn) { - Console.Beep(750, 750); + this.beep(750, 750); } if (status == Status.Error) { - Console.Beep(750, 500); - Console.Beep(37, 100); - Console.Beep(750, 500); - Console.Beep(37, 100); - Console.Beep(750, 500); + this.beep(750, 500); + this.beep(37, 100); + this.beep(750, 500); + this.beep(37, 100); + this.beep(750, 500); } Console.WriteLine(text); this.displayClear(); @@ -194,6 +223,9 @@ namespace Matomat } public void RequestStop() { + while (messages.Count != 0) { Thread.Sleep(10); } + while (beeb.Count != 0) { Thread.Sleep(10); } + Thread.Sleep(100); _shouldStop = true; if (this.serialPort.IsOpen) this.serialPort.Close(); diff --git a/Matomat/Matomat.csproj b/Matomat/Matomat.csproj index 4d8b3ad..5080461 100644 --- a/Matomat/Matomat.csproj +++ b/Matomat/Matomat.csproj @@ -34,21 +34,8 @@ 4 - - False - .\mysql.data.dll - - - False - .\mysql.data.entity.dll - - - .\mysql.visualstudio.dll - - - False - .\mysql.web.dll - + + False .\RfidClass.dll @@ -75,6 +62,7 @@ + diff --git a/Matomat/Prod.cs b/Matomat/Prod.cs index 1610cee..27f20fd 100644 --- a/Matomat/Prod.cs +++ b/Matomat/Prod.cs @@ -10,6 +10,9 @@ namespace Matomat private long prodId; private bool found; private ProdType type; + private int price; + private string name; + private string function; public enum ProdType { product, @@ -35,11 +38,14 @@ namespace Matomat if (t.iscommand) { this.type = ProdType.instruction; + this.function = t.name; } else { this.type = ProdType.product; + this.name = t.name; } + this.price = t.cost; } @@ -70,17 +76,17 @@ namespace Matomat internal double GetProdPrice() { - return 1.0; + return this.price; } internal string GetProdName() { - return "Mate-Cola"; + return this.name; } internal string GetFunctName() { - return "aufladen(10);"; + return this.function; } } } diff --git a/Matomat/Program.cs b/Matomat/Program.cs index ceb3961..3dc0508 100644 --- a/Matomat/Program.cs +++ b/Matomat/Program.cs @@ -19,9 +19,9 @@ namespace Matomat while (workerThread.IsAlive) { - Thread.Sleep(1); + Thread.Sleep(100); } - Console.WriteLine("main thread: Worker thread has terminated."); + //Console.ReadLine(); } } } diff --git a/Matomat/RFIDReader.cs b/Matomat/RFIDReader.cs index 73a6bd1..346a8df 100644 --- a/Matomat/RFIDReader.cs +++ b/Matomat/RFIDReader.cs @@ -18,8 +18,9 @@ namespace Matomat try { return r.readKey(); + //return 388914410; } - catch (Exception) //e) + catch (Exception)// e) { //Console.WriteLine(e); } diff --git a/Matomat/Tables/Tables.Best.cs b/Matomat/Tables/Tables.Best.cs new file mode 100644 index 0000000..67a99da --- /dev/null +++ b/Matomat/Tables/Tables.Best.cs @@ -0,0 +1,53 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Data; + +namespace Matomat +{ + class TBest : Tables + { + public TBest(long num, string name) + { + this._num = num; + this._name = name; + } + public TBest() + { + this._name = ""; + this._num = 0; + } + private long _num; + public long num + { + get + { + return _num; + } + set + { + if (_num != value) + { + _num = value; + } + } + } + + private string _name; + public string name + { + get + { + return _name; + } + set + { + if (_name != value) + { + _name = value; + } + } + } + } +} diff --git a/Matomat/Tables/Tables.Product.cs b/Matomat/Tables/Tables.Product.cs index 06895e3..608dcf9 100644 --- a/Matomat/Tables/Tables.Product.cs +++ b/Matomat/Tables/Tables.Product.cs @@ -7,6 +7,17 @@ namespace Matomat { class TProduct : Tables { + public TProduct() + { + } + public TProduct(int id, long barcode, string name, int cost, bool iscommand) + { + this._id = id; + this._barcode = barcode; + this._name = name; + this._cost = cost; + this._iscommand = iscommand; + } private int _id; public int id { diff --git a/Matomat/Tables/Tables.User.cs b/Matomat/Tables/Tables.User.cs index 823a1cd..8042c73 100644 --- a/Matomat/Tables/Tables.User.cs +++ b/Matomat/Tables/Tables.User.cs @@ -8,6 +8,19 @@ namespace Matomat { class TUser : Tables { + public TUser() + { + } + public TUser(int id, long userid, string username, int credits, bool admin, string shortname, string email) + { + this._id = id; + this._userid = userid; + this._username = username; + this._credits = credits; + this._admin = admin; + this._shortname = shortname; + this._email = email; + } private int _id; public int id { diff --git a/Matomat/Tables/Tables.cs b/Matomat/Tables/Tables.cs index 1223e46..0d5e3e9 100644 --- a/Matomat/Tables/Tables.cs +++ b/Matomat/Tables/Tables.cs @@ -14,9 +14,13 @@ namespace Matomat public TUser getUserTable(long userid) { Database db = Factory.getDBO(); - db.query("SELECT * FROM `user` WHERE `userid` =" + db.quote(userid.ToString())); + db.query("SELECT `id`, `userid`, `username`, `credits`, `admin`, `shortname`, `email` FROM `user` WHERE `userid` =" + db.quote(userid.ToString())); object[] row = db.getResult(); - return new TUser(); + if (row == null) + { + return null; + } + return new TUser((int)row[0], (long)row[1], (string)row[2], (int)row[3], (bool)row[4], (string)row[5], (string)row[6]); } public TProduct getProdTable(int id) { @@ -31,13 +35,44 @@ namespace Matomat { return null; } - TProduct ret = new TProduct(); - ret.id = (int)row[0]; - ret.barcode = (long)row[1]; - ret.name = (string)row[2]; - ret.cost = (int)row[3]; - ret.iscommand = (bool)row[4]; + return new TProduct((int)row[0], (long)row[1], (string)row[2], (int)row[3], (bool)row[4]); + } + + internal List getBestlist() + { + Database db = Factory.getDBO(); + db.query("SELECT COUNT(*) AS `num`,`u`.`shortname` AS `name` "+ + "FROM `history` AS `h` "+ + "LEFT JOIN `product` AS `p` ON `p`.`id` = `h`.`prod` "+ + "LEFT JOIN `user` AS `u` ON `u`.`id` = `h`.`user` "+ + "WHERE `p`.`iscommand` = 0 GROUP BY `h`.`user` ORDER BY `num` DESC LIMIT 0,4"); + List rows = db.getResultList(); + if (rows == null) + { + return null; + } + List ret = new List(); + foreach (object[] row in rows) + { + ret.Add(new TBest((long)row[0], (string)row[1])); + } return ret; } + + internal TBest getUserMax(int p) + { + Database db = Factory.getDBO(); + db.query("SELECT SUM(`p`.`cost`) AS `num`,`u`.`shortname` AS `name` "+ + "FROM `history` AS `h` "+ + "LEFT JOIN `product` AS `p` ON `p`.`id` = `h`.`prod` "+ + "LEFT JOIN `user` AS `u` ON `u`.`id` = `h`.`user` "+ + "WHERE `p`.`iscommand` = 0 AND `h`.`user` = " + db.quote(p.ToString())); + object[] row = db.getResult(); + if (row == null) + { + return null; + } + return new TBest(Decimal.ToInt64((decimal)row[0]), (string)row[1]); + } } } diff --git a/Matomat/User.cs b/Matomat/User.cs index bcb207f..b5ff018 100644 --- a/Matomat/User.cs +++ b/Matomat/User.cs @@ -9,6 +9,12 @@ namespace Matomat { private long userId; private bool found; + private string username; + private string shrotname; + private int credits; + private long all; + private bool admin; + private int id; public User(long userId) { @@ -24,7 +30,13 @@ namespace Matomat this.found = false; return; } + TBest b = new Tables().getUserMax(u.id); this.found = true; + this.shrotname = u.shortname; + this.credits = u.credits; + this.all = b.num; + this.admin = u.admin; + this.id = u.id; } internal bool vaild() @@ -32,7 +44,10 @@ namespace Matomat LCDDisplay lcd = Factory.getLCDDisplay(); if (!found) { - lcd.print("User wurde nich gefunden",LCDDisplay.Status.Error,5); + lcd.print("²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²" + + "² User wurde nicht gefunden ²" + + "² UserID: " + (this.GetUserId().ToString() + " unbekannt").PadRight(28, ' ') + " ²" + + "²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²", LCDDisplay.Status.Error, 5); System.Threading.Thread.Sleep(4500); return false; } @@ -42,12 +57,12 @@ namespace Matomat internal string GetUserName() { - return "pschel2s"; + return this.shrotname; } internal int GetUserKonto() { - return 20; + return this.credits; } internal long GetUserId() @@ -55,9 +70,22 @@ namespace Matomat return this.userId; } - internal int GetUserAll() + internal long GetUserAll() { - return 35; + return this.all; + } + + internal bool IsAdmin() + { + return this.admin; + } + + internal void SetUserKonto(int p) + { + Database db = Factory.getDBO(); + this.credits = p; + db.query("UPDATE `user` SET `credits` = '" + db.quote(p.ToString())+"' WHERE "+ + "`id` = '"+db.quote(this.id.ToString())+"'"); } } } diff --git a/Matomat/Worker.cs b/Matomat/Worker.cs index 09fcf7e..2411f2b 100644 --- a/Matomat/Worker.cs +++ b/Matomat/Worker.cs @@ -31,8 +31,12 @@ namespace Matomat InputData input = inp.getAnyInput(0); automat.doJob(input); } - lcd.print("Matomat Beendet!"); - lcd.RequestStop(); + this.lcd.print("²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²" + + "² Der Matomat wurde beendet. ²" + + "² Einen schönen Tag! ²" + + "²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²"); + Factory.rmLCDDisplay(); + Factory.rmDBO(); } private void RequestStop(bool stop) {