CEL_Payroll/Payroll.BO/OPI/OpiParameterGrade.cs

167 lines
4.4 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;
using Ease.CoreV35.Model;
using Ease.CoreV35.Caching;
using System.Data.Linq.Mapping;
namespace Payroll.BO
{
#region OpiParameterGrade
[Serializable]
public class OpiParameterGrade : BasicBaseObject
{
#region Cache Store
private static Cache _cache = new Cache(typeof(OpiParameterGrade));
#endregion
#region Constructor
public OpiParameterGrade()
{
_gradeId = null;
_opiItemId = null;
_opiParameterId = null;
_garde = null;
}
#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 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 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 OpiParameterGrade Get(ID nOpiParameterGradeID)
{
OpiParameterGrade oOpiParameterGrade = null;
#region Cache Header
oOpiParameterGrade = (OpiParameterGrade)_cache["Get", nOpiParameterGradeID];
if (oOpiParameterGrade != null)
return oOpiParameterGrade;
#endregion
oOpiParameterGrade = OpiParameterGrade.Service.Get(nOpiParameterGradeID);
#region Cache Footer
_cache.Add(oOpiParameterGrade, "Get", nOpiParameterGradeID);
#endregion
return oOpiParameterGrade;
}
public static ObjectsTemplate<OpiParameterGrade> Get()
{
#region Cache Header
ObjectsTemplate<OpiParameterGrade> OpiParameterGrades = _cache["Get"] as ObjectsTemplate<OpiParameterGrade>;
if (OpiParameterGrades != null)
return OpiParameterGrades;
#endregion
try
{
OpiParameterGrades = Service.Get();
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(OpiParameterGrades, "Get");
#endregion
return OpiParameterGrades;
}
public ID Save()
{
this.SetAuditTrailProperties();
return OpiParameterGrade.Service.Save(this);
}
public void Delete()
{
OpiParameterGrade.Service.Delete(this.ID);
}
#endregion
#region Service Factory
internal static IOpiParameterGradeService Service
{
get
{
return Services.Factory.CreateService<IOpiParameterGradeService>(typeof(IOpiParameterGradeService));
}
}
#endregion
}
#endregion
#region IOpiParameterGrade Service
public interface IOpiParameterGradeService
{
OpiParameterGrade Get(ID id);
ObjectsTemplate<OpiParameterGrade> Get();
ID Save(OpiParameterGrade oOpiParameterGrade);
void Delete(ID id);
}
#endregion
}