EchoTex_Payroll/HRM.BO/Budget/BudgetMaster.cs

466 lines
14 KiB
C#
Raw Normal View History

2024-10-14 10:01:49 +06:00
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<BudgetGrade> BudgetGrades { get; set; }
public List<BudgetIndivisualChange> Individualchanges { get; set; }
public List<BudgetDepartment> BudgetDepartments { get; set; }
public List<BudgetCostCenter> BudgetCCs { get; set; }
public List<BudgetComponent> Components { get; set; }
public List<BudgetNewJoiner> NewJoiners { get; set; }
public List<BudgetProcessMonthly> BudgetProcessMonthlys { get; set; }
//private List<BudgetGrade> _budgetGrades;
//public List<BudgetGrade> BudgetGrades
//{
// get
// {
// if (_budgetGrades == null)
// {
// _budgetGrades = new List<BudgetGrade>();
// if (!this.ID.IsUnassigned)
// {
// _budgetGrades = BudgetGrade.Get(this.ID.Integer); // # get by budget master id
// }
// }
// return this._budgetGrades;
// }
// set
// {
// _budgetGrades = value;
// }
//}
//private List<BudgetIndivisualChange> _individualchanges;
//public List<BudgetIndivisualChange> Individualchanges
//{
// get
// {
// if (_individualchanges == null)
// {
// _individualchanges = new List<BudgetIndivisualChange>();
// if (!this.ID.IsUnassigned)
// {
// _individualchanges = BudgetIndivisualChange.Get(this.ID.Integer); // # get by budget master id
// }
// }
// return this._individualchanges;
// }
// set
// {
// _individualchanges = value;
// }
//}
//private List<BudgetCostCenter> _budgetCCs;
//public List<BudgetCostCenter> BudgetCCs
//{
// get
// {
// if (_budgetCCs == null)
// {
// _budgetCCs = new List<BudgetCostCenter>();
// if (!this.ID.IsUnassigned)
// {
// _budgetCCs = BudgetCostCenter.Get(this.ID.Integer); // # get by budget master id
// }
// }
// return _budgetCCs;
// }
// set
// {
// _budgetCCs = value;
// }
//}
//private List<BudgetDepartment> _budgetDepts;
//public List<BudgetDepartment> BudgetDepartments
//{
// get
// {
// if (_budgetDepts == null)
// {
// _budgetDepts = new List<BudgetDepartment>();
// if (!this.ID.IsUnassigned)
// {
// _budgetDepts = BudgetDepartment.Get(this.ID.Integer); // # get by budget master id
// }
// }
// return _budgetDepts;
// }
// set
// {
// _budgetDepts = value;
// }
//}
////private List<BudgetNewJoinerCrG> _budgetNewJoinerCCs;
////public List<BudgetNewJoinerCrG> 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<BudgetComponent> _components;
//public List<BudgetComponent> Components
//{
// get
// {
// if (_components == null)
// {
// _components = new List<BudgetComponent>();
// if (!this.ID.IsUnassigned)
// {
// _components = BudgetComponent.Get(this.ID.Integer); // # get by budget master id
// }
// }
// return _components;
// }
// set
// {
// _components = value;
// }
//}
//private List<BudgetNewJoiner> _newJoiners;
//public List<BudgetNewJoiner> NewJoiners
//{
// get
// {
// if (_newJoiners == null)
// {
// _newJoiners = new List<BudgetNewJoiner>();
// if (!this.ID.IsUnassigned)
// {
// _newJoiners = BudgetNewJoiner.Get(this.ID.Integer); // # get by budget master id
// }
// }
// return _newJoiners;
// }
// set
// {
// _newJoiners = value;
// }
}
//private List<BudgetProcessMonthly> _processMonthly;
//public List<BudgetProcessMonthly> BudgetProcessMonthlys
//{
// get
// {
// if (_processMonthly == null)
// {
// _processMonthly = new List<BudgetProcessMonthly>();
// 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<BudgetIndivisualChange> getException(DateTime onmonth, Employee oEmployee)
// {
// onmonth = Ease.CoreV35.Utility.Global.DateFunctions.PayrollLastDateOfMonth(onmonth);
// List<BudgetIndivisualChange> exceptions = new List<BudgetIndivisualChange>();
// 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<BudgetNewJoiner> GetNewJoiner(DateTime onmonth)
// {
// onmonth = Ease.CoreV35.Utility.Global.DateFunctions.PayrollLastDateOfMonth(onmonth);
// List<BudgetNewJoiner> newJoiners = new List<BudgetNewJoiner>();
// 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<BudgetCostCenter> GetCC(DateTime onmonth)
// {
// List<BudgetCostCenter> CCs = new List<BudgetCostCenter>();
// 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<BudgetNewJoinerCrG> GetNewJoinerCC(DateTime onmonth)
// {
// List<BudgetNewJoinerCrG> newJoinerCCs = new List<BudgetNewJoinerCrG>();
// onmonth = Ease.CoreV35.Utility.Global.DateFunctions.PayrollLastDateOfMonth(onmonth);
// List<BudgetNewJoiner> newJoiners = new List<BudgetNewJoiner>();
// 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<BudgetComponent> GetApplicableParameters(Employee employee, int graId)
// {
// List<BudgetComponent> 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<IBudgetMasterService>(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<BudgetMaster> Get()
//{
// #region Cache Header
// List<BudgetMaster> oBudgetMasters = _cache["Get"] as List<BudgetMaster>;
// 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<BudgetMaster> Get(DateTime dtFromDate, DateTime dtToDate)
//{
// #region Cache Header
// List<BudgetMaster> oBudgetMasters = _cache["Get"] as List<BudgetMaster>;
// 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