Statistics : First working version, ver. 2.18.1104

This commit is contained in:
Milan Hanajik
2018-12-19 12:24:37 +01:00
parent 76042756b1
commit 6b803444f0
13 changed files with 406 additions and 15 deletions
+22 -3
View File
@@ -14,6 +14,8 @@ using Results;
using Results.Entities;
using Statistics.Resources;
using Statistics.UserControls;
using System.Threading;
using System.Globalization;
namespace Statistics
{
@@ -21,7 +23,7 @@ namespace Statistics
{
static string[] testBenchNames = new string[] { "WR10", "WR11", "WR13", "WR14", "WR15", "PT7" };
///
#if false
#if true
static string[] connectionStrings = new string[] {
"SERVER=10.42.128.197; DATABASE=st-wr10-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;", /// WR10
"SERVER=10.42.128.98; DATABASE=st-wr11-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;", /// WR11
@@ -120,7 +122,7 @@ namespace Statistics
}
public void UpdateRequest(int benchId, MidId midId)
public IList<TestRslt> UpdateRequest(int benchId, MidId midId)
{
if (benchId >= sessionFactories.Length || sessionFactories[benchId] == null || (midId == MidId.WaterMeters))
{
@@ -132,9 +134,22 @@ namespace Statistics
{
MessageBox.Show(string.Format("Cannot load statistics of {0}", (benchId < testBenchNames.Length) ? testBenchNames[benchId] : "XY"));
}
return;
return null;
}
Thread thread = new Thread(() => Application.Run(new Forms.ModelessForm()
{
Title = string.Empty,
Message = Strings.searching_,
BackgroundColor = Color.LightGreen,
FontFamily = "Arial",
FontSize = 14,
FontStyle = FontStyle.Regular,
}));
thread.CurrentCulture = CultureInfo.CurrentCulture;
thread.CurrentUICulture = CultureInfo.CurrentUICulture;
thread.Start();
try
{
ISession session = sessionFactories[benchId].OpenSession();
@@ -151,11 +166,15 @@ namespace Statistics
foreach (var tr in listOfRslts) testRslts.Add(tr);
}
Forms.ModelessForm.CloseForm();
session.Close();
return testRslts;
}
catch (Exception exc)
{
Forms.ModelessForm.CloseForm();
MessageBox.Show(string.Format("Error loading statistics of {0}\r\n{1}", (benchId < testBenchNames.Length) ? testBenchNames[benchId] : "XY", exc.Message));
return null;
}
}
}