CEL_Payroll/Payroll.BO/SAPLookUp/CRGDepartmentLookup.cs

161 lines
3.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;
using Ease.CoreV35.Model;
using Ease.CoreV35.Caching;
using System.Data.Linq.Mapping;
namespace Payroll.BO
{
#region CRGDepartmentLookup
[Serializable]
public class CRGDepartmentLookup : AuditTrailBase
{
#region Cache Store
private static Cache _cache = new Cache(typeof(CRGDepartmentLookup));
#endregion
#region Constructor
public CRGDepartmentLookup()
{
_CrgID = ID.FromInteger(0);
_DepartmentID = ID.FromInteger(0);
}
#endregion
#region Properties
#region CrgID : ID
private ID _CrgID;
public ID CrgID
{
get { return _CrgID; }
set
{
base.OnPropertyChange<ID>("CrgID", _CrgID, value);
_CrgID = value;
}
}
#endregion
#region DepartmentID : ID
private ID _DepartmentID;
public ID DepartmentID
{
get { return _DepartmentID; }
set
{
base.OnPropertyChange<ID>("DepartmentID", _DepartmentID, value);
_DepartmentID = value;
}
}
#endregion
#region Service Factory ICompanyService : ICompanyService
internal static ICRGDepartmentLookupService Service
{
get { return Services.Factory.CreateService<ICRGDepartmentLookupService>(typeof(ICRGDepartmentLookupService)); }
}
#endregion
#endregion
#region Functions
public static CRGDepartmentLookup Get(ID nID)
{
CRGDepartmentLookup oCRGDepartmentLookup = null;
#region Cache Header
oCRGDepartmentLookup = (CRGDepartmentLookup)_cache["Get", nID];
if (oCRGDepartmentLookup != null)
return oCRGDepartmentLookup;
#endregion
oCRGDepartmentLookup = CRGDepartmentLookup.Service.Get(nID);
#region Cache Footer
_cache.Add(oCRGDepartmentLookup, "Get", nID);
#endregion
return oCRGDepartmentLookup;
}
public static ObjectsTemplate<CRGDepartmentLookup> Get()
{
#region Cache Header
ObjectsTemplate<CRGDepartmentLookup> oCDlookups = _cache["Get"] as ObjectsTemplate<CRGDepartmentLookup>;
if (oCDlookups != null)
return oCDlookups;
#endregion
try
{
oCDlookups = Service.Get();
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(oCDlookups, "Get");
#endregion
return oCDlookups;
}
public ID Save()
{
base.SetAuditTrailProperties();
return CRGDepartmentLookup.Service.Save(this);
}
public void Save(ObjectsTemplate<CRGDepartmentLookup> oCDLookups)
{
foreach (CRGDepartmentLookup item in oCDLookups)
{
item.SetAuditTrailProperties();
}
CRGDepartmentLookup.Service.Save(oCDLookups);
}
public void Delete(ID id)
{
CRGDepartmentLookup.Service.Delete(id);
}
#endregion
}
#endregion
#region ICompany Service
public interface ICRGDepartmentLookupService
{
CRGDepartmentLookup Get(ID id);
ID Save(CRGDepartmentLookup item);
void Delete(ID id);
ObjectsTemplate<CRGDepartmentLookup> Get();
void Save(ObjectsTemplate<CRGDepartmentLookup> oCDLookups);
}
#endregion
}