'Config', 'Results' projects added, includes iPerl opto logging bug-fixes, builds OK, cannot open DB, version 2.0.158.
This commit is contained in:
@@ -6,19 +6,15 @@ using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using log4net;
|
||||
using Config.Entities;
|
||||
using TBF.Resources;
|
||||
using TBF.Forms;
|
||||
using TBF.ErrorHandler;
|
||||
|
||||
using NHibernate;
|
||||
|
||||
namespace TBF
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
public const string AdminUsername = "admin";
|
||||
public const string AdminPassword = "staratura";
|
||||
|
||||
public const string HomeDir = "C:\\Tbf\\"; /// Contains subdirectories Results, Logs, Images, ...
|
||||
|
||||
/// log4net
|
||||
@@ -34,36 +30,7 @@ namespace TBF
|
||||
public const string LocalSettingsBackupName = "config.backup.xml";
|
||||
|
||||
public static System.Globalization.CultureInfo AltCulture;
|
||||
|
||||
/// Database related: This object reference is set after a successful user login
|
||||
public static DatabaseSettings CurrentBench;
|
||||
const string SQLiteDbFName = "SQLite.db";
|
||||
|
||||
#if MUNICH
|
||||
public const int WMsCount = 3;
|
||||
public const int LineSize = 1;
|
||||
public const int CompoundWMsCount = 1;
|
||||
#elif DN100 || BADGER_VELKA_TRAT
|
||||
public const int WMsCount = 3;
|
||||
public const int LineSize = 3;
|
||||
public const int CompoundWMsCount = 1;
|
||||
#elif FUZHOU300 || FUZHOU150 || PT200IL
|
||||
public const int WMsCount = 6;
|
||||
public const int LineSize = 6;
|
||||
public const int CompoundWMsCount = 3;
|
||||
#elif TORINO50 || BADGER_MALA_TRAT
|
||||
public const int WMsCount = 6;
|
||||
public const int LineSize = 6;
|
||||
public const int CompoundWMsCount = 1;
|
||||
#elif TORUN_PT50_2015 || CEVAK_PT40_272 || MURES_PT40 || FUZHOU_40
|
||||
public const int WMsCount = 20;
|
||||
public const int LineSize = 10;
|
||||
public const int CompoundWMsCount = 1;
|
||||
#elif IPERLST
|
||||
public const int WMsCount = 40;
|
||||
public const int LineSize = 20;
|
||||
public const int CompoundWMsCount = 1;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Selected procedure data
|
||||
@@ -76,7 +43,7 @@ namespace TBF
|
||||
/// of procedure data and uses them for the test. Changes of 'SelectedProcedure'
|
||||
/// done during the test do not have any influence on the currently running test.
|
||||
/// </summary>
|
||||
public static Entities.Procedure SelectedProcedure = null;
|
||||
public static Config.Entities.Procedure SelectedProcedure = null;
|
||||
|
||||
/// <summary>
|
||||
/// Main window object.
|
||||
@@ -115,11 +82,11 @@ namespace TBF
|
||||
string sampleConfig = Application.StartupPath + Path.DirectorySeparatorChar + "SampleConfig" + Path.DirectorySeparatorChar;
|
||||
if (File.Exists(sampleConfig + LocalSettingsFileName)) { File.Copy(sampleConfig + LocalSettingsFileName, LocalSettingsFileName); }
|
||||
if (File.Exists(sampleConfig + log4netConfigFName)) { File.Copy(sampleConfig + log4netConfigFName, log4netConfigFName); }
|
||||
if (File.Exists(sampleConfig + SQLiteDbFName)) { File.Copy(sampleConfig + SQLiteDbFName, SQLiteDbFName); }
|
||||
if (File.Exists(sampleConfig + Config.Data.SQLiteDbFName)) { File.Copy(sampleConfig + Config.Data.SQLiteDbFName, Config.Data.SQLiteDbFName); }
|
||||
|
||||
File.SetAttributes(LocalSettingsFileName, FileAttributes.Normal);
|
||||
File.SetAttributes(log4netConfigFName, FileAttributes.Normal);
|
||||
File.SetAttributes(SQLiteDbFName, FileAttributes.Normal);
|
||||
File.SetAttributes(Config.Data.SQLiteDbFName, FileAttributes.Normal);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -223,22 +190,22 @@ namespace TBF
|
||||
{
|
||||
if (LocalSettings.TestBenches[i].BenchName == loginDlgBench.BenchName)
|
||||
{
|
||||
Entities.User loadedUser = null;
|
||||
User loadedUser = null;
|
||||
try
|
||||
{
|
||||
bool authorized = false;
|
||||
|
||||
if (Entities.User.IsPowerUser(loginDlgBench.User, loginDlgBench.Password))
|
||||
if (User.IsPowerUser(loginDlgBench.User, loginDlgBench.Password))
|
||||
{
|
||||
loadedUser = new Entities.User(loginDlgBench.User);
|
||||
loadedUser = new User(loginDlgBench.User);
|
||||
authorized = loadedUser.Authorize(loginDlgBench.User, loginDlgBench.Password);
|
||||
}
|
||||
|
||||
if (!authorized)
|
||||
{
|
||||
/// Load user from the UsersAndGroupsDB database
|
||||
loadedUser = Entities.User.LoadUserByName(loginDlgBench.User,
|
||||
LocalSettings.TestBenches[i].UsersDBSettings);
|
||||
loadedUser = User.LoadUserByName(loginDlgBench.User,
|
||||
LocalSettings.TestBenches[i].UsersDBSettings);
|
||||
if (loadedUser != null)
|
||||
{
|
||||
authorized = loadedUser.Authorize(loginDlgBench.User, loginDlgBench.Password);
|
||||
@@ -247,15 +214,16 @@ namespace TBF
|
||||
|
||||
if (authorized)
|
||||
{
|
||||
log.InfoFormat("Password accepted, bench '{0}' parameters loaded.", LocalSettings.TestBenches[i].BenchName);
|
||||
log.InfoFormat("Password accepted, bench '{0}' parameters loaded.",
|
||||
LocalSettings.TestBenches[i].BenchName);
|
||||
|
||||
/// Copy the selected bench settings to CurrentBench.
|
||||
/// Clone() guarantees that current bench settings wont be modified
|
||||
/// when user modifies the database settings in DatabaseSettingsDlg.
|
||||
CurrentBench = (DatabaseSettings)LocalSettings.TestBenches[i].Clone();
|
||||
Config.Data.CurrentBench = (Config.DatabaseSettings)LocalSettings.TestBenches[i].Clone();
|
||||
|
||||
/// Save the selection to local settings
|
||||
LocalSettings.LastBenchName = CurrentBench.BenchName;
|
||||
LocalSettings.LastBenchName = Config.Data.CurrentBench.BenchName;
|
||||
|
||||
retryLogin = false;
|
||||
break;
|
||||
@@ -297,10 +265,10 @@ namespace TBF
|
||||
///
|
||||
if (LocalSettings.LastProcedureName != null)
|
||||
{
|
||||
IList<Entities.Procedure> listOfProcedures = FluentCommon.CreateSession(Database.Procedures)
|
||||
IList<Procedure> listOfProcedures = Config.FluentCommon.CreateSession(Config.Database.Procedures)
|
||||
.CreateQuery("FROM Procedure WHERE ProcedureState = 'Active' AND Name = :procName")
|
||||
.SetParameter("procName", LocalSettings.LastProcedureName)
|
||||
.List<Entities.Procedure>();
|
||||
.List<Procedure>();
|
||||
|
||||
if (listOfProcedures.Count == 1)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user