public bool VerifySetup() { try { bool result = false; using (DbConnection = new SQLitePersistence(DbConnectionSettings)) { if (DbConnection.IsConnected()) { using (DbCommand = new SQLiteCommand()) { string sql = "SELECT DatabaseName from HostSettings WHERE id = 1"; DbCommand.CommandText = sql; DataTable returnDT = DbConnection.ExecuteQuery(DbCommand); if (returnDT.Rows.Count == 1) { DataRow row = returnDT.Rows[0]; result = row["DatabaseName"] != DBNull.Value; row = null; } returnDT = null; } }else { throw new Exception("Unable to Connect"); } } return result; }catch { throw; } }
public HostOptions GetHostOptions() { try { HostOptions result = new HostOptions(); using (DbConnection = new SQLitePersistence(DbConnectionSettings)) { if (DbConnection.IsConnected()) { using (DbCommand = new SQLiteCommand()) { string sql = "SELECT SessionTimeout, LockTimeout from HostOptions"; DbCommand.CommandText = sql; DataTable returnDT = DbConnection.ExecuteQuery(DbCommand); if (returnDT.Rows.Count == 1) { DataRow row = returnDT.Rows[0]; result.SessionTimeout = Convert.ToInt32(row["SessionTimeout"]); result.LockTimeout = Convert.ToInt32(row["LockTimeout"]); row = null; } returnDT = null; } }else { throw new Exception("Unable to Connect"); } } return result; }catch { throw; } }
public IHostSettings GetHostSettings() { try { IHostSettings result = new HostSettings(); using (DbConnection = new SQLitePersistence(DbConnectionSettings)) { if (DbConnection.IsConnected()) { using (DbCommand = new SQLiteCommand()) { string sql = "SELECT Id, DataSource,DatabaseName, UserLogin, Password, SALogin, SAPassword, BaseKey from HostSettings " + "WHERE Id = 1"; DbCommand.CommandText = sql; DataTable returnDT = DbConnection.ExecuteQuery(DbCommand); if (returnDT.Rows.Count == 1) { DataRow row = returnDT.Rows[0]; result.Id = Convert.ToInt32(row["Id"]); result.DataSource = row["DataSource"].ToString(); result.DatabaseName = row["DatabaseName"].ToString(); result.UserLogin = row["UserLogin"].ToString(); result.Password = row["Password"].ToString(); result.SALogin = row["SALogin"].ToString(); result.SAPassword = row["SAPassword"].ToString(); result.BaseKey = row["BaseKey"].ToString(); row = null; } returnDT = null; } }else { throw new Exception("Unable to Connect"); } } return result; }catch { throw; } }
public AccountingSettings GetAccountingSettings() { try { AccountingSettings result = new AccountingSettings(); using (DbConnection = new SQLitePersistence(DbConnectionSettings)) { if (DbConnection.IsConnected()) { using (DbCommand = new SQLiteCommand()) { string sql = "SELECT InterfaceId, Setting1, Setting2, Setting3, Setting4, Setting5 from Accounting"; DbCommand.CommandText = sql; DataTable returnDT = DbConnection.ExecuteQuery(DbCommand); if (returnDT.Rows.Count > 0) { DataRow row = returnDT.Rows[0]; result.InterfaceId = Convert.ToInt32(row["InterfaceId"]); result.Setting1 = row["Setting1"].ToString(); result.Setting2 = row["Setting2"].ToString(); result.Setting3 = row["Setting3"].ToString(); result.Setting4 = row["Setting4"].ToString(); result.Setting5 = row["Setting5"].ToString(); row = null; } returnDT = null; } }else { throw new Exception("Unable to Connect"); } } return result; }catch { throw; } }