using System; using System.Collections.Generic; using System.Linq; using System.Text; using Ease.CoreV35.Model; using System.Data; namespace Payroll.BO { [Serializable] public class PMPProcess : BasicBaseObject { #region Constructor public PMPProcess() { PmpYear = DateTime.MinValue; Description = string.Empty; TargetSettingFrom = DateTime.MinValue; TargetSettingTo = DateTime.MinValue; MedianAppraisalFrom = DateTime.MinValue; MedianAppraisalTo = DateTime.MinValue; FinalApprovalFrom = DateTime.MinValue; FinalApprovalTo = DateTime.MinValue; IsFinalize = false; OpmpEmployeeRating = null; PmpStatus = PMPStatus.NotYetInitiate; } #endregion #region Properties #region PmpStatus private PMPStatus _pmpStatus; public PMPStatus PmpStatus { get { return _pmpStatus; } set { _pmpStatus = value; } } #endregion #region PMPYear : DateTime private DateTime _pmpYear; public DateTime PmpYear { get { return _pmpYear; } set { _pmpYear = value; } } #endregion #region DummyYear public string DummyYear { get { if (this.ID != null) return PmpYear.ToString("yyyy"); else return ""; } } #endregion #region Description : string private string _description; public string Description { get { return _description; } set { _description = value; } } #endregion #region TargetSettingFrom : DateTime private DateTime _targetSettingFrom; public DateTime TargetSettingFrom { get { return _targetSettingFrom; } set { _targetSettingFrom = value; } } #endregion #region TargetSettingTo : DateTime private DateTime _targetSettingTo; public DateTime TargetSettingTo { get { return _targetSettingTo; } set { _targetSettingTo = value; } } #endregion #region MedianAppraisalFrom : DateTime private DateTime _medianAppraisalFrom; public DateTime MedianAppraisalFrom { get { return _medianAppraisalFrom; } set { _medianAppraisalFrom = value; } } #endregion #region MedianAppraisalTo: DateTime private DateTime _medianAppraisalTo; public DateTime MedianAppraisalTo { get { return _medianAppraisalTo; } set { _medianAppraisalTo = value; } } #endregion #region FinalApprovalFrom : DateTime private DateTime _finalApprovalFrom; public DateTime FinalApprovalFrom { get { return _finalApprovalFrom; } set { _finalApprovalFrom = value; } } #endregion #region FinalApprovalTo : DateTime private DateTime _finalApprovalTo; public DateTime FinalApprovalTo { get { return _finalApprovalTo; } set { _finalApprovalTo = value; } } #endregion #region IsFinalize : bool private bool _isFinalize; public bool IsFinalize { get { return _isFinalize; } set { _isFinalize = value; } } #endregion #region PMPEmployeeRating : PMPEmployeeRating private PMPEmployeeRating _opmpEmployeeRating; public PMPEmployeeRating OpmpEmployeeRating { get { PMPEmployeeRating oPMPEmployeeRating = null; if (this.ID != null) { oPMPEmployeeRating = PMPProcess.Service.GetPMPEmployeeRatingByPMPProcessID(this.ID); } return oPMPEmployeeRating; } set { _opmpEmployeeRating = value; } } #endregion #endregion #region Service Factory IPMPProcessService : IPMPProcessService internal static IPMPProcessService Service { get { return Services.Factory.CreateService(typeof(IPMPProcessService)); } } #endregion #region Input validator public string[] InputValidator() { string[] sErrorString = new string[2]; if (this.Description == "") { sErrorString[0] = "Description can not be empty"; sErrorString[1] = "Description"; return sErrorString; } if (this.TargetSettingFrom == null) { sErrorString[0] = "Target Setting From can not be empty"; sErrorString[1] = "TargetSettingFrom"; return sErrorString; } if (this.TargetSettingTo == null) { sErrorString[0] = "Target Setting To can not be empty"; sErrorString[1] = "TargetSettingTo"; return sErrorString; } if (this.MedianAppraisalFrom == null) { sErrorString[0] = "Median Appraisal From can not be empty"; sErrorString[1] = "MedianAppraisalFrom"; return sErrorString; } if (this.MedianAppraisalTo == null) { sErrorString[0] = "Median Appraisal To can not be empty"; sErrorString[1] = "MedianAppraisalTo"; return sErrorString; } if (this.FinalApprovalFrom == null) { sErrorString[0] = "Final Approval From To can not be empty"; sErrorString[1] = "FinalApprovalFrom"; return sErrorString; } if (this.FinalApprovalTo == null) { sErrorString[0] = "Final Approval To To can not be empty"; sErrorString[1] = "FinalApprovalTo"; return sErrorString; } sErrorString = null; return sErrorString; } #endregion #region Functions #region Save public ID Save() { this.SetAuditTrailProperties(); return PMPProcess.Service.Save(this); } #endregion #region Delete public void Delete(ID id) { PMPProcess.Service.Delete(id); } #endregion #region Get PMPTargetSetting By PMPEmployeeRating public PMPEmployeeRating GetPMPEmployeeRatingByPMPProcessID(ID Id) { PMPEmployeeRating oPMPEmployeeRating = new PMPEmployeeRating(); if (!this.ID.IsUnassigned) { return oPMPEmployeeRating = PMPProcess.Service.GetPMPEmployeeRatingByPMPProcessID(Id); } else return oPMPEmployeeRating; } #endregion #region Get PMPTargetSetting BY PMPTargetSettingID public static PMPTargetSetting GetPmpTargetSettingByPmpTargetSettingId(ID Id) { return PMPProcess.Service.GetPmpTargetSettingByPmpTargetSettingId(Id); } #endregion #region GetAllPMPTargetSettings public static ObjectsTemplate GetAllPMPTargetSettings() { return PMPProcess.Service.GetAllPMPTargetSettings(); } #endregion #region GetPmpValueBehaviorRating By Id public static PMPValueBehaviorRating GetPmpValueBehaviorRatingById(ID Id) { return PMPProcess.Service.GetPmpValueBehaviorRatingById(Id); } #endregion #region Save SavePMPEmployeeRating public static ID SavePMPEmployeeRating(PMPEmployeeRating item) { return PMPProcess.Service.SavePMPEmployeeRating(item); } #endregion #region Save SavePMPTargetSetting public static ID SavePMPTargetSetting(PMPTargetSetting item) { return PMPProcess.Service.SavePMPTargetSetting(item); } #endregion #region Save SavePMPValueBehaviorRating public static ID SavePMPValueBehaviorRating(PMPValueBehaviorRating item) { return PMPProcess.Service.SavePMPValueBehaviorRating(item); } #endregion #region Get All PMPProcess public static ObjectsTemplate Get(EnumStatus status) { return PMPProcess.Service.Get(status); } public static PMPProcess Get(DateTime pmpYear) { return PMPProcess.Service.Get(pmpYear); } #endregion #region GetPmpProcessByPmpProcesId public static PMPProcess GetPmpProcessByPmpProcesId(ID id) { return PMPProcess.Service.GetPmpProcessByPmpProcesId(id); } #endregion #region GetByPMPProcessID public static PMPProcess GetByPMPProcessID(ID id) { return PMPProcess.Service.GetByPMPProcessID(id); } #endregion #region GetPMPTargetSettingsByEmployeeId public static ObjectsTemplate GetPMPTargetSettingsByEmployeeIdAndPMPProcessID(ID id,ID pmpProcessID) { return PMPProcess.Service.GetPMPTargetSettingsByEmployeeIdAndPMPProcessID(id, pmpProcessID); } #endregion #region DeletePMPTargetSettingById public static void DeletePMPTargetSettingById(ID id) { PMPProcess.Service.DeletePMPTargetSettingById(id); } #endregion #region SaveAllPMPTargetSettings public static void SaveAllPMPTargetSettings(ObjectsTemplate allSettings) { PMPProcess.Service.SaveAllPMPTargetSettings(allSettings); } #endregion #region GetValueBehaviorRatingsByEmployeeIdAndPmpProcessId public static ObjectsTemplate GetValueBehaviorRatingsByEmployeeIdAndPmpProcessId(ID empId, ID pmpProcessId) { return PMPProcess.Service.GetValueBehaviorRatingsByEmployeeIdAndPmpProcessId(empId, pmpProcessId); } #endregion #region SaveAllPMPValueBehaviorRaings public static void SaveAllPMPValueBehaviorRaings(ObjectsTemplate allValueBehaviorRatings) { PMPProcess.Service.SaveAllPMPValueBehaviorRaings(allValueBehaviorRatings); } #endregion #region SaveSinglePMPEmployeeRatingObject public static void SaveSinglePMPEmployeeRatingObject(PMPEmployeeRating obPmpempRating) { PMPProcess.Service.SaveSinglePMPEmployeeRatingObject(obPmpempRating); } #endregion #region GetPmpEmployeeRatingByEmployeeIdAndPmpProcessId public static PMPEmployeeRating GetPmpEmployeeRatingByEmployeeIdAndPmpProcessId(ID empId, ID pmpProcessId) { return PMPProcess.Service.GetPmpEmployeeRatingByEmployeeIdAndPmpProcessId(empId, pmpProcessId); } #endregion #region GetPmpEmployeeRatingByRatingId public static PMPEmployeeRating GetPmpEmployeeRatingByRatingId(ID ratingId) { return PMPProcess.Service.GetPmpEmployeeRatingByRatingId(ratingId); } #endregion #region GetEmployeeRating public static ObjectsTemplate GetEmployeeRating(ID processID) { return PMPProcess.Service.GetEmployeeRating(processID); } #endregion #region GetEmployeeRating /// /// This function not return actual result. /// /// public static PMPProcess GetCurrentPMP() { ObjectsTemplate processes = PMPProcess.Get(EnumStatus.Regardless); // ObjectsTemplate Curprocesses = new ObjectsTemplate(); foreach (PMPProcess item in processes) { if (item.PmpStatus == PMPStatus.Final_Appraisal && item.IsFinalize ==false) return item; } return null; } public static PMPEmployeeRating GetEmployeeRating(ID employeeID, ID processID) { return PMPProcess.Service.GetEmployeeRating(employeeID, processID); } #endregion #region DeleteAllPmpTargetSettings public static void DeleteAllPmpTargetSettings(ObjectsTemplate allSettings) { PMPProcess.Service.DeleteAllPmpTargetSettings(allSettings); } #endregion #region GetEmployeeRating public static ObjectsTemplate GetEmployeeRating(ID pmpProcessId, PMPStatus pmpstatus, PMPWFStatus status) { return PMPProcess.Service.GetEmployeeRating(pmpProcessId,pmpstatus, status); } #endregion #region GetEmployeeRatingForDraft public static ObjectsTemplate GetEmployeeRatingForDraft(ID pmpProcessId) { return PMPProcess.Service.GetEmployeeRatingForDraft(pmpProcessId); } #endregion #region GetEmployeeRatingForNotInitiate public static ObjectsTemplate GetEmployeeRatingForNotInitiate(ID pmpProcessId, PMPStatus pmpStatus) { return PMPProcess.Service.GetEmployeeRatingForNotInitiate(pmpProcessId, pmpStatus); } #endregion #region void SavePMPEmployeeRatingObject(PMPEmployeeRating obPmpempRating) public static void SavePMPEmployeeRatingObject(PMPEmployeeRating obPmpempRating) { PMPProcess.SavePMPEmployeeRatingObject(obPmpempRating); } #endregion #endregion } #region IPMPProcessService Service public interface IPMPProcessService { ObjectsTemplate GetEmployeeRating(ID processID); PMPEmployeeRating GetEmployeeRating(ID employeeID, ID processID); ObjectsTemplate GetEmployeeRatingForNotInitiate(ID pmpProcessId, PMPStatus pmpStatus); ObjectsTemplate < PMPEmployeeRating > GetEmployeeRating(ID pmpProcessId, PMPStatus pmpStatus, PMPWFStatus status); ObjectsTemplate GetEmployeeRatingForDraft(ID pmpProcessId); PMPEmployeeRating GetPMPEmployeeRatingByPMPProcessID(ID id); // will not return correct value PMPTargetSetting GetPmpTargetSettingByPmpTargetSettingId(ID Id); PMPValueBehaviorRating GetPmpValueBehaviorRatingById(ID Id); ObjectsTemplate GetPMPTargetSettingsByEmployeeIdAndPMPProcessID(ID id, ID pmpProcessID); PMPEmployeeRating GetPmpEmployeeRatingByEmployeeIdAndPmpProcessId(ID empId, ID pmpProcessId); PMPEmployeeRating GetPmpEmployeeRatingByRatingId(ID ratingId); ObjectsTemplate GetValueBehaviorRatingsByEmployeeIdAndPmpProcessId(ID empId, ID pmpProcessId); ObjectsTemplate Get(EnumStatus status); // remove ObjectsTemplate GetAllPMPTargetSettings(); //remove PMPProcess GetPmpProcessByPmpProcesId(ID id); PMPProcess GetByPMPProcessID(ID id); PMPProcess Get(DateTime pmpYear); ID Save(PMPProcess item); void Update(PMPProcess item); void Delete(ID id); void SaveSinglePMPEmployeeRatingObject(PMPEmployeeRating obPmpempRating); ID SavePMPEmployeeRating(PMPEmployeeRating item); ID SavePMPTargetSetting(PMPTargetSetting item); ID SavePMPValueBehaviorRating(PMPValueBehaviorRating item); void DeletePMPTargetSettingById(ID id); void SaveAllPMPTargetSettings(ObjectsTemplate allSettings); void DeleteAllPmpTargetSettings(ObjectsTemplate allSettings); void SavePMPEmployeeRatingObject(PMPEmployeeRating obPmpempRating); void SaveAllPMPValueBehaviorRaings(ObjectsTemplate allValueBehaviorRatings); void SavePMPValueBehaviorRatingItem(PMPValueBehaviorRating item); } #endregion }