CEL_Payroll/Payroll.BO/CarFuel/CarFuelParameterGrade.cs
2024-09-17 14:30:13 +06:00

183 lines
5.0 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 CarFuelParameterGrade
[Serializable]
public class CarFuelParameterGrade : BasicBaseObject
{
#region Cache Store
private static Cache _cache = new Cache(typeof(CarFuelParameterGrade));
#endregion
#region Constructor
public CarFuelParameterGrade()
{
_gradeId = null;
_CarFuelItemId = null;
_CarFuelParameterId = null;
_garde = null;
_payrollTypeID = SystemInformation.CurrentSysInfo.PayrollTypeID;
}
#endregion
#region Properties
#region GradeId : ID
private ID _gradeId;
public ID GradeId
{
get
{
return _gradeId ;
}
set
{
base.OnPropertyChange<ID>("gradeid", _gradeId, value);
_gradeId = 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 payrollTypeID : ID
private ID _payrollTypeID;
public ID PayrollTypeID
{
get { return _payrollTypeID; }
set
{
base.OnPropertyChange<ID>("payrollTypeID", _payrollTypeID, value);
_payrollTypeID = value;
}
}
#endregion
#region Garde : Grade
private Grade _garde;
public Grade Garde
{
get
{
if (_gradeId.Integer > 0 && _garde == null)
{
_garde = Grade.Get(_gradeId);
}
return this._garde;
}
set
{
_garde = value;
}
}
#endregion
#endregion
#region Functions
public CarFuelParameterGrade Get(ID nCarFuelParameterGradeID)
{
CarFuelParameterGrade oCarFuelParameterGrade = null;
#region Cache Header
oCarFuelParameterGrade = (CarFuelParameterGrade)_cache["Get", nCarFuelParameterGradeID];
if (oCarFuelParameterGrade != null)
return oCarFuelParameterGrade;
#endregion
oCarFuelParameterGrade = CarFuelParameterGrade.Service.Get(nCarFuelParameterGradeID);
#region Cache Footer
_cache.Add(oCarFuelParameterGrade, "Get", nCarFuelParameterGradeID);
#endregion
return oCarFuelParameterGrade;
}
public static ObjectsTemplate<CarFuelParameterGrade> Get()
{
#region Cache Header
ObjectsTemplate<CarFuelParameterGrade> CarFuelParameterGrades = _cache["Get"] as ObjectsTemplate<CarFuelParameterGrade>;
if (CarFuelParameterGrades != null)
return CarFuelParameterGrades;
#endregion
try
{
CarFuelParameterGrades = Service.Get();
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(CarFuelParameterGrades, "Get");
#endregion
return CarFuelParameterGrades;
}
public ID Save()
{
this.SetAuditTrailProperties();
return CarFuelParameterGrade.Service.Save(this);
}
public void Delete()
{
CarFuelParameterGrade.Service.Delete(this.ID);
}
#endregion
#region Service Factory
internal static ICarFuelParameterGradeService Service
{
get
{
return Services.Factory.CreateService<ICarFuelParameterGradeService>(typeof(ICarFuelParameterGradeService));
}
}
#endregion
}
#endregion
#region ICarFuelParameterGrade Service
public interface ICarFuelParameterGradeService
{
CarFuelParameterGrade Get(ID id);
ObjectsTemplate<CarFuelParameterGrade> Get();
ID Save(CarFuelParameterGrade oCarFuelParameterGrade);
void Delete(ID id);
}
#endregion
}