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

250 lines
6.7 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using Ease.CoreV35.Caching;
using System.Text;
using Ease.CoreV35.Model;
using Ease.CoreV35;
namespace Payroll.BO
{
[Serializable]
public class ChildrenEducation : BasicBaseObject
{
#region Cache Store
private static Cache _cache = new Cache(typeof(ChildrenEducation));
#endregion
#region ctor(s)
public ChildrenEducation()
{
_amount = 0;
_noOfChildren = 0;
_fromMonth = DateTime.MinValue;
//_employeeID = 0;
}
#endregion
#region Propertise
#region ChildrenEducationID:ID
private ID _childrenEducationID;
public ID ChildrenEducationID
{
get { return _childrenEducationID; }
set
{
base.OnPropertyChange<ID>("ChildrenEducationID", _childrenEducationID, value);
_childrenEducationID = value;
}
}
#endregion
#region From Month: DateTime
private DateTime _fromMonth;
public DateTime FromMonth
{
get { return _fromMonth; }
set
{
base.OnPropertyChange<DateTime>("FromMonth", _fromMonth, value);
_fromMonth = value;
}
}
#endregion
#region NoOfChildren: Int
private int _noOfChildren;
public int NoOfChildren
{
get { return _noOfChildren; }
set
{
base.OnPropertyChange<int>("NoOfChildren", _noOfChildren, value);
_noOfChildren = value;
}
}
#endregion
#region Amount:double
private double _amount;
public double Amount
{
get { return _amount; }
set
{
base.OnPropertyChange<double>("Amount", _amount, value);
_amount = value;
}
}
#endregion
#region EmployeeID: ID
private ID _employeeID;
public ID EmployeeID
{
get { return _employeeID; }
set
{
base.OnPropertyChange<ID>("EmployeeID", _employeeID, value);
_employeeID = value;
}
}
#endregion
#endregion
#region Functions
public ID Save()
{
this.SetAuditTrailProperties();
return ChildrenEducation.Service.Save(this);
}
public void Save(ObjectsTemplate<ChildrenEducation> oChildrenEducations)
{
foreach (ChildrenEducation oCEAllow in oChildrenEducations)
{
oCEAllow.SetAuditTrailProperties();
}
ChildrenEducation.Service.Save(oChildrenEducations);
}
public void Save(ObjectsTemplate<ChildrenEducation> oChildrenEducations, ObjectsTemplate<ADParameterEmployee> adParamEmployees)
{
foreach (ChildrenEducation oCEAllow in oChildrenEducations)
{
oCEAllow.SetAuditTrailProperties();
}
ChildrenEducation.Service.Save(oChildrenEducations, adParamEmployees);
}
public void Save(ChildrenEducation oChildrenEducation, ADParameterEmployee adParamEmployee)
{
oChildrenEducation.SetAuditTrailProperties();
ChildrenEducation.Service.Save(oChildrenEducation, adParamEmployee);
}
public void Delete(ID id)
{
ChildrenEducation.Service.Delete(id);
}
public static ObjectsTemplate<ChildrenEducation> Get(DateTime date)
{
#region Cache Header
ObjectsTemplate<ChildrenEducation> aChildrenEducation = _cache["Get"] as ObjectsTemplate<ChildrenEducation>;
#endregion
try
{
aChildrenEducation = Service.Get(date);
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
#region Cache Footer
_cache.Add(aChildrenEducation, "Get");
#endregion
return aChildrenEducation;
}
public static ObjectsTemplate<ChildrenEducation> Get()
{
#region Cache Header
ObjectsTemplate<ChildrenEducation> childrenEducations = _cache["Get"] as ObjectsTemplate<ChildrenEducation>;
if (childrenEducations != null)
return childrenEducations;
#endregion
try
{
childrenEducations = Service.Get();
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(childrenEducations, "Get");
#endregion
return childrenEducations;
}
public static ChildrenEducation Get(ID nID)
{
ChildrenEducation oChildrenEducation = null;
#region Cache Header
oChildrenEducation = (ChildrenEducation)_cache["Get", nID];
if (oChildrenEducation != null)
return oChildrenEducation;
#endregion
oChildrenEducation = ChildrenEducation.Service.Get(nID);
#region Cache Footer
_cache.Add(oChildrenEducation, "Get", nID);
#endregion
return oChildrenEducation;
}
public bool IsExist(ChildrenEducation childrenEducation)
{
try
{
return Service.IsExist(childrenEducation);
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
}
#region Service Factory IChildrenEducationService: IChildrenEducationService
internal static IChildrenEducationService Service
{
get { return Services.Factory.CreateService<IChildrenEducationService>(typeof(IChildrenEducationService)); }
}
#endregion
#endregion
}
#region IChildrenEducation Service
public interface IChildrenEducationService
{
void Save(ChildrenEducation oChildrenEducation, ADParameterEmployee adParamEmployee);
void Save(ObjectsTemplate<ChildrenEducation> oChildrenEducations, ObjectsTemplate<ADParameterEmployee> adParamEmployees);
void Save(ObjectsTemplate<ChildrenEducation> oChildrenEducations);
ID Save(ChildrenEducation item);
void Delete(ID id);
ChildrenEducation Get(ID id);
ObjectsTemplate<ChildrenEducation> Get();
ObjectsTemplate<ChildrenEducation> Get(DateTime date);
bool IsExist(ChildrenEducation ChildrenEducation);
}
#endregion
}