166 lines
5.0 KiB
C#
166 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;
|
|
using System.Data;
|
|
|
|
namespace Payroll.BO
|
|
{
|
|
[Serializable]
|
|
public class EmployeeOutsideOffice : BasicBaseObject
|
|
{
|
|
#region Cache Store
|
|
private static Cache _cache = new Cache(typeof(EmployeeOutsideOffice));
|
|
#endregion
|
|
|
|
#region Constructor
|
|
public EmployeeOutsideOffice()
|
|
{
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region Properties
|
|
#region EmployeeID
|
|
private int _employeeID;
|
|
public int EmployeeID
|
|
{
|
|
get { return _employeeID; }
|
|
set { _employeeID = value; }
|
|
}
|
|
#endregion
|
|
#region EmailAddress
|
|
private string _emailAddress;
|
|
public string EmailAddress
|
|
{
|
|
get { return _emailAddress; }
|
|
set { _emailAddress = value; }
|
|
}
|
|
#endregion
|
|
#region EffectDate
|
|
private DateTime _effectDate;
|
|
public DateTime EffectDate
|
|
{
|
|
get { return _effectDate; }
|
|
set { _effectDate = value; }
|
|
}
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
#region Functions
|
|
|
|
|
|
public static ObjectsTemplate<EmployeeOutsideOffice> Get()
|
|
{
|
|
#region Cache Header
|
|
ObjectsTemplate<EmployeeOutsideOffice> employeeOutsideOffice = _cache["Get"] as ObjectsTemplate<EmployeeOutsideOffice>;
|
|
if (employeeOutsideOffice != null)
|
|
return employeeOutsideOffice;
|
|
#endregion
|
|
try
|
|
{
|
|
employeeOutsideOffice = EmployeeOutsideOffice.Service.Get();
|
|
}
|
|
catch (ServiceException e)
|
|
{
|
|
throw new Exception(e.Message, e);
|
|
}
|
|
#region Cache Footer
|
|
_cache.Add(employeeOutsideOffice, "Get");
|
|
#endregion
|
|
return employeeOutsideOffice;
|
|
}
|
|
public static ObjectsTemplate<EmployeeOutsideOffice> GetByEmpID(int empID)
|
|
{
|
|
#region Cache Header
|
|
ObjectsTemplate<EmployeeOutsideOffice> employeeOutsideOffice = _cache["Get", empID] as ObjectsTemplate<EmployeeOutsideOffice>;
|
|
if (employeeOutsideOffice != null)
|
|
return employeeOutsideOffice;
|
|
#endregion
|
|
try
|
|
{
|
|
employeeOutsideOffice = EmployeeOutsideOffice.Service.GetByEmpID(empID);
|
|
}
|
|
catch (ServiceException e)
|
|
{
|
|
throw new Exception(e.Message, e);
|
|
}
|
|
#region Cache Footer
|
|
_cache.Add(employeeOutsideOffice, "Get", empID);
|
|
#endregion
|
|
return employeeOutsideOffice;
|
|
}
|
|
public static ObjectsTemplate<EmployeeOutsideOffice> GetByEffectDate(DateTime effectDate)
|
|
{
|
|
#region Cache Header
|
|
ObjectsTemplate<EmployeeOutsideOffice> employeeOutsideOffice = _cache["Get", effectDate] as ObjectsTemplate<EmployeeOutsideOffice>;
|
|
if (employeeOutsideOffice != null)
|
|
return employeeOutsideOffice;
|
|
#endregion
|
|
try
|
|
{
|
|
employeeOutsideOffice = EmployeeOutsideOffice.Service.GetByEffectDate(effectDate);
|
|
}
|
|
catch (ServiceException e)
|
|
{
|
|
throw new Exception(e.Message, e);
|
|
}
|
|
#region Cache Footer
|
|
_cache.Add(employeeOutsideOffice, "Get", effectDate);
|
|
#endregion
|
|
return employeeOutsideOffice;
|
|
}
|
|
|
|
public ID Save()
|
|
{
|
|
this.SetAuditTrailProperties();
|
|
return EmployeeOutsideOffice.Service.Save(this);
|
|
}
|
|
|
|
public static void SaveAll(ObjectsTemplate<EmployeeOutsideOffice> _employeesOutsideOffice)
|
|
{
|
|
foreach (EmployeeOutsideOffice employeeOutsideOffice in _employeesOutsideOffice)
|
|
{
|
|
employeeOutsideOffice.SetAuditTrailProperties();
|
|
}
|
|
EmployeeOutsideOffice.Service.SaveAll(_employeesOutsideOffice);
|
|
}
|
|
|
|
public void Delete(ID id)
|
|
{
|
|
EmployeeOutsideOffice.Service.Delete(id);
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
#region Service Factory
|
|
internal static IEmployeeOutsideOfficeService Service
|
|
{
|
|
get { return Services.Factory.CreateService<IEmployeeOutsideOfficeService>(typeof(IEmployeeOutsideOfficeService)); }
|
|
}
|
|
#endregion
|
|
}
|
|
|
|
#region IEmployeeOutsideOffice Service
|
|
|
|
|
|
public interface IEmployeeOutsideOfficeService
|
|
{
|
|
ObjectsTemplate<EmployeeOutsideOffice> Get();
|
|
ObjectsTemplate<EmployeeOutsideOffice> GetByEmpID(int id);
|
|
ObjectsTemplate<EmployeeOutsideOffice> GetByEffectDate(DateTime effectDate);
|
|
ID Save(EmployeeOutsideOffice employeeOutsideOffice);
|
|
void SaveAll(ObjectsTemplate<EmployeeOutsideOffice> _employeesOutsideOffice);
|
|
void Delete(ID id);
|
|
|
|
}
|
|
|
|
#endregion
|
|
}
|