diff --git a/GMCabsDriverAssistantSolution/ViewModels/VoucherScanHistoryViewModel.cs b/GMCabsDriverAssistantSolution/ViewModels/VoucherScanHistoryViewModel.cs new file mode 100644 index 0000000..48bd8ce --- /dev/null +++ b/GMCabsDriverAssistantSolution/ViewModels/VoucherScanHistoryViewModel.cs @@ -0,0 +1,56 @@ +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 + } +} diff --git a/GMCabsDriverAssistantSolution/Views/VoucherScanHistory.xaml b/GMCabsDriverAssistantSolution/Views/VoucherScanHistory.xaml new file mode 100644 index 0000000..1877c7f --- /dev/null +++ b/GMCabsDriverAssistantSolution/Views/VoucherScanHistory.xaml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/GMCabsDriverAssistantSolution/Views/VoucherScanHistory.xaml.cs b/GMCabsDriverAssistantSolution/Views/VoucherScanHistory.xaml.cs new file mode 100644 index 0000000..05e7834 --- /dev/null +++ b/GMCabsDriverAssistantSolution/Views/VoucherScanHistory.xaml.cs @@ -0,0 +1,27 @@ +using GMCabsDriverAssistantSolution.ViewModels; + +namespace GMCabsDriverAssistantSolution.Views; + +public partial class VoucherScanHistory : ContentPage +{ + #region Fields + private readonly VoucherScanHistoryViewModel _viewModel; + #endregion + + #region Properties + #endregion + + #region Constructor + public VoucherScanHistory() + { + InitializeComponent(); + BindingContext = _viewModel = new VoucherScanHistoryViewModel(); + } + #endregion + public void OnDateSelected(object sender, DateChangedEventArgs args) + { + _viewModel.OnDateSelected(sender, args); + } + #region Methods + #endregion +} \ No newline at end of file