approveCancelLeaveRequestEntry() Method

Table of Contents

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

Function

  • Used to approve the cancellation of a leave request

Syntax

  • AeXMLBridge.approveCancelLeaveRequestEntry(UniqueID, Comments);

Parameters

  • Integer - UniqueID value from a valid TAeTimeOffRequest structure
  • String - comments (optional)

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
string minDate = DateTime.Now.ToString("yyyy-MM-dd");                        
// setting minDate to today

string maxDate = DateTime.Now.AddDays(30).ToString("yyyy-MM-dd");
// setting maxDate to 30 days from today

string empID = "1234";
// use employee 1234

TAeTimeOffRequestAry[] reqs = ws.extractEmployeeLeaveRequestsByIDNum(empID, TRTOFilterEnum.rfRequested, 1, minDate, maxDate);
// retrieve all leave requests within time frame

for (int i = reqs.Length - 1; i >= 0; i--)
// and iterate thru them
{
if (reqs[i].ReqState == 4)
// ReqState = 4 means request is in "Cancel Request" state
{
try
{
ws.approveCancelLeaveRequestEntry(reqs[i].UniqueID, comments);
}
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
Dim minDate As String = DateTime.Now.ToString("yyyy-MM-dd")
' setting minDate to today

Dim maxDate As String = DateTime.Now.AddDays(30).ToString("yyyy-MM-dd")
' setting maxDate to 30 days from today

Dim empID As String = "1234"
' use employee 1234

Dim reqs As TAeTimeOffRequestAry() = ws.extractEmployeeLeaveRequestsByIDNum(empID, TRTOFilterEnum.rfRequested, 1, minDate, maxDate)
' retrieve all leave requests within time frame and iterate thru them

For i As Integer = reqs.Length - 1 To 0 Step -1
If reqs(i).ReqState = 4 Then
' ReqState = 4 means request is in "Cancel Request" state

Try
ws.approveCancelLeaveRequestEntry(reqs(i).UniqueID, comments)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End If
Next

Remarks

  • This method marks a request as cancelled
  • The UniqueID specifies the leave request to be cancelled
  • Field ReqState in TAeTimeOffRequest structure must have a value of ‘4’ for the cancel leave request to be approved

Possible Errors

  • Leave request with ID unavailable
  • yyyy-mm-dd is required [Date supplied in invalid format]

Alternate Method

approveCancelLeaveRequestEntryMess

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

Back to Top