using System; using System.Collections.Generic; namespace HRM.BO { #region class Institution public class Institution : BasicBaseObject { #region constructor public Institution() { Code = string.Empty; Name = string.Empty; EducationTypeID = 0; Type = 0; Status = EnumStatus.Active; } #endregion #region properties public string Code { get; set; } public string Name { get; set; } public EnmInstituteType Type { get; set; } public int EducationTypeID { get; set; } public bool BoardRequired { get; set; } //#region Service Factory IInstitutionService : IInstitutionService //internal static IInstitutionService Service //{ // get { return Services.Factory.CreateService(typeof(IInstitutionService)); } //} //#endregion #endregion //#region Function //public static Institution Get(ID nID) //{ // Institution oInstitution = null; // #region Cache Header // oInstitution = (Institution)_cache["Get", nID]; // if (oInstitution != null) // return oInstitution; // #endregion // oInstitution = Institution.Service.Get(nID); // #region Cache Footer // _cache.Add(oInstitution, "Get", nID); // #endregion // return oInstitution; //} //public static Institution Get(string sCode) //{ // Institution oInstitution = null; // #region Cache Header // oInstitution = (Institution)_cache["Get", sCode]; // if (oInstitution != null) // return oInstitution; // #endregion // oInstitution = Institution.Service.Get(sCode); // #region Cache Footer // _cache.Add(oInstitution, "Get", sCode); // #endregion // return oInstitution; //} //public static List Get() //{ // #region cache header // List institutions = _cache["Get"] as List; // if (institutions != null) // return institutions; // #endregion // try // { // institutions = Service.Get(); // } // catch (ServiceException e) // { // throw new Exception(e.Message, e); // } // #region cache footer // _cache.Add(institutions, "Get"); // #endregion // return institutions; //} //public static List Get(EnumStatus status) //{ // #region Cache Header // List institutions = _cache["Get", status] as List; // if (institutions != null) // return institutions; // #endregion // try // { // institutions = Service.Get(status); // } // catch (ServiceException e) // { // throw new Exception(e.Message, e); // } // #region Cache Footer // _cache.Add(institutions, "Get", status); // #endregion // return institutions; //} //public static List GetByInstituteType(EnmInstituteType type) //{ // #region Cache Header // List institutions = _cache["GetByInstituteType", type] as List; // if (institutions != null) // return institutions; // #endregion // try // { // institutions = Service.GetByInstituteType(type); // } // catch (ServiceException e) // { // throw new Exception(e.Message, e); // } // #region Cache Footer // _cache.Add(institutions, "GetByInstituteType", type); // #endregion // return institutions; //} //public ID Save() //{ // this.SetAuditTrailProperties(); // if (this.ID.IsUnassigned&& this.IsExists(this.Code)) // throw new Exception("Duplicate code is not allowed."); // return Institution.Service.Save(this); //} //public void Delete(ID id) //{ // Institution.Service.Delete(id); //} //private bool IsExists(string Code) //{ // try // { // bool isExists = false; // if (this.Code != null) // { // isExists = Institution.Service.IsExists(Code); // } // return isExists; // } // catch (ServiceException e) // { // throw new ServiceException(e.Message, e); // } //} //#endregion } #endregion #region IInstitution Service public interface IInstitutionService { Institution Get(int id); Institution Get(string sCode); List Get(); List Get(EnumStatus status); List GetByInstituteType(EnmInstituteType type); int Save(Institution item); void Delete(int id); bool IsExists(string Code); } #endregion }