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 CarFuelParameterIndividual
|
|||
|
[Serializable]
|
|||
|
public class CarFuelParameterIndividual : BasicBaseObject
|
|||
|
{
|
|||
|
#region Cache Store
|
|||
|
private static Cache _cache = new Cache(typeof(CarFuelParameterIndividual));
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Constructor
|
|||
|
public CarFuelParameterIndividual()
|
|||
|
{
|
|||
|
_CarFuelParameterID = null;
|
|||
|
_CarFuelItemId = null;
|
|||
|
_CarFuelPeriodicity = EnumCarFuelPeriodicity.OnceOff;
|
|||
|
_employeeId = null;
|
|||
|
_fromDate = DateTime.MinValue;
|
|||
|
_toDate = DateTime.MinValue;
|
|||
|
_arrearType = EnumArrearType.NotPresent;
|
|||
|
_employee = null;
|
|||
|
_individualType = EnumCarFuelIndivdualType.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 : EnumCarFuelIndivdualType
|
|||
|
private EnumCarFuelIndivdualType _individualType;
|
|||
|
public EnumCarFuelIndivdualType IndividualType
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return _individualType;
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<short>("individualtype", (short)_individualType, (short)value);
|
|||
|
_individualType = value;
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region CarFuelItemId : ID
|
|||
|
private ID _CarFuelItemId;
|
|||
|
public ID CarFuelItemId
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return _CarFuelItemId;
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<ID>("CarFuelitemid", _CarFuelItemId, value);
|
|||
|
_CarFuelItemId = value;
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region CarFuelParameterID : ID
|
|||
|
private ID _CarFuelParameterID;
|
|||
|
public ID CarFuelParameterID
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return _CarFuelParameterID;
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<ID>("CarFuelparameterid", _CarFuelParameterID, value);
|
|||
|
_CarFuelParameterID = value;
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region CarFuelPeriodicity : EnumCarFuelPeriodicity
|
|||
|
private EnumCarFuelPeriodicity _CarFuelPeriodicity;
|
|||
|
public EnumCarFuelPeriodicity CarFuelPeriodicity
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return _CarFuelPeriodicity;
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
_CarFuelPeriodicity = 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 CarFuelParameterIndividual Get(ID nCarFuelParameterIndividualID)
|
|||
|
{
|
|||
|
CarFuelParameterIndividual oCarFuelParameterIndividual = null;
|
|||
|
#region Cache Header
|
|||
|
oCarFuelParameterIndividual = (CarFuelParameterIndividual)_cache["Get", nCarFuelParameterIndividualID];
|
|||
|
if (oCarFuelParameterIndividual != null)
|
|||
|
return oCarFuelParameterIndividual;
|
|||
|
#endregion
|
|||
|
oCarFuelParameterIndividual = CarFuelParameterIndividual.Service.Get(nCarFuelParameterIndividualID);
|
|||
|
#region Cache Footer
|
|||
|
_cache.Add(oCarFuelParameterIndividual, "Get", nCarFuelParameterIndividualID);
|
|||
|
#endregion
|
|||
|
return oCarFuelParameterIndividual;
|
|||
|
}
|
|||
|
public static ObjectsTemplate<CarFuelParameterIndividual> Get()
|
|||
|
{
|
|||
|
#region Cache Header
|
|||
|
ObjectsTemplate<CarFuelParameterIndividual> CarFuelParameterIndividuals = _cache["Get"] as ObjectsTemplate<CarFuelParameterIndividual>;
|
|||
|
if (CarFuelParameterIndividuals != null)
|
|||
|
return CarFuelParameterIndividuals;
|
|||
|
#endregion
|
|||
|
try
|
|||
|
{
|
|||
|
CarFuelParameterIndividuals = Service.Get();
|
|||
|
}
|
|||
|
catch (ServiceException e)
|
|||
|
{
|
|||
|
throw new Exception(e.Message, e);
|
|||
|
}
|
|||
|
#region Cache Footer
|
|||
|
_cache.Add(CarFuelParameterIndividuals, "Get");
|
|||
|
#endregion
|
|||
|
return CarFuelParameterIndividuals;
|
|||
|
}
|
|||
|
public static ObjectsTemplate<CarFuelParameterIndividual> GetByParameterID(ID nParameterID)
|
|||
|
{
|
|||
|
#region Cache Header
|
|||
|
ObjectsTemplate<CarFuelParameterIndividual> CarFuelParameterIndividuals = _cache["GetByParameterID"] as ObjectsTemplate<CarFuelParameterIndividual>;
|
|||
|
if (CarFuelParameterIndividuals != null)
|
|||
|
return CarFuelParameterIndividuals;
|
|||
|
#endregion
|
|||
|
try
|
|||
|
{
|
|||
|
CarFuelParameterIndividuals = Service.GetByParameterID(nParameterID);
|
|||
|
}
|
|||
|
catch (ServiceException e)
|
|||
|
{
|
|||
|
throw new Exception(e.Message, e);
|
|||
|
}
|
|||
|
#region Cache Footer
|
|||
|
_cache.Add(CarFuelParameterIndividuals, "GetByParameterID");
|
|||
|
#endregion
|
|||
|
return CarFuelParameterIndividuals;
|
|||
|
}
|
|||
|
public static ObjectsTemplate<CarFuelParameterIndividual> GetIndividuals(ID nCarFuelPAramID, EnumCarFuelIndivdualType type)
|
|||
|
{
|
|||
|
#region Cache Header
|
|||
|
ObjectsTemplate<CarFuelParameterIndividual> CarFuelParamIndividuals = _cache["GetIndividuals", nCarFuelPAramID, type] as ObjectsTemplate<CarFuelParameterIndividual>;
|
|||
|
if (CarFuelParamIndividuals != null)
|
|||
|
{
|
|||
|
return CarFuelParamIndividuals;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
CarFuelParamIndividuals = Service.GetIndividuals(nCarFuelPAramID, type);
|
|||
|
}
|
|||
|
catch (ServiceException e)
|
|||
|
{
|
|||
|
throw new Exception(e.Message, e);
|
|||
|
}
|
|||
|
|
|||
|
#region Cache Footer
|
|||
|
|
|||
|
_cache.Add(CarFuelParamIndividuals, "GetIndividuals", nCarFuelPAramID, type);
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
return CarFuelParamIndividuals;
|
|||
|
}
|
|||
|
|
|||
|
public ID Save()
|
|||
|
{
|
|||
|
this.SetAuditTrailProperties();
|
|||
|
return CarFuelParameterIndividual.Service.Save(this);
|
|||
|
}
|
|||
|
public void Delete()
|
|||
|
{
|
|||
|
CarFuelParameterIndividual.Service.Delete(this.ID);
|
|||
|
}
|
|||
|
|
|||
|
public static void BulkSave(ObjectsTemplate<CarFuelParameterIndividual> oParams)
|
|||
|
{
|
|||
|
foreach (CarFuelParameterIndividual item in oParams)
|
|||
|
{
|
|||
|
item.SetAuditTrailProperties();
|
|||
|
}
|
|||
|
CarFuelParameterIndividual.Service.BulkSave(oParams);
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Service Factory
|
|||
|
internal static ICarFuelParameterIndividualService Service
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return Services.Factory.CreateService<ICarFuelParameterIndividualService>(typeof(ICarFuelParameterIndividualService));
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
public CarFuelParameterIndividual Clone()
|
|||
|
{
|
|||
|
CarFuelParameterIndividual CarFuelIndividual = new CarFuelParameterIndividual();
|
|||
|
CarFuelIndividual.IndividualType = this.IndividualType;
|
|||
|
CarFuelIndividual.CarFuelParameterID = this.CarFuelParameterID;
|
|||
|
CarFuelIndividual.CarFuelItemId = this.CarFuelItemId;
|
|||
|
CarFuelIndividual.ArrearType = this.ArrearType;
|
|||
|
//CarFuelIndividual.DisburseAmount = this.DisburseAmount;
|
|||
|
CarFuelIndividual.EmployeeId = this.EmployeeId;
|
|||
|
CarFuelIndividual.FromDate = this.FromDate;
|
|||
|
CarFuelIndividual.Value = this.Value;
|
|||
|
CarFuelIndividual.CarFuelPeriodicity = this.CarFuelPeriodicity;
|
|||
|
CarFuelIndividual.SortOrder = this.SortOrder;
|
|||
|
CarFuelIndividual.ToDate = this.ToDate;
|
|||
|
//CarFuelIndividual.TotalAmount = this.TotalAmount;
|
|||
|
CarFuelIndividual.ValueType = this.ValueType;
|
|||
|
return CarFuelIndividual;
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region ICarFuelParameterIndividual Service
|
|||
|
public interface ICarFuelParameterIndividualService
|
|||
|
{
|
|||
|
CarFuelParameterIndividual Get(ID id);
|
|||
|
ObjectsTemplate<CarFuelParameterIndividual> Get();
|
|||
|
ObjectsTemplate<CarFuelParameterIndividual> Get(DateTime fromdate, DateTime todate);
|
|||
|
ObjectsTemplate<CarFuelParameterIndividual> GetByParameterID(ID nParameterID);
|
|||
|
ObjectsTemplate<CarFuelParameterIndividual> GetIndividuals(ID nCarFuelPAramID, EnumCarFuelIndivdualType type);
|
|||
|
ID Save(CarFuelParameterIndividual oCarFuelParameterIndividual);
|
|||
|
void Delete(ID id);
|
|||
|
void BulkSave(ObjectsTemplate<CarFuelParameterIndividual> oParams);
|
|||
|
}
|
|||
|
#endregion
|
|||
|
}
|