From 345818f0565cf667f0b3b780a7c18b0b378eb73e Mon Sep 17 00:00:00 2001 From: Dasha06 Date: Thu, 26 Dec 2024 13:10:54 +0300 Subject: [PATCH] done selecting multiple date for presence --- .../ViewModels/PresenceViewModel.cs | 42 ++++++++++-------- Presence.Desktop/Views/PresenceView.axaml | 6 ++- Presence.Desktop/Views/PresenceView.axaml.cs | 20 +++++++++ .../bin/Debug/net8.0/Presence.Desktop.dll | Bin 238592 -> 238592 bytes .../bin/Debug/net8.0/Presence.Desktop.pdb | Bin 23600 -> 24028 bytes Presence.Desktop/bin/Debug/net8.0/data.dll | Bin 41984 -> 41984 bytes Presence.Desktop/bin/Debug/net8.0/data.pdb | Bin 20684 -> 20684 bytes Presence.Desktop/bin/Debug/net8.0/domain.dll | Bin 25088 -> 25088 bytes Presence.Desktop/bin/Debug/net8.0/domain.pdb | Bin 19376 -> 19376 bytes .../net8.0/Avalonia/Presence.Desktop.dll | Bin 238592 -> 238592 bytes .../net8.0/Avalonia/Presence.Desktop.pdb | Bin 23600 -> 24028 bytes .../obj/Debug/net8.0/Avalonia/resources | Bin 183406 -> 183442 bytes .../net8.0/Presence.Desktop.AssemblyInfo.cs | 4 +- .../Presence.Desktop.AssemblyInfoInputs.cache | 2 +- ...nce.Desktop.csproj.AssemblyReference.cache | Bin 22498 -> 22498 bytes .../obj/Debug/net8.0/Presence.Desktop.dll | Bin 209920 -> 210432 bytes .../obj/Debug/net8.0/Presence.Desktop.pdb | Bin 22084 -> 22396 bytes .../obj/Debug/net8.0/ref/Presence.Desktop.dll | Bin 12288 -> 12288 bytes .../refint/Avalonia/Presence.Desktop.dll | Bin 12288 -> 12288 bytes .../Debug/net8.0/refint/Presence.Desktop.dll | Bin 12800 -> 13312 bytes .../Debug/net8.0/console_ui.AssemblyInfo.cs | 2 +- .../console_ui.AssemblyInfoInputs.cache | 2 +- .../console_ui.csproj.AssemblyReference.cache | Bin 11349 -> 11349 bytes data/bin/Debug/net8.0/data.dll | Bin 41984 -> 41984 bytes data/bin/Debug/net8.0/data.pdb | Bin 20684 -> 20684 bytes data/obj/Debug/net8.0/data.AssemblyInfo.cs | 4 +- .../net8.0/data.AssemblyInfoInputs.cache | 2 +- data/obj/Debug/net8.0/data.dll | Bin 41984 -> 41984 bytes data/obj/Debug/net8.0/data.pdb | Bin 20684 -> 20684 bytes data/obj/Debug/net8.0/ref/data.dll | Bin 14848 -> 14848 bytes data/obj/Debug/net8.0/refint/data.dll | Bin 14848 -> 14848 bytes domain/bin/Debug/net8.0/data.dll | Bin 41984 -> 41984 bytes domain/bin/Debug/net8.0/data.pdb | Bin 20684 -> 20684 bytes domain/bin/Debug/net8.0/domain.dll | Bin 25088 -> 25088 bytes domain/bin/Debug/net8.0/domain.pdb | Bin 19376 -> 19376 bytes .../obj/Debug/net8.0/domain.AssemblyInfo.cs | 4 +- .../net8.0/domain.AssemblyInfoInputs.cache | 2 +- .../domain.csproj.AssemblyReference.cache | Bin 8151 -> 8151 bytes domain/obj/Debug/net8.0/domain.dll | Bin 25088 -> 25088 bytes domain/obj/Debug/net8.0/domain.pdb | Bin 19376 -> 19376 bytes domain/obj/Debug/net8.0/ref/domain.dll | Bin 13824 -> 13824 bytes domain/obj/Debug/net8.0/refint/domain.dll | Bin 13824 -> 13824 bytes .../Debug/net8.0/presence_api.AssemblyInfo.cs | 2 +- .../presence_api.AssemblyInfoInputs.cache | 2 +- ...resence_api.csproj.AssemblyReference.cache | Bin 5581 -> 5242 bytes ui/obj/Debug/net8.0/ui.AssemblyInfo.cs | 2 +- .../Debug/net8.0/ui.AssemblyInfoInputs.cache | 2 +- .../net8.0/ui.csproj.AssemblyReference.cache | Bin 10602 -> 10602 bytes 48 files changed, 63 insertions(+), 35 deletions(-) diff --git a/Presence.Desktop/ViewModels/PresenceViewModel.cs b/Presence.Desktop/ViewModels/PresenceViewModel.cs index ce76ecf..dda7000 100644 --- a/Presence.Desktop/ViewModels/PresenceViewModel.cs +++ b/Presence.Desktop/ViewModels/PresenceViewModel.cs @@ -6,6 +6,7 @@ using Presence.Desktop.Models; using Presence.Desktop.ViewModels; using ReactiveUI; using System; +using System.Collections.Generic; using System.Collections.ObjectModel; using System.Globalization; using System.Linq; @@ -41,8 +42,8 @@ namespace Presence.Desktop.ViewModels } } - private DateTime? _selectedDate; - public DateTime? SelectedDate + private List _selectedDate = new List(); + public List SelectedDate { get => _selectedDate; set @@ -83,7 +84,7 @@ namespace Presence.Desktop.ViewModels } } - private void FilterAttendanceRecords() + public void FilterAttendanceRecords() { if (SelectedGroup == null || SelectedDate == null) { @@ -91,25 +92,30 @@ namespace Presence.Desktop.ViewModels return; } - var records = _presenceUseCase.GetPresenceByGroupAndDate( - SelectedGroup.Id, - DateOnly.FromDateTime(SelectedDate.Value)); - AttendanceRecords.Clear(); - foreach (var record in records) + + foreach (var selDate in SelectedDate) { - AttendanceRecords.Add(new PresencePresenter - { - Id = record.Id, - Date = record.Date, - ClassNumber = record.ClassNumber, - IsAttendence = record.IsAttendence, - User = new UserPresenter + var records = _presenceUseCase.GetPresenceByGroupAndDate( + SelectedGroup.Id, + DateOnly.FromDateTime(selDate.Value)); + + foreach (var record in records) { - Id = record.User.Id, - Name= record.User.FIO + AttendanceRecords.Add(new PresencePresenter + { + Id = record.Id, + Date = record.Date, + ClassNumber = record.ClassNumber, + IsAttendence = record.IsAttendence, + User = new UserPresenter + { + Id = record.User.Id, + Name = record.User.FIO + } + }); } - }); + } // Логирование для отладки diff --git a/Presence.Desktop/Views/PresenceView.axaml b/Presence.Desktop/Views/PresenceView.axaml index 5da2718..31a40e6 100644 --- a/Presence.Desktop/Views/PresenceView.axaml +++ b/Presence.Desktop/Views/PresenceView.axaml @@ -19,10 +19,11 @@ - + + - + @@ -34,6 +35,7 @@