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

146 lines
3.5 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
{
#region TaxHeadAssignment
[Serializable]
public class TaxHeadAssignment : BasicBaseObject
{
#region Cache Store
private static Cache _cache = new Cache(typeof(TaxHeadAssignment));
#endregion
#region Constructor
public TaxHeadAssignment()
{
_description = string.Empty;
_deductPercent = 0;
}
#endregion
#region Properties
#region description : string
private string _description;
public string Description
{
get { return _description; }
set
{
base.OnPropertyChange<string>("description", _description, value);
_description = value;
}
}
#endregion
#region deductPercent : double
private double _deductPercent;
public double DeductPercent
{
get { return _deductPercent; }
set
{
base.OnPropertyChange<double>("deductPercent", _deductPercent, value);
_deductPercent = value;
}
}
#endregion
#region Service Factory ITaxHeadAssignmentService : ITaxHeadAssignmentService
internal static ITaxHeadAssignmentService Service
{
get { return Services.Factory.CreateService<ITaxHeadAssignmentService>(typeof(ITaxHeadAssignmentService)); }
}
#endregion
#endregion
#region Functions
public static TaxHeadAssignment Get(ID nID)
{
TaxHeadAssignment oTaxHeadAssignment = null;
#region Cache Header
oTaxHeadAssignment = (TaxHeadAssignment)_cache["Get", nID];
if (oTaxHeadAssignment != null)
return oTaxHeadAssignment;
#endregion
oTaxHeadAssignment = TaxHeadAssignment.Service.Get(nID);
#region Cache Footer
_cache.Add(oTaxHeadAssignment, "Get", nID);
#endregion
return oTaxHeadAssignment;
}
public static ObjectsTemplate<TaxHeadAssignment> Get()
{
#region Cache Header
ObjectsTemplate<TaxHeadAssignment> taxHeadAssignments = _cache["Get"] as ObjectsTemplate<TaxHeadAssignment>;
if (taxHeadAssignments != null)
return taxHeadAssignments;
#endregion
try
{
taxHeadAssignments = Service.Get();
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(taxHeadAssignments, "Get");
#endregion
return taxHeadAssignments;
}
public ID Save()
{
this.SetAuditTrailProperties();
return TaxHeadAssignment.Service.Save(this);
}
public void Delete()
{
TaxHeadAssignment.Service.Delete(ID);
}
#endregion
}
#endregion
#region ITaxHeadAssignment Service
public interface ITaxHeadAssignmentService
{
TaxHeadAssignment Get(ID id);
ObjectsTemplate<TaxHeadAssignment> Get();
ID Save(TaxHeadAssignment item);
void Delete(ID id);
}
#endregion
}