Files
PatientMgr-CSharp/SaPatMgrWinDbas/Win/Dbas/Bus/SpmEmployeeRole_Dbas.cs
T
2019-06-04 09:06:12 +01:00

59 lines
2.1 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 SpmEmployeeRole_Dbas : SpmEmployeeRole
{
//-------------------------------------------------------------------
// Data members.
private readonly SpmUserContext userContext;
//-------------------------------------------------------------------
// Construction.
public SpmEmployeeRole_Dbas(SpmUserContext userContext, SysId departmentId, SysId employeeId, Spm.EmployeeRole employeeRole, ushort flags) :
base(departmentId, employeeId, employeeRole)
{
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 HasAdmissionRoles()
{
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 AdmissionRoles:
// AdmissionRole.EmployeeRoleId = This item's Id.
List<String> filters = new List<String>();
filters.Add(SpmDbDfn.GetColumnName(SpmDbDfn.ColumnIdx.SwmAdmissionRole_EmployeeRoleId) + "=" + Id.ToString());
return db.GetRowCount(SpmDbDfn.GetTableName(SpmDbDfn.TableIdx.SwmAdmissionRole), filters.Concat(" AND ", "(", ")")) > 0;
}
//-------------------------------------------------------------------
}
//=======================================================================
}