Session Console and Internals.
This commit is contained in:
@@ -16,22 +16,45 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private SacsDatabase db = null;
|
||||
private readonly SbmDbDataItem.SbmDatabaseInfo dbInfo;
|
||||
public class Members
|
||||
{
|
||||
public SacsDatabase db = null;
|
||||
public SbmDbDataItem.SbmDatabaseInfo dbInfo;
|
||||
}
|
||||
private readonly Members mbr = new Members();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SbmAssetMgr_Dbas(ISbmUserContext_Core userContext) :
|
||||
public SbmAssetMgr_Dbas(SbmInternals internals) :
|
||||
base(internals)
|
||||
{
|
||||
Initialise();
|
||||
}
|
||||
public SbmAssetMgr_Dbas(ISbmUserOrganisationContext userContext) :
|
||||
base(userContext)
|
||||
{
|
||||
db = (SbmGlobals.Application.GetBusMgrDatabase(SessionContext) as SacsDatabase);
|
||||
dbInfo = new SbmDbDataItem.SbmDatabaseInfo(db.DatabaseName, db.GetTableDfns());
|
||||
Initialise();
|
||||
}
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Initialisation.
|
||||
private void Initialise()
|
||||
{
|
||||
mbr.db = (SbmGlobals.Application.GetBusMgrDatabase(SessionContext) as SacsDatabase);
|
||||
mbr.dbInfo = new SbmDbDataItem.SbmDatabaseInfo(mbr.db.DatabaseName, mbr.db.GetTableDfns());
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
protected ISacsDatabase Database { get { return db; } }
|
||||
protected SbmDbDataItem.SbmDatabaseInfo DbInfo { get { return dbInfo; } }
|
||||
protected ISacsDatabase Database { get { return mbr.db; } }
|
||||
protected SbmDbDataItem.SbmDatabaseInfo DbInfo { get { return mbr.dbInfo; } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
@@ -39,10 +62,10 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
public override bool AssetDatabaseIsValid()
|
||||
{
|
||||
ClearErrorState();
|
||||
if (db == null) return SetErrorState("Database not specified");
|
||||
if (Database == null) return SetErrorState("Database not specified");
|
||||
//if (pDb->GetInterfaceType() != SaDatabase::eSaDbInterfaceOdbc) return SetErrorState ("Database not ODBC");
|
||||
if (db.TableExists(SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.SaAssetCategory))) return SetErrorState("Asset Category table does not exist");
|
||||
if (db.TableExists(SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.SaAsset))) return SetErrorState("Asset table does not exist");
|
||||
if (Database.TableExists(SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.SaAssetCategory))) return SetErrorState("Asset Category table does not exist");
|
||||
if (Database.TableExists(SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.SaAsset))) return SetErrorState("Asset table does not exist");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user