58 lines
2.0 KiB
C#
58 lines
2.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using Sarand.Core.Base;
|
|
using Sarand.Core.Bus;
|
|
using Sarand.PatientMgr.Core.App;
|
|
using Sarand.PatientMgr.Core.Bus;
|
|
using Sarand.Core.Interfaces;
|
|
using Sarand.Core.Dbas.Base;
|
|
using Sarand.PatientMgr.Core.Mgr;
|
|
|
|
namespace Sarand.PatientMgr.Win.Dbas.Bus
|
|
{
|
|
//=======================================================================
|
|
class SpmEmployee_Dbas : SpmEmployee
|
|
{
|
|
//-------------------------------------------------------------------
|
|
// Data members.
|
|
private readonly SpmUserContext userContext;
|
|
|
|
//-------------------------------------------------------------------
|
|
// Construction.
|
|
public SpmEmployee_Dbas(SpmUserContext userContext, SysId id, SysId institutionId, ushort flags) :
|
|
base(id, institutionId)
|
|
{
|
|
this.userContext = userContext;
|
|
Flags = flags;
|
|
}
|
|
protected override void Dispose(bool disposing)
|
|
{
|
|
if (disposing)
|
|
{
|
|
}
|
|
base.Dispose(disposing);
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Properties.
|
|
|
|
//-------------------------------------------------------------------
|
|
// A s s o c i a t e d D a t a E l e m e n t s
|
|
//-------------------------------------------------------------------
|
|
public override bool HasRoles()
|
|
{
|
|
ClearErrorState();
|
|
if (!SysId.IsValid(Id)) return false;
|
|
ISacsDatabase db = SpmGlobals.Application.GetDatabase(userContext.SessionContext);
|
|
if (db == null) return SetErrorState("date unavailable");
|
|
// Filter to identify matching admissions:
|
|
// Patient Id = This item's Id.
|
|
List<String> filters = new List<String>();
|
|
filters.Add(SpmDbDfn.GetColumnName(SpmDbDfn.ColumnIdx.SwmEmployeeRole_EmployeeId) + "=" + Id.ToString());
|
|
return db.GetRowCount(SpmDbDfn.GetTableName(SpmDbDfn.TableIdx.SwmEmployeeRole), filters.Concat(" AND ", "(", ")")) > 0;
|
|
}
|
|
//-------------------------------------------------------------------
|
|
}
|
|
//=======================================================================
|
|
}
|