LevelStatistics.razor.cs 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. using AntDesign;
  2. using Microsoft.AspNetCore.Components;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Globalization;
  6. using System.Threading.Tasks;
  7. using wispro.sp.share;
  8. using wispro.sp.web.Services;
  9. using System.Linq;
  10. namespace wispro.sp.web.Pages.AppCase
  11. {
  12. public partial class LevelStatistics
  13. {
  14. CultureInfo CiEn = CultureInfo.GetCultureInfo("en-US");
  15. CultureInfo CiCn = CultureInfo.GetCultureInfo("zh-CN");
  16. DatePicker<DateTime?> refDate;
  17. DateTime? SelectedTime;
  18. DatePickerLocale CN = new DatePickerLocale
  19. {
  20. FirstDayOfWeek = DayOfWeek.Sunday,
  21. Lang = new DateLocale
  22. {
  23. YearFormat = "yyyy年",
  24. MonthFormat = "M月",
  25. DateSelect = "选择日期",
  26. WeekSelect = "选择周",
  27. MonthSelect = "选择月份",
  28. YearSelect = "选择年份",
  29. QuarterSelect = "选择季度",
  30. Today = "今天"
  31. }
  32. };
  33. [Inject]
  34. PerformanceItemServices pService { get; set; }
  35. private async Task ShowSelectedDate()
  36. {
  37. if (SelectedTime != null)
  38. {
  39. int year = SelectedTime.Value.Year;
  40. int quartar = 1;
  41. if (SelectedTime.Value.Month <= 3)
  42. {
  43. quartar = 1;
  44. }
  45. else
  46. {
  47. if (SelectedTime.Value.Month <= 6)
  48. {
  49. quartar = 2;
  50. }
  51. else
  52. {
  53. if (SelectedTime.Value.Month <= 9)
  54. {
  55. quartar = 3;
  56. }
  57. else
  58. {
  59. quartar = 4;
  60. }
  61. }
  62. }
  63. await pService.StatisticsLevelCount(year, 1);
  64. await pService.StatisticsLevelCount(year, 2);
  65. await pService.StatisticsLevelCount(year, 3);
  66. }
  67. }
  68. LevelStatisticsResult AResult;
  69. LevelStatisticsResult BResult;
  70. LevelStatisticsResult CResult;
  71. LevelStatisticsResult DResult;
  72. protected override async Task OnInitializedAsync()
  73. {
  74. if(SelectedTime == null)
  75. {
  76. SelectedTime = DateTime.Now.AddMonths(-3);
  77. }
  78. AResult = await pService.CalAgentLevel(SelectedTime.Value.Year, 1, "A");
  79. BResult = await pService.CalAgentLevel(SelectedTime.Value.Year, 1, "B");
  80. CResult = await pService.CalAgentLevel(SelectedTime.Value.Year, 1, "C");
  81. DResult = await pService.CalAgentLevel(SelectedTime.Value.Year, 1, "D");
  82. await base.OnInitializedAsync();
  83. }
  84. }
  85. }