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

583 lines
15 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;
namespace Payroll.BO
{
#region ExitInterview
[Serializable]
public class ExitInterview : AuditTrailBase
{
#region Cache Store
private static Cache _cache = new Cache(typeof(ExitInterview));
#endregion
#region Constructor
public ExitInterview()
{
_EmployeeID = null;
_Name = string.Empty;
_JobTitle = string.Empty;
_DepartmentName = string.Empty;
_ManagerName = string.Empty;
_SourceofHire = string.Empty;
_HireDate = null;
_TermDate = null;
_ExitInteviewDate = DateTime.Today;
//_ReasonsforLeaving = string.Empty;
_CultureandClimate = string.Empty;
_CareerDevelopment = string.Empty;
_Settingobjectives = string.Empty;
_providingfeedbackonperformance = string.Empty;
_facilitatingteamwork = string.Empty;
_communicatinginformationaffects = string.Empty;
_relationshipwithemployees = string.Empty;
_other = string.Empty;
_AdditionalComments = string.Empty;
_CommentForCompany = string.Empty;
}
#endregion
#region Properties
#region _EmployeeID : ID
private ID _EmployeeID;
public ID EmployeeID
{
get { return _EmployeeID; }
set
{
base.OnPropertyChange<ID>("EmployeeID", _EmployeeID, value);
_EmployeeID = value;
}
}
#endregion
#region _ExitInteviewDate : DateTime
private DateTime _ExitInteviewDate;
public DateTime ExitInteviewDate
{
get { return _ExitInteviewDate; }
set
{
base.OnPropertyChange<DateTime>("ExitInteviewDate", _ExitInteviewDate, value);
_ExitInteviewDate = value;
}
}
#endregion
#region _TermDate : DateTime
private DateTime? _TermDate;
public DateTime? TermDate
{
get { return _TermDate; }
set
{
base.OnPropertyChange<DateTime>("TermDate", _TermDate, value);
_TermDate = value;
}
}
#endregion
#region _HireDate : DateTime
private DateTime? _HireDate;
public DateTime? HireDate
{
get { return _HireDate; }
set
{
base.OnPropertyChange<DateTime>("HireDate", _HireDate, value);
_HireDate = value;
}
}
#endregion
#region _CommentForCompany : string
private string _CommentForCompany;
public string CommentForCompany
{
get { return _CommentForCompany; }
set
{
base.OnPropertyChange<string>("CommentForCompany", _CommentForCompany, value);
_CommentForCompany = value;
}
}
#endregion
#region _AdditionalComments : string
private string _AdditionalComments;
public string AdditionalComments
{
get { return _AdditionalComments; }
set
{
base.OnPropertyChange<string>("AdditionalComments", _AdditionalComments, value);
_AdditionalComments = value;
}
}
#endregion
#region _other : string
private string _other;
public string Other
{
get { return _other; }
set
{
base.OnPropertyChange<string>("Other", _other, value);
_other = value;
}
}
#endregion
#region _relationshipwithemployees : string
private string _relationshipwithemployees;
public string Relationshipwithemployees
{
get { return _relationshipwithemployees; }
set
{
base.OnPropertyChange<string>("Relationshipwithemployees", _relationshipwithemployees, value);
_relationshipwithemployees = value;
}
}
#endregion
#region _communicatinginformationaffects : string
private string _communicatinginformationaffects;
public string Communicatinginformationaffects
{
get { return _communicatinginformationaffects; }
set
{
base.OnPropertyChange<string>("Communicatinginformationaffects", _communicatinginformationaffects, value);
_communicatinginformationaffects = value;
}
}
#endregion
#region _facilitatingteamwork : string
private string _facilitatingteamwork;
public string Facilitatingteamwork
{
get { return _facilitatingteamwork; }
set
{
base.OnPropertyChange<string>("Facilitatingteamwork", _facilitatingteamwork, value);
_facilitatingteamwork = value;
}
}
#endregion
#region _Settingobjectives : string
private string _Settingobjectives;
public string Settingobjectives
{
get { return _Settingobjectives; }
set
{
base.OnPropertyChange<string>("Settingobjectives", _Settingobjectives, value);
_Settingobjectives = value;
}
}
#endregion
#region _providingfeedbackonperformance : string
private string _providingfeedbackonperformance;
public string Providingfeedbackonperformance
{
get { return _providingfeedbackonperformance; }
set
{
base.OnPropertyChange<string>("Providingfeedbackonperformance", _providingfeedbackonperformance, value);
_providingfeedbackonperformance = value;
}
}
#endregion
#region _SourceofHire : string
private string _SourceofHire;
public string SourceofHire
{
get { return _SourceofHire; }
set
{
base.OnPropertyChange<string>("SourceofHire", _SourceofHire, value);
_SourceofHire = value;
}
}
#endregion
//#region _ReasonsforLeaving : string
//private string _ReasonsforLeaving;
//public string ReasonsforLeaving
//{
// get { return _ReasonsforLeaving; }
// set
// {
// base.OnPropertyChange<string>("ReasonsforLeaving", _ReasonsforLeaving, value);
// _ReasonsforLeaving = value;
// }
//}
//#endregion
#region _CultureandClimate : string
private string _CultureandClimate;
public string CultureandClimate
{
get { return _CultureandClimate; }
set
{
base.OnPropertyChange<string>("CultureandClimate", _CultureandClimate, value);
_CultureandClimate = value;
}
}
#endregion
#region _CareerDevelopment : string
private string _CareerDevelopment;
public string CareerDevelopment
{
get { return _CareerDevelopment; }
set
{
base.OnPropertyChange<string>("CareerDevelopment", _CareerDevelopment, value);
_CareerDevelopment = value;
}
}
#endregion
#region _Name : string
private string _Name;
public string Name
{
get { return _Name; }
set
{
base.OnPropertyChange<string>("Name", _Name, value);
_Name = value;
}
}
#endregion
#region _JobTitle : string
private string _JobTitle;
public string JobTitle
{
get { return _JobTitle; }
set
{
base.OnPropertyChange<string>("JobTitle", _JobTitle, value);
_JobTitle = value;
}
}
#endregion
#region _DepartmentName : string
private string _DepartmentName;
public string DepartmentName
{
get { return _DepartmentName; }
set
{
base.OnPropertyChange<string>("DepartmentName", _DepartmentName, value);
_DepartmentName = value;
}
}
#endregion
#region _ManagerName : string
private string _ManagerName;
public string ManagerName
{
get { return _ManagerName; }
set
{
base.OnPropertyChange<string>("ManagerName", _ManagerName, value);
_ManagerName = value;
}
}
#endregion
#region ReasonsForLeaving : ReasonsForLeaving
private ObjectsTemplate<ReasonsForLeaving> _ReasonsForLeaving;
public ObjectsTemplate<ReasonsForLeaving> ReasonsForLeavingCol
{
get
{
if (this.ID != null && this.ID.IsUnassigned == false && this.ID.Integer > 0 && _ReasonsForLeaving == null)
{
ReasonsForLeavingCol = new ObjectsTemplate<ReasonsForLeaving>();
_ReasonsForLeaving = GetReasonsForLeaving(this.ID);
}
return this._ReasonsForLeaving;
}
set
{
_ReasonsForLeaving = value;
}
}
#endregion
#region Service Factory IExitInterviewService : IExitInterviewService
internal static IExitInterviewService Service
{
get { return Services.Factory.CreateService<IExitInterviewService>(typeof(IExitInterviewService)); }
}
#endregion
#endregion
#region Functions
public static ObjectsTemplate<ReasonsForLeaving> GetReasonsForLeaving(ID nExitInterviewID)
{
#region Cache Header
ObjectsTemplate<ReasonsForLeaving> oReasonsForLeaving = _cache["GetReasonsForLeaving"] as ObjectsTemplate<ReasonsForLeaving>;
if (oReasonsForLeaving != null)
return oReasonsForLeaving;
#endregion
try
{
oReasonsForLeaving = Service.GetReasonsForLeaving(nExitInterviewID);
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(oReasonsForLeaving, "GetReasonsForLeaving");
#endregion
return oReasonsForLeaving;
}
public static ExitInterview Get(ID nID)
{
ExitInterview oExitInterview = null;
#region Cache Header
oExitInterview = (ExitInterview)_cache["Get", nID];
if (oExitInterview != null)
return oExitInterview;
#endregion
oExitInterview = ExitInterview.Service.Get(nID);
#region Cache Footer
_cache.Add(oExitInterview, "Get", nID);
#endregion
return oExitInterview;
}
public static ExitInterview GetByEmployeeID(ID nID)
{
ExitInterview oExitInterview = null;
#region Cache Header
oExitInterview = (ExitInterview)_cache["GetByEmployeeID", nID];
if (oExitInterview != null)
return oExitInterview;
#endregion
oExitInterview = ExitInterview.Service.GetByEmployeeID(nID);
#region Cache Footer
_cache.Add(oExitInterview, "GetByEmployeeID", nID);
#endregion
return oExitInterview;
}
public static ObjectsTemplate<ExitInterview> Get()
{
#region Cache Header
ObjectsTemplate<ExitInterview> ExitInterviews = _cache["Get"] as ObjectsTemplate<ExitInterview>;
if (ExitInterviews != null)
return ExitInterviews;
#endregion
try
{
ExitInterviews = Service.Get();
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(ExitInterviews, "Get");
#endregion
return ExitInterviews;
}
public static ObjectsTemplate<ExitInterview> Get(DateTime dtFrom,DateTime dtTo,int nReasonID)
{
#region Cache Header
ObjectsTemplate<ExitInterview> ExitInterviews = _cache["Get", dtFrom, dtTo, nReasonID] as ObjectsTemplate<ExitInterview>;
if (ExitInterviews != null)
return ExitInterviews;
#endregion
try
{
ExitInterviews = Service.Get(dtFrom, dtTo, nReasonID);
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(ExitInterviews, "Get", dtFrom, dtTo, nReasonID);
#endregion
return ExitInterviews;
}
public ID Save()
{
this.SetAuditTrailProperties();
return ExitInterview.Service.Save(this);
}
public void Delete(ID id)
{
ExitInterview.Service.Delete(id);
}
#endregion
}
#endregion
#region ReasonsForLeaving
[Serializable]
public class ReasonsForLeaving : BasicBaseObject
{
#region Cache Store
private static Cache _cache = new Cache(typeof(ReasonsForLeaving));
#endregion
#region Constructor
public ReasonsForLeaving()
{
_ExitInterviewID = null;
_ReasonID = null;
}
#endregion
#region Properties
#region _ExitInterviewID : ID
private ID _ExitInterviewID;
public ID ExitInterviewID
{
get { return _ExitInterviewID; }
set
{
base.OnPropertyChange<ID>("ExitInterviewID", _ExitInterviewID, value);
_ExitInterviewID = value;
}
}
#endregion
#region _ReasonID : ID
private ID _ReasonID;
public ID ReasonID
{
get { return _ReasonID; }
set
{
base.OnPropertyChange<ID>("ReasonID", _ReasonID, value);
_ReasonID = value;
}
}
#endregion
#endregion
}
#endregion
#region IExitInterview Service
public interface IExitInterviewService
{
ExitInterview Get(ID id);
ExitInterview GetByEmployeeID(ID nID);
ObjectsTemplate<ExitInterview> Get();
ID Save(ExitInterview item);
void Delete(ID id);
ObjectsTemplate<ReasonsForLeaving> GetReasonsForLeaving(ID nExitInterviewID);
ObjectsTemplate<ExitInterview> Get(DateTime dtFrom, DateTime dtTo, int nReasonID);
}
#endregion
}