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

436 lines
11 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ease.CoreV35.Model;
namespace Payroll.BO
{
[Serializable]
public class PMPEmployeeRating : BasicBaseObject, IworkflowInterface
{
#region Constructor
public PMPEmployeeRating()
{
_employeeID = null;
_selfObjectRatingID = null;
_approvarObjectRatingID = null;
_approvarID = null;
_selfValueBehaviorRatingID = null;
_appValueBehaviorRatingID = null;
_isTargetSettingDone = false;
_isMedianDone = false;
_isValueBehaviorDone = false;
_oPMPTargetSettings = null;
_oPMPValueBehaviorRatings = null;
_pmpStatus = PMPStatus.Target_Setting;
_pmpWFStatus = PMPWFStatus.Draft;
_incrementedPercentByHR = Double.MinValue;
_remarksByHR = String.Empty;
_isFinalized = false;
}
#endregion
#region Properties
#region IsFinalized
private bool _isFinalized;
public bool IsFinalized
{
get { return _isFinalized; }
set { _isFinalized = value; }
}
#endregion
#region PmpStatus
private PMPStatus _pmpStatus;
public PMPStatus PmpStatus
{
get { return _pmpStatus; }
set { _pmpStatus = value; }
}
#endregion
#region HrValueBehaValueBehaviorRatingID
private ID _hrValueBehaValueBehaviorRatingID;
public ID HrValueBehaValueBehaviorRatingID
{
get { return _hrValueBehaValueBehaviorRatingID; }
set { _hrValueBehaValueBehaviorRatingID = value; }
}
#endregion
#region HrTargetSettingRatingID
private ID _hrTargetSettingRatingID;
public ID HrTargetSettingRatingID
{
get { return _hrTargetSettingRatingID; }
set { _hrTargetSettingRatingID = value; }
}
#endregion
#region RemarksByHR
private string _remarksByHR;
public string RemarksByHR
{
get { return _remarksByHR; }
set { _remarksByHR = value; }
}
#endregion
#region IncrementedPercentByHR
private double _incrementedPercentByHR;
public double IncrementedPercentByHR
{
get { return _incrementedPercentByHR; }
set { _incrementedPercentByHR = value; }
}
#endregion
#region PmpWFStatus
private PMPWFStatus _pmpWFStatus;
public PMPWFStatus PmpWFStatus
{
get { return _pmpWFStatus; }
set { _pmpWFStatus = value; }
}
#endregion
#region PMPProcessID : ID
private ID _pmpProcessID;
public ID PmpProcessID
{
get { return _pmpProcessID; }
set { _pmpProcessID = value; }
}
#endregion
#region EmployeeID : ID
private ID _employeeID;
public ID EmployeeID
{
get { return _employeeID; }
set { _employeeID = value; }
}
#endregion
#region SelfObjectRatingID : ID
private ID _selfObjectRatingID;
public ID SelfObjectRatingID
{
get { return _selfObjectRatingID; }
set { _selfObjectRatingID = value; }
}
#endregion
#region ApprovarObjectRatingID : ID
private ID _approvarObjectRatingID;
public ID ApprovarObjectRatingID
{
get { return _approvarObjectRatingID; }
set { _approvarObjectRatingID = value; }
}
#endregion
#region ApprovarID : ID
private ID _approvarID;
public ID ApprovarID
{
get { return _approvarID; }
set { _approvarID = value; }
}
#endregion
#region SelfValueBehaviorRatingID : ID
private ID _selfValueBehaviorRatingID;
public ID SelfValueBehaviorRatingID
{
get { return _selfValueBehaviorRatingID; }
set { _selfValueBehaviorRatingID = value; }
}
#endregion
#region AppValueBehaviorRatingID : ID
private ID _appValueBehaviorRatingID;
public ID AppValueBehaviorRatingID
{
get { return _appValueBehaviorRatingID; }
set { _appValueBehaviorRatingID = value; }
}
#endregion
#region IsTargetSettingDone : bool
private bool _isTargetSettingDone;
public bool IsTargetSettingDone
{
get { return _isTargetSettingDone; }
set { _isTargetSettingDone = value; }
}
#endregion
#region IsMedianDone : bool
private bool _isMedianDone;
public bool IsMedianDone
{
get { return _isMedianDone; }
set { _isMedianDone = value; }
}
#endregion
#region IsValueBehaviorDone : bool
private bool _isValueBehaviorDone;
public bool IsValueBehaviorDone
{
get { return _isValueBehaviorDone; }
set { _isValueBehaviorDone = value; }
}
#endregion
#region ObjectsTemplate < PMPTargetSetting > : PMPTargetSetting
private ObjectsTemplate<PMPTargetSetting> _oPMPTargetSettings;
public ObjectsTemplate < PMPTargetSetting > OPMPTargetSettings
{
get
{
if (this.PmpProcessID != null && this.PmpProcessID.IsUnassigned == false && this.PmpProcessID.Integer > 0 && _oPMPTargetSettings == null)
_oPMPTargetSettings = PMPProcess.GetPMPTargetSettingsByEmployeeIdAndPMPProcessID(EmployeeID, PmpProcessID);
return _oPMPTargetSettings;
}
set { _oPMPTargetSettings = value; }
}
#endregion
#region ObjectsTemplate < PMPValueBehaviorRating > : OPMPValueBehaviorRatings
private ObjectsTemplate < PMPValueBehaviorRating > _oPMPValueBehaviorRatings;
public ObjectsTemplate< PMPValueBehaviorRating > OPMPValueBehaviorRatings
{
get
{
if (this.PmpProcessID != null && this.PmpProcessID.IsUnassigned == false && this.PmpProcessID.Integer > 0 && _oPMPValueBehaviorRatings == null)
_oPMPValueBehaviorRatings = PMPProcess.GetValueBehaviorRatingsByEmployeeIdAndPmpProcessId(this.EmployeeID, this.PmpProcessID);
return _oPMPValueBehaviorRatings;
}
set { _oPMPValueBehaviorRatings = value; }
}
public ObjectsTemplate<PMPValueBehaviorRating> ValueBehaviorRatings
{
get
{
ObjectsTemplate<PMPValueBehaviorRating> _valueBehaviorRatings=PMPProcess.GetValueBehaviorRatingsByEmployeeIdAndPmpProcessId(EmployeeID, PmpProcessID);
if(_valueBehaviorRatings ==null )
_valueBehaviorRatings = new ObjectsTemplate<PMPValueBehaviorRating>();
ObjectsTemplate<PMPValueBehaviorRating> valueBehaviorRatings = new ObjectsTemplate<PMPValueBehaviorRating>();
foreach (PMPValueBehaviorRating rat in _valueBehaviorRatings)
{
valueBehaviorRatings.Add(rat);
}
ObjectsTemplate<PMPValueBehavior> _valueBehaviors = PMPValueBehavior.Get(EnumStatus.Active ) ;
foreach (PMPValueBehavior vb in _valueBehaviors)
{
bool toadd = true;
PMPValueBehaviorRating item = new PMPValueBehaviorRating();
foreach (PMPValueBehaviorRating rat in _valueBehaviorRatings)
{
if (rat.PMPValueBehaviorID.Integer == vb.ID.Integer)
{
toadd = false;
break;
}
}
if (toadd)
{
item.PMPValueBehaviorID = vb.ID;
item.EmployeeID = EmployeeID;
item.PmpEmployeeRatingID = ID;
item.PmpProcessId = PmpProcessID;
valueBehaviorRatings.Add(item);
}
}
_oPMPValueBehaviorRatings = valueBehaviorRatings;
return valueBehaviorRatings;
}
}
#endregion
#region Employee
private Employee _employee;
public Employee Employee
{
get
{
if (_employee == null && _employeeID != null)
{
_employee = Employee.Get(_employeeID);
}
return _employee;
}
set
{
_employee = value;
}
}
#endregion
#endregion
public string WFDesciption()
{
string sDescription;
sDescription = this.Employee.Name + " (" + this.Employee.EmployeeNo + ")"
+ " Submitted target for this year PMP";
return sDescription;
}
#region Iworkflow Implementation
public string ObjectDescription
{
get
{
string str = "";
str = this.Employee.Name + " (" + this.Employee.EmployeeNo + ")"
+ " Submitted target for this year PMP" ;
return str;
}
}
public int GetStatusbyWf(enumwfStatus wfstatus)
{
PMPWFStatus tatus;
switch (wfstatus)
{
case enumwfStatus.Exception:
case enumwfStatus.Received:
case enumwfStatus.Passed:
tatus = PMPWFStatus.InProcess;
break;
case enumwfStatus.Revert:
tatus = PMPWFStatus.Revert;
break;
case enumwfStatus.Decline:
tatus = PMPWFStatus.Decline;
break;
case enumwfStatus.Approve:
tatus = PMPWFStatus.Complete;
break;
case enumwfStatus.End:
tatus = PMPWFStatus.Complete;
break;
default:
tatus = PMPWFStatus.InProcess;
break;
}
return (int)tatus;
}
public ID SetupID
{
get
{
return ID.FromInteger(2);
}
}
public ID ObjectID
{
get { return this.ID; }
}
public static PMPEmployeeRating Get(ID pmpempid)
{
return PMPProcess.Service.GetPMPEmployeeRatingByPMPProcessID(pmpempid);
}
#endregion
}
}