Skip to content

Instantly share code, notes, and snippets.

@jvanhoesen
Created November 24, 2020 21:38
Show Gist options
  • Select an option

  • Save jvanhoesen/a385ca54d3f87a4694728f6c509c9a27 to your computer and use it in GitHub Desktop.

Select an option

Save jvanhoesen/a385ca54d3f87a4694728f6c509c9a27 to your computer and use it in GitHub Desktop.
Primary Data-Access-Class RowSelected
/// <summary>
/// Enables Approve/Reject buttons when a document goes to 'Pending Approval'
/// Disables header fields except for 'Hold' checkbox when doc is off hold
/// </summary>
protected virtual void _(Events.RowSelected<AATimeRequest> e)
{
if (e.Row is AATimeRequest row)
{
if (Setup.Current.TimeRequestApproval ?? false) //Approvals are set
{
Approve.SetEnabled(row.Status == AATimeRequestStatus.PendingApproval && row.IsApprover == true);
Reject.SetEnabled(row.Status == AATimeRequestStatus.PendingApproval && row.IsApprover == true);
}
else //No approvals
{
Approve.SetEnabled(row.Status == AATimeRequestStatus.PendingApproval);
Reject.SetEnabled(row.Status == AATimeRequestStatus.PendingApproval);
}
e.Cache.SetEnabled<AATimeRequest.employeeID>(row, row.Status == AATimeRequestStatus.OnHold);
e.Cache.SetEnabled<AATimeRequest.date>(row, row.Status == AATimeRequestStatus.OnHold);
e.Cache.SetEnabled<AATimeRequest.description>(row, row.Status == AATimeRequestStatus.OnHold);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment