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 { public enum EnumSalaryComponent { Basic = -101, Allowance = 2, Bonus=3 } [Serializable] public class SalaryComponent : BasicBaseObject { private string _description = string.Empty; private ID _internalID = null; private EnumSalaryComponent _Type = EnumSalaryComponent.Basic; private static ObjectsTemplate _Components = null; private static ObjectsTemplate _Benefits = null; public SalaryComponent() { } public ID ObjectID { get { return _internalID; } set { _internalID = value; } } public string Description { get { return _description; } set { _description = value; } } public EnumSalaryComponent Type { get { return _Type; } set { _Type = value; } } public static ObjectsTemplate Benefits() { SalaryComponent component = null; ObjectsTemplate _Allowances = null; if (_Benefits == null || _Benefits.Count == 0) { _Benefits = new ObjectsTemplate(); component = new SalaryComponent(); component.ObjectID = ID.FromInteger(-101); component.Description = "Basic Salary"; component.Type = EnumSalaryComponent.Basic; _Benefits.Add(component); _Allowances = AllowanceDeduction.GetAllowance(EnumStatus.Active); foreach (AllowanceDeduction allowance in _Allowances) { component = new SalaryComponent(); component.ObjectID = allowance.ID; component.Description = allowance.Name; component.Type = EnumSalaryComponent.Allowance; _Benefits.Add(component); } } return _Benefits; } public static ObjectsTemplate Components() { SalaryComponent component = null; ObjectsTemplate _Allowances = null; ObjectsTemplate _Deductions = null; if(_Components==null || _Components.Count==0) { _Components = new ObjectsTemplate(); component = new SalaryComponent(); component.ObjectID = ID.FromInteger(-101); component.Description = "Basic Salary"; component.Type = EnumSalaryComponent.Basic; _Components.Add(component); _Allowances = AllowanceDeduction.GetAllowance(EnumStatus.Active); foreach (AllowanceDeduction allowance in _Allowances) { component = new SalaryComponent(); component.ObjectID = allowance.ID; component.Description = allowance.Name; component.Type = EnumSalaryComponent.Allowance; _Components.Add(component); } _Deductions = AllowanceDeduction.GetDeduction(EnumStatus.Active); foreach (AllowanceDeduction deduction in _Deductions) { component = new SalaryComponent(); component.ObjectID = deduction.ID; component.Description = deduction.Name; //component.Type = EnumSalaryComponent.Deduction; _Components.Add(component); } } return _Components; } } }