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 TaxChallan [Serializable] public class ITEmpHead : AuditTrailBase { #region Cache Store private static Cache _cache = new Cache(typeof(ITEmpHead)); #endregion #region Constructor public ITEmpHead() { _employeeID = null; _headID = EnumIncomeTaxHead.None; _startDate = DateTime.MinValue; _endDate = DateTime.MinValue; _houseRent = 0.0; _Employee = null; _taxparamID = null; _isArrear = 0; } #endregion #region Properties #region EmployeeID : ID private ID _employeeID; public ID EmployeeID { get { return _employeeID; } set { base.OnPropertyChange("EmployeeID", _employeeID, value); _employeeID = value; } } #endregion #region HeadID : ID private EnumIncomeTaxHead _headID; public EnumIncomeTaxHead HeadID { get { return _headID; } set { base.OnPropertyChange("HeadID",(short) _headID,(short) value); _headID = value; } } #endregion #region StartDate : DateTime private DateTime _startDate; public DateTime StartDate { get { return _startDate; } set { base.OnPropertyChange("StartDate", _startDate, value); _startDate = value; } } #endregion #region EndDate : DateTime private DateTime _endDate; public DateTime EndDate { get { return _endDate; } set { base.OnPropertyChange("EndDate", _endDate, value); _endDate = value; } } #endregion #region HouseRent : double private double _houseRent; public double HouseRent { get { return _houseRent; } set { base.OnPropertyChange("HouseRent", _houseRent, value); _houseRent = value; } } #endregion #region Employee : Employee private Employee _Employee = null; public Employee Employee { get { if (_employeeID.Integer > 0 && _Employee == null) { _Employee = new Employee(); _Employee = Employee.Get(_employeeID); } return this._Employee; } set { _Employee = value; } } #endregion #region TaxparamID : ID private ID _taxparamID; public ID TaxparamID { get { return _taxparamID; } set { base.OnPropertyChange("TaxparamID", _taxparamID, value); _taxparamID = value; } } #endregion #region IsArrear : int private int _isArrear; public int IsArrear { get { return _isArrear; } set { base.OnPropertyChange("IsArrear", _isArrear, value); _isArrear = value; } } #endregion #region Service Factory ITaxChallanService : ITaxChallanService internal static IITEmpHeadService Service { get { return Services.Factory.CreateService(typeof(IITEmpHeadService)); } } #endregion #endregion #region Functions public static ITEmpHead Get(ID nID) { ITEmpHead oITEmpHead = null; #region Cache Header oITEmpHead = (ITEmpHead)_cache["Get", nID]; if (oITEmpHead != null) return oITEmpHead; #endregion oITEmpHead = ITEmpHead.Service.Get(nID); #region Cache Footer _cache.Add(oITEmpHead, "Get", nID); #endregion return oITEmpHead; } public static ITEmpHead Get(int nEmpID, int taxparamID) { ITEmpHead oITEmpHead = null; #region Cache Header oITEmpHead = (ITEmpHead)_cache["Get", nEmpID, taxparamID]; if (oITEmpHead != null) return oITEmpHead; #endregion oITEmpHead = ITEmpHead.Service.Get(nEmpID, taxparamID); #region Cache Footer _cache.Add(oITEmpHead, "Get", nEmpID, taxparamID); #endregion return oITEmpHead; } public static ObjectsTemplate Get(int taxparamID) { #region Cache Header ObjectsTemplate iTEmpHeads = _cache["Get",taxparamID] as ObjectsTemplate; if (iTEmpHeads != null) return iTEmpHeads; #endregion try { iTEmpHeads = Service.Get(taxparamID); } catch (ServiceException e) { throw new Exception(e.Message, e); } #region Cache Footer _cache.Add(iTEmpHeads, "Get",taxparamID); #endregion return iTEmpHeads; } public static ObjectsTemplate Get(ObjectsTemplate ITEmpHeads, ID employeeId) { var ReturnItems = from item in ITEmpHeads where item.EmployeeID == employeeId select item; ObjectsTemplate Items = new ObjectsTemplate(); foreach (ITEmpHead oi in ReturnItems) { Items.Add(oi); } return Items; } public static ObjectsTemplate Get(ObjectsTemplate ITEmpHeads, ID employeeId,ID taxparamID) { var ReturnItems = from item in ITEmpHeads where item.EmployeeID == employeeId && item.TaxparamID==taxparamID select item; ObjectsTemplate Items = new ObjectsTemplate(); foreach (ITEmpHead oi in ReturnItems) { Items.Add(oi); } return Items; } public static ObjectsTemplate GetByTaxParamID(ObjectsTemplate ITEmpHeads, ID taxparamID) { var ReturnItems = from item in ITEmpHeads where item.TaxparamID == taxparamID select item; ObjectsTemplate Items = new ObjectsTemplate(); foreach (ITEmpHead oi in ReturnItems) { Items.Add(oi); } return Items; } public ID Save() { this.SetAuditTrailProperties(); return ITEmpHead.Service.Save(this); } public ID Save2() { this.SetAuditTrailProperties(); return ITEmpHead.Service.Save2(this); } public void Delete() { ITEmpHead.Service.Delete(ID); } #endregion } #endregion #region ITaxChallan Service public interface IITEmpHeadService { ITEmpHead Get(ID id); ITEmpHead Get(int nEmpID, int taxparamID); ObjectsTemplate Get(int taxparamID); ID Save(ITEmpHead item); ID Save2(ITEmpHead item); void Delete(ID id); } #endregion }