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

139 lines
3.2 KiB
C#

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
{
[Serializable]
public class SAPDesignationCode : AuditTrailBase
{
#region Cache Store
private static Cache _cache = new Cache(typeof(SAPDesignationCode));
#endregion
#region Constructor
public SAPDesignationCode()
{
_sapCode = string.Empty;
_designationID = ID.FromInteger(0);
}
#endregion
#region Properties
#region DesignationID : ID
private ID _designationID;
public ID DesignationID
{
get { return _designationID; }
set { _designationID = value; }
}
#endregion
#region code : string
private string _sapCode;
public string SAPCode
{
get { return _sapCode; }
set { _sapCode = value; }
}
#endregion
#region Service Factory ISAPDesignationCodeService : ISAPDesignationCodeService
internal static ISAPDesignationCodeService Service
{
get { return Services.Factory.CreateService<ISAPDesignationCodeService>(typeof(ISAPDesignationCodeService)); }
}
#endregion
#endregion
#region Functions
public static ObjectsTemplate<SAPDesignationCode> Get(ID designationID)
{
#region Cache Header
ObjectsTemplate<SAPDesignationCode> sapDesignationCodes = _cache["Get", designationID] as ObjectsTemplate<SAPDesignationCode>;
if (sapDesignationCodes != null)
return sapDesignationCodes;
#endregion
try
{
sapDesignationCodes = Service.Get(designationID);
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(sapDesignationCodes, "Get", designationID);
#endregion
return sapDesignationCodes;
}
public ID Save()
{
this.SetAuditTrailProperties();
return Service.Save(this);
}
public static void Delete(ID id)
{
Service.Delete(id);
}
public static bool SAPCodeExists(string sapCode, out string sDesignationName)
{
try
{
string desigName;
bool isExist;
isExist = Service.SAPCodeExists(sapCode, out desigName);
sDesignationName = desigName;
return isExist;
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
}
#endregion
}
#region IDesignation Service
public interface ISAPDesignationCodeService
{
ObjectsTemplate<SAPDesignationCode> Get(ID designationID);
ID Save(SAPDesignationCode sAPDesignationCode);
void Delete(ID id);
bool SAPCodeExists(string sapCode, out string desigName);
}
#endregion
}