You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.5 KiB

  1. using GMCabsDriverAssistant.Services;
  2. using GMCabsDriverAssistant.Utils;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace GMCabsDriverAssistantSolution.ViewModels
  9. {
  10. public class VoucherScanHistoryViewModel : BaseViewModel
  11. {
  12. #region Fields
  13. private int voucherScanCount = 0;
  14. #endregion
  15. #region Properties
  16. public int VoucherScanCount
  17. {
  18. get => voucherScanCount;
  19. set => SetProperty(ref voucherScanCount, value);
  20. }
  21. #endregion
  22. #region Constructor
  23. public VoucherScanHistoryViewModel()
  24. {
  25. Title = "Voucher Scan History";
  26. DateTime reportingDate = DateTime.Now;
  27. VoucherScanedCount(reportingDate);
  28. }
  29. #endregion
  30. #region Methods
  31. public void OnDateSelected(object sender, DateChangedEventArgs args)
  32. {
  33. DateTime reportingDate = args.NewDate;
  34. VoucherScanedCount(reportingDate);
  35. }
  36. private async void VoucherScanedCount(DateTime reportingDate)
  37. {
  38. int count;
  39. var token = Preferences.Get(SecureStorageData.Token, "");
  40. if (token != null)
  41. {
  42. GMCabsDriverService gmCabsDriverService = new GMCabsDriverService();
  43. count = await gmCabsDriverService.VoucherScanedCount(token, reportingDate);
  44. VoucherScanCount = count;
  45. }
  46. }
  47. #endregion
  48. }
  49. }