using System; using System.Collections.Generic; using System.Linq; namespace HRM.BO { public delegate void ListItemChanged(); public class LTASetup : BasicBaseObject { #region Constructor public LTASetup() { _fromMonth = DateTime.MinValue; _toMonth = DateTime.MinValue; _description = string.Empty; _createdDate = DateTime.MinValue; _createdBy = (0); _payrollTypeID = (0); } #endregion #region Properties #region FromMonth : datetime private DateTime _fromMonth; public DateTime FromMonth { get { return _fromMonth; } set { _fromMonth = value; } } #endregion #region ToMonth : datetime private DateTime _toMonth; public DateTime ToMonth { get { return _toMonth; } set { _toMonth = value; } } #endregion #region Description : string private string _description; public string Description { get { return _description; } set { _description = value; } } #endregion #region CreatedDate : datetime private DateTime _createdDate; public DateTime CreatedDate { get { return _createdDate; } set { _createdDate = value; } } #endregion #region CreatedBy : ID private int _createdBy; public int CreatedBy { get { return _createdBy; } set { _createdBy = value; } } #endregion #region PayrollTypeID : ID private int _payrollTypeID; public int PayrollTypeID { get { return _payrollTypeID; } set { _payrollTypeID = value; } } #endregion public List LTABasics { get; set; } public List LTABenefits { get; set; } //#region _lTABasics : List //private List _lTABasics; //public List LTABasics //{ // get // { // if (this.int != null && _lTABasics == null) // { // _lTABasics = LTASetup.Service.GetLTAbasic(this.ID); // } // return _lTABasics; // } // set // { // _lTABasics = value; // } //} //#endregion // #region _lTABasics : List // private List _lTABenefits; //public List LTABenefits //{ // get // { // if (this.int != null && _lTABenefits == null) // { // _lTABenefits = LTASetup.Service.GetLTAbenefit(this.ID); // } // return _lTABenefits; // } // set // { // _lTABenefits = value; // } //} //#endregion //#region Service Factory //internal static ILTASetupService Service //{ // get { return Services.Factory.CreateService(typeof(ILTASetupService)); } //} //#endregion #endregion //#region Functions //public static LTASetup Get(int id) //{ // LTASetup oLTASetup = null; // #region Cache Header // oLTASetup = (LTASetup)_cache["Get", id]; // if (oLTASetup != null) // return oLTASetup; // #endregion // oLTASetup = LTASetup.Service.Get(id); // #region Cache Footer // _cache.Add(oLTASetup, "Get", id); // #endregion // return oLTASetup; //} //public static List Get() //{ // #region Cache Header // List ltaSetups = _cache["Get"] as List; // if (ltaSetups != null) // return ltaSetups; // #endregion // try // { // ltaSetups = LTASetup.Service.Get(SystemInformation .CurrentSysInfo .PayrollTypeID .Integer ); // } // catch (ServiceException e) // { // throw new Exception(e.Message, e); // } // #region Cache Footer // _cache.Add(ltaSetups, "Get"); // #endregion // return ltaSetups; //} //public static List Get(DateTime fromDate, DateTime toDate) //{ // #region Cache Header // List ltaSetups = _cache["Get"] as List; // if (ltaSetups != null) // return ltaSetups; // #endregion // try // { // ltaSetups = LTASetup.Service.Get(fromDate, toDate,SystemInformation .CurrentSysInfo .PayrollTypeID .Integer ); // } // catch (ServiceException e) // { // throw new Exception(e.Message, e); // } // #region Cache Footer // _cache.Add(ltaSetups, "Get"); // #endregion // return ltaSetups; //} //public static List GetDistinctBenefit() //{ // #region Cache Header // List ltaSetups = _cache["Get"] as List; // if (ltaSetups != null) // return ltaSetups; // #endregion // try // { // ltaSetups = LTASetup.Service.GetDistinctBenefit(); // } // catch (ServiceException e) // { // throw new Exception(e.Message, e); // } // #region Cache Footer // _cache.Add(ltaSetups, "Get"); // #endregion // return ltaSetups; //} //public int Save() //{ // this.SetAuditTrailProperties(); // return LTASetup.Service.Save(this); //} //public void Delete(int id) //{ // LTASetup.Service.Delete(id); //} // #endregion } #region LTABasic public class LTABasic : BasicBaseObject { #region Constructor public LTABasic() { _lTASetupID = (0); _fromBasic = 0; _toBasic = 0; _increment = 0; _percent = 0; } #endregion #region Properties #region LTASetupID : ID private int _lTASetupID; public int LTASetupID { get { return _lTASetupID; } set { _lTASetupID = value; } } #endregion #region FromBasic : double private double _fromBasic; public double FromBasic { get { return _fromBasic; } set { _fromBasic = value; } } #endregion #region ToBasic : double private double _toBasic; public double ToBasic { get { return _toBasic; } set { _toBasic = value; } } #endregion #region Increment : double private double _increment; public double Increment { get { return _increment; } set { _increment = value; } } #endregion #region Percent : double private double _percent; public double Percent { get { return _percent; } set { _percent = value; } } #endregion #endregion public static double GetIncrementAmount(List ltbasics, double basicSalary) { double increment = 0; foreach (LTABasic item in ltbasics) { if (basicSalary > item.FromBasic && basicSalary < item.ToBasic) { increment = item.Increment; break; } } return increment; } } #endregion #region LTABenefit public class LTABenefit : BasicBaseObject { #region Constructor public LTABenefit() { _lTASetupID = (0); _itemID = 0; _flatIncrement = 0; _flatIncrementGF = 0; _previousBasicPercent = 0; _previousBasicIncrementPercent = 0; _gfPreviousBasicPercent = 0; _gfPreviousBasicIncrementPercent = 0; _isDependOnAttendance = false; } #endregion #region Properties #region LTASetupID : ID private int _lTASetupID; public int LTASetupID { get { return _lTASetupID; } set { _lTASetupID = value; } } #endregion #region ItemType private enumPayrollComponentType _itemType; public enumPayrollComponentType ItemType { get { return _itemType; } set { _itemType = value; } } #endregion #region ItemID : ID private int _itemID; public int ItemID { get { return _itemID; } set { _itemID = value; } } #endregion #region FlatIncrement : double private double _flatIncrement; public double FlatIncrement { get { return _flatIncrement; } set { _flatIncrement = value; } } #endregion #region FlatIncrementGF : double private double _flatIncrementGF; public double FlatIncrementGF { get { return _flatIncrementGF; } set { _flatIncrementGF = value; } } #endregion #region PreviousBasicPercent : double private double _previousBasicPercent; public double PreviousBasicPercent { get { return _previousBasicPercent; } set { _previousBasicPercent = value; } } #endregion #region PreviousBasicIncrementPercent : double private double _previousBasicIncrementPercent; public double PreviousBasicIncrementPercent { get { return _previousBasicIncrementPercent; } set { _previousBasicIncrementPercent = value; } } #endregion #region GFPreviousBasicPercent : double private double _gfPreviousBasicPercent; public double GFPreviousBasicPercent { get { return _gfPreviousBasicPercent; } set { _gfPreviousBasicPercent = value; } } #endregion #region GFPreviousBasicIncrementPercent : double private double _gfPreviousBasicIncrementPercent; public double GFPreviousBasicIncrementPercent { get { return _gfPreviousBasicIncrementPercent; } set { _gfPreviousBasicIncrementPercent = value; } } #endregion #region IsDependOnAttendance : bool private bool _isDependOnAttendance; public bool IsDependOnAttendance { get { return _isDependOnAttendance; } set { _isDependOnAttendance = value; } } #endregion #endregion } #endregion public interface ILTASetupService { LTASetup Get(int id); List GetWithPayrollType(int payrollTypeID); List GetDistinctBenefit(); List Get(DateTime fromDate, DateTime toDate, int payrollTypeID); List GetLTAbasic(int iD); List GetLTAbenefit(int iD); int Save(LTASetup item); void Delete(int id); } }