CEL_Payroll/Payroll.BO/Attendence/ShiftTermDetail.cs

190 lines
4.8 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 ShiftTermDetail
[Serializable]
public class ShiftTermDetail : ObjectTemplate
{
#region Cache Store
private static Cache _cache = new Cache(typeof(ShiftTermDetail));
#endregion
#region Constructor
public ShiftTermDetail()
{
_shiftTermID = null;
_hour = 0;
_sequenceNo = 0;
_termID = null;
}
#endregion
#region Properties
#region shiftTermID : ID
private ID _shiftTermID;
public ID ShiftTermID
{
get { return _shiftTermID; }
set
{
base.OnPropertyChange<ID>("shiftTermID", _shiftTermID, value);
_shiftTermID = value;
}
}
#endregion
#region hour : double
private double _hour;
public double Hour
{
get { return _hour; }
set
{
base.OnPropertyChange<double>("hour", _hour, value);
_hour = value;
}
}
#endregion
#region sequenceNo : int
private int _sequenceNo;
public int SequenceNo
{
get { return _sequenceNo; }
set
{
base.OnPropertyChange<int>("sequenceNo", _sequenceNo, value);
_sequenceNo = value;
}
}
#endregion
#region TermID : ID
private ID _termID;
public ID TermID
{
get { return _termID; }
set
{
base.OnPropertyChange<ID>("TermID", _termID, value);
_termID = value;
}
}
#endregion
#region Service Factory IShiftTermDetailService : IShiftTermDetailService
internal static IShiftTermDetailService Service
{
get { return Services.Factory.CreateService<IShiftTermDetailService>(typeof(IShiftTermDetailService)); }
}
#endregion
#endregion
#region Functions
public static ShiftTermDetail Get(ID nID)
{
ShiftTermDetail oShiftTermDetail = null;
#region Cache Header
oShiftTermDetail = (ShiftTermDetail)_cache["Get", nID];
if (oShiftTermDetail != null)
return oShiftTermDetail;
#endregion
oShiftTermDetail = ShiftTermDetail.Service.Get(nID);
#region Cache Footer
_cache.Add(oShiftTermDetail, "Get", nID);
#endregion
return oShiftTermDetail;
}
public static ObjectsTemplate<ShiftTermDetail> Get()
{
#region Cache Header
ObjectsTemplate<ShiftTermDetail> shiftTermDetails = _cache["Get"] as ObjectsTemplate<ShiftTermDetail>;
if (shiftTermDetails != null)
return shiftTermDetails;
#endregion
try
{
shiftTermDetails = Service.Get();
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(shiftTermDetails, "Get");
#endregion
return shiftTermDetails;
}
public static ObjectsTemplate<ShiftTermDetail> GetByShiftTermID(ID nShiftTermID)
{
#region Cache Header
ObjectsTemplate<ShiftTermDetail> shiftTermDetails = _cache["GetByShiftTermID", nShiftTermID] as ObjectsTemplate<ShiftTermDetail>;
if (shiftTermDetails != null)
return shiftTermDetails;
#endregion
try
{
shiftTermDetails = Service.GetByShiftTermID(nShiftTermID);
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(shiftTermDetails, "GetByShiftTermID", nShiftTermID);
#endregion
return shiftTermDetails;
}
public ID Save()
{
return ShiftTermDetail.Service.Save(this);
}
public void Delete()
{
ShiftTermDetail.Service.Delete(ID);
}
#endregion
}
#endregion
#region IShiftTermDetail Service
public interface IShiftTermDetailService
{
ShiftTermDetail Get(ID id);
ObjectsTemplate<ShiftTermDetail> GetByShiftTermID(ID nShiftTermID);
ObjectsTemplate<ShiftTermDetail> Get();
ID Save(ShiftTermDetail item);
void Delete(ID id);
}
#endregion
}