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 Get() { #region Cache Header ObjectsTemplate employeeOutsideOffice = _cache["Get"] as ObjectsTemplate; 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 GetByEmpID(int empID) { #region Cache Header ObjectsTemplate employeeOutsideOffice = _cache["Get", empID] as ObjectsTemplate; 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 GetByEffectDate(DateTime effectDate) { #region Cache Header ObjectsTemplate employeeOutsideOffice = _cache["Get", effectDate] as ObjectsTemplate; 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 _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(typeof(IEmployeeOutsideOfficeService)); } } #endregion } #region IEmployeeOutsideOffice Service public interface IEmployeeOutsideOfficeService { ObjectsTemplate Get(); ObjectsTemplate GetByEmpID(int id); ObjectsTemplate GetByEffectDate(DateTime effectDate); ID Save(EmployeeOutsideOffice employeeOutsideOffice); void SaveAll(ObjectsTemplate _employeesOutsideOffice); void Delete(ID id); } #endregion }