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 { [Serializable] public class SurveyOrganization : AuditTrailBase { #region Cache Store private static Cache _cache = new Cache(typeof(SurveyOrganization)); #endregion #region Constructor public SurveyOrganization() { _surveyID = null; _gradeID = null; _companyID = null; _departmentID = null; _locationID = null; } #endregion #region Properties #region SurveyID : ID private ID _surveyID; public ID SurveyID { get { return _surveyID; } set { base.OnPropertyChange("SurveyOrganizationID", _surveyID, value); _surveyID = value; } } #endregion #region GradeID : ID private ID _gradeID; public ID GradeID { get { return _gradeID; } set { base.OnPropertyChange("GradeID", _gradeID, value); _gradeID = value; } } #endregion #region CompanyID : ID private ID _companyID; public ID CompanyID { get { return _companyID; } set { base.OnPropertyChange("CompanyID", _companyID, value); _companyID = value; } } #endregion #region DepartmentID : ID private ID _departmentID; public ID DepartmentID { get { return _departmentID; } set { base.OnPropertyChange("DepartmentID", _departmentID, value); _departmentID = value; } } #endregion #region LocationID : ID private ID _locationID; public ID LocationID { get { return _locationID; } set { base.OnPropertyChange("LocationID", _locationID, value); _locationID = value; } } #endregion #region Service Factory IPFTransactionService : IPFTransactionService internal static ISurveyOrganizationService Service { get { return Services.Factory.CreateService(typeof(ISurveyOrganizationService)); } } #endregion #endregion #region Functions public SurveyOrganization Get(ID nID) { SurveyOrganization oSurveyOrganization = null; #region Cache Header oSurveyOrganization = (SurveyOrganization)_cache["Get", ID]; if (oSurveyOrganization != null) return oSurveyOrganization; #endregion oSurveyOrganization = SurveyOrganization.Service.Get(nID); #region Cache Footer _cache.Add(oSurveyOrganization, "Get", ID); #endregion return oSurveyOrganization; } public static ObjectsTemplate Get() { #region cache header ObjectsTemplate SurveyOrganizations = _cache["Get"] as ObjectsTemplate; if (SurveyOrganizations != null) return SurveyOrganizations; #endregion try { SurveyOrganizations = Service.Get(); } catch (ServiceException e) { throw new Exception(e.Message, e); } #region cache footer _cache.Add(SurveyOrganizations, "Get"); #endregion return SurveyOrganizations; } public static ObjectsTemplate Get(EnumStatus status) { #region Cache Header ObjectsTemplate SurveyOrganizations = _cache["Get", status] as ObjectsTemplate; if (SurveyOrganizations != null) return SurveyOrganizations; #endregion try { SurveyOrganizations = Service.Get(status); } catch (ServiceException e) { throw new Exception(e.Message, e); } #region Cache Footer _cache.Add(SurveyOrganizations, "Get", status); #endregion return SurveyOrganizations; } public static ObjectsTemplate GetSurveyOrganization(ID surveyId) { #region Cache Header ObjectsTemplate SurveyOrganizations = _cache["GetSurveyOrganization", surveyId] as ObjectsTemplate; if (SurveyOrganizations != null) return SurveyOrganizations; #endregion try { SurveyOrganizations = Service.GetSurveyOrganization(surveyId); } catch (ServiceException e) { throw new Exception(e.Message, e); } #region Cache Footer _cache.Add(SurveyOrganizations, "GetSurveyOrganization", surveyId); #endregion return SurveyOrganizations; } public ID Save() { base.SetAuditTrailProperties(); return SurveyOrganization.Service.Save(this); } public void Delete(ID id) { SurveyOrganization.Service.Delete(id); } #endregion } #region ISurveyOrganization Service public interface ISurveyOrganizationService { SurveyOrganization Get(ID id); ObjectsTemplate Get(); ObjectsTemplate GetSurveyOrganization(ID surveyId); ObjectsTemplate Get(EnumStatus status); ID Save(SurveyOrganization item); void Delete(ID id); } #endregion }