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

155 lines
4.3 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 LeaveException
[Serializable]
public class LeaveException : BasicBaseObject
{
#region Cache Store
private static Cache _cache = new Cache(typeof(LeaveException));
#endregion
#region Constructor
public LeaveException()
{
_nEmployeeID = 0;
_dStartDate = DateTime.Today;
_dEndDate = DateTime.Today;
_nLeaveID = 0;
_nOpeningBalance = 0;
_nMaxDays = 0;
_nCFDays = 0;
}
#endregion
#region Properties
#region EmployeeID
private int _nEmployeeID;
public int EmployeeID
{
get { return _nEmployeeID; }
set { _nEmployeeID = value; }
}
#endregion
#region StartDate
private DateTime _dStartDate;
public DateTime StartDate
{
get { return _dStartDate; }
set { _dStartDate = value; }
}
#endregion
#region EndDate
private DateTime _dEndDate;
public DateTime EndDate
{
get { return _dEndDate; }
set { _dEndDate = value; }
}
#endregion
#region LeaveID
private int _nLeaveID;
public int LeaveID
{
get { return _nLeaveID; }
set { _nLeaveID = value; }
}
#endregion
#region OpeningBalance
private double _nOpeningBalance;
public double OpeningBalance
{
get { return _nOpeningBalance; }
set { _nOpeningBalance = value; }
}
#endregion
#region MaxDays
private double _nMaxDays;
public double MaxDays
{
get { return _nMaxDays; }
set { _nMaxDays = value; }
}
#endregion
#region CFDays
private double _nCFDays;
public double CFDays
{
get { return _nCFDays; }
set { _nCFDays = value; }
}
#endregion
#endregion
#region Functions
public ID Save()
{
this.SetAuditTrailProperties();
return LeaveException.Service.Save(this);
}
public void DeleteByLeaveID()
{
LeaveException.Service.DeleteByLeaveID(this.LeaveID);
}
public void Delete()
{
LeaveException.Service.DeleteItem(this.ID.Integer);
}
public static ObjectsTemplate<LeaveException> Get(DateTime dFrom,DateTime dTo)
{
#region Cache Header
ObjectsTemplate<LeaveException> Leaves = _cache["Get"] as ObjectsTemplate<LeaveException>;
if (Leaves != null)
return Leaves;
#endregion
Leaves = LeaveException.Service.Get(dFrom, dTo);
#region Cache Footer
_cache.Add(Leaves, "Get");
#endregion
return Leaves;
}
public static ObjectsTemplate<LeaveException> GetByEmpID(int nLeaveID,int nEmpID)
{
#region Cache Header
ObjectsTemplate<LeaveException> Leaves = _cache["GetByEmpID"] as ObjectsTemplate<LeaveException>;
if (Leaves != null)
return Leaves;
#endregion
Leaves = LeaveException.Service.GetByEmpID(nLeaveID,nEmpID);
#region Cache Footer
_cache.Add(Leaves, "GetByEmpID");
#endregion
return Leaves;
}
#endregion
#region Service Factory
internal static ILeaveExceptionService Service
{
get { return Services.Factory.CreateService<ILeaveExceptionService>(typeof(ILeaveExceptionService)); }
}
#endregion
}
#endregion
#region ILeaveException Service
public interface ILeaveExceptionService
{
ID Save(LeaveException oLeave);
void DeleteByLeaveID(int nLeaveID);
void DeleteItem(int nID);
ObjectsTemplate<LeaveException> Get(DateTime dFrom, DateTime dTo);
ObjectsTemplate<LeaveException> GetByEmpID(int nLeaveID,int nEmpID);
}
#endregion
}