CEL_Payroll/Payroll.BO/Budget/BudgetIndivisualChange.cs

336 lines
8.7 KiB
C#
Raw Permalink Normal View History

2024-09-17 14:30:13 +06:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ease.CoreV35.Caching;
using Ease.CoreV35.Model;
namespace Payroll.BO
{
#region Class BudgetIndividualChange
[Serializable]
public class BudgetIndivisualChange : UpdateAuditTrail
{
#region Cache Store
private static Cache _cache = new Cache(typeof(BudgetIndivisualChange));
#endregion
#region Constructor
public BudgetIndivisualChange()
{
_budgetID = null;
_employeeID = null;
_butGetIndvChangeType = EnumBudgetChangeType.None;
_effectDate = DateTime.MinValue;
_value = null;
_changedBasic = 0.0;
_valueType = EnumValueType.Amount;
}
#endregion
#region Properties
#region BudgetID : ID
private ID _budgetID;
public ID BudgetID
{
get { return _budgetID; }
set { _budgetID = value; }
}
#endregion
#region EmployeeID : ID
private ID _employeeID;
public ID EmployeeID
{
get { return _employeeID; }
set { _employeeID = value; }
}
#endregion
#region ButGetIndvChangeType : EnumBudgetChangeType
private EnumBudgetChangeType _butGetIndvChangeType;
public EnumBudgetChangeType ButGetIndvChangeType
{
get { return _butGetIndvChangeType; }
set { _butGetIndvChangeType = value; }
}
#endregion
#region EffectDate : Datetime
private DateTime _effectDate;
public DateTime EffectDate
{
get { return _effectDate; }
set { _effectDate = value; }
}
#endregion
#region _valueType : EnumValueType
private EnumValueType _valueType;
public EnumValueType ValueType
{
get { return _valueType; }
set { _valueType = value; }
}
#endregion
#region Value : ID
private ID _value;
public ID Value
{
get { return _value; }
set { _value = value; }
}
#endregion
#region Value : Double
private double _changedBasic;
public double ChangedBasic
{
get { return _changedBasic; }
set { _changedBasic = value; }
}
#endregion
#region grade : Grade
private Grade _grade;
public Grade Grade
{
get
{
if (_value != null && !_value.IsUnassigned)
{
if (_value.Integer > 0 && _grade == null)
{
_grade = new Grade();
_grade = Grade.Get(_value);
}
}
return this._grade;
}
set
{
_grade = value;
}
}
#endregion
#region department : Department
private Department _department;
public Department Department
{
get
{
if (_value != null && !_value.IsUnassigned)
{
if (_value.Integer > 0 && _department == null)
{
_department = new Department();
_department = Department.Get(_value);
}
}
return this._department;
}
set
{
_department = value;
}
}
#endregion
#region location : Location
private Location _location;
public Location Location
{
get
{
if (_value != null && !_value.IsUnassigned)
{
if (_value.Integer > 0 && _location == null)
{
_location = new Location();
_location = Location.Get(_value);
}
}
return this._location;
}
set
{
_location = value;
}
}
#endregion
#region cc : CC
private Costcenter _cc;
public Costcenter CC
{
get
{
if (_value != null && !_value.IsUnassigned)
{
if (_value.Integer > 0 && _cc == null)
{
_cc = new Costcenter();
_cc = Costcenter.Get(_value);
}
}
return this._cc;
}
set
{
_cc = value;
}
}
#endregion
#region function : Function
private Function _function;
public Function Function
{
get
{
if (_value != null && !_value.IsUnassigned)
{
if (_value.Integer > 0 && _function == null)
{
_function = new Function();
_function = Function.Get(_value);
}
}
return this._function;
}
set
{
_function = value;
}
}
#endregion
#region Service Factory IBudgetIndivisualChangeService : IBudgetIndivisualChangeService
internal static IBudgetIndivisualChangeService Service
{
get { return Services.Factory.CreateService<IBudgetIndivisualChangeService>(typeof(IBudgetIndivisualChangeService)); }
}
#endregion
#endregion
#region Function(s)
#region Get
public static BudgetIndivisualChange Get(ID nID)
{
BudgetIndivisualChange oBudgetIndividualChange = null;
#region Cache Header
oBudgetIndividualChange = (BudgetIndivisualChange)_cache["Get", nID];
if (oBudgetIndividualChange != null)
return oBudgetIndividualChange;
#endregion
try
{
oBudgetIndividualChange = Service.Get(nID);
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(oBudgetIndividualChange, "Get", nID);
#endregion
return oBudgetIndividualChange;
}
public static ObjectsTemplate<BudgetIndivisualChange> Get()
{
#region Cache Header
ObjectsTemplate<BudgetIndivisualChange> oBudgetIndividualChanges = _cache["Get"] as ObjectsTemplate<BudgetIndivisualChange>;
if (oBudgetIndividualChanges != null)
return oBudgetIndividualChanges;
#endregion
try
{
oBudgetIndividualChanges = Service.Get();
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(oBudgetIndividualChanges, "Get");
#endregion
return oBudgetIndividualChanges;
}
public static ObjectsTemplate<BudgetIndivisualChange> Get(int nBudID)
{
#region Cache Header
ObjectsTemplate<BudgetIndivisualChange> oBudgetIndividualChanges = _cache["Get"] as ObjectsTemplate<BudgetIndivisualChange>;
if (oBudgetIndividualChanges != null)
return oBudgetIndividualChanges;
#endregion
try
{
oBudgetIndividualChanges = Service.Get(nBudID);
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(oBudgetIndividualChanges, "Get");
#endregion
return oBudgetIndividualChanges;
}
#endregion
#region Save
public ID Save()
{
//SetAuditTrailProperties();
return Service.Save(this);
}
#endregion
#region Delete
public void Delete(ID id)
{
Service.Delete(id);
}
#endregion
#endregion
}
#endregion
#region IBudgetIndividualChangeService
public interface IBudgetIndivisualChangeService
{
BudgetIndivisualChange Get(ID nID);
ObjectsTemplate<BudgetIndivisualChange> Get();
ObjectsTemplate<BudgetIndivisualChange> Get(int nBudID);
ID Save(BudgetIndivisualChange item);
void Delete(ID nID);
}
#endregion
}