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; namespace Payroll.BO { #region class ExtraCurricularActivity [Serializable] public class ExtraCurricularActivity : BasicBaseObject { #region cache store private static Cache _cache = new Cache(typeof(ExtraCurricularActivity)); #endregion #region constructor #region Input validator public string[] InputValidator() { string[] sErrorString = new string[2]; if (this.Code == "") { sErrorString[0] = "Code can not be empty"; sErrorString[1] = "Code"; return sErrorString; } if (this.Description == "") { sErrorString[0] = "Description can not be empty"; sErrorString[1] = "Description"; return sErrorString; } sErrorString = null; return sErrorString; } #endregion public ExtraCurricularActivity() { _code = string.Empty; _description = string.Empty; _status = EnumStatus.Active; } #endregion #region properties #region code : string private string _code; public string Code { get { return _code; } set { base.OnPropertyChange("CODE", _code, value); _code = value; } } #endregion #region description : string private string _description; public string Description { get { return _description; } set { base.OnPropertyChange("DESCRIPTION", _description, value); _description = value; } } #endregion #region Service Factory IExtraCurricularActivityService : IExtraCurricularActivityService internal static IExtraCurricularActivityService Service { get { return Services.Factory.CreateService(typeof(IExtraCurricularActivityService)); } } #endregion #endregion #region Function public static ExtraCurricularActivity Get(ID nID) { ExtraCurricularActivity oExtraCurricularActivity = null; #region Cache Header oExtraCurricularActivity = (ExtraCurricularActivity)_cache["Get", nID]; if (oExtraCurricularActivity != null) return oExtraCurricularActivity; #endregion oExtraCurricularActivity = ExtraCurricularActivity.Service.Get(nID); #region Cache Footer _cache.Add(oExtraCurricularActivity, "Get", nID); #endregion return oExtraCurricularActivity; } public static ExtraCurricularActivity Get(string sCode) { ExtraCurricularActivity oExtraCurricularActivity = null; #region Cache Header oExtraCurricularActivity = (ExtraCurricularActivity)_cache["Get", sCode]; if (oExtraCurricularActivity != null) return oExtraCurricularActivity; #endregion oExtraCurricularActivity = ExtraCurricularActivity.Service.Get(sCode); #region Cache Footer _cache.Add(oExtraCurricularActivity, "Get", sCode); #endregion return oExtraCurricularActivity; } public static ObjectsTemplate Get() { #region cache header ObjectsTemplate extraCurricularActivities = _cache["Get"] as ObjectsTemplate; if (extraCurricularActivities != null) return extraCurricularActivities; #endregion try { extraCurricularActivities = Service.Get(); } catch (ServiceException e) { throw new Exception(e.Message, e); } #region cache footer _cache.Add(extraCurricularActivities, "Get"); #endregion return extraCurricularActivities; } public static ObjectsTemplate Get(EnumStatus status) { #region Cache Header ObjectsTemplate extraCurricularActivities = _cache["Get", status] as ObjectsTemplate; if (extraCurricularActivities != null) return extraCurricularActivities; #endregion try { extraCurricularActivities = Service.Get(status); } catch (ServiceException e) { throw new Exception(e.Message, e); } #region Cache Footer _cache.Add(extraCurricularActivities, "Get", status); #endregion return extraCurricularActivities; } public ID Save() { this.SetAuditTrailProperties(); return ExtraCurricularActivity.Service.Save(this); } public void Delete(ID id) { ExtraCurricularActivity.Service.Delete(id); } #endregion } #endregion #region IExtraCurricularActivity Service public interface IExtraCurricularActivityService { ExtraCurricularActivity Get(ID id); ExtraCurricularActivity Get(string sCode); ObjectsTemplate Get(); ObjectsTemplate Get(EnumStatus status); ID Save(ExtraCurricularActivity item); void Delete(ID id); } #endregion }