368 lines
11 KiB
C#
368 lines
11 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using Ease.CoreV35;
|
|
using Ease.CoreV35.Model;
|
|
using Ease.CoreV35.Caching;
|
|
using System.Data.Linq.Mapping;
|
|
|
|
namespace Payroll.BO
|
|
{
|
|
#region OpiParameterIndividual
|
|
[Serializable]
|
|
public class OpiParameterIndividual : BasicBaseObject
|
|
{
|
|
#region Cache Store
|
|
private static Cache _cache = new Cache(typeof(OpiParameterIndividual));
|
|
#endregion
|
|
|
|
#region Constructor
|
|
public OpiParameterIndividual()
|
|
{
|
|
_opiParameterID = null;
|
|
_opiItemId = null;
|
|
_opiPeriodicity = EnumOpiPeriodicity.OnceOff;
|
|
_employeeId = null;
|
|
_fromDate = DateTime.MinValue;
|
|
_toDate = DateTime.MinValue;
|
|
_arrearType = EnumArrearType.NotPresent;
|
|
_employee = null;
|
|
_individualType = EnumOPIIndivdualType.AppliedToIndividual;
|
|
_value = 0.0;
|
|
_valueType = EnumValueType.Amount;
|
|
}
|
|
#endregion
|
|
|
|
#region Properties
|
|
|
|
#region ArrearType : EnumArrearType
|
|
private EnumArrearType _arrearType;
|
|
public EnumArrearType ArrearType
|
|
{
|
|
get
|
|
{
|
|
return _arrearType;
|
|
}
|
|
set
|
|
{
|
|
base.OnPropertyChange<short>("arreartype", (short)_arrearType, (short)value);
|
|
_arrearType = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region EmployeeId : ID
|
|
private ID _employeeId;
|
|
public ID EmployeeId
|
|
{
|
|
get
|
|
{
|
|
return _employeeId;
|
|
}
|
|
set
|
|
{
|
|
base.OnPropertyChange<ID>("employeeid", _employeeId, value);
|
|
_employeeId = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region FromDate : DateTime
|
|
private DateTime _fromDate;
|
|
public DateTime FromDate
|
|
{
|
|
get
|
|
{
|
|
return _fromDate;
|
|
}
|
|
set
|
|
{
|
|
base.OnPropertyChange<DateTime>("fromdate", _fromDate, value);
|
|
_fromDate = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region ToDate : DateTime
|
|
private DateTime? _toDate;
|
|
public DateTime? ToDate
|
|
{
|
|
get
|
|
{
|
|
return _toDate;
|
|
}
|
|
set
|
|
{
|
|
base.OnPropertyChange<DateTime>("todate", _toDate, value);
|
|
_toDate = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region IndividualType : EnumOPIIndivdualType
|
|
private EnumOPIIndivdualType _individualType;
|
|
public EnumOPIIndivdualType IndividualType
|
|
{
|
|
get
|
|
{
|
|
return _individualType;
|
|
}
|
|
set
|
|
{
|
|
base.OnPropertyChange<short>("individualtype", (short)_individualType, (short)value);
|
|
_individualType = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region OpiItemId : ID
|
|
private ID _opiItemId;
|
|
public ID OpiItemId
|
|
{
|
|
get
|
|
{
|
|
return _opiItemId;
|
|
}
|
|
set
|
|
{
|
|
base.OnPropertyChange<ID>("opiitemid", _opiItemId, value);
|
|
_opiItemId = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region OpiParameterID : ID
|
|
private ID _opiParameterID;
|
|
public ID OpiParameterID
|
|
{
|
|
get
|
|
{
|
|
return _opiParameterID;
|
|
}
|
|
set
|
|
{
|
|
base.OnPropertyChange<ID>("opiparameterid", _opiParameterID, value);
|
|
_opiParameterID = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region OpiPeriodicity : EnumOpiPeriodicity
|
|
private EnumOpiPeriodicity _opiPeriodicity;
|
|
public EnumOpiPeriodicity OpiPeriodicity
|
|
{
|
|
get
|
|
{
|
|
return _opiPeriodicity;
|
|
}
|
|
set
|
|
{
|
|
_opiPeriodicity = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region Value : double
|
|
private double _value;
|
|
public double Value
|
|
{
|
|
get
|
|
{
|
|
return _value;
|
|
}
|
|
set
|
|
{
|
|
base.OnPropertyChange<double>("value", _value, value);
|
|
_value = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region ValueType : EnumValueType
|
|
private EnumValueType _valueType;
|
|
public EnumValueType ValueType
|
|
{
|
|
get
|
|
{
|
|
return _valueType;
|
|
}
|
|
set
|
|
{
|
|
base.OnPropertyChange<short>("valuetype", (short)_valueType, (short)value);
|
|
_valueType = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region employee : Employee
|
|
private Employee _employee;
|
|
public Employee Employee
|
|
{
|
|
get
|
|
{
|
|
if (_employeeId.Integer > 0 && _employee == null)
|
|
{
|
|
_employee = new Employee();
|
|
_employee = Employee.Get(_employeeId);
|
|
}
|
|
return this._employee;
|
|
}
|
|
set
|
|
{
|
|
_employee = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
#region Functions
|
|
public OpiParameterIndividual Get(ID nOpiParameterIndividualID)
|
|
{
|
|
OpiParameterIndividual oOpiParameterIndividual = null;
|
|
#region Cache Header
|
|
oOpiParameterIndividual = (OpiParameterIndividual)_cache["Get", nOpiParameterIndividualID];
|
|
if (oOpiParameterIndividual != null)
|
|
return oOpiParameterIndividual;
|
|
#endregion
|
|
oOpiParameterIndividual = OpiParameterIndividual.Service.Get(nOpiParameterIndividualID);
|
|
#region Cache Footer
|
|
_cache.Add(oOpiParameterIndividual, "Get", nOpiParameterIndividualID);
|
|
#endregion
|
|
return oOpiParameterIndividual;
|
|
}
|
|
public static ObjectsTemplate<OpiParameterIndividual> Get()
|
|
{
|
|
#region Cache Header
|
|
ObjectsTemplate<OpiParameterIndividual> OpiParameterIndividuals = _cache["Get"] as ObjectsTemplate<OpiParameterIndividual>;
|
|
if (OpiParameterIndividuals != null)
|
|
return OpiParameterIndividuals;
|
|
#endregion
|
|
try
|
|
{
|
|
OpiParameterIndividuals = Service.Get();
|
|
}
|
|
catch (ServiceException e)
|
|
{
|
|
throw new Exception(e.Message, e);
|
|
}
|
|
#region Cache Footer
|
|
_cache.Add(OpiParameterIndividuals, "Get");
|
|
#endregion
|
|
return OpiParameterIndividuals;
|
|
}
|
|
public static ObjectsTemplate<OpiParameterIndividual> GetByParameterID(ID nParameterID)
|
|
{
|
|
#region Cache Header
|
|
ObjectsTemplate<OpiParameterIndividual> OpiParameterIndividuals = _cache["GetByParameterID"] as ObjectsTemplate<OpiParameterIndividual>;
|
|
if (OpiParameterIndividuals != null)
|
|
return OpiParameterIndividuals;
|
|
#endregion
|
|
try
|
|
{
|
|
OpiParameterIndividuals = Service.GetByParameterID(nParameterID);
|
|
}
|
|
catch (ServiceException e)
|
|
{
|
|
throw new Exception(e.Message, e);
|
|
}
|
|
#region Cache Footer
|
|
_cache.Add(OpiParameterIndividuals, "GetByParameterID");
|
|
#endregion
|
|
return OpiParameterIndividuals;
|
|
}
|
|
public static ObjectsTemplate<OpiParameterIndividual> GetIndividuals(ID nOpiPAramID, EnumOPIIndivdualType type)
|
|
{
|
|
#region Cache Header
|
|
ObjectsTemplate<OpiParameterIndividual> opiParamIndividuals = _cache["GetIndividuals", nOpiPAramID, type] as ObjectsTemplate<OpiParameterIndividual>;
|
|
if (opiParamIndividuals != null)
|
|
{
|
|
return opiParamIndividuals;
|
|
}
|
|
#endregion
|
|
|
|
try
|
|
{
|
|
opiParamIndividuals = Service.GetIndividuals(nOpiPAramID, type);
|
|
}
|
|
catch (ServiceException e)
|
|
{
|
|
throw new Exception(e.Message, e);
|
|
}
|
|
|
|
#region Cache Footer
|
|
|
|
_cache.Add(opiParamIndividuals, "GetIndividuals", nOpiPAramID, type);
|
|
|
|
#endregion
|
|
|
|
return opiParamIndividuals;
|
|
}
|
|
|
|
public ID Save()
|
|
{
|
|
this.SetAuditTrailProperties();
|
|
return OpiParameterIndividual.Service.Save(this, SystemInformation.CurrentSysInfo.PayrollTypeID);
|
|
}
|
|
public void Delete()
|
|
{
|
|
OpiParameterIndividual.Service.Delete(this.ID);
|
|
}
|
|
|
|
public static void BulkSave(ObjectsTemplate<OpiParameterIndividual> oParams)
|
|
{
|
|
foreach (OpiParameterIndividual item in oParams)
|
|
{
|
|
item.SetAuditTrailProperties();
|
|
}
|
|
OpiParameterIndividual.Service.BulkSave(oParams, SystemInformation.CurrentSysInfo.PayrollTypeID);
|
|
}
|
|
#endregion
|
|
|
|
#region Service Factory
|
|
internal static IOpiParameterIndividualService Service
|
|
{
|
|
get
|
|
{
|
|
return Services.Factory.CreateService<IOpiParameterIndividualService>(typeof(IOpiParameterIndividualService));
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
public OpiParameterIndividual Clone()
|
|
{
|
|
OpiParameterIndividual opiIndividual = new OpiParameterIndividual();
|
|
opiIndividual.IndividualType = this.IndividualType;
|
|
opiIndividual.OpiParameterID = this.OpiParameterID;
|
|
opiIndividual.OpiItemId = this.OpiItemId;
|
|
opiIndividual.ArrearType = this.ArrearType;
|
|
//opiIndividual.DisburseAmount = this.DisburseAmount;
|
|
opiIndividual.EmployeeId = this.EmployeeId;
|
|
opiIndividual.FromDate = this.FromDate;
|
|
opiIndividual.Value = this.Value;
|
|
opiIndividual.OpiPeriodicity = this.OpiPeriodicity;
|
|
opiIndividual.SortOrder = this.SortOrder;
|
|
opiIndividual.ToDate = this.ToDate;
|
|
//opiIndividual.TotalAmount = this.TotalAmount;
|
|
opiIndividual.ValueType = this.ValueType;
|
|
return opiIndividual;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region IOpiParameterIndividual Service
|
|
public interface IOpiParameterIndividualService
|
|
{
|
|
OpiParameterIndividual Get(ID id);
|
|
ObjectsTemplate<OpiParameterIndividual> Get();
|
|
ObjectsTemplate<OpiParameterIndividual> Get(DateTime fromdate, DateTime todate);
|
|
ObjectsTemplate<OpiParameterIndividual> GetByParameterID(ID nParameterID);
|
|
ObjectsTemplate<OpiParameterIndividual> GetIndividuals(ID nOpiPAramID, EnumOPIIndivdualType type);
|
|
ID Save(OpiParameterIndividual oOpiParameterIndividual, ID payrollTypeID);
|
|
void Delete(ID id);
|
|
void BulkSave(ObjectsTemplate<OpiParameterIndividual> oParams, ID payrollTypeID);
|
|
}
|
|
#endregion
|
|
}
|