clsEmployeeLeave¶
clsEmployeeLeave is a public class in SAIF.Business that inherits clsBusinessBase, implements ILoadable, and models an employee-leave record with leave-type, date-range, employee, and audit fields.
Purpose¶
- Represents a single employee-leave row identified by
EMPLOYEE_LEAVE_SEQ_NUM. - Creates new leave records with generated sequence numbers and system-type context.
- Retrieves existing leave data and exposes related employee information and leave-type mappings.
- Enforces required-field and date-range business rules before save operations.
Context¶
- Namespace:
SAIF.Business - Assembly/package:
SAIF.Business
Public members¶
| Member | Signature | Purpose |
|---|---|---|
EmployeeLeaveSeqNum |
Public Property EmployeeLeaveSeqNum() As Decimal |
Gets or sets the employee-leave sequence number. |
EmployeeEmplid |
Public Property EmployeeEmplid() As String |
Gets or sets the employee ID and clears the cached employee object when the value changes. |
Employee |
Public ReadOnly Property Employee As clsEmployeeData |
Lazily retrieves and returns the related clsEmployeeData for EmployeeEmplid. |
EmployeeName |
Public ReadOnly Property EmployeeName As String |
Returns the employee's formatted name when the employee is valid and active; otherwise returns the employee ID. |
LeaveTypeCode |
Public Property LeaveTypeCode() As String |
Gets or sets the stored leave-type code. |
LeaveType |
Public ReadOnly Property LeaveType As LeaveTypes |
Returns the mapped LeaveTypes enum value for LeaveTypeCode, defaulting to LeaveTypes.Leave when the code is empty. |
LeaveDescription |
Public ReadOnly Property LeaveDescription() As String |
Returns the string form of the mapped leave type, or an empty string when no leave code is set. |
BeginDate |
Public Property BeginDate() As Date |
Gets or sets the leave begin date through the backing clsSmartDate. |
EndDate |
Public Property EndDate() As Date |
Gets or sets the leave end date through the backing clsSmartDate. |
OriginalBeignDate |
Public ReadOnly Property OriginalBeignDate As Date |
Returns the original value captured by the begin-date clsSmartDate. |
OriginalEndDate |
Public ReadOnly Property OriginalEndDate As Date |
Returns the original value captured by the end-date clsSmartDate. |
SystemTypeCode |
Public ReadOnly Property SystemTypeCode() As String |
Returns the system-type code associated with the leave record. |
CreateDate |
Public Property CreateDate() As Date |
Gets or sets the create date stored on the leave record. |
CreateUser |
Public Property CreateUser() As String |
Gets or sets the create user stored on the leave record. |
UpdateDate |
Public Property UpdateDate() As Date |
Gets or sets the update date through the backing clsSmartDate. |
UpdateUser |
Public Property UpdateUser() As String |
Gets or sets the update user through the backing clsSmartString. |
NewEmployeeLeave |
Public Shared Function NewEmployeeLeave(ByVal inDataportal As IDataPortalInfo, ByVal inSystemTypeCode As String) As clsEmployeeLeave |
Creates a new clsEmployeeLeave through the data-access layer using the supplied system type code. |
GetEmployeeLeave |
Public Shared Function GetEmployeeLeave(ByVal inDataportal As IDataPortalInfo, ByVal inEmployeeLeaveSeqNum As Decimal, ByVal inEmployeeEmplid As String) As clsEmployeeLeave |
Retrieves an existing leave record through the data-access layer. |
Behavioral notes¶
Employeelazy-loadsclsEmployeeDatawithclsEmployeeData.GetDataByEmployeeID(MyCriteria.DataPortalInfo, _EmployeeEmplid, , True)and caches the result untilEmployeeEmplidchanges.EmployeeNamereturnsEmployee.FormattedNameonly when the related employee is both valid and active.Createassigns a new sequence fromEMPLOYEE_LEAVE_SEQ, copiesSystemTypeCodefrom criteria, stampsCreateDatewithToday, and stores an uppercase trimmedCreateUserfrom the data portal user ID.- Insert and update operations call
AddInsertUpdateParms, which sendsEmployeeLeaveSeqNum,EmployeeEmplid,LeaveTypeCode,SystemTypeCode,BeginDate, andEndDateas request parameters. AfterInsert,AfterUpdate, andAfterDeleteall expect exactly one affected row; otherwise the object records an error message instead of marking itself old or new.GetEmployeeLeave(ByVal inDataportal As IDataPortalInfo, ByVal inEmployeeLeaveSeqNum As Decimal, ByVal inEmployeeEmplid As String)accepts both sequence number and employee ID, butBeforeRetrieveadds onlyEmployeeLeaveSeqNumto the request.- Business rules require nonblank
EmployeeEmplidandLeaveTypeCode, require both dates, require each date to be later than01/01/1900and no later than two years from today, requireEndDate >= BeginDate, and requireEndDate >= Today.
Constraints and usage notes¶
- Instances are created through
NewEmployeeLeaveor retrieved throughGetEmployeeLeave; the class's constructor isProtected Friend. SystemTypeCodeis read-only on the public surface and is set during create/load operations.- The request parameter lengths baked into this class are 11 for
EmployeeEmplid, 5 forLeaveTypeCode, 5 forSystemTypeCode, and 30 forCreateUser/UpdateUser. - The property name is spelled
OriginalBeignDatein source and documentation because that is the public member declared by the class.
Sources¶
Business\SAIF.Business\clsEmployeeLeave.vb