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 { #region Class Education Level [Serializable] public class EducationLevel : BasicBaseObject { #region cache store private static Cache _cache = new Cache(typeof(EducationLevel)); #endregion #region constructor public EducationLevel() { _code = string.Empty; _description = string.Empty; _educationTypeID = null; _status = EnumStatus.Active; } #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 #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 educationTypeID : ID private ID _educationTypeID; public ID EducationTypeID { get { return _educationTypeID; } set { _educationTypeID = value; } } #endregion #region Service Factory IEducationLevelService : IEducationLevelService internal static IEducationLevelService Service { get { return Services.Factory.CreateService(typeof(IEducationLevelService)); } } #endregion #endregion #region functions public static EducationLevel Get(ID nID) { EducationLevel oEducationLevel = null; #region Cache Header oEducationLevel = (EducationLevel)_cache["Get", nID]; if (oEducationLevel != null) return oEducationLevel; #endregion oEducationLevel = EducationLevel.Service.Get(nID); #region Cache Footer _cache.Add(oEducationLevel, "Get", nID); #endregion return oEducationLevel; } public static EducationLevel Get(string sCode) { EducationLevel oEducationLevel = null; #region cache header oEducationLevel = (EducationLevel)_cache["Get", sCode]; if (oEducationLevel != null) return oEducationLevel; #endregion oEducationLevel = EducationLevel.Service.Get(sCode); #region cache footer _cache.Add(oEducationLevel, "Get", sCode); #endregion return oEducationLevel; } public static ObjectsTemplate Get() { #region cache header ObjectsTemplate educationLevels = _cache["Get"] as ObjectsTemplate; if (educationLevels != null) return educationLevels; #endregion try { educationLevels = Service.Get(); } catch (ServiceException e) { throw new Exception(e.Message, e); } #region cache footer _cache.Add(educationLevels, "Get"); #endregion return educationLevels; } public static ObjectsTemplate Get(EnumStatus status) { #region Cache Header ObjectsTemplate educationLevels = _cache["Get", status] as ObjectsTemplate; if (educationLevels != null) return educationLevels; #endregion try { educationLevels = Service.Get(status); } catch (ServiceException e) { throw new Exception(e.Message, e); } #region Cache Footer _cache.Add(educationLevels, "Get", status); #endregion return educationLevels; } public static ObjectsTemplate GetByType(ID typeID) { #region Cache Header ObjectsTemplate educationLevels = _cache["GetByType", typeID] as ObjectsTemplate; if (educationLevels != null) return educationLevels; #endregion try { educationLevels = Service.GetByType(typeID); } catch (ServiceException e) { throw new Exception(e.Message, e); } #region Cache Footer _cache.Add(educationLevels, "GetByType", typeID); #endregion return educationLevels; } public static EducationLevel GetByLevelID(ID nLevelID) { EducationLevel oEducationLevel = null; #region Cache Header oEducationLevel = (EducationLevel)_cache["GetByLevelID", nLevelID]; if (oEducationLevel != null) return oEducationLevel; #endregion oEducationLevel = EducationLevel.Service.GetByLevelID(nLevelID); #region Cache Footer _cache.Add(oEducationLevel, "GetByLevelID", nLevelID); #endregion return oEducationLevel; } public ID Save() { this.SetAuditTrailProperties(); return EducationLevel.Service.Save(this); } public void Delete(ID id) { EducationLevel.Service.Delete(id); } #endregion public static System.Data.DataSet GetManpower(string sparam) { DataSet ds = null; try { ds = Service.GetManpower(sparam); } catch (Exception e) { throw new Exception(e.Message, e); } return ds; } } #endregion #region IEducationLevel Service public interface IEducationLevelService { EducationLevel Get(ID id); EducationLevel Get(string sCode); ObjectsTemplate Get(); ObjectsTemplate GetByType(ID typeID); ObjectsTemplate Get(EnumStatus status); EducationLevel GetByLevelID(ID LevelID); ID Save(EducationLevel item); void Delete(ID id); DataSet GetManpower(string sparam); } #endregion }