169 lines
4.5 KiB
C#
169 lines
4.5 KiB
C#
|
using System;
|
|||
|
using Ease.CoreV35.Model;
|
|||
|
using Ease.CoreV35.Caching;
|
|||
|
|
|||
|
namespace Payroll.BO
|
|||
|
{
|
|||
|
#region Class TrainingScheduleStatus
|
|||
|
[Serializable]
|
|||
|
public class TrainingScheduleStatus : BasicBaseObject
|
|||
|
{
|
|||
|
#region cache store
|
|||
|
private static Cache _cache = new Cache(typeof(TrainingScheduleStatus));
|
|||
|
#endregion
|
|||
|
|
|||
|
#region constructor
|
|||
|
|
|||
|
public TrainingScheduleStatus()
|
|||
|
{
|
|||
|
_name = string.Empty;
|
|||
|
}
|
|||
|
|
|||
|
#region Input validator
|
|||
|
public string[] InputValidator()
|
|||
|
{
|
|||
|
string[] sErrorString = new string[2];
|
|||
|
|
|||
|
if (this.Name == "")
|
|||
|
{
|
|||
|
sErrorString[0] = "Name can not be empty";
|
|||
|
sErrorString[1] = "Name";
|
|||
|
return sErrorString;
|
|||
|
}
|
|||
|
|
|||
|
sErrorString = null;
|
|||
|
return sErrorString;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
#endregion
|
|||
|
|
|||
|
#region properties
|
|||
|
|
|||
|
#region Name : string
|
|||
|
private string _name;
|
|||
|
public string Name
|
|||
|
{
|
|||
|
get { return _name; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<string>("DESCRIPTION", _name, Name);
|
|||
|
_name = value;
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Service Factory ITrainingScheduleStatusService : ITrainingTypeService
|
|||
|
|
|||
|
internal static ITrainingScheduleStatusService Service
|
|||
|
{
|
|||
|
get { return Services.Factory.CreateService<ITrainingScheduleStatusService>(typeof(ITrainingScheduleStatusService)); }
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region functions
|
|||
|
|
|||
|
public static TrainingScheduleStatus Get(ID nID)
|
|||
|
{
|
|||
|
TrainingScheduleStatus oTrainingScheduleStatus = null;
|
|||
|
#region Cache Header
|
|||
|
oTrainingScheduleStatus = (TrainingScheduleStatus)_cache["Get", nID];
|
|||
|
if (oTrainingScheduleStatus != null)
|
|||
|
return oTrainingScheduleStatus;
|
|||
|
#endregion
|
|||
|
oTrainingScheduleStatus = TrainingScheduleStatus.Service.Get(nID);
|
|||
|
#region Cache Footer
|
|||
|
_cache.Add(oTrainingScheduleStatus, "Get", nID);
|
|||
|
#endregion
|
|||
|
return oTrainingScheduleStatus;
|
|||
|
}
|
|||
|
|
|||
|
public static ObjectsTemplate<TrainingScheduleStatus> Get()
|
|||
|
{
|
|||
|
ObjectsTemplate<TrainingScheduleStatus> trainingScheduleStatuses;
|
|||
|
#region cache header
|
|||
|
trainingScheduleStatuses = _cache["Get"] as ObjectsTemplate<TrainingScheduleStatus>;
|
|||
|
if (trainingScheduleStatuses != null)
|
|||
|
return trainingScheduleStatuses;
|
|||
|
#endregion
|
|||
|
try
|
|||
|
{
|
|||
|
trainingScheduleStatuses = Service.Get();
|
|||
|
}
|
|||
|
catch (ServiceException e)
|
|||
|
{
|
|||
|
throw new Exception(e.Message, e);
|
|||
|
}
|
|||
|
|
|||
|
#region cache footer
|
|||
|
_cache.Add(trainingScheduleStatuses, "Get");
|
|||
|
#endregion
|
|||
|
|
|||
|
return trainingScheduleStatuses;
|
|||
|
}
|
|||
|
|
|||
|
public static ObjectsTemplate<TrainingScheduleStatus> Get(EnumStatus status)
|
|||
|
{
|
|||
|
#region Cache Header
|
|||
|
|
|||
|
ObjectsTemplate<TrainingScheduleStatus> trainingScheduleStatuses = _cache["Get", status] as ObjectsTemplate<TrainingScheduleStatus>;
|
|||
|
if (trainingScheduleStatuses != null)
|
|||
|
return trainingScheduleStatuses;
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
if(status==EnumStatus.Regardless)
|
|||
|
trainingScheduleStatuses = Service.Get();
|
|||
|
else
|
|||
|
trainingScheduleStatuses = Service.Get(status);
|
|||
|
}
|
|||
|
catch (ServiceException e)
|
|||
|
{
|
|||
|
throw new Exception(e.Message, e);
|
|||
|
}
|
|||
|
|
|||
|
#region Cache Footer
|
|||
|
|
|||
|
_cache.Add(trainingScheduleStatuses, "Get", status);
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
return trainingScheduleStatuses;
|
|||
|
}
|
|||
|
|
|||
|
public ID Save()
|
|||
|
{
|
|||
|
this.SetAuditTrailProperties();
|
|||
|
return Service.Save(this);
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
public void Delete(ID id)
|
|||
|
{
|
|||
|
Service.Delete(id);
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region ITrainingScheduleStatus Service
|
|||
|
public interface ITrainingScheduleStatusService
|
|||
|
{
|
|||
|
|
|||
|
void Delete(ID id);
|
|||
|
ID Save(TrainingScheduleStatus trainingScheduleStatus);
|
|||
|
ObjectsTemplate<TrainingScheduleStatus> Get();
|
|||
|
TrainingScheduleStatus Get(ID id);
|
|||
|
ObjectsTemplate<TrainingScheduleStatus> Get(EnumStatus status);
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
}
|