using GMCabsDriverAssistant.Services;
|
|
using GMCabsDriverAssistant.Utils;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace GMCabsDriverAssistantSolution.ViewModels
|
|
{
|
|
public class VoucherScanHistoryViewModel : BaseViewModel
|
|
{
|
|
#region Fields
|
|
private int voucherScanCount = 0;
|
|
#endregion
|
|
|
|
#region Properties
|
|
|
|
public int VoucherScanCount
|
|
{
|
|
get => voucherScanCount;
|
|
set => SetProperty(ref voucherScanCount, value);
|
|
}
|
|
#endregion
|
|
|
|
#region Constructor
|
|
public VoucherScanHistoryViewModel()
|
|
{
|
|
Title = "Voucher Scan History";
|
|
DateTime reportingDate = DateTime.Now;
|
|
VoucherScanedCount(reportingDate);
|
|
}
|
|
#endregion
|
|
|
|
#region Methods
|
|
public void OnDateSelected(object sender, DateChangedEventArgs args)
|
|
{
|
|
DateTime reportingDate = args.NewDate;
|
|
VoucherScanedCount(reportingDate);
|
|
}
|
|
|
|
private async void VoucherScanedCount(DateTime reportingDate)
|
|
{
|
|
int count;
|
|
var token = Preferences.Get(SecureStorageData.Token, "");
|
|
if (token != null)
|
|
{
|
|
GMCabsDriverService gmCabsDriverService = new GMCabsDriverService();
|
|
count = await gmCabsDriverService.VoucherScanedCount(token, reportingDate);
|
|
|
|
VoucherScanCount = count;
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
}
|