CEL_Payroll/Payroll.BO/TrainingBOs/TrainingDepartment.cs
2024-09-17 14:30:13 +06:00

185 lines
4.9 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ease.CoreV35.Caching;
using Ease.CoreV35.Model;
namespace Payroll.BO
{
#region class TrainingDepartment
[Serializable]
public class TrainingDepartment : AuditTrailBase
{
#region Cache Store
private static Cache _cache = new Cache(typeof(TrainingDepartment));
#endregion
#region Constructor
public TrainingDepartment()
{
_trainingNeedAnalysisID = null;
_departmentID = null;
_remarks = String.Empty;
}
#endregion
#region Properties
#region Property TrainingNeedAnalysisID : ID
private ID _trainingNeedAnalysisID;
public ID TrainingNeedAnalysisID
{
get
{
return _trainingNeedAnalysisID;
}
set
{
_trainingNeedAnalysisID = value;
base.SetObjectStateModified();
}
}
#endregion
#region Property DepartmentID : ID
private ID _departmentID;
public ID DepartmentID
{
get
{
return _departmentID;
}
set
{
_departmentID = value;
base.SetObjectStateModified();
}
}
#endregion
#region Property Remarks : string
private string _remarks;
public string Remarks
{
get
{
return _remarks;
}
set
{
_remarks = value;
}
}
#endregion
#endregion
#region Functions
public static TrainingDepartment Get(int nTrainingDepartmentID)
{
TrainingDepartment onTrainingDepartment = null;
#region Cache Header
onTrainingDepartment = (TrainingDepartment)_cache["Get", nTrainingDepartmentID];
if (onTrainingDepartment != null)
return onTrainingDepartment;
#endregion
onTrainingDepartment = Service.Get(ID.FromInteger(nTrainingDepartmentID));
#region Cache Footer
_cache.Add(onTrainingDepartment, "Get", nTrainingDepartmentID);
#endregion
return onTrainingDepartment;
}
public ID Save()
{
this.SetAuditTrailProperties();
return Service.Save(this);
}
public static bool DoesTrainingDepartmentExists(ID nTrainingDepartmentID)
{
return Service.DoesTrainingDepartmentExists(nTrainingDepartmentID);
}
public void Delete()
{
Service.Delete(ID);
}
#endregion
#region Collection Functions
public static ObjectsTemplate<TrainingDepartment> Get()
{
ObjectsTemplate<TrainingDepartment> oTrainingDepartments = null;
#region Cache Header
oTrainingDepartments = (ObjectsTemplate<TrainingDepartment>)_cache["Get"];
if (oTrainingDepartments != null)
return oTrainingDepartments;
#endregion
oTrainingDepartments = Service.Get();
#region Cache Footer
_cache.Add(oTrainingDepartments, "Get");
#endregion
return oTrainingDepartments;
}
public static ObjectsTemplate<TrainingDepartment> GetByTrainingNeedAnalysisID(ID trainingNeedAnalysisID)
{
ObjectsTemplate<TrainingDepartment> oTrainingDepartments = null;
#region Cache Header
oTrainingDepartments = (ObjectsTemplate<TrainingDepartment>)_cache["Get"];
if (oTrainingDepartments != null)
return oTrainingDepartments;
#endregion
oTrainingDepartments = Service.GetByTrainingNeedAnalysisID(trainingNeedAnalysisID);
#region Cache Footer
_cache.Add(oTrainingDepartments, "Get");
#endregion
return oTrainingDepartments;
}
#endregion
#region Service Factory
internal static ITrainingDepartmentService Service
{
get
{
return Services.Factory.CreateService<ITrainingDepartmentService>(typeof(ITrainingDepartmentService));
}
}
#endregion
}
#endregion
#region ITrainingDepartment Service
public interface ITrainingDepartmentService
{
TrainingDepartment Get(ID nTrainingDepartmentID);
ObjectsTemplate<TrainingDepartment> Get();
ID Save(TrainingDepartment oTrainingDepartment);
void Delete(ID id);
bool DoesTrainingDepartmentExists(ID nTrainingDepartmentID);
ObjectsTemplate<TrainingDepartment> GetByTrainingNeedAnalysisID(ID trainingNeedAnalysisID);
}
#endregion
}