using System; using System.Collections.Generic; using System.Linq; using Ease.CoreV35.Caching; using Ease.CoreV35.Model; using Ease.CoreV35; using System.Text; namespace Payroll.BO { [Serializable] public class MonthlyWorkingHour:BasicBaseObject { #region Cache Store private static Cache _cache = new Cache(typeof(MonthlyWorkingHour)); #endregion #region ctor(s) #endregion #region Propertise #region WorkingMonth:DateTime private DateTime _workingMonth; public DateTime WorkingMonth { get { return _workingMonth; } set { base.OnPropertyChange("WorkingMonth", _workingMonth, value); _workingMonth = value; } } #endregion #region EmployeeID:ID private ID _employeeID; public ID EmployeeID { get { return _employeeID; } set { base.OnPropertyChange("EmployeeID", _employeeID, value); _employeeID = value; } } #endregion #region Regular Hour: double private double _regularHour; public double RegularHour { get { return _regularHour; } set { base.OnPropertyChange("RegularHour", _regularHour, value); _regularHour = value; } } #endregion #region Special Hour:double private double _specialHour; public double SpecialHour { get { return _specialHour; } set { base.OnPropertyChange("SpecialHour", _specialHour, value); _specialHour = value; } } #endregion #endregion #region Functions public ID Save() { this.SetAuditTrailProperties(); return MonthlyWorkingHour.Service.Save(this); } public void Save(ObjectsTemplate items) { MonthlyWorkingHour.Service.Save(items); } void Delete(ID id) { MonthlyWorkingHour.Service.Delete(id); } public static ObjectsTemplate Get() { #region Cache Header ObjectsTemplate monthlyWorkingHours = _cache["Get"] as ObjectsTemplate; if (monthlyWorkingHours != null) return monthlyWorkingHours; #endregion try { monthlyWorkingHours = Service.Get(); } catch (ServiceException e) { throw new Exception(e.Message, e); } #region Cache Footer _cache.Add(monthlyWorkingHours, "Get"); #endregion return monthlyWorkingHours; } public static ObjectsTemplate Get(DateTime date) { #region Cache Header ObjectsTemplate monthlyWorkingHours=_cache["Get"] as ObjectsTemplate; #endregion try { monthlyWorkingHours = Service.Get(date); } catch (ServiceException e) { throw new Exception(e.Message, e); } #region Cache Footer _cache.Add(monthlyWorkingHours, "Get"); #endregion return monthlyWorkingHours; } public static MonthlyWorkingHour Get(ID nID) { MonthlyWorkingHour oMonthlyWorkingHour = null; #region Cache Header oMonthlyWorkingHour = (MonthlyWorkingHour)_cache["Get", nID]; if (oMonthlyWorkingHour != null) return oMonthlyWorkingHour; #endregion oMonthlyWorkingHour = MonthlyWorkingHour.Service.Get(nID); #region Cache Footer _cache.Add(oMonthlyWorkingHour, "Get", nID); #endregion return oMonthlyWorkingHour; } public bool IsExist(MonthlyWorkingHour monthlyWorkingHour) { try { return Service.IsExist(monthlyWorkingHour); } catch (ServiceException e) { throw new Exception(e.Message, e); } } #region Service Factory IMonthlyWorkingHourService: IMonthlyWorkingHourService internal static IMonthlyWorkingHourService Service { get { return Services.Factory.CreateService(typeof(IMonthlyWorkingHourService)); } } #endregion #endregion } #region IMonthlyWorkingHour Service public interface IMonthlyWorkingHourService { ID Save(MonthlyWorkingHour item); void Delete(ID id); MonthlyWorkingHour Get(ID id); ObjectsTemplate Get(); ObjectsTemplate Get(DateTime date); bool IsExist(MonthlyWorkingHour monthlyWorkingHour); void Save(ObjectsTemplate items); } #endregion }