using System; using System.Collections.Generic; using System.Linq; using System.Text; using Ease.CoreV35.Caching; using Ease.CoreV35.Model; using System.Data; namespace Payroll.BO { [Serializable] public class BudgetProcessMonthly : AuditTrailBase { private static Cache _cache = new Cache(typeof(BudgetProcessMonthly)); public BudgetProcessMonthly() { _budgetID = null; _departmentID = null; _employeeID = null; _gradeID = null; _isConfirm = 0; _locationID = null; _month = DateTime.MinValue; _newJoinerID = null; _newJoinerName = ""; _oBudgetProcessMonthlyDetails = null; _oBudgetMonthlyCCs = null; } private ID _budgetID; public ID BudgetID { get { return _budgetID; } set { _budgetID = value; } } private ID _departmentID; public ID DepartmentID { get { return _departmentID; } set { _departmentID = value; } } private ID _employeeID; public ID EmployeeID { get { return _employeeID; } set { _employeeID = value; } } private ID _gradeID; public ID GradeID { get { return _gradeID; } set { _gradeID = value; } } private int _isConfirm; public int IsConfirm { get { return _isConfirm; } set { _isConfirm = value; } } private ID _locationID; public ID LocationID { get { return _locationID; } set { _locationID = value; } } private DateTime _month; public DateTime Month { get { return _month; } set { _month = value; } } private ID _newJoinerID; public ID NewJoinerID { get { return _newJoinerID; } set { _newJoinerID = value; } } private string _newJoinerName; public string NewJoinerName { get { return _newJoinerName; } set { _newJoinerName = value; } } private ObjectsTemplate _oBudgetProcessMonthlyDetails; public ObjectsTemplate OBudgetProcessMonthlyDetails { get { if(_oBudgetProcessMonthlyDetails==null) { _oBudgetProcessMonthlyDetails=new ObjectsTemplate(); if (!this.ID.IsUnassigned && _oBudgetProcessMonthlyDetails.Count>0) _oBudgetProcessMonthlyDetails = BudgetProcessMonthly.Service.GetBudgetDetails(base.ID); } return _oBudgetProcessMonthlyDetails; } set { _oBudgetProcessMonthlyDetails = value; } } private ObjectsTemplate _oBudgetMonthlyCCs; public ObjectsTemplate OBudgetMonthlyCCs { get { if (_oBudgetMonthlyCCs == null) { _oBudgetMonthlyCCs = new ObjectsTemplate(); if (!this.ID.IsUnassigned && _oBudgetMonthlyCCs.Count>0) _oBudgetMonthlyCCs = BudgetProcessMonthly.Service.GetBudgetMonthlyCCs(this.ID); } return _oBudgetMonthlyCCs; } set { _oBudgetMonthlyCCs = value; } } public static BudgetProcessMonthly Get(ID nID) { BudgetProcessMonthly oBudgetProcessMonthly = null; oBudgetProcessMonthly = (BudgetProcessMonthly)_cache["Get", nID]; if (oBudgetProcessMonthly != null) return oBudgetProcessMonthly; try { oBudgetProcessMonthly = Service.Get(nID, SystemInformation.CurrentSysInfo.PayrollTypeID); } catch (ServiceException e) { throw new Exception(e.Message, e); } _cache.Add(oBudgetProcessMonthly, "Get", nID); return oBudgetProcessMonthly; } public static ObjectsTemplate Get() { ObjectsTemplate oBudgetProcessMonthlies = _cache["Get"] as ObjectsTemplate; if (oBudgetProcessMonthlies != null) return oBudgetProcessMonthlies; try { oBudgetProcessMonthlies = Service.Get(SystemInformation.CurrentSysInfo.PayrollTypeID); } catch (ServiceException e) { throw new Exception(e.Message, e); } _cache.Add(oBudgetProcessMonthlies, "Get"); return oBudgetProcessMonthlies; } public static ObjectsTemplate Get(int nBudID) { ObjectsTemplate oBudgetProcessMonthlies = _cache["Get"] as ObjectsTemplate; if (oBudgetProcessMonthlies != null) return oBudgetProcessMonthlies; try { oBudgetProcessMonthlies = Service.Get(nBudID, SystemInformation.CurrentSysInfo.PayrollTypeID); } catch (ServiceException e) { throw new Exception(e.Message, e); } _cache.Add(oBudgetProcessMonthlies, "Get"); return oBudgetProcessMonthlies; } public ID Save() { //SetAuditTrailProperties(); return Service.Save(this, SystemInformation.CurrentSysInfo.PayrollTypeID); } public void Delete(ID id) { Service.Delete(id, SystemInformation.CurrentSysInfo.PayrollTypeID); } internal static IBudgetProcessMonthlyService Service { get { return Services.Factory.CreateService(typeof(IBudgetProcessMonthlyService)); } } } [Serializable] public class BudgetProcessMonthlyDetail : BasicBaseObject { private static Cache _cache = new Cache(typeof(BudgetProcessMonthlyDetail)); public BudgetProcessMonthlyDetail() { _calculatedamount = 0; _changedamount = 0; _budgetComponentID = null; _budgetProcessMonthlyID = null; _employeeID = null; _month = DateTime.MinValue; _name = ""; _budgetGroup = EnumBudgetGroup.Gross; _budgetCode = EnumBudgetCode.Allowance; _position = 0; _originID = null; } 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 ID _originID; public ID OriginID { get { return _originID; } set { _originID = value; } } private ID _budgetComponentID; public ID BudgetComponentID { get { return _budgetComponentID; } set { _budgetComponentID = value; } } private ID _budgetProcessMonthlyID; public ID BudgetProcessMonthlyID { get { return _budgetProcessMonthlyID; } set { _budgetProcessMonthlyID = value; } } private ID _employeeID; public ID 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; } } 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 ObjectsTemplate _cc; public ObjectsTemplate CCs { get { if (_cc == null && _employeeID.IsUnassigned == false && _employeeID.Integer > 0) { _cc = new ObjectsTemplate(); _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 ObjectsTemplate Get(DateTime dtFrom,DateTime dtTo, int nBudID) { ObjectsTemplate oBudgetProcessMonthlieDetails = _cache["Get"] as ObjectsTemplate; if (oBudgetProcessMonthlieDetails != null) return oBudgetProcessMonthlieDetails; try { oBudgetProcessMonthlieDetails = BudgetProcessMonthly.Service.Get(dtFrom,dtTo, nBudID, SystemInformation.CurrentSysInfo.PayrollTypeID); } catch (ServiceException e) { throw new Exception(e.Message, e); } _cache.Add(oBudgetProcessMonthlieDetails, "Get"); return oBudgetProcessMonthlieDetails; } public static ObjectsTemplate Get2(DateTime dtFrom, DateTime dtTo, int nBudID) { ObjectsTemplate oBudgetProcessMonthlieDetails = _cache["Get2"] as ObjectsTemplate; if (oBudgetProcessMonthlieDetails != null) return oBudgetProcessMonthlieDetails; try { oBudgetProcessMonthlieDetails = BudgetProcessMonthly.Service.Get2(dtFrom, dtTo, nBudID, SystemInformation.CurrentSysInfo.PayrollTypeID); } catch (ServiceException e) { throw new Exception(e.Message, e); } _cache.Add(oBudgetProcessMonthlieDetails, "Get2"); return oBudgetProcessMonthlieDetails; } } [Serializable] public class BudgetMonthlyCC : BasicBaseObject { private static Cache _cache = new Cache(typeof(BudgetMonthlyCC)); public BudgetMonthlyCC() { _budgetProcessMonthlyID = null; _cCID = null; _employeeID = null; _month = DateTime.MinValue; _percentage = 0; } private ID _budgetProcessMonthlyID; public ID BudgetProcessMonthlyID { get { return _budgetProcessMonthlyID; } set { _budgetProcessMonthlyID = value; } } private ID _cCID; public ID CCID { get { return _cCID; } set { _cCID = value; } } private ID _employeeID; public ID 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; } } 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(ID nID, ID PayrollTypeID); ObjectsTemplate Get(ID PayrollTypeID); ObjectsTemplate Get(int nBudID, ID PayrollTypeID); ID Save(BudgetProcessMonthly item, ID payrollTypeID); void Delete(ID nID, ID PayrollTypeID); ObjectsTemplate GetBudgetDetails(ID id); ObjectsTemplate GetBudgetMonthlyCCs(ID id); ObjectsTemplate Get(DateTime dtFrom, DateTime dtTo, int nBudID, ID PayrollTypeID); ObjectsTemplate Get2(DateTime dtFrom, DateTime dtTo, int nBudID, ID PayrollTypeID); } }