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 OtherTalent [Serializable] public class OtherTalent : BasicBaseObject { #region cache store private static Cache _cache = new Cache(typeof(OtherTalent)); #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 OtherTalent() { _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 IOtherTalentService : IOtherTalentService internal static IOtherTalentService Service { get { return Services.Factory.CreateService(typeof(IOtherTalentService)); } } #endregion #region functions public static OtherTalent Get(ID nID) { OtherTalent oOtherTalent = null; #region cache header oOtherTalent = (OtherTalent)_cache["Get", nID]; if (oOtherTalent != null) return oOtherTalent; #endregion oOtherTalent = OtherTalent.Service.Get(nID); #region Cache Footer _cache.Add(oOtherTalent, "Get", nID); #endregion return oOtherTalent; } public static OtherTalent Get(string sCode) { OtherTalent oOtherTalent = null; #region cache header oOtherTalent = (OtherTalent)_cache["Get", sCode]; if (oOtherTalent != null) return oOtherTalent; #endregion oOtherTalent = OtherTalent.Service.Get(sCode); #region Cache Footer _cache.Add(oOtherTalent, "Get", sCode); #endregion return oOtherTalent; } public static ObjectsTemplate Get() { #region cache header ObjectsTemplate otherTalents = _cache["Get"] as ObjectsTemplate; if (otherTalents != null) return otherTalents; #endregion try { otherTalents = Service.Get(); } catch (ServiceException e) { throw new Exception(e.Message, e); } #region cache footer _cache.Add(otherTalents, "Get"); #endregion return otherTalents; } public static ObjectsTemplate Get(EnumStatus status) { #region Cache Header ObjectsTemplate otherTalents = _cache["Get", status] as ObjectsTemplate; if (otherTalents != null) return otherTalents; #endregion try { otherTalents = Service.Get(status); } catch (ServiceException e) { throw new Exception(e.Message, e); } #region Cache Footer _cache.Add(otherTalents, "Get", status); #endregion return otherTalents; } public ID Save() { this.SetAuditTrailProperties(); return OtherTalent.Service.Save(this); } public void Delete(ID id) { OtherTalent.Service.Delete(id); } #endregion #endregion } #endregion #region IOtherTalentService public interface IOtherTalentService { OtherTalent Get(ID id); OtherTalent Get(string sCode); ObjectsTemplate Get(); ObjectsTemplate Get(EnumStatus status); ID Save(OtherTalent item); void Delete(ID id); } #endregion }