using Ease.Core.Model; using System; using System.Collections.Generic; using System.Data; namespace HRM.BO { #region class BudgetMaster public class BudgetMaster : AuditTrailBase { #region Constructor public BudgetMaster() { _basedOn = EnumBasedOnPercent.None; _effectMonth = DateTime.MinValue; _name = string.Empty; _overAllPercentage = 0.0; _toDate = DateTime.MinValue; Individualchanges = null; _payrollTypeID = 0; } #endregion #region Properties #region BasedOn : EnumBasedOnPercent private EnumBasedOnPercent _basedOn; public EnumBasedOnPercent BasedOn { get { return _basedOn; } set { _basedOn = value; } } #endregion #region EffectMonth : DateTime private DateTime _effectMonth; public DateTime EffectMonth { get { return _effectMonth; } set { _effectMonth = value; } } #endregion #region FromDate : DateTime private DateTime _fromDate; public DateTime FromDate { get { return _fromDate; } set { _fromDate = value; } } #endregion #region PayrollTypeID : ID private int _payrollTypeID; public int PayrollTypeID { get { return _payrollTypeID; } set { _payrollTypeID = value; } } #endregion #region Name : string private string _name; public string Name { get { return _name; } set { _name = value; } } #endregion #region OverAllPercentage : double private double _overAllPercentage; public double OverAllPercentage { get { return _overAllPercentage; } set { _overAllPercentage = value; } } #endregion #region ToDate : DateTime private DateTime _toDate; public DateTime ToDate { get { return _toDate; } set { _toDate = value; } } #endregion public List BudgetGrades { get; set; } public List Individualchanges { get; set; } public List BudgetDepartments { get; set; } public List BudgetCCs { get; set; } public List Components { get; set; } public List NewJoiners { get; set; } public List BudgetProcessMonthlys { get; set; } //private List _budgetGrades; //public List BudgetGrades //{ // get // { // if (_budgetGrades == null) // { // _budgetGrades = new List(); // if (!this.ID.IsUnassigned) // { // _budgetGrades = BudgetGrade.Get(this.ID.Integer); // # get by budget master id // } // } // return this._budgetGrades; // } // set // { // _budgetGrades = value; // } //} //private List _individualchanges; //public List Individualchanges //{ // get // { // if (_individualchanges == null) // { // _individualchanges = new List(); // if (!this.ID.IsUnassigned) // { // _individualchanges = BudgetIndivisualChange.Get(this.ID.Integer); // # get by budget master id // } // } // return this._individualchanges; // } // set // { // _individualchanges = value; // } //} //private List _budgetCCs; //public List BudgetCCs //{ // get // { // if (_budgetCCs == null) // { // _budgetCCs = new List(); // if (!this.ID.IsUnassigned) // { // _budgetCCs = BudgetCostCenter.Get(this.ID.Integer); // # get by budget master id // } // } // return _budgetCCs; // } // set // { // _budgetCCs = value; // } //} //private List _budgetDepts; //public List BudgetDepartments //{ // get // { // if (_budgetDepts == null) // { // _budgetDepts = new List(); // if (!this.ID.IsUnassigned) // { // _budgetDepts = BudgetDepartment.Get(this.ID.Integer); // # get by budget master id // } // } // return _budgetDepts; // } // set // { // _budgetDepts = value; // } //} ////private List _budgetNewJoinerCCs; ////public List BudgetNewJoinerCCs ////{ //// get //// { //// if (_budgetNewJoinerCCs == null && this.int == null && this.ID.Integer > 0) //// { //// BudgetNewJoiner b = new BudgetNewJoiner(); //// _budgetNewJoinerCCs = b.OBudgetNewJoinerCrGs; //BudgetNewJoinerCrG.Get(); // # get by budget master id //// } //// return _budgetNewJoinerCCs; //// } //// set //// { //// _budgetNewJoinerCCs = value; //// } ////} //private List _components; //public List Components //{ // get // { // if (_components == null) // { // _components = new List(); // if (!this.ID.IsUnassigned) // { // _components = BudgetComponent.Get(this.ID.Integer); // # get by budget master id // } // } // return _components; // } // set // { // _components = value; // } //} //private List _newJoiners; //public List NewJoiners //{ // get // { // if (_newJoiners == null) // { // _newJoiners = new List(); // if (!this.ID.IsUnassigned) // { // _newJoiners = BudgetNewJoiner.Get(this.ID.Integer); // # get by budget master id // } // } // return _newJoiners; // } // set // { // _newJoiners = value; // } } //private List _processMonthly; //public List BudgetProcessMonthlys //{ // get // { // if (_processMonthly == null) // { // _processMonthly = new List(); // if (!this.ID.IsUnassigned) // { // _processMonthly = BudgetProcessMonthly.Get(); // # get by budget master id // } // } // return _processMonthly; // } // set // { // _processMonthly = value; // } //} #endregion // #region Service Factory IBudgetMasterService : IBudgetMasterService // public List getException(DateTime onmonth, Employee oEmployee) // { // onmonth = Ease.CoreV35.Utility.Global.DateFunctions.PayrollLastDateOfMonth(onmonth); // List exceptions = new List(); // if (this.Individualchanges != null && this.Individualchanges.Count > 0) // exceptions = this.Individualchanges.FindAll(delegate(BudgetIndivisualChange oItem) { return oItem.EmployeeID == oEmployee.int && onmonth >= Ease.CoreV35.Utility.Global.DateFunctions.PayrollLastDateOfMonth(oItem.EffectDate); }); // return exceptions; // } // public List GetNewJoiner(DateTime onmonth) // { // onmonth = Ease.CoreV35.Utility.Global.DateFunctions.PayrollLastDateOfMonth(onmonth); // List newJoiners = new List(); // if (this.NewJoiners != null && this.NewJoiners.Count > 0) // newJoiners = this.NewJoiners.FindAll(delegate(BudgetNewJoiner oItem) { return onmonth >= Ease.CoreV35.Utility.Global.DateFunctions.PayrollLastDateOfMonth(oItem.FromDate); }); // return newJoiners; // } // public List GetCC(DateTime onmonth) // { // List CCs = new List(); // onmonth = Ease.CoreV35.Utility.Global.DateFunctions.PayrollLastDateOfMonth(onmonth); // if (this.BudgetCCs != null && this.BudgetCCs.Count > 0) // CCs = this.BudgetCCs.FindAll(delegate(BudgetCostCenter oItem) { return onmonth >= Ease.CoreV35.Utility.Global.DateFunctions.PayrollLastDateOfMonth(oItem.FromMonth) ; }); // return CCs; // } // public List GetNewJoinerCC(DateTime onmonth) // { // List newJoinerCCs = new List(); // onmonth = Ease.CoreV35.Utility.Global.DateFunctions.PayrollLastDateOfMonth(onmonth); // List newJoiners = new List(); // if (this.NewJoiners != null && this.NewJoiners.Count > 0) // { // newJoiners = this.NewJoiners.FindAll(delegate(BudgetNewJoiner oItem) { return onmonth >= Ease.CoreV35.Utility.Global.DateFunctions.PayrollLastDateOfMonth(oItem.FromDate); }); // foreach(BudgetNewJoiner bnj in newJoiners) // { // foreach (BudgetNewJoinerCrG bncc in bnj.OBudgetNewJoinerCrGs) // { // newJoinerCCs.Add(bncc); // } // } // } // return newJoinerCCs; // } // public List GetApplicableParameters(Employee employee, int graId) // { // List applicableParams = this.Components.FindAll(delegate(BudgetComponent param) { return IsApplicable(param, graId, employee) ;}); // return applicableParams; // } //private static bool IsApplicable(BudgetComponent param, int graid, Employee employee) // { // bool isApplicable = false; // foreach (BudgetComponentGrade adgrade in param.OBudgetComponentGrades) // { // if (adgrade.GradeID.Integer == graid.Integer) // { // isApplicable = true; // } // } // if (!isApplicable) return false; // return true; // } // internal static IBudgetMasterService Service // { // get { return Services.Factory.CreateService(typeof(IBudgetMasterService)); } // } // #endregion //#region Function(s) //#region Get //public static BudgetMaster Get(int nID) //{ // BudgetMaster oBudgetMaster = null; // #region Cache Header // oBudgetMaster = (BudgetMaster)_cache["Get", nID]; // if (oBudgetMaster != null) // return oBudgetMaster; // #endregion // try // { // oBudgetMaster = Service.Get(nID,SystemInformation.CurrentSysInfo.PayrollTypeID.Integer); // } // catch (ServiceException e) // { // throw new Exception(e.Message, e); // } // #region Cache Footer // _cache.Add(oBudgetMaster, "Get", nID); // #endregion // return oBudgetMaster; //} //public static List Get() //{ // #region Cache Header // List oBudgetMasters = _cache["Get"] as List; // if (oBudgetMasters != null) // return oBudgetMasters; // #endregion // try // { // oBudgetMasters = Service.Get(SystemInformation.CurrentSysInfo.PayrollTypeID.Integer); // } // catch (ServiceException e) // { // throw new Exception(e.Message, e); // } // #region Cache Footer // _cache.Add(oBudgetMasters, "Get"); // #endregion // return oBudgetMasters; //} //public static List Get(DateTime dtFromDate, DateTime dtToDate) //{ // #region Cache Header // List oBudgetMasters = _cache["Get"] as List; // if (oBudgetMasters != null) // return oBudgetMasters; // #endregion // try // { // oBudgetMasters = Service.Get(dtFromDate, dtToDate,SystemInformation.CurrentSysInfo.PayrollTypeID.Integer); // } // catch (ServiceException e) // { // throw new Exception(e.Message, e); // } // #region Cache Footer // _cache.Add(oBudgetMasters, "Get"); // #endregion // return oBudgetMasters; //} //#endregion //#region Save //public int Save(ProgressBar pbar) //{ // //SetAuditTrailProperties(); // return Service.Save(this, pbar); //} //#endregion //#region Delete //public void Delete(int id) //{ // Service.Delete(id,SystemInformation.CurrentSysInfo.PayrollTypeID.Integer); //} //#endregion //#endregion } #endregion