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

195 lines
5.4 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;
using System.Data;
namespace Payroll.BO
{
[Serializable]
public class EmployeeShortLeave: BasicBaseObject
{
#region Cache Store
private static Cache _cache = new Cache(typeof(EmployeeShortLeave));
#endregion
#region Constructor
public EmployeeShortLeave()
{
}
#endregion
#region Properties
#region EmployeeID
private int _employeeID;
public int EmployeeID
{
get { return _employeeID; }
set { _employeeID = value; }
}
#endregion
#region Description
private string _description;
public string Description
{
get { return _description; }
set { _description = value; }
}
#endregion
#region FromDate
private DateTime _fromDate;
public DateTime FromDate
{
get { return _fromDate; }
set { _fromDate = value; }
}
#endregion
#region ToDate
private DateTime _toDate;
public DateTime ToDate
{
get { return _toDate; }
set { _toDate = value; }
}
#endregion
#region ShortLeaveType
private EnumShortLeaveType _shortleaveType;
public EnumShortLeaveType ShortLeaveType
{
get { return _shortleaveType; }
set { _shortleaveType = value; }
}
#endregion
#region WillReturn
private bool _willReturn;
public bool WillReturn
{
get { return _willReturn; }
set { _willReturn = value; }
}
#endregion
#endregion
#region Functions
public EmployeeShortLeave Get()
{
EmployeeShortLeave esLeave = null;
#region Cache Header
esLeave = (EmployeeShortLeave)_cache["Get"];
if (esLeave != null)
return esLeave;
#endregion
esLeave = EmployeeShortLeave.Service.Get();
#region Cache Footer
_cache.Add(esLeave, "Get");
#endregion
return esLeave;
}
public EmployeeShortLeave Get(ID sLeaveID)
{
EmployeeShortLeave esLeave = null;
#region Cache Header
esLeave = (EmployeeShortLeave)_cache["Get", sLeaveID];
if (esLeave != null)
return esLeave;
#endregion
esLeave = EmployeeShortLeave.Service.Get(sLeaveID);
#region Cache Footer
_cache.Add(esLeave, "Get", sLeaveID);
#endregion
return esLeave;
}
public EmployeeShortLeave GetByType(int sLType)
{
EmployeeShortLeave esLeave = null;
#region Cache Header
esLeave = (EmployeeShortLeave)_cache["Get", sLType];
if (esLeave != null)
return esLeave;
#endregion
esLeave = EmployeeShortLeave.Service.GetByType(sLType);
#region Cache Footer
_cache.Add(esLeave, "Get", sLType);
#endregion
return esLeave;
}
public EmployeeShortLeave GetByEmpID(int employeeID)
{
EmployeeShortLeave esLeave = null;
#region Cache Header
esLeave = (EmployeeShortLeave)_cache["Get", employeeID];
if (esLeave != null)
return esLeave;
#endregion
esLeave = EmployeeShortLeave.Service.GetByEmpID(employeeID);
#region Cache Footer
_cache.Add(esLeave, "Get", employeeID);
#endregion
return esLeave;
}
public ID Save()
{
this.SetAuditTrailProperties();
return EmployeeShortLeave.Service.Save(this);
}
public void Delete(ID id)
{
EmployeeShortLeave.Service.Delete(id);
}
//public void Delete()
//{
// EmployeeShortLeave.Service.Delete(this.ID);
//}
public static ObjectsTemplate<EmployeeShortLeave> GetByEmp(int employeeID)
{
ObjectsTemplate<EmployeeShortLeave> Leaves = null;
Leaves = EmployeeShortLeave.Service.GetByEmp(employeeID);
return Leaves;
}
public static DataSet GetEmployeeWiseShortLeaveReport(int empId)
{
return EmployeeShortLeave.Service.GetEmployeeWiseShortLeaveReport(empId);
}
#endregion
#region Service Factory
internal static IEmployeeShortLeaveService Service
{
get { return Services.Factory.CreateService<IEmployeeShortLeaveService>(typeof(IEmployeeShortLeaveService)); }
}
#endregion
}
#region IEmployeeShortLeave Service
public interface IEmployeeShortLeaveService
{
EmployeeShortLeave Get();
EmployeeShortLeave Get(ID id);
EmployeeShortLeave GetByType(int sLType);
EmployeeShortLeave GetByEmpID(int employeeID);
ObjectsTemplate<EmployeeShortLeave> GetByEmp(int employeeID);
DataSet GetEmployeeWiseShortLeaveReport(int empId);
ID Save(EmployeeShortLeave oLeave);
void Delete(ID id);
}
#endregion
}