EchoTex_Payroll/HRM.BO/Budget/BudgetProcessMonthly.cs

591 lines
15 KiB
C#
Raw Permalink 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
{
public class BudgetProcessMonthly : AuditTrailBase
{
public BudgetProcessMonthly()
{
_budgetID = 0;
_departmentID = 0;
_employeeID = 0;
_gradeID = 0;
_isConfirm = 0;
_locationID = 0;
_month = DateTime.MinValue;
_newJoinerID = 0;
_newJoinerName = "";
OBudgetProcessMonthlyDetails = null;
OBudgetMonthlyCCs = null;
//####_payrollTypeID = SystemInformation.CurrentSysInfo.PayrollTypeID;
}
#region PayrollTypeID : ID
private int _payrollTypeID;
public int PayrollTypeID
{
get { return _payrollTypeID; }
set { _payrollTypeID = value; }
}
#endregion
private int _budgetID;
public int BudgetID
{
get { return _budgetID; }
set { _budgetID = value; }
}
private int _departmentID;
public int DepartmentID
{
get { return _departmentID; }
set { _departmentID = value; }
}
private int _employeeID;
public int EmployeeID
{
get { return _employeeID; }
set { _employeeID = value; }
}
private int _gradeID;
public int GradeID
{
get { return _gradeID; }
set { _gradeID = value; }
}
private int _isConfirm;
public int IsConfirm
{
get { return _isConfirm; }
set { _isConfirm = value; }
}
private int _locationID;
public int LocationID
{
get { return _locationID; }
set { _locationID = value; }
}
private DateTime _month;
public DateTime Month
{
get { return _month; }
set { _month = value; }
}
private int _newJoinerID;
public int NewJoinerID
{
get { return _newJoinerID; }
set { _newJoinerID = value; }
}
private string _newJoinerName;
public string NewJoinerName
{
get { return _newJoinerName; }
set { _newJoinerName = value; }
}
public List<BudgetProcessMonthlyDetail> OBudgetProcessMonthlyDetails { get; set; }
public List<BudgetMonthlyCC> OBudgetMonthlyCCs { get; set; }
//private List<BudgetProcessMonthlyDetail> _oBudgetProcessMonthlyDetails;
//public List<BudgetProcessMonthlyDetail> OBudgetProcessMonthlyDetails
//{
// get
// {
// if(_oBudgetProcessMonthlyDetails==null)
// {
// _oBudgetProcessMonthlyDetails=new List<BudgetProcessMonthlyDetail>();
// if (!this.ID.IsUnassigned && _oBudgetProcessMonthlyDetails.Count>0)
// _oBudgetProcessMonthlyDetails = BudgetProcessMonthly.Service.GetBudgetDetails(base.ID);
// }
// return _oBudgetProcessMonthlyDetails;
// }
// set { _oBudgetProcessMonthlyDetails = value; }
//}
//private List<BudgetMonthlyCC> _oBudgetMonthlyCCs;
//public List<BudgetMonthlyCC> OBudgetMonthlyCCs
//{
// get
// {
// if (_oBudgetMonthlyCCs == null)
// {
// _oBudgetMonthlyCCs = new List<BudgetMonthlyCC>();
// if (!this.ID.IsUnassigned && _oBudgetMonthlyCCs.Count>0)
// _oBudgetMonthlyCCs = BudgetProcessMonthly.Service.GetBudgetMonthlyCCs(this.ID);
// }
// return _oBudgetMonthlyCCs;
// }
// set { _oBudgetMonthlyCCs = value; }
//}
//public static BudgetProcessMonthly Get(int nID)
//{
// BudgetProcessMonthly oBudgetProcessMonthly = null;
// oBudgetProcessMonthly = (BudgetProcessMonthly)_cache["Get", nID];
// if (oBudgetProcessMonthly != null)
// return oBudgetProcessMonthly;
// try
// {
// oBudgetProcessMonthly = Service.Get(nID,SystemInformation.CurrentSysInfo.PayrollTypeID.Integer);
// }
// catch (ServiceException e)
// {
// throw new Exception(e.Message, e);
// }
// _cache.Add(oBudgetProcessMonthly, "Get", nID);
// return oBudgetProcessMonthly;
//}
//public static List<BudgetProcessMonthly> Get()
//{
// List<BudgetProcessMonthly> oBudgetProcessMonthlies = _cache["Get"] as List<BudgetProcessMonthly>;
// if (oBudgetProcessMonthlies != null)
// return oBudgetProcessMonthlies;
// try
// {
// oBudgetProcessMonthlies = Service.Get(SystemInformation.CurrentSysInfo.PayrollTypeID.Integer);
// }
// catch (ServiceException e)
// {
// throw new Exception(e.Message, e);
// }
// _cache.Add(oBudgetProcessMonthlies, "Get");
// return oBudgetProcessMonthlies;
//}
//public static List<BudgetProcessMonthly> Get(int nBudID)
//{
// List<BudgetProcessMonthly> oBudgetProcessMonthlies = _cache["Get"] as List<BudgetProcessMonthly>;
// if (oBudgetProcessMonthlies != null)
// return oBudgetProcessMonthlies;
// try
// {
// oBudgetProcessMonthlies = Service.Get(nBudID,SystemInformation.CurrentSysInfo.PayrollTypeID.Integer);
// }
// catch (ServiceException e)
// {
// throw new Exception(e.Message, e);
// }
// _cache.Add(oBudgetProcessMonthlies, "Get");
// return oBudgetProcessMonthlies;
//}
//public int Save()
//{
// //SetAuditTrailProperties();
// return Service.Save(this);
//}
//public void Delete(int id)
//{
// Service.Delete(id,SystemInformation.CurrentSysInfo.PayrollTypeID.Integer);
//}
//internal static IBudgetProcessMonthlyService Service
//{
// get { return Services.Factory.CreateService<IBudgetProcessMonthlyService>(typeof(IBudgetProcessMonthlyService)); }
//}
}
public class BudgetProcessMonthlyDetail : BasicBaseObject
{
public BudgetProcessMonthlyDetail()
{
_calculatedamount = 0;
_changedamount = 0;
_budgetComponentID = 0;
_budgetProcessMonthlyID = 0;
_employeeID = 0;
_month = DateTime.MinValue;
_name = "";
_budgetGroup = EnumBudgetGroup.Gross;
_budgetCode = EnumBudgetCode.Allowance;
_position = 0;
_originID = 0;
}
private double _calculatedamount;
public double Calculatedamount
{
get { return _calculatedamount; }
set { _calculatedamount = value; }
}
private double _changedamount;
public double Changedamount
{
get { return _changedamount; }
set { _changedamount = value; }
}
private int _originID;
public int OriginID
{
get { return _originID; }
set { _originID = value; }
}
private int _budgetComponentID;
public int BudgetComponentID
{
get { return _budgetComponentID; }
set { _budgetComponentID = value; }
}
private int _budgetProcessMonthlyID;
public int BudgetProcessMonthlyID
{
get { return _budgetProcessMonthlyID; }
set { _budgetProcessMonthlyID = value; }
}
private int _employeeID;
public int EmployeeID
{
get { return _employeeID; }
set { _employeeID = value; }
}
private DateTime _month;
public DateTime Month
{
get { return _month; }
set { _month = value; }
}
private string _name;
public string Name
{
get { return _name; }
set { _name = value; }
}
private EnumBudgetGroup _budgetGroup;
public EnumBudgetGroup BudgetGroup
{
get { return _budgetGroup; }
set { _budgetGroup = value; }
}
private EnumBudgetCode _budgetCode;
public EnumBudgetCode BudgetCode
{
get { return _budgetCode; }
set { _budgetCode = value; }
}
private int _position;
public int Position
{
get { return _position; }
set { _position = value; }
}
public Employee Employee { get; set; }
public List<EmployeeCostCenter> CCs { get; set; }
public BudgetComponent BugetComponent { get; set; }
//private Employee _emp;
//public Employee Employee
//{
// get
// {
// if (_emp == null && _employeeID.IsUnassigned == false && _employeeID.Integer > 0)
// {
// _emp = new Employee();
// _emp = Employee.Get(_employeeID);
// }
// return this._emp;
// }
// set
// {
// _emp = value;
// }
//}
//private List<EmployeeCostCenter> _cc;
//public List<EmployeeCostCenter> CCs
//{
// get
// {
// if (_cc == null && _employeeID.IsUnassigned == false && _employeeID.Integer > 0)
// {
// _cc = new List<EmployeeCostCenter>();
// _cc = EmployeeCostCenter.GetByEmpID(_employeeID);
// }
// return this._cc;
// }
// set
// {
// _cc = value;
// }
//}
//private BudgetComponent _bugetComponent;
//public BudgetComponent BugetComponent
//{
// get
// {
// if (_bugetComponent == null && BudgetComponentID!=null)
// {
// _bugetComponent = BudgetComponent.Service.Get(this.BudgetComponentID);
// }
// return _bugetComponent;
// }
// set { _bugetComponent = value; }
//}
//public static List<BudgetProcessMonthlyDetail> Get(DateTime dtFrom,DateTime dtTo, int nBudID)
//{
// List<BudgetProcessMonthlyDetail> oBudgetProcessMonthlieDetails = _cache["Get"] as List<BudgetProcessMonthlyDetail>;
// if (oBudgetProcessMonthlieDetails != null)
// return oBudgetProcessMonthlieDetails;
// try
// {
// oBudgetProcessMonthlieDetails = BudgetProcessMonthly.Service.Get(dtFrom,dtTo, nBudID,SystemInformation.CurrentSysInfo.PayrollTypeID.Integer);
// }
// catch (ServiceException e)
// {
// throw new Exception(e.Message, e);
// }
// _cache.Add(oBudgetProcessMonthlieDetails, "Get");
// return oBudgetProcessMonthlieDetails;
//}
//public static List<BudgetProcessMonthlyDetail> Get2(DateTime dtFrom, DateTime dtTo, int nBudID)
//{
// List<BudgetProcessMonthlyDetail> oBudgetProcessMonthlieDetails = _cache["Get2"] as List<BudgetProcessMonthlyDetail>;
// if (oBudgetProcessMonthlieDetails != null)
// return oBudgetProcessMonthlieDetails;
// try
// {
// oBudgetProcessMonthlieDetails = BudgetProcessMonthly.Service.Get2(dtFrom, dtTo, nBudID,SystemInformation.CurrentSysInfo.PayrollTypeID.Integer);
// }
// catch (ServiceException e)
// {
// throw new Exception(e.Message, e);
// }
// _cache.Add(oBudgetProcessMonthlieDetails, "Get2");
// return oBudgetProcessMonthlieDetails;
//}
}
public class BudgetMonthlyCC : BasicBaseObject
{
public BudgetMonthlyCC()
{
_budgetProcessMonthlyID = 0;
_cCID = 0;
_employeeID = 0;
_month = DateTime.MinValue;
_percentage = 0;
}
private int _budgetProcessMonthlyID;
public int BudgetProcessMonthlyID
{
get { return _budgetProcessMonthlyID; }
set { _budgetProcessMonthlyID = value; }
}
private int _cCID;
public int CCID
{
get { return _cCID; }
set { _cCID = value; }
}
private int _employeeID;
public int EmployeeID
{
get { return _employeeID; }
set { _employeeID = value; }
}
private DateTime _month;
public DateTime Month
{
get { return _month; }
set { _month = value; }
}
private double _percentage;
public double Percentage
{
get { return _percentage; }
set { _percentage = value; }
}
//public Costcenter Costcenter { get; set; }
//public Employee Employee { get; set; }
//private Costcenter _costcenter;
//public Costcenter Costcenter
//{
// get
// {
// if (_cCID.Integer > 0 && _costcenter == null)
// {
// _costcenter = new Costcenter();
// _costcenter = Costcenter.Get(_cCID);
// }
// return this._costcenter;
// }
// set
// {
// _costcenter = value;
// }
//}
//private Employee _emp;
//public Employee Employee
//{
// get
// {
// if (_emp == null && _employeeID.IsUnassigned == false && _employeeID.Integer > 0)
// {
// _emp = new Employee();
// _emp = Employee.Get(_employeeID);
// }
// return this._emp;
// }
// set
// {
// _emp = value;
// }
//}
}
public interface IBudgetProcessMonthlyService
{
BudgetProcessMonthly Get(int nID, int payrollTypeID);
List<BudgetProcessMonthly> Get(int payrollTypeID);
List<BudgetProcessMonthly> GetWithBudgetID(int nBudID, int payrollTypeID);
int Save(BudgetProcessMonthly item);
void Delete(int nID, int payrollTypeID);
List<BudgetProcessMonthlyDetail> GetBudgetDetails(int id);
List<BudgetMonthlyCC> GetBudgetMonthlyCCs(int id);
List<BudgetProcessMonthlyDetail> Get(DateTime dtFrom, DateTime dtTo, int nBudID, int payrollTypeID);
List<BudgetProcessMonthlyDetail> Get2(DateTime dtFrom, DateTime dtTo, int nBudID, int payrollTypeID);
}
}