63 lines
2.1 KiB
C#
63 lines
2.1 KiB
C#
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
|
using Sarand.BusinessMgr.Net.Standard.Base.Bus;
|
|
using Sarand.Net.Standard.Base.Bus;
|
|
using Sarand.Net.Standard.Base.Core;
|
|
using Sarand.Net.Standard.Base.Dbas;
|
|
using Sarand.Net.Standard.Base.Utils;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace Sarand.BusinessMgr.Net.Standard.Dbas.Bus
|
|
{
|
|
//=======================================================================
|
|
class SbmSystemAccount_Dbas : SbmSystemAccount
|
|
{
|
|
//-------------------------------------------------------------------
|
|
// Data members.
|
|
private readonly SbmInternals internals;
|
|
|
|
//-------------------------------------------------------------------
|
|
// Construction.
|
|
public SbmSystemAccount_Dbas(SbmInternals internals, SysId id, SysId affIdOwner, Sbm.SystemAccountType systemAccountType, SysId interfaceId, SysId assocId, ushort flags) :
|
|
base(internals.UserContext, id, affIdOwner, systemAccountType, interfaceId, assocId)
|
|
{
|
|
this.internals = internals;
|
|
Flags = flags;
|
|
}
|
|
protected override void Dispose(bool disposing)
|
|
{
|
|
if (disposing)
|
|
{
|
|
// NB Do not dispose the Internals - owned by manager.
|
|
}
|
|
base.Dispose(disposing);
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Properties.
|
|
|
|
//-------------------------------------------------------------------
|
|
// Associated data.
|
|
public override bool HasUsers()
|
|
{
|
|
if (!SysId.IsValid(Id)) return false;
|
|
ISacsDatabase db = internals.BusMgrDatabase;
|
|
if (db != null)
|
|
{
|
|
String table = SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.SystemAccountUser);
|
|
if (db.TableExists(table))
|
|
{
|
|
String column = SbmDbDfn.GetColumnName(SbmDbDfn.ColumnIdx.SystemAccountUser_AccountId);
|
|
List<String> filters = new List<String>();
|
|
filters.Add(SbmDbDfn.GetColumnName(SbmDbDfn.ColumnIdx.SystemAccountUser_AccountId) + "=" + Id.ToString());
|
|
return db.GetRowCount(table, /*column,*/ filters.Concat(" AND ", "(", ")")) > 0;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
}
|
|
//=======================================================================
|
|
}
|