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 InternalRecruitment [Serializable] public class InternalRecruitment : AuditTrailBase { #region Cache Store private static Cache _cache = new Cache(typeof(InternalRecruitment)); #endregion #region Constructor public InternalRecruitment() { _sPositionName=string.Empty; _sJobDescription = string.Empty; _sEducation = string.Empty; _sExperience=string.Empty; _sResponsibility = string.Empty; _sOtherResponsibility = string.Empty; _sSalaryRange = string.Empty; _sBenefits = string.Empty; _sApplicationLastDate = string.Empty; _dPublishedDate = DateTime.MinValue; _bWorkflowRequired = false; _bIsClosed = false; } #endregion #region Properties #region PositionName : string private string _sPositionName; public string PositionName { get { return _sPositionName; } set { base.OnPropertyChange("PositionName", _sPositionName, value); _sPositionName = value; } } #endregion #region JobDescription : string private string _sJobDescription; public string JobDescription { get { return _sJobDescription; } set { base.OnPropertyChange("JobDescription", _sJobDescription, value); _sJobDescription = value; } } #endregion #region Education : string private string _sEducation; public string Education { get { return _sEducation; } set { base.OnPropertyChange("Education", _sEducation, value); _sEducation = value; } } #endregion #region Experience : string private string _sExperience; public string Experience { get { return _sExperience; } set { base.OnPropertyChange("Experience", _sExperience, value); _sExperience = value; } } #endregion #region Responsibility : string private string _sResponsibility; public string Responsibility { get { return _sResponsibility; } set { base.OnPropertyChange("Responsibility", _sResponsibility, value); _sResponsibility = value; } } #endregion #region OtherResponsibility : string private string _sOtherResponsibility; public string OtherResponsibility { get { return _sOtherResponsibility; } set { base.OnPropertyChange("OtherResponsibility", _sOtherResponsibility, value); _sOtherResponsibility = value; } } #endregion #region SalaryRange : string private string _sSalaryRange; public string SalaryRange { get { return _sSalaryRange; } set { base.OnPropertyChange("SalaryRange", _sSalaryRange, value); _sSalaryRange = value; } } #endregion #region Benefits : string private string _sBenefits; public string Benefits { get { return _sBenefits; } set { base.OnPropertyChange("Benefits", _sBenefits, value); _sBenefits = value; } } #endregion #region ApplicationLastDate : string private string _sApplicationLastDate; public string ApplicationLastDate { get { return _sApplicationLastDate; } set { base.OnPropertyChange("ApplicationLastDate", _sApplicationLastDate, value); _sApplicationLastDate = value; } } #endregion #region PublishedDate : DateTime private DateTime _dPublishedDate; public DateTime PublishedDate { get { return _dPublishedDate; } set { base.OnPropertyChange("PublishedDate", _dPublishedDate, value); _dPublishedDate = value; } } #endregion #region WorkflowRequired : bool private bool _bWorkflowRequired; public bool WorkflowRequired { get { return _bWorkflowRequired; } set { base.OnPropertyChange("WorkflowRequired", _bWorkflowRequired, value); _bWorkflowRequired = value; } } #endregion #region IsClosed : bool private bool _bIsClosed; public bool IsClosed { get { return _bIsClosed; } set { base.OnPropertyChange("IsClosed", _bIsClosed, value); _bIsClosed = value; } } #endregion #region IRNotifications private ObjectsTemplate _oNotifications; public ObjectsTemplate Notifications { get { if (_oNotifications == null) { _oNotifications = new ObjectsTemplate(); if (!this.IsNew) _oNotifications = InternalRecruitment.Service.GetNotifications(this.ID); } return _oNotifications; } set { _oNotifications = value; } } #endregion #region IREmployeess private ObjectsTemplate _oIREmployees; public ObjectsTemplate IREmployees { get { if (_oIREmployees == null ) { _oIREmployees = new ObjectsTemplate(); if (!this.IsNew) _oIREmployees = InternalRecruitment.Service.GetIREmployeess(this.ID); } return _oIREmployees; } set { _oIREmployees = value; } } #endregion #endregion #region Service Factory IInternalRecruitmentService : IInternalRecruitmentService internal static IInternalRecruitmentService Service { get { return Services.Factory.CreateService(typeof(IInternalRecruitmentService)); } } #endregion #region Functions public static InternalRecruitment Get(ID InternalRecruitmentId) { InternalRecruitment oInternalRecruitment = null; #region Cache Header oInternalRecruitment = (InternalRecruitment)_cache["Get", InternalRecruitmentId]; if (oInternalRecruitment != null) return oInternalRecruitment; #endregion oInternalRecruitment = InternalRecruitment.Service.Get(InternalRecruitmentId); #region Cache Footer _cache.Add(oInternalRecruitment, "Get", InternalRecruitmentId); #endregion return oInternalRecruitment; } public static ObjectsTemplate Get() { #region Cache Header ObjectsTemplate internalRecruitments = _cache["Get"] as ObjectsTemplate; if (internalRecruitments != null) return internalRecruitments; #endregion try { internalRecruitments = Service.Get(); } catch (ServiceException e) { throw new Exception(e.Message, e); } #region Cache Footer _cache.Add(internalRecruitments, "Get"); #endregion return internalRecruitments; } public static ObjectsTemplate Get(bool isClosed) { #region Cache Header ObjectsTemplate internalRecruitments = _cache["Get", isClosed] as ObjectsTemplate; if (internalRecruitments != null) return internalRecruitments; #endregion try { internalRecruitments = Service.Get(isClosed); } catch (ServiceException e) { throw new Exception(e.Message, e); } #region Cache Footer _cache.Add(internalRecruitments, "Get", isClosed); #endregion return internalRecruitments; } public ID Save() { this.SetAuditTrailProperties(); return InternalRecruitment.Service.Save(this); } public ID SaveIrEmployee(IREmployee iREmployee) { this.SetAuditTrailProperties(); return InternalRecruitment.Service.SaveIrEmployee(iREmployee); } public void Delete(ID id) { InternalRecruitment.Service.Delete(id); } public IRNotification Get(int positionID) { IRNotification oIRNotification = null; #region Cache Header oIRNotification = (IRNotification)_cache["Get", positionID]; if (oIRNotification != null) return oIRNotification; #endregion oIRNotification = InternalRecruitment.Service.Get(positionID); #region Cache Footer _cache.Add(oIRNotification, "Get", positionID); #endregion return oIRNotification; } //public IRNotification Get(int positionID, int empid) //{ // IRNotification oIRNotification = null; // #region Cache Header // oIRNotification = (IRNotification)_cache["Get", positionID, empid]; // if (oIRNotification != null) // return oIRNotification; // #endregion // oIRNotification = InternalRecruitment.Service.Get(positionID, empid); // #region Cache Footer // _cache.Add(oIRNotification, "Get", positionID, empid); // #endregion // return oIRNotification; //} public IREmployee GetIRempID(ID irEmpID) { IREmployee oIRNotification = null; #region Cache Header oIRNotification = (IREmployee)_cache["Get", irEmpID]; if (oIRNotification != null) return oIRNotification; #endregion oIRNotification = IREmployee.Service.GetIrempID(irEmpID); #region Cache Footer _cache.Add(oIRNotification, "Get", irEmpID); #endregion return oIRNotification; } #endregion } #endregion #region IInternalRecruitment Service public interface IInternalRecruitmentService { InternalRecruitment Get(ID InternalRecruitmentId); ObjectsTemplate Get(); ObjectsTemplate Get(bool isClosed); ID Save(InternalRecruitment oInternalRecruitment); void Delete(ID InternalRecruitmentId); ObjectsTemplate GetNotifications(ID iD); IRNotification Get(int positionID); ObjectsTemplate GetIREmployeess(ID iD); ID SaveIrEmployee(IREmployee iREmployee); IREmployee Get(int positionID, int empid); IREmployee GetIrempID(ID irempid); } #endregion }