202 lines
6.1 KiB
C#
202 lines
6.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using Sarand.Core.Base;
|
|
using Sarand.Core.Bus;
|
|
using Sarand.PatientMgr.Core.App;
|
|
|
|
namespace Sarand.PatientMgr.Core.Bus
|
|
{
|
|
//=======================================================================
|
|
public abstract class SpmEmployeeRole : SacsHierarchyItem
|
|
{
|
|
//-------------------------------------------------------------------
|
|
// Columns.
|
|
public enum Column
|
|
{
|
|
Pos,
|
|
Id,
|
|
DepartmentId,
|
|
EmployeeId,
|
|
Role,
|
|
ApplicationFrom,
|
|
ApplicationTo,
|
|
|
|
// Common properties.
|
|
Notes,
|
|
Flag,
|
|
Status,
|
|
Status_Ind,
|
|
Status_Desc,
|
|
CreateOn_Date,
|
|
UpdateOn_Date,
|
|
}
|
|
|
|
// Data.
|
|
public new class Data : SacsHierarchyItem.Data
|
|
{
|
|
public Data()
|
|
{
|
|
//Status = EmployeeRoleStatus;
|
|
}
|
|
public SysId DepartmentId { get; set; }
|
|
public SysId EmployeeId { get; set; }
|
|
public Spm.EmployeeRole EmployeeRole { get; set; }
|
|
public DateTime ApplicationFrom { get; set; }
|
|
public DateTime ApplicationTo { get; set; }
|
|
|
|
internal void PopulateFrom(Data data)
|
|
{
|
|
DepartmentId = data.DepartmentId;
|
|
EmployeeId = data.EmployeeId;
|
|
EmployeeRole = data.EmployeeRole;
|
|
ApplicationFrom = data.ApplicationFrom;
|
|
ApplicationTo = data.ApplicationTo;
|
|
base.PopulateFrom(data);
|
|
}
|
|
public Data Clone()
|
|
{
|
|
Data data = new Data();
|
|
data.PopulateFrom(this);
|
|
return data;
|
|
}
|
|
}
|
|
|
|
// ErrField.
|
|
public new class ErrField : SacsHierarchyItem.ErrField
|
|
{
|
|
public ValidValue DepartmentId { get; set; } = ValidValue.Valid;
|
|
public ValidValue EmployeeId { get; set; } = ValidValue.Valid;
|
|
public ValidValue EmployeeRole { get; set; } = ValidValue.Valid;
|
|
public ValidValue ApplicationFrom { get; set; } = ValidValue.Valid;
|
|
public ValidValue ApplicationTo { get; set; } = ValidValue.Valid;
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Data members.
|
|
private readonly Data data = new Data();
|
|
|
|
//-------------------------------------------------------------------
|
|
// Construction.
|
|
protected SpmEmployeeRole(SysId departmentId, SysId employeeId, Spm.EmployeeRole employeeRole) : base()
|
|
{
|
|
departmentId = DepartmentId;
|
|
employeeId = EmployeeId;
|
|
employeeRole = EmployeeRole;
|
|
Status = DefaultStatus;
|
|
base.SetData(data);
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Status.
|
|
private static readonly List<SaStatus> employeeRoleStatuses = new List<SaStatus>()
|
|
{
|
|
SaStatus.Current,
|
|
};
|
|
public static SaStatus DefaultStatus { get { return SaStatus.Current; } }
|
|
public static List<SaStatus> EmployeeRoleStatuses { get { return new List<SaStatus>(employeeRoleStatuses); } }
|
|
public static DataValue.TriStateType GetStatusTriState(SaStatus status)
|
|
{
|
|
employeeRoleStatuses.Add(SaStatus.Current);
|
|
|
|
switch (status)
|
|
{
|
|
case SaStatus.Current:
|
|
return DataValue.TriStateType.Green;
|
|
}
|
|
return DataValue.TriStateType.Unknown;
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Utilities.
|
|
|
|
//-------------------------------------------------------------------
|
|
// Properties.
|
|
public Data GetData() { return data.Clone(); }
|
|
public void SetData(Data data)
|
|
{
|
|
String fn = GetType().Name + ".SetData";
|
|
// Properties that cannot be changed if previously specified.
|
|
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
|
throw new NotSupportedException(fn + " Id cannot be changed");
|
|
this.data.PopulateFrom(data);
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Attributes.
|
|
public SysId DepartmentId
|
|
{
|
|
get { return data.DepartmentId; }
|
|
set { CheckChanged(data.DepartmentId, value); data.DepartmentId = value; }
|
|
}
|
|
public SysId EmployeeId
|
|
{
|
|
get { return data.EmployeeId; }
|
|
set { CheckChanged(data.EmployeeId, value); data.EmployeeId = value; }
|
|
}
|
|
public Spm.EmployeeRole EmployeeRole
|
|
{
|
|
get { return data.EmployeeRole; }
|
|
set { CheckChanged((int)data.EmployeeRole, (int)value); data.EmployeeRole = value; }
|
|
}
|
|
public DateTime ApplicationFrom
|
|
{
|
|
get { return data.ApplicationFrom; }
|
|
set { CheckChanged(data.ApplicationFrom, value); data.ApplicationFrom = value; }
|
|
}
|
|
public DateTime ApplicationTo
|
|
{
|
|
get { return data.ApplicationTo; }
|
|
set { CheckChanged(data.ApplicationTo, value); data.ApplicationTo = value; }
|
|
}
|
|
|
|
|
|
//-------------------------------------------------------------------
|
|
// Flags.
|
|
|
|
//-------------------------------------------------------------------
|
|
// A s s o c i a t e d D a t a E l e m e n t s
|
|
//-------------------------------------------------------------------
|
|
public abstract bool HasAdmissionRoles();
|
|
|
|
//-------------------------------------------------------------------
|
|
// P a r a m s
|
|
//-------------------------------------------------------------------
|
|
/// <summary>Parameters - used to define the filters that should be applied to a List of Addresses</summary>
|
|
// List parameters.
|
|
public enum StatusCat
|
|
{
|
|
Any,
|
|
}
|
|
/// <summary> Item list parameters. </summary>
|
|
public new class Params : SacsHierarchyItem.Params
|
|
{
|
|
// List filtering.
|
|
public List<SysId> IncludedIds { get; } = new List<SysId>();
|
|
public List<SysId> ExcludedIds { get; } = new List<SysId>();
|
|
// EmployeeRole.
|
|
public SysId DepartmentId { get; set; }
|
|
public SysId EmployeeId { get; set; }
|
|
public Spm.EmployeeRole EmployeeRole { get; set; }
|
|
public String Surname { get; set; }
|
|
public String Initials { get; set; }
|
|
public DateTime ApplicationFrom { get; set; }
|
|
public DateTime ApplicationTo { get; set; }
|
|
public DateTime Application { get; set; }
|
|
|
|
public StatusCat StatusCat { get; set; } = StatusCat.Any;
|
|
}
|
|
//-------------------------------------------------------------------
|
|
}
|
|
//=======================================================================
|
|
// EmployeeRole D a t a L i s t
|
|
//=======================================================================
|
|
public static class SpmEmployeeRoleList
|
|
{
|
|
}
|
|
|
|
//=======================================================================
|
|
}
|