using System; using System.Collections.Generic; using System.Linq; namespace HRM.BO { #region ADParameter public class ADParameter : AuditTrailBase { #region Constructor public ADParameter() { AllowDeductID = 0; IsForConfirmOnly = false; FlatAmount = 0; PercentOfBasic = 0; PercentOfGross = 0; MinAmount = 0; MaxAmount = 0; IsCurrentlyActive = false; TaxablePercentage = 100; IsTaxable = false; IsTaxProjection = false; IsDependsOnAttendance = false; IsDependsOnOTHour = false; IsWithException = false; Periodicity = EnumPeriodicity.Monthly; AllowOrDeductType = EnumAllowOrDeduct.Allowance; Gender = EnumGender.None; AllowanceDeduction = null; ISDEPENDSONSPECIALHOUR = false; EntitleType = EnumEntitleType.Grade; NotApplicable = new List(); Exception = new List(); ADParameterEmployees = new List(); } #endregion #region Internal Class public class ADParameterGrade : AuditTrailBase { #region Constructor public ADParameterGrade() { ADParameterID = 0; GradeID = 0; AllowDeductID = 0; //Garde = null; } #endregion #region Properties public int ADParameterID { get; set; } public int GradeID { get; set; } public int AllowDeductID { get; set; } //public Grade Garde { get; set; } #endregion } #endregion #region Internal Class ADParameterShift public class ADParameterShift : AuditTrailBase { #region Constructor public ADParameterShift() { ADParameterID = 0; ShiftID = 0; AllowDeductID = 0; Shift = null; } #endregion #region Properties public int ADParameterID { get; set; } public int ShiftID { get; set; } public int AllowDeductID { get; set; } public Shift Shift { get; set; } #endregion } #endregion #region Internal Class public class ADParameterDesignation : AuditTrailBase { #region Constructor public ADParameterDesignation() { ADParameterID = 0; AllowDeductID = 0; DesignationID = 0; FlatAmount = 0; PercentOfBasic = 0; PercentOfGross = 0; EffectMonth = PayrollGlobalFunctions.PayrollFirstDateOfMonth(DateTime.Today); ArrearToCalculationMonth = PayrollGlobalFunctions.PayrollFirstDateOfMonth(DateTime.Today); } #endregion #region Properties public int ADParameterDesignationID { get; set; } public int ADParameterID { get; set; } public int AllowDeductID { get; set; } public int AllowDeduct { get; set; } public int DesignationID { get; set; } public double FlatAmount { get; set; } public double PercentOfBasic { get; set; } public double PercentOfGross { get; set; } public DateTime EffectMonth { get; set; } public DateTime ArrearToCalculationMonth { get; set; } #endregion //#region employee : Employee //private Designation _designation; //public Designation Desingation //{ // get // { // if (_designation == null) // { // _designation = new Designation(); // _designation = Designation.Get(_designationID); // } // return this._designation; // } // set // { // _designation = value; // } //} //#endregion //#region Service Factory IADParameterEmployeeService : IADParameterEmployeeService //internal static IADParameterEmployeeService Service //{ // get { return Services.Factory.CreateService(typeof(IADParameterEmployeeService)); } //} //#endregion #endregion } #endregion #region Properties public int AllowDeductID { get; set; } public int PayrollTypeID { get; set; } public bool IsForConfirmOnly { get; set; } public bool IsFractionateApplicable { get; set; } public double FlatAmount { get; set; } public double PercentOfBasic { get; set; } public double PercentOfEarnedBasic { get; set; } public double PercentOfGross { get; set; } public double GFFlatAmount { get; set; } public double GFPercentOfBasic { get; set; } public double GFPercentOfGross { get; set; } public double MinAmount { get; set; } public double MaxAmount { get; set; } public bool IsCurrentlyActive { get; set; } public double TaxablePercentage { get; set; } public bool IsTaxable { get; set; } public bool IsFlatAmount { get; set; } public bool IsTaxProjection { get; set; } public bool IsDependsOnAttendance { get; set; } public bool ISDEPENDSONSPECIALHOUR { get; set; } public bool IsDependsOnOTHour { get; set; } public bool IsWithException { get; set; } public EnumPeriodicity Periodicity { get; set; } public EnumEntitleType EntitleType { get; set; } public EnumAllowOrDeduct AllowOrDeductType { get; set; } public EnumGender Gender { get; set; } public AllowanceDeduction AllowanceDeduction { get; set; } public List Exception { get; set; } public List NotApplicable { get; set; } public List ADParameterGrades { get; set; } public List ADParameterDesignations { get; set; } public List DesignationChanges { get; set; } public List ADParameterEmployees { get; set; } public List ADParameterShifts { get; set; } //private List _designationchanges = null; //public List designationchanges //{ // get // { // if (_designationchanges == null) _designationchanges = new objectstemplate(); // return _designationchanges; // } // set // { // _designationchanges = value; // } //} //#region allowanceDeduction : AllowanceDeduction //private AllowanceDeduction _allowanceDeduction; //public AllowanceDeduction AllowanceDeduction //{ // get // { // if (_allowDeductID.Integer > 0 && _allowanceDeduction == null) // { // _allowanceDeduction = new AllowanceDeduction(); // _allowanceDeduction = AllowanceDeduction.Get(_allowDeductID); // } // return this._allowanceDeduction; // } // set // { // _allowanceDeduction = value; // } //} //#endregion //#region ADParamEmployee : ADParameterEmployee //private List _ADParameterEmployee = null; //public List ADParameterEmployees //{ // get // { // if (_ADParameterEmployee == null && !this.ID.IsUnassigned && this.ID.Integer > 0) // { // _ADParameterEmployee = ADParameterEmployee.GetbyParameter(this.ID); // } // return this._ADParameterEmployee; // } // set // { // _ADParameterEmployee = value; // } //} //#endregion //#region Exception : ADParameterEmployee //private List _Exception = null; //public List Exception //{ // get // { // if (_Exception == null && !this.ID.IsUnassigned && this.ID.Integer > 0) // { // _Exception = ADParameterEmployee.GetbyParameter(this.ID,EnumADEmpType.Exception); // } // return this._Exception; // } // set // { // this._Exception = value; // } //} //#endregion //#region NotApplicable : ADParameterEmployee //private List _NotApplicable = null; //public List NotApplicable //{ // get // { // if (_NotApplicable == null && !this.ID.IsUnassigned && this.ID.Integer > 0) // { // _NotApplicable = ADParameterEmployee.GetbyParameter(this.ID, EnumADEmpType.NotApplicable); // } // return this._NotApplicable; // } // set // { // this._NotApplicable = value; // } //} //#endregion //#region ADParamGrade : ADParameterGrade //private List _ADParameterGrades = null; //public List ADParameterGrades //{ // get // { // if (_ADParameterGrades == null && !this.ID.IsUnassigned && this.ID.Integer > 0) // { // _ADParameterGrades = ADParameter.GetGrades(this.ID); // } // return this._ADParameterGrades; // } // set // { // _ADParameterGrades = value; // } //} //#endregion //#region ADParamGrade : ADParameterGrade //private List _ADParameterDesignations = null; //public List ADParameterDesignations //{ // get // { // if (_ADParameterDesignations == null && !this.ID.IsUnassigned && this.ID.Integer > 0) // { // _ADParameterDesignations = ADParameter.GetDesignations(this.ID); // } // return this._ADParameterDesignations; // } // set // { // _ADParameterDesignations = value; // } //} //#endregion //#region ADParamGrade : ADParameterGrade //private List _designationchanges = null; //public List DesignationChanges //{ // get // { // if (_designationchanges == null) _designationchanges = new List(); // return _designationchanges; // } // set // { // _designationchanges = value; // } //} //#endregion //#region Service Factory IADParameterService : IADParameterService //internal static IADParameterService Service //{ // get { return Services.Factory.CreateService(typeof(IADParameterService)); } //} //#endregion #endregion // #region Functions // public static ADParameter Get(ID nID) // { // ADParameter oADParameter = null; // #region Cache Header // oADParameter = (ADParameter)_cache["Get", nID]; // if (oADParameter != null) // return oADParameter; // #endregion // oADParameter = ADParameter.Service.Get(nID,SystemInformation .CurrentSysInfo .PayrollTypeID.Integer); // #region Cache Footer // _cache.Add(oADParameter, "Get", nID); // #endregion // return oADParameter; // } // public static List GetApplicableParameters(Employee employee, ID graId, List parameters) // { // List applicableParams = parameters.FindAll(delegate(ADParameter param) { return IsApplicable(param, graId, employee) ;}); // return applicab leParams; // }mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm,,,,,,,,,,,,,,,,,,,,,,,,,,,,,kkkkkkkkkkkkkkkkkkkkkkkkk]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]yg-4e nnnnn 330o // //public static ADParameter GetApplicableParameter(Employee employee, // // ID graId, List parameters) // //{ // // foreach (ADParameter item in parameters) // // { // // if (IsApplicable(item, graId, employee) == true) // // return item; // // } // // return null; // //} // public static ADParameter GetApplicableParameter(Employee employee, ID graId, List parameters, ID allowdeductID) // { // foreach (ADParameter item in parameters) // { // if (item.AllowDeductID == allowdeductID) // { // if (IsApplicable(item, graId, employee) == true) // return item; // } // } // return null; // } // private static bool IsApplicable(ADParameter param, ID graid, Employee employee) // { // bool isApplicable = false; // foreach (ADParameterGrade adgrade in param.ADParameterGrades) // { // if (adgrade.GradeID.Integer == graid.Integer) // { // isApplicable = true; // } // } // if (!isApplicable) return false; // if (param.Gender != EnumGender.None // && param.Gender != employee.Gender) // { // return false; // } // if (param.IsForConfirmOnly && !employee.IsConfirmed) // { // return false; // } // return true; // } public double CalculateAmount(Employee oEmp) { double amount = 0; if (this.PercentOfBasic > 0) { amount = this.FlatAmount + (this.PercentOfBasic * oEmp.BasicSalary) / 100; } else if (this.PercentOfGross > 0) { amount = this.FlatAmount + (this.PercentOfGross * oEmp.GrossSalary) / 100; } else { amount = this.FlatAmount; } return amount; } // public static List Get(EnumStatus status) // { // #region Cache Header // List aDParameters = _cache["Get"] as List; // if (aDParameters != null) // return aDParameters; // #endregion // try // { // aDParameters = Service.Get(status,SystemInformation .CurrentSysInfo.PayrollTypeID .Integer ); // } // catch (ServiceException e) // { // throw new Exception(e.Message, e); // } // #region Cache Footer // _cache.Add(aDParameters, "Get",status); // #endregion // return aDParameters; // } // public static List Get(EnumStatus status, EnumAllowOrDeduct type) // { // #region Cache Header // List aDParameters = _cache["Get", type] as List; // if (aDParameters != null) // return aDParameters; // #endregion // try // { // aDParameters = Service.Get(status, type, SystemInformation.CurrentSysInfo.PayrollTypeID.Integer); // } // catch (ServiceException e) // { // throw new Exception(e.Message, e); // } // #region Cache Footer // _cache.Add(aDParameters, "Get", status, type); // #endregion // return aDParameters; // } // public static List GetDistinct(EnumStatus status, EnumAllowOrDeduct type) // { // #region Cache Header // List aDParameters = _cache["Get", type] as List; // if (aDParameters != null) // return aDParameters; // #endregion // try // { // aDParameters = Service.Get(status, type, SystemInformation.CurrentSysInfo.PayrollTypeID.Integer); // } // catch (ServiceException e) // { // throw new Exception(e.Message, e); // } // #region Cache Footer // _cache.Add(aDParameters, "Get", status, type); // #endregion // return aDParameters; // } // public static List Get(EnumStatus status, ID nAllowDeducID) // { // #region Cache Header // List aDParameters = _cache["Get", nAllowDeducID] as List; // if (aDParameters != null) // return aDParameters; // #endregion // try // { // aDParameters = Service.Get(status, nAllowDeducID); // } // catch (ServiceException e) // { // throw new Exception(e.Message, e); // } // #region Cache Footer // _cache.Add(aDParameters, "Get", status, nAllowDeducID); // #endregion // return aDParameters; // } // public static List Get(ID gradeID, EnumEntitleType nADEmpType, EnumAllowOrDeduct nType) // { // #region Cache Header // List aDParameters = _cache["Get", gradeID, nADEmpType, nType] as List; // if (aDParameters != null) // return aDParameters; // #endregion // try // { // aDParameters = Service.Get(gradeID, nADEmpType, nType,SystemInformation.CurrentSysInfo.PayrollTypeID .Integer); // } // catch (ServiceException e) // { // throw new Exception(e.Message, e); // } // #region Cache Footer // _cache.Add(aDParameters, "Get", gradeID, nADEmpType, nType); // #endregion // return aDParameters; // } // public static List GetGrades(ID adID) // { // #region Cache Header // List aDParameterGrades = _cache["Get", adID] as List; // if (aDParameterGrades != null) // return aDParameterGrades; // #endregion // try // { // aDParameterGrades = Service.GetGrades(adID); // } // catch (ServiceException e) // { // throw new Exception(e.Message, e); // } // #region Cache Footer // _cache.Add(aDParameterGrades, "Get", adID); // #endregion // return aDParameterGrades; // } // public static List GetDesignations(ID adID) // { // #region Cache Header // List aDParameterGrades = _cache["Get", adID] as List; // if (aDParameterGrades != null) // return aDParameterGrades; // #endregion // try // { // aDParameterGrades = Service.GetDesignaitons(adID); // } // catch (ServiceException e) // { // throw new Exception(e.Message, e); // } // #region Cache Footer // _cache.Add(aDParameterGrades, "Get", adID); // #endregion // return aDParameterGrades; // } // public ID Save() // { // base.SetAuditTrailProperties(); // return ADParameter.Service.Save(this); // } // public void Delete() // { // ADParameter.Service.Delete(ID); // } // public void ChangeStatus(EnumStatus enumStatus) // { // ADParameter.Service.ChangeStatus(this.ID,enumStatus); // } // private List GetParametes(Employee employee, // ID gradeId, List allparameters) // { // List parameters = new List(); // return parameters; // } // public static void ApplicableParameters(Employee emlpoyee, // SalaryMonthly salary, List allAdparameters) // { // foreach (EmployeeGradeSalary gs in salary.GradeSalaries) // { // List lparameter = ADParameter.GetApplicableParameters(emlpoyee, gs.GradeID, allAdparameters); // gs.ADParameters = new List(); // foreach (ADParameter item in lparameter) // gs.ADParameters.Add(item); // } // foreach (EmployeeGradeSalary gs in salary.ArrearGradeSalaries) // { // List alparameter = ADParameter.GetApplicableParameters(emlpoyee, gs.GradeID, allAdparameters); // gs.ADParameters = new List(); // foreach (ADParameter item in alparameter) // gs.ADParameters.Add(item); // } // foreach (EmployeeGradeSalary gs in salary.ArrearPaidGradeSalaries) // { // List aplparameter = ADParameter.GetApplicableParameters(emlpoyee, gs.GradeID, allAdparameters); // gs.ADParameters = new List(); // foreach (ADParameter item in aplparameter) // gs.ADParameters.Add(item); // } // } //#endregion } #region IADParameter Service public interface IADParameterService { ADParameter Get(int id, int payrollTypeID); List Get(int? gradeID, EnumEntitleType nADEmpType, EnumAllowOrDeduct nType, int payrolltypeid); List GetGrades(int adparameterid); List GetUsedGrades(int allowancedeductid); List GetDesignaitons(int adID); List GetWithPayrollType(EnumStatus status, int payrollTypeID); List Get(EnumStatus status, EnumAllowOrDeduct nType, int parollTypeID); List GetDistinct(EnumStatus status, EnumAllowOrDeduct type, int payrollTypeID); int Save(ADParameter item); void Delete(int id); void ChangeStatus(int id, EnumStatus enumStatus); List Get(int gradeID, EnumEntitleType nADEmpType, EnumAllowOrDeduct nType, int payrollTypeID); List GetWithDetail(EnumStatus status, int payrollTypeID); double GetGradeDefinedAmount(Employee employee, double basicSalary, double grossSalary, EmployeeGradeSalary oEmpGradeSalary, ADParameter param); } #endregion }