protected async override Task OnInitializedAsync()
        {
            authenticationState = await((CustomAuthenticationStateProvider)AuthenticationStateProvider).GetAuthenticationStateAsync();
            Username            =
                authenticationState.User.Claims
                .Where(c => c.Type.Equals("sub"))
                .Select(c => c.Value)
                .FirstOrDefault() ?? string.Empty;

            //Requested = 1, Approved = 2, Rejected = 3, Queried = 4, Processing = 5, RejectedByFinance = 7, Finished = 8, Cancel = 9, Saved = 99
            ExpenseClaimsList = (await ExpenseClaimDataService.GetExpenseClaimsWithItems(false));

            if (Username[0].Equals('5')) // Approver
            {
                ExpenseClaimsList = ExpenseClaimsList.Where(x => x.Status == Services.Status.Approved);
            }
            else if (Username[0].Equals('7')) // Finance Dept
            {
                ExpenseClaimsList = ExpenseClaimsList.Where(x => x.Status == Services.Status.Processing);
            }
            else if (Username[0].Equals('2')) // employees
            {
                ExpenseClaimsList = ExpenseClaimsList.Where(x => x.RequesterId == int.Parse(Username));
            }
            else if (Username[0].Equals('9')) // administrator
            {
            }
            else // others
            {
                ExpenseClaimsList = null;
            }
        }
 protected async void OnIncludeHistoryChanged(ChangeEventArgs args)
 {
     if ((bool)args.Value)
     {
         ExpenseClaims = await ExpenseClaimDataService.GetExpenseClaimsWithItems(true);
     }
     else
     {
         ExpenseClaims = await ExpenseClaimDataService.GetExpenseClaimsWithItems(false);
     }
 }
        protected async Task GetExpenseClaims()
        {
            DateTime dt = new DateTime(int.Parse(SelectedYear), int.Parse(SelectedMonth), 1);

            var Claims = await ExpenseClaimDataService.GetPagedClaimForMonth(dt, pageNumber.Value, 5);

            paginatedList     = new PaginatedList <ExpenseClaimItemsViewModel>(Claims.ClaimsForMonth.ToList(), Claims.Count, pageNumber.Value, 5);
            ExpenseClaimsList = paginatedList.Items;

            StateHasChanged();
        }
        protected async Task HandleValidSubmit()
        {
            ApiResponse <int> response;

            if (SelectedExpenseClaimId == 0)
            {
                response = await ExpenseClaimDataService.CreateExpenseClaim(ExpenseClaimDetailViewModel);
            }
            else
            {
                response = await ExpenseClaimDataService.UpdateExpenseClaim(ExpenseClaimDetailViewModel);
            }

            HandleResponse(response);
        }
 protected override async Task OnInitializedAsync()
 {
     authenticationState = await((CustomAuthenticationStateProvider)AuthenticationStateProvider).GetAuthenticationStateAsync();
     Username            =
         authenticationState.User.Claims
         .Where(c => c.Type.Equals("sub"))
         .Select(c => c.Value)
         .FirstOrDefault() ?? string.Empty;
     if (int.TryParse(ExpenseClaimid, out SelectedExpenseClaimId))
     {
         ExpenseClaimDetailViewModel = await ExpenseClaimDataService.GetExpenseClaimById(SelectedExpenseClaimId);
     }
     else
     {
         ExpenseClaimDetailViewModel.RequesterId = int.Parse(Username);
     }
 }
        protected async Task DeleteExpenseClaim()
        {
            var response = await ExpenseClaimDataService.DeleteExpenseClaim(SelectedExpenseClaimId);

            HandleResponse(response);
        }