CEL_Payroll/Payroll.BO/TrainingBOs/TrainingCostHead.cs

168 lines
4.3 KiB
C#
Raw Permalink Normal View History

2024-09-17 14:30:13 +06:00
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 TrainingCostHead
[Serializable]
public class TrainingCostHead : BasicBaseObject
{
#region Cache Store
private static Cache _cache = new Cache(typeof(TrainingCostHead));
#endregion
#region Constructor
public TrainingCostHead()
{
_code = string.Empty;
_name = string.Empty;
}
#endregion
#region Properties
#region Property Code : string
private string _code;
public string Code
{
get
{
return _code;
}
set
{
_code = value;
base.SetObjectStateModified();
}
}
#endregion
#region Property Name : string
private string _name;
public string Name
{
get
{
return _name;
}
set
{
_name = value;
base.SetObjectStateModified();
}
}
#endregion
#endregion
#region Input validator
public string[] InputValidator()
{
string[] sErrorString = new string[2];
if (this.Code == "")
{
sErrorString[0] = "Code can not be empty";
sErrorString[1] = "Code";
return sErrorString;
}
if (this.Name == "")
{
sErrorString[0] = "Description can not be empty";
sErrorString[1] = "Description";
return sErrorString;
}
sErrorString = null;
return sErrorString;
}
#endregion
#region Functions
public static TrainingCostHead Get(int nTrainingCostHeadID)
{
TrainingCostHead oTrainingCostHead = null;
#region Cache Header
oTrainingCostHead = (TrainingCostHead)_cache["Get", nTrainingCostHeadID];
if (oTrainingCostHead != null)
return oTrainingCostHead;
#endregion
oTrainingCostHead = TrainingCostHead.Service.Get(ID.FromInteger(nTrainingCostHeadID));
#region Cache Footer
_cache.Add(oTrainingCostHead, "Get", nTrainingCostHeadID);
#endregion
return oTrainingCostHead;
}
public ID Save()
{
this.SetAuditTrailProperties();
return TrainingCostHead.Service.Save(this);
}
//public void Delete()
//{
// TrainingCostHead.Service.Delete(ID);
//}
public void Delete(ID id)
{
TrainingCostHead.Service.Delete(id);
}
#endregion
#region Collection Functions
public static ObjectsTemplate<TrainingCostHead> Get()
{
ObjectsTemplate<TrainingCostHead> oTrainingCostHeads = null;
#region Cache Header
oTrainingCostHeads = (ObjectsTemplate<TrainingCostHead>)_cache["Get"];
if (oTrainingCostHeads != null)
return oTrainingCostHeads;
#endregion
oTrainingCostHeads = TrainingCostHead.Service.Get();
#region Cache Footer
_cache.Add(oTrainingCostHeads, "Get");
#endregion
return oTrainingCostHeads;
}
public static ObjectsTemplate<TrainingCostHead> Get(EnumStatus status)
{
return Get();
}
#endregion
#region Service Factory
internal static ITrainingCostHeadService Service
{
get
{
return Services.Factory.CreateService<ITrainingCostHeadService>(typeof(ITrainingCostHeadService));
}
}
#endregion
}
#endregion
#region ITrainingCostHeadService Service
public interface ITrainingCostHeadService
{
TrainingCostHead Get(ID id);
ObjectsTemplate<TrainingCostHead> Get();
ID Save(TrainingCostHead oTrainingCostHead);
void Delete(ID id);
}
#endregion
}