197 lines
4.8 KiB
C#
197 lines
4.8 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 TaxAdjustment
|
|||
|
|
|||
|
[Serializable]
|
|||
|
public class TaxAdjustment : BasicBaseObject
|
|||
|
{
|
|||
|
#region Cache Store
|
|||
|
|
|||
|
private static Cache _cache = new Cache(typeof(TaxAdjustment));
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Constructor
|
|||
|
#region Input validator
|
|||
|
public string[] InputValidator()
|
|||
|
{
|
|||
|
string[] sErrorString = new string[2];
|
|||
|
if (this.Name == "")
|
|||
|
{
|
|||
|
sErrorString[0] = "Name cannot be empty";
|
|||
|
sErrorString[1] = "Name";
|
|||
|
return sErrorString;
|
|||
|
}
|
|||
|
if (this.TaxType== EnumIncomeTaxSide.Tax_Info_Item)
|
|||
|
{
|
|||
|
sErrorString[0] = "Select Tax type";
|
|||
|
sErrorString[1] = "Tax Type";
|
|||
|
return sErrorString;
|
|||
|
}
|
|||
|
|
|||
|
sErrorString = null;
|
|||
|
return sErrorString;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
public TaxAdjustment()
|
|||
|
{
|
|||
|
_name = string.Empty;
|
|||
|
_taxType = EnumIncomeTaxSide.Tax_Info_Item;
|
|||
|
_status = EnumStatus.Active;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Properties
|
|||
|
|
|||
|
#region name : string
|
|||
|
|
|||
|
private string _name;
|
|||
|
public string Name
|
|||
|
{
|
|||
|
get { return _name; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<string>("name", _name, value);
|
|||
|
_name = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region taxType : EnumIncomeTaxGroupType
|
|||
|
|
|||
|
private EnumIncomeTaxSide _taxType;
|
|||
|
public EnumIncomeTaxSide TaxType
|
|||
|
{
|
|||
|
get { return _taxType; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<short>("taxType", (short)_taxType, (short)value);
|
|||
|
_taxType = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Service Factory ITaxAdjustmentService : ITaxAdjustmentService
|
|||
|
|
|||
|
internal static ITaxAdjustmentService Service
|
|||
|
{
|
|||
|
get { return Services.Factory.CreateService<ITaxAdjustmentService>(typeof(ITaxAdjustmentService)); }
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Functions
|
|||
|
|
|||
|
public static TaxAdjustment Get(ID nID)
|
|||
|
{
|
|||
|
TaxAdjustment oTaxAdjustment = null;
|
|||
|
#region Cache Header
|
|||
|
oTaxAdjustment = (TaxAdjustment)_cache["Get", nID];
|
|||
|
if (oTaxAdjustment != null)
|
|||
|
return oTaxAdjustment;
|
|||
|
#endregion
|
|||
|
oTaxAdjustment = TaxAdjustment.Service.Get(nID);
|
|||
|
#region Cache Footer
|
|||
|
_cache.Add(oTaxAdjustment, "Get", nID);
|
|||
|
#endregion
|
|||
|
return oTaxAdjustment;
|
|||
|
}
|
|||
|
|
|||
|
public static ObjectsTemplate<TaxAdjustment> Get()
|
|||
|
{
|
|||
|
#region Cache Header
|
|||
|
|
|||
|
ObjectsTemplate<TaxAdjustment> taxAdjustments = _cache["Get"] as ObjectsTemplate<TaxAdjustment>;
|
|||
|
if (taxAdjustments != null)
|
|||
|
return taxAdjustments;
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
taxAdjustments = Service.Get();
|
|||
|
}
|
|||
|
catch (ServiceException e)
|
|||
|
{
|
|||
|
throw new Exception(e.Message, e);
|
|||
|
}
|
|||
|
|
|||
|
#region Cache Footer
|
|||
|
|
|||
|
_cache.Add(taxAdjustments, "Get");
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
return taxAdjustments;
|
|||
|
}
|
|||
|
|
|||
|
public static ObjectsTemplate<TaxAdjustment> Get(EnumStatus status)
|
|||
|
{
|
|||
|
#region Cache Header
|
|||
|
|
|||
|
ObjectsTemplate<TaxAdjustment> TaxAdjustments = _cache["Get", status] as ObjectsTemplate<TaxAdjustment>;
|
|||
|
if (TaxAdjustments != null)
|
|||
|
return TaxAdjustments;
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
TaxAdjustments = Service.Get(status);
|
|||
|
}
|
|||
|
catch (ServiceException e)
|
|||
|
{
|
|||
|
throw new Exception(e.Message, e);
|
|||
|
}
|
|||
|
|
|||
|
#region Cache Footer
|
|||
|
|
|||
|
_cache.Add(TaxAdjustments, "Get", status);
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
return TaxAdjustments;
|
|||
|
}
|
|||
|
|
|||
|
public ID Save()
|
|||
|
{
|
|||
|
this.SetAuditTrailProperties();
|
|||
|
return TaxAdjustment.Service.Save(this);
|
|||
|
}
|
|||
|
public void Delete(ID ID)
|
|||
|
{
|
|||
|
TaxAdjustment.Service.Delete(ID);
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region ITaxAdjustment Service
|
|||
|
|
|||
|
public interface ITaxAdjustmentService
|
|||
|
{
|
|||
|
TaxAdjustment Get(ID id);
|
|||
|
ObjectsTemplate<TaxAdjustment> Get();
|
|||
|
ObjectsTemplate<TaxAdjustment> Get(EnumStatus status);
|
|||
|
ID Save(TaxAdjustment item);
|
|||
|
void Delete(ID id);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|