CEL_Payroll/Payroll.BO/Recruitement/InternalRecruitment.cs
2024-09-17 14:30:13 +06:00

440 lines
12 KiB
C#

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<string>("PositionName", _sPositionName, value);
_sPositionName = value;
}
}
#endregion
#region JobDescription : string
private string _sJobDescription;
public string JobDescription
{
get { return _sJobDescription; }
set
{
base.OnPropertyChange<string>("JobDescription", _sJobDescription, value);
_sJobDescription = value;
}
}
#endregion
#region Education : string
private string _sEducation;
public string Education
{
get { return _sEducation; }
set
{
base.OnPropertyChange<string>("Education", _sEducation, value);
_sEducation = value;
}
}
#endregion
#region Experience : string
private string _sExperience;
public string Experience
{
get { return _sExperience; }
set
{
base.OnPropertyChange<string>("Experience", _sExperience, value);
_sExperience = value;
}
}
#endregion
#region Responsibility : string
private string _sResponsibility;
public string Responsibility
{
get { return _sResponsibility; }
set
{
base.OnPropertyChange<string>("Responsibility", _sResponsibility, value);
_sResponsibility = value;
}
}
#endregion
#region OtherResponsibility : string
private string _sOtherResponsibility;
public string OtherResponsibility
{
get { return _sOtherResponsibility; }
set
{
base.OnPropertyChange<string>("OtherResponsibility", _sOtherResponsibility, value);
_sOtherResponsibility = value;
}
}
#endregion
#region SalaryRange : string
private string _sSalaryRange;
public string SalaryRange
{
get { return _sSalaryRange; }
set
{
base.OnPropertyChange<string>("SalaryRange", _sSalaryRange, value);
_sSalaryRange = value;
}
}
#endregion
#region Benefits : string
private string _sBenefits;
public string Benefits
{
get { return _sBenefits; }
set
{
base.OnPropertyChange<string>("Benefits", _sBenefits, value);
_sBenefits = value;
}
}
#endregion
#region ApplicationLastDate : string
private string _sApplicationLastDate;
public string ApplicationLastDate
{
get { return _sApplicationLastDate; }
set
{
base.OnPropertyChange<string>("ApplicationLastDate", _sApplicationLastDate, value);
_sApplicationLastDate = value;
}
}
#endregion
#region PublishedDate : DateTime
private DateTime _dPublishedDate;
public DateTime PublishedDate
{
get { return _dPublishedDate; }
set
{
base.OnPropertyChange<DateTime>("PublishedDate", _dPublishedDate, value);
_dPublishedDate = value;
}
}
#endregion
#region WorkflowRequired : bool
private bool _bWorkflowRequired;
public bool WorkflowRequired
{
get { return _bWorkflowRequired; }
set
{
base.OnPropertyChange<bool>("WorkflowRequired", _bWorkflowRequired, value);
_bWorkflowRequired = value;
}
}
#endregion
#region IsClosed : bool
private bool _bIsClosed;
public bool IsClosed
{
get { return _bIsClosed; }
set
{
base.OnPropertyChange<bool>("IsClosed", _bIsClosed, value);
_bIsClosed = value;
}
}
#endregion
#region IRNotifications
private ObjectsTemplate<IRNotification> _oNotifications;
public ObjectsTemplate<IRNotification> Notifications
{
get
{
if (_oNotifications == null)
{
_oNotifications = new ObjectsTemplate<IRNotification>();
if (!this.IsNew)
_oNotifications = InternalRecruitment.Service.GetNotifications(this.ID);
}
return _oNotifications;
}
set
{
_oNotifications = value;
}
}
#endregion
#region IREmployeess
private ObjectsTemplate<IREmployee> _oIREmployees;
public ObjectsTemplate<IREmployee> IREmployees
{
get
{
if (_oIREmployees == null )
{
_oIREmployees = new ObjectsTemplate<IREmployee>();
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<IInternalRecruitmentService>(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<InternalRecruitment> Get()
{
#region Cache Header
ObjectsTemplate<InternalRecruitment> internalRecruitments = _cache["Get"] as ObjectsTemplate<InternalRecruitment>;
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<InternalRecruitment> Get(bool isClosed)
{
#region Cache Header
ObjectsTemplate<InternalRecruitment> internalRecruitments = _cache["Get", isClosed] as ObjectsTemplate<InternalRecruitment>;
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<InternalRecruitment> Get();
ObjectsTemplate<InternalRecruitment> Get(bool isClosed);
ID Save(InternalRecruitment oInternalRecruitment);
void Delete(ID InternalRecruitmentId);
ObjectsTemplate<IRNotification> GetNotifications(ID iD);
IRNotification Get(int positionID);
ObjectsTemplate<IREmployee> GetIREmployeess(ID iD);
ID SaveIrEmployee(IREmployee iREmployee);
IREmployee Get(int positionID, int empid);
IREmployee GetIrempID(ID irempid);
}
#endregion
}