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 Capitalization : BasicBaseObject { #region Cache Store private static Cache _cache = new Cache(typeof(Capitalization)); #endregion #region Constructor public Capitalization() { _salaryMonth = DateTime.MinValue; _departmentID = null; _percent = 0; } #endregion #region Properties #region SalaryMonth : DateTime private DateTime _salaryMonth; public DateTime SalaryMonth { get { return _salaryMonth; } set { base.OnPropertyChange("SalaryMonth", _salaryMonth, value); _salaryMonth = value; } } #endregion #region DepartmentID : ID private ID _departmentID; public ID DepartmentID { get { return _departmentID; } set { base.OnPropertyChange("DepartmentID", _departmentID, value); _departmentID = value; } } #endregion #region Percent : Double private double _percent; public double Percent { get { return _percent; } set { base.OnPropertyChange("Percent", _percent, value); _percent = value; } } #endregion #endregion #region Service Factory ICapitalizationService : ICapitalizationService internal static ICapitalizationService Service { get { return Services.Factory.CreateService(typeof(ICapitalizationService)); } } #endregion public static ObjectsTemplate Get() { #region cache header ObjectsTemplate capitalizations = _cache["Get"] as ObjectsTemplate; if (capitalizations != null) return capitalizations; #endregion try { capitalizations = Service.Get(); } catch (ServiceException e) { throw new Exception(e.Message, e); } #region cache footer _cache.Add(capitalizations, "Get"); #endregion return capitalizations; } public static ObjectsTemplate Get(DateTime sMonth) { #region cache header ObjectsTemplate capitalizations = _cache["Get"] as ObjectsTemplate; if (capitalizations != null) return capitalizations; #endregion try { capitalizations = Service.Get(sMonth); } catch (ServiceException e) { throw new Exception(e.Message, e); } #region cache footer _cache.Add(capitalizations, "Get"); #endregion return capitalizations; } public static ObjectsTemplate Get(ID departmetID) { #region cache header ObjectsTemplate capitalizations = _cache["Get"] as ObjectsTemplate; if (capitalizations != null) return capitalizations; #endregion try { capitalizations = Service.Get(departmetID); } catch (ServiceException e) { throw new Exception(e.Message, e); } #region cache footer _cache.Add(capitalizations, "Get"); #endregion return capitalizations; } public static Capitalization Get(ID departmetID, DateTime sMonth) { #region cache header Capitalization capitalization = _cache["Get"] as Capitalization; if (capitalization != null) return capitalization; #endregion try { capitalization = Service.Get(departmetID, sMonth); } catch (ServiceException e) { throw new Exception(e.Message, e); } #region cache footer _cache.Add(capitalization, "Get"); #endregion return capitalization; } public static DateTime? GetMaxDate() { DateTime? maxDate = Capitalization.Service.GetMaxDate(); return maxDate; } public void Delete(ID id) { Capitalization.Service.Delete(id); } public void Save(ObjectsTemplate capitalizations) { capitalizations.ForEach(x => x.SetAuditTrailProperties()); Capitalization.Service.Save(capitalizations); } } #region ICategory Service public interface ICapitalizationService { ObjectsTemplate Get(); ObjectsTemplate Get(DateTime sMonth); ObjectsTemplate Get(ID departmetID); Capitalization Get(ID departmetID, DateTime sMonth); void Save(ObjectsTemplate capitalizations); DateTime? GetMaxDate(); void Delete(ID id); } #endregion }