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

57 lines
1.9 KiB
C#

using System;
using System.Collections.Generic;
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;
using Sarand.Core.Base;
namespace Sarand.PatientMgr.Win.Dbas.Bus
{
//=======================================================================
class SpmPatient_Dbas : SpmPatient
{
//-------------------------------------------------------------------
// Data members.
private readonly SpmUserContext userContext;
//-------------------------------------------------------------------
// Construction.
public SpmPatient_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 HasAdmission()
{
ClearErrorState();
if (SysId.IsValid(Id)) return false;
ISacsDatabase db = SpmGlobals.Application.GetDatabase(userContext.SessionContext);
// Filter to identify matching Admissions: Facility Id = This item's Id.
List<String> filters = new List<String>();
filters.Add(SpmDbDfn.GetColumnName(SpmDbDfn.ColumnIdx.SwmAdmission_ProcedureId) + "=" + Id.ToString());
return db.GetRowCount(SpmDbDfn.GetTableName(SpmDbDfn.TableIdx.SwmAdmission), filters.Concat(" AND ", "(", ")")) > 0;
}
//-------------------------------------------------------------------
}
//=======================================================================
}