diff --git a/Data/Repository/IPresenceRepository.cs b/Data/Repository/IPresenceRepository.cs index 880ebde..35d07d1 100644 --- a/Data/Repository/IPresenceRepository.cs +++ b/Data/Repository/IPresenceRepository.cs @@ -7,6 +7,7 @@ namespace Demo.Data.Repository List GetAllPresences(); List? GetPresenceByGroup(); List GetPresenceByGroupDate(); + void IsAttedance(int firstLesson, int lastLesson, DateOnly date, Guid UserGuid); List GeneratePresence(List presenceLocalEntities); } } \ No newline at end of file diff --git a/Data/Repository/PresenceRepositoryImpl.cs b/Data/Repository/PresenceRepositoryImpl.cs index ad7d57d..7ef17e0 100644 --- a/Data/Repository/PresenceRepositoryImpl.cs +++ b/Data/Repository/PresenceRepositoryImpl.cs @@ -11,7 +11,7 @@ namespace Demo.Data.Repository return GetAllPresence; } - public List? GetPresenceByGroup(){ + public List GetPresenceByGroup(){ return GetAllPresence; } @@ -23,5 +23,13 @@ namespace Demo.Data.Repository GetAllPresence.AddRange(presenceLocalEntities); return presenceLocalEntities; } + + public void IsAttedance(int firstLesson, int lastLesson, DateOnly date, Guid UserGuid){ + foreach(PresenceLocalEntity presence in GetAllPresence.Where(x => x.LessonNumber >= firstLesson && x.LessonNumber <= lastLesson && x.Date == date)){ + if (presence.UserGuid == UserGuid){ + presence.IsAttedance = false; + } + } + } } -} \ No newline at end of file +} diff --git a/Domain/UseCase/IPresenceUseCase.cs b/Domain/UseCase/IPresenceUseCase.cs index 261491f..7c298c1 100644 --- a/Domain/UseCase/IPresenceUseCase.cs +++ b/Domain/UseCase/IPresenceUseCase.cs @@ -6,6 +6,7 @@ namespace Demo.Domain.UseCase { List GetPresenceByGroup(int groupID); List GetPresenceByGroupByTime(int groupID, DateOnly date); + bool IsAttedance(int firstLesson, int lastLesson, DateOnly date, Guid UserGuid); bool GeneratePresence(int firstLesson, int lastLesson, int groupID, DateOnly date); } } \ No newline at end of file diff --git a/Domain/UseCase/PresenceUseCase.cs b/Domain/UseCase/PresenceUseCase.cs index 4b02494..f832291 100644 --- a/Domain/UseCase/PresenceUseCase.cs +++ b/Domain/UseCase/PresenceUseCase.cs @@ -63,6 +63,11 @@ namespace Demo.Domain.UseCase return presenceByGroup; } + public bool IsAttedance(int firstLesson, int lastLesson, DateOnly date, Guid UserGuid){ + _repositoryPresenceImpl.IsAttedance(firstLesson, lastLesson, date, UserGuid); + return true; + } + public bool GeneratePresence(int firstLesson, int lastLesson, int groupID, DateOnly date){ List presenceList = new List{}; var usersByGroup = _repositoryUserImpl.GetAllUser().Where(x => x.GroupID == groupID); diff --git a/UI/MainMenu.cs b/UI/MainMenu.cs index 35fd8fa..77ede43 100644 --- a/UI/MainMenu.cs +++ b/UI/MainMenu.cs @@ -33,9 +33,10 @@ namespace Demo.UI case "10": Console.WriteLine("писяпопакака"); break; - case "777": _presenceConsoleUI.DisplayPresenceByGroup(Convert.ToInt32(Console.ReadLine())); break; - case "888": _presenceConsoleUI.DisplayPresenceByGroupByTime(Convert.ToInt32(Console.ReadLine()), DateOnly.FromDateTime(Convert.ToDateTime(Console.ReadLine()))); break; - case "999": _presenceConsoleUI.GeneratePresence(Convert.ToInt32(Console.ReadLine()), Convert.ToInt32(Console.ReadLine()), Convert.ToInt32(Console.ReadLine()), DateOnly.FromDateTime(Convert.ToDateTime(Console.ReadLine()))); break; + case "666": _presenceConsoleUI.DisplayPresenceByGroup(Convert.ToInt32(Console.ReadLine())); break; + case "777": _presenceConsoleUI.DisplayPresenceByGroupByTime(Convert.ToInt32(Console.ReadLine()), DateOnly.FromDateTime(Convert.ToDateTime(Console.ReadLine()))); break; + case "888": _presenceConsoleUI.GeneratePresence(Convert.ToInt32(Console.ReadLine()), Convert.ToInt32(Console.ReadLine()), Convert.ToInt32(Console.ReadLine()), DateOnly.FromDateTime(Convert.ToDateTime(Console.ReadLine()))); break; + case "999": _presenceConsoleUI.IsAttedance(Convert.ToInt32(Console.ReadLine()), Convert.ToInt32(Console.ReadLine()), DateOnly.FromDateTime(Convert.ToDateTime(Console.ReadLine())), Guid.Parse(Console.ReadLine())); break; default: DisplayMenu(); break; diff --git a/UI/UserConsole.cs b/UI/UserConsole.cs index d788dc1..54dcc0b 100644 --- a/UI/UserConsole.cs +++ b/UI/UserConsole.cs @@ -113,5 +113,10 @@ namespace Demo.UI string output = _presenceUseCase.GeneratePresence(firstLesson, lastLesson, groupID, date) ? "Сгенерированно" : "Не сгенерированно"; Console.WriteLine(output); } + + public void IsAttedance(int firstLesson, int lastLesson, DateOnly date, Guid UserGuid){ + string output = _presenceUseCase.IsAttedance(firstLesson, lastLesson, date, UserGuid) ? "Обновлено" : "Не обновлено"; + Console.WriteLine(output); + } } } \ No newline at end of file diff --git a/bin/Debug/net8.0/Demo.dll b/bin/Debug/net8.0/Demo.dll index 004f83b..fc0015c 100644 Binary files a/bin/Debug/net8.0/Demo.dll and b/bin/Debug/net8.0/Demo.dll differ diff --git a/bin/Debug/net8.0/Demo.pdb b/bin/Debug/net8.0/Demo.pdb index 131f007..64a5206 100644 Binary files a/bin/Debug/net8.0/Demo.pdb and b/bin/Debug/net8.0/Demo.pdb differ diff --git a/obj/Debug/net8.0/Demo.AssemblyInfo.cs b/obj/Debug/net8.0/Demo.AssemblyInfo.cs index 860a7c0..eee0f46 100644 --- a/obj/Debug/net8.0/Demo.AssemblyInfo.cs +++ b/obj/Debug/net8.0/Demo.AssemblyInfo.cs @@ -13,7 +13,7 @@ using System.Reflection; [assembly: System.Reflection.AssemblyCompanyAttribute("Demo")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+62cf71e0807e9e3240bed91fc96a70ca85f326da")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+fdad32d8d007294c9270715bb64c3c6b73d4aa0e")] [assembly: System.Reflection.AssemblyProductAttribute("Demo")] [assembly: System.Reflection.AssemblyTitleAttribute("Demo")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] diff --git a/obj/Debug/net8.0/Demo.AssemblyInfoInputs.cache b/obj/Debug/net8.0/Demo.AssemblyInfoInputs.cache index bf8e6c2..1903a9d 100644 --- a/obj/Debug/net8.0/Demo.AssemblyInfoInputs.cache +++ b/obj/Debug/net8.0/Demo.AssemblyInfoInputs.cache @@ -1 +1 @@ -a01cfb167fed9f2405a5e73c2f292e1435aae3d26590e7f2368a0b28d9d0813e +1f5ed0f5079c7ee0bc0322da92b35ef0b9128733503d321fbe8276d571ff8b7d diff --git a/obj/Debug/net8.0/Demo.dll b/obj/Debug/net8.0/Demo.dll index 004f83b..fc0015c 100644 Binary files a/obj/Debug/net8.0/Demo.dll and b/obj/Debug/net8.0/Demo.dll differ diff --git a/obj/Debug/net8.0/Demo.pdb b/obj/Debug/net8.0/Demo.pdb index 131f007..64a5206 100644 Binary files a/obj/Debug/net8.0/Demo.pdb and b/obj/Debug/net8.0/Demo.pdb differ diff --git a/obj/Debug/net8.0/ref/Demo.dll b/obj/Debug/net8.0/ref/Demo.dll index e62f0f4..91cf30f 100644 Binary files a/obj/Debug/net8.0/ref/Demo.dll and b/obj/Debug/net8.0/ref/Demo.dll differ diff --git a/obj/Debug/net8.0/refint/Demo.dll b/obj/Debug/net8.0/refint/Demo.dll index e62f0f4..91cf30f 100644 Binary files a/obj/Debug/net8.0/refint/Demo.dll and b/obj/Debug/net8.0/refint/Demo.dll differ