diff --git a/Matomat/App.config b/Matomat/App.config
index 8da3d8e..a25fc87 100644
--- a/Matomat/App.config
+++ b/Matomat/App.config
@@ -1,8 +1,8 @@
-
+
-
-
+
+
@@ -12,4 +12,4 @@
-
\ No newline at end of file
+
diff --git a/Matomat/Database/TDatabase.cs b/Matomat/Database/TDatabase.cs
index c7692d9..126a19a 100644
--- a/Matomat/Database/TDatabase.cs
+++ b/Matomat/Database/TDatabase.cs
@@ -35,7 +35,18 @@ namespace Matomat.Database
if (db.getError() != null)
{
- throw new Exception("db Fehler:" + db.getError());
+ Exception e = db.getError();
+ if (e.GetType() == typeof(MySql.Data.MySqlClient.MySqlException))
+ {
+ String mesg = e.Message;
+ if (mesg.Length > 38)
+ {
+ mesg = mesg.Substring(0, 38) + "\n" + mesg.Substring(38);
+ }
+ Matomat.Helper.Factory.getLCD().print(mesg, 10, Matomat.Output.LCDDisplay.Status.Error);
+ System.Threading.Thread.Sleep(10000);
+ throw new Exception("ENDE");
+ }
}
instances.Add(signature,db);
@@ -114,14 +125,14 @@ namespace Matomat.Database
foreach (System.Reflection.PropertyInfo item in p)
{
fields.Add(this.quoteName(item.Name));
- if (item.GetValue(row, null).GetType() == DateTime.Now.GetType())
- {
- values.Add(this.quote(((DateTime)item.GetValue(row, null)).ToString("s")));
- }
- else
- {
- values.Add(this.quote(item.GetValue(row, null).ToString()));
- }
+ if (item.GetValue(row, null).GetType() == DateTime.Now.GetType())
+ {
+ values.Add(this.quote(((DateTime)item.GetValue(row, null)).ToString("s")));
+ }
+ else
+ {
+ values.Add(this.quote(item.GetValue(row, null).ToString()));
+ }
}
if (p.Length == 0)
diff --git a/Matomat/Model/History.cs b/Matomat/Model/History.cs
index 27cab24..3df3737 100644
--- a/Matomat/Model/History.cs
+++ b/Matomat/Model/History.cs
@@ -21,7 +21,8 @@ namespace Matomat.Model
query.where(Factory.getDBO().quoteName("p.iscommand") + " = " + Factory.getDBO().quote(0.ToString()));
query.where(Factory.getDBO().quoteName("h.time") + " >= DATE_SUB(NOW(),INTERVAL 7 DAY)");
query.group(Factory.getDBO().quoteName("h.user"));
- query.order(Factory.getDBO().quoteName("num"));
+ query.order(Factory.getDBO().quoteName("num")+" DESC");
+ query.order(Factory.getDBO().quoteName("name"));
query.limit(0, limit);
Factory.getDBO().setQuery(query);
@@ -54,6 +55,10 @@ namespace Matomat.Model
Console.WriteLine(Factory.getDBO().getError());
return 0;
}
+ if (row[0].GetType() == System.DBNull.Value.GetType())
+ {
+ return 0;
+ }
return (int)(double)row[0];
}
@@ -65,19 +70,38 @@ namespace Matomat.Model
query.from(Factory.getDBO().quoteName("history", "h"));
query.leftJoin(Factory.getDBO().quoteName("product", "p") + " ON " + Factory.getDBO().quoteName("p.id") + " = " + Factory.getDBO().quoteName("h.prod"));
query.where(Factory.getDBO().quoteName("h.time") + " >= DATE_SUB(NOW(),INTERVAL 7 DAY)");
+ query.group(Factory.getDBO().quoteName("h.user"));
Factory.getDBO().setQuery(query);
- object[] row = Factory.getDBO().getResult();
- if (row == null)
+ List