removeLeaveRequestEntry() Method

Table of Contents

  1. Function
  2. Syntax
  3. Parameters
  4. Return Value
  5. Sample Code
  6. Remarks
  7. Possible Errors
  8. Related Methods

Function

  • Removes an existing employee’s time off request from the system

Syntax

  • AeXMLBridge.removeLeaveRequestEntry(AeTimeOffRequest);

Parameters

Return Value

  • None

Sample Code

C#

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
string empID = "1234";                                                        
// using employee with ID 1234

string minDate = DateTime.Now.ToString("yyyy-MM-dd");
string maxDate = DateTime.Now.AddDays(30).ToString("yyyy-MM-dd");
// set date range to extract employee leave requests

TAeTimeOffRequest[] requests = ws.extractEmployeeLeaveRequestsByIDNum(empID, TRTOFilterEnum.rfRequested, 1, minDate, maxDate);
// extract leave records

if (requests.Length > 0)
// see if we have any leave requests returned
{
for (int i = requests.Length - 1; i >= 0; i--)
// iterate through list to find which record(s) we want to remove
{
if (requests[i].ReqState == 1)
// can only remove those records in a "submitted" state
{
try
{
ws.removeLeaveRequestEntry(requests[i]);
break;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
}

VB.Net

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Dim empID As Sting = "1234"
' using employee with ID 1234

Dim minDate As String = DateTime.Now.ToString("yyyy-MM-dd")
' set date range to extract employee leave requests
Dim maxDate As String = DateTime.Now.AddDays(30).ToString("yyyy-MM-dd")

Dim requests As TAeTimeOffRequest() = ws.extractEmployeeLeaveRequestsByIDNum(empID, TRTOFilterEnum.rfRequested, 1, minDate, maxDate)
' extract leave records

If requests.Length > 0 Then
' see if we have any leave requests returned

For i As Integer = requests.Length - 1 To 0 Step -1
' iterate through list to find which record(s) we want to remove

If requests(i).ReqState = 1 Then
' can only remove those records in a "submitted" state

Try
ws.removeLeaveRequestEntry(requests(i))
Exit Try
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End If
Next
End If

Remarks

  • The field ReqState in the TAeTimeOffRequest structure must be equal to one to be able to be removed

Possible Errors

  • Leave request with ID (UniqueID) unavailable

approveCancelLeaveRequestEntry
approveCancelLeaveRequestEntryMess
approveLeaveRequestEntry
approveLeaveRequestEntryEx
approveLeaveRequestEntryMess
denyCancelLeaveRequestEntry
denyCancelLeaveRequestEntryMess
denyLeaveRequestEntryEx
denyLeaveRequestEntryMess
describeLeaveRequestEntry
empCancelLeaveRequestEntry
empCancelLeaveRequestEntryMess
empRemoveLeaveRequestEntry
empRemoveLeaveRequestEntryMess
extractEmployeeLeaveRequest
extractEmployeeLeaveRequestsByIDNum
extractEmployeeLeaveRequestHist
extractLeaveRequestsByState
extractTimeOffRequestStates
leaveRequestIsCancelable
leaveRequestIsRemovable
submitTimeOffRequest
submitTimeOffRequestEx
submitTimeOffRequestMess

Back to Top