diff --git a/presence_new/Data/Repository/SQLPresenceRepositoryImpl.cs b/presence_new/Data/Repository/SQLPresenceRepositoryImpl.cs index 2e13420..92bc1fd 100644 --- a/presence_new/Data/Repository/SQLPresenceRepositoryImpl.cs +++ b/presence_new/Data/Repository/SQLPresenceRepositoryImpl.cs @@ -19,14 +19,36 @@ namespace Demo.Data.Repository public void SavePresence(List presences) { - _remoteDatabaseContext.PresenceDaos.AddRange(presences.Select(it => new PresenceDao { - Date = DateOnly.FromDateTime(it.Date), - IsAttedance = it.IsAttedance, - LessonNumber = it.LessonNumber, - UserGuid = it.UserGuid })); + foreach (var presence in presences) + { + // Проверяем, существует ли запись с указанными датой, пользователем и номером занятия + var existing = _remoteDatabaseContext.PresenceDaos.FirstOrDefault(p => + p.Date == DateOnly.FromDateTime(presence.Date) && + p.UserGuid == presence.UserGuid && + p.LessonNumber == presence.LessonNumber); + + if (existing == null) + { + // Добавляем запись, если её не существует + _remoteDatabaseContext.PresenceDaos.Add(new PresenceDao + { + Date = DateOnly.FromDateTime(presence.Date), + IsAttedance = presence.IsAttedance, + LessonNumber = presence.LessonNumber, + UserGuid = presence.UserGuid + }); + } + else + { + // Обновляем запись, если она уже существует + existing.IsAttedance = presence.IsAttedance; + } + } + + // Сохраняем все изменения в базе данных _remoteDatabaseContext.SaveChanges(); } - + public void AddPresence(PresenceLocalEntity presence) { if (presence == null) throw new ArgumentNullException(nameof(presence)); diff --git a/presence_new/bin/Debug/net8.0/Demo.dll b/presence_new/bin/Debug/net8.0/Demo.dll index 8c99645..e183bd9 100644 Binary files a/presence_new/bin/Debug/net8.0/Demo.dll and b/presence_new/bin/Debug/net8.0/Demo.dll differ diff --git a/presence_new/bin/Debug/net8.0/Demo.exe b/presence_new/bin/Debug/net8.0/Demo.exe index f2faf2d..29f6e5a 100644 Binary files a/presence_new/bin/Debug/net8.0/Demo.exe and b/presence_new/bin/Debug/net8.0/Demo.exe differ diff --git a/presence_new/bin/Debug/net8.0/Demo.pdb b/presence_new/bin/Debug/net8.0/Demo.pdb index edeaa41..c36d382 100644 Binary files a/presence_new/bin/Debug/net8.0/Demo.pdb and b/presence_new/bin/Debug/net8.0/Demo.pdb differ diff --git a/presence_new/obj/Debug/net8.0/Demo.AssemblyInfo.cs b/presence_new/obj/Debug/net8.0/Demo.AssemblyInfo.cs index 0e00dd0..6b02f59 100644 --- a/presence_new/obj/Debug/net8.0/Demo.AssemblyInfo.cs +++ b/presence_new/obj/Debug/net8.0/Demo.AssemblyInfo.cs @@ -14,7 +14,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+a2c399bffd9faab806c32428db650aa0dc6beda0")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f0f13fd99020ad4382d88f0d7ac71fd127a217f9")] [assembly: System.Reflection.AssemblyProductAttribute("Demo")] [assembly: System.Reflection.AssemblyTitleAttribute("Demo")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] diff --git a/presence_new/obj/Debug/net8.0/Demo.AssemblyInfoInputs.cache b/presence_new/obj/Debug/net8.0/Demo.AssemblyInfoInputs.cache index 411550b..ed7cb88 100644 --- a/presence_new/obj/Debug/net8.0/Demo.AssemblyInfoInputs.cache +++ b/presence_new/obj/Debug/net8.0/Demo.AssemblyInfoInputs.cache @@ -1 +1 @@ -dd902f0088e730c458698a5604cc9ccee9e7331bc32a1270f6f471ef0788085f +926ddea3ff12cb8f4f0ca8122c04de8f5c0b00ba69e9b8f0048baf56e27cb1cf diff --git a/presence_new/obj/Debug/net8.0/Demo.GeneratedMSBuildEditorConfig.editorconfig b/presence_new/obj/Debug/net8.0/Demo.GeneratedMSBuildEditorConfig.editorconfig index 785e987..674a253 100644 --- a/presence_new/obj/Debug/net8.0/Demo.GeneratedMSBuildEditorConfig.editorconfig +++ b/presence_new/obj/Debug/net8.0/Demo.GeneratedMSBuildEditorConfig.editorconfig @@ -8,6 +8,6 @@ build_property.PlatformNeutralAssembly = build_property.EnforceExtendedAnalyzerRules = build_property._SupportedPlatformList = Linux,macOS,Windows build_property.RootNamespace = Demo -build_property.ProjectDir = C:\Users\class_student\Source\Repos\Mega_New_Presence\presence_new\ +build_property.ProjectDir = C:\Users\class_student\source\repos\Mega_New_Presence\presence_new\ build_property.EnableComHosting = build_property.EnableGeneratedComInterfaceComImportInterop = diff --git a/presence_new/obj/Debug/net8.0/Demo.assets.cache b/presence_new/obj/Debug/net8.0/Demo.assets.cache index ddd7854..e0783c6 100644 Binary files a/presence_new/obj/Debug/net8.0/Demo.assets.cache and b/presence_new/obj/Debug/net8.0/Demo.assets.cache differ diff --git a/presence_new/obj/Debug/net8.0/Demo.dll b/presence_new/obj/Debug/net8.0/Demo.dll index 8c99645..e183bd9 100644 Binary files a/presence_new/obj/Debug/net8.0/Demo.dll and b/presence_new/obj/Debug/net8.0/Demo.dll differ diff --git a/presence_new/obj/Debug/net8.0/Demo.genruntimeconfig.cache b/presence_new/obj/Debug/net8.0/Demo.genruntimeconfig.cache index 57822d9..5fedcad 100644 --- a/presence_new/obj/Debug/net8.0/Demo.genruntimeconfig.cache +++ b/presence_new/obj/Debug/net8.0/Demo.genruntimeconfig.cache @@ -1 +1 @@ -8bfd3511ab889b8490352355df4ad111bccdd9af0463ad3198e9d919d614764e +66e4c1bba691035b8d023c5ab70479699ad4d8c58a5e6d5f7ad60ecde8af2bcb diff --git a/presence_new/obj/Debug/net8.0/Demo.pdb b/presence_new/obj/Debug/net8.0/Demo.pdb index edeaa41..c36d382 100644 Binary files a/presence_new/obj/Debug/net8.0/Demo.pdb and b/presence_new/obj/Debug/net8.0/Demo.pdb differ diff --git a/presence_new/obj/Debug/net8.0/apphost.exe b/presence_new/obj/Debug/net8.0/apphost.exe index f2faf2d..29f6e5a 100644 Binary files a/presence_new/obj/Debug/net8.0/apphost.exe and b/presence_new/obj/Debug/net8.0/apphost.exe differ diff --git a/presence_new/obj/Debug/net8.0/ref/Demo.dll b/presence_new/obj/Debug/net8.0/ref/Demo.dll index c4b0631..581da9e 100644 Binary files a/presence_new/obj/Debug/net8.0/ref/Demo.dll and b/presence_new/obj/Debug/net8.0/ref/Demo.dll differ diff --git a/presence_new/obj/Debug/net8.0/refint/Demo.dll b/presence_new/obj/Debug/net8.0/refint/Demo.dll index c4b0631..581da9e 100644 Binary files a/presence_new/obj/Debug/net8.0/refint/Demo.dll and b/presence_new/obj/Debug/net8.0/refint/Demo.dll differ diff --git a/presence_new/obj/Demo.csproj.nuget.dgspec.json b/presence_new/obj/Demo.csproj.nuget.dgspec.json index c69468e..7e29ddc 100644 --- a/presence_new/obj/Demo.csproj.nuget.dgspec.json +++ b/presence_new/obj/Demo.csproj.nuget.dgspec.json @@ -1,20 +1,24 @@ { "format": 1, "restore": { - "C:\\Users\\class_student\\Source\\Repos\\Mega_New_Presence\\presence_new\\Demo.csproj": {} + "C:\\Users\\class_student\\source\\repos\\Mega_New_Presence\\presence_new\\Demo.csproj": {} }, "projects": { - "C:\\Users\\class_student\\Source\\Repos\\Mega_New_Presence\\presence_new\\Demo.csproj": { + "C:\\Users\\class_student\\source\\repos\\Mega_New_Presence\\presence_new\\Demo.csproj": { "version": "1.0.0", "restore": { - "projectUniqueName": "C:\\Users\\class_student\\Source\\Repos\\Mega_New_Presence\\presence_new\\Demo.csproj", + "projectUniqueName": "C:\\Users\\class_student\\source\\repos\\Mega_New_Presence\\presence_new\\Demo.csproj", "projectName": "Demo", - "projectPath": "C:\\Users\\class_student\\Source\\Repos\\Mega_New_Presence\\presence_new\\Demo.csproj", + "projectPath": "C:\\Users\\class_student\\source\\repos\\Mega_New_Presence\\presence_new\\Demo.csproj", "packagesPath": "C:\\Users\\class_student\\.nuget\\packages\\", - "outputPath": "C:\\Users\\class_student\\Source\\Repos\\Mega_New_Presence\\presence_new\\obj\\", + "outputPath": "C:\\Users\\class_student\\source\\repos\\Mega_New_Presence\\presence_new\\obj\\", "projectStyle": "PackageReference", + "fallbackFolders": [ + "C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages" + ], "configFilePaths": [ "C:\\Users\\class_student\\AppData\\Roaming\\NuGet\\NuGet.Config", + "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config", "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" ], "originalTargetFrameworks": [ diff --git a/presence_new/obj/Demo.csproj.nuget.g.props b/presence_new/obj/Demo.csproj.nuget.g.props index edb479c..c24b8e3 100644 --- a/presence_new/obj/Demo.csproj.nuget.g.props +++ b/presence_new/obj/Demo.csproj.nuget.g.props @@ -5,12 +5,13 @@ NuGet $(MSBuildThisFileDirectory)project.assets.json $(UserProfile)\.nuget\packages\ - C:\Users\class_student\.nuget\packages\ + C:\Users\class_student\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages PackageReference 6.9.2 + diff --git a/presence_new/obj/project.assets.json b/presence_new/obj/project.assets.json index 8bdc45a..ee3aab7 100644 --- a/presence_new/obj/project.assets.json +++ b/presence_new/obj/project.assets.json @@ -2396,19 +2396,24 @@ ] }, "packageFolders": { - "C:\\Users\\class_student\\.nuget\\packages\\": {} + "C:\\Users\\class_student\\.nuget\\packages\\": {}, + "C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages": {} }, "project": { "version": "1.0.0", "restore": { - "projectUniqueName": "C:\\Users\\class_student\\Source\\Repos\\Mega_New_Presence\\presence_new\\Demo.csproj", + "projectUniqueName": "C:\\Users\\class_student\\source\\repos\\Mega_New_Presence\\presence_new\\Demo.csproj", "projectName": "Demo", - "projectPath": "C:\\Users\\class_student\\Source\\Repos\\Mega_New_Presence\\presence_new\\Demo.csproj", + "projectPath": "C:\\Users\\class_student\\source\\repos\\Mega_New_Presence\\presence_new\\Demo.csproj", "packagesPath": "C:\\Users\\class_student\\.nuget\\packages\\", - "outputPath": "C:\\Users\\class_student\\Source\\Repos\\Mega_New_Presence\\presence_new\\obj\\", + "outputPath": "C:\\Users\\class_student\\source\\repos\\Mega_New_Presence\\presence_new\\obj\\", "projectStyle": "PackageReference", + "fallbackFolders": [ + "C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages" + ], "configFilePaths": [ "C:\\Users\\class_student\\AppData\\Roaming\\NuGet\\NuGet.Config", + "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config", "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" ], "originalTargetFrameworks": [ diff --git a/presence_new/obj/project.nuget.cache b/presence_new/obj/project.nuget.cache index acf5d9b..35a3095 100644 --- a/presence_new/obj/project.nuget.cache +++ b/presence_new/obj/project.nuget.cache @@ -1,8 +1,8 @@ { "version": 2, - "dgSpecHash": "5j6Q0wQAgGNgXb7AVtlneZ6ztPd6SxIjaxUAnwEiUSDrqBM9Uhid+TaQlvpxQpbqhuvap8gDUh1InqHMnd0/fg==", + "dgSpecHash": "MCQYo+gWP0sRSB7d7cA1aBHHMnk9N2WXV8R5eoe+rfk9u/FbMB9qiuSuvJgyZl7k5rqRp51YEut1IAZqOq/2ng==", "success": true, - "projectFilePath": "C:\\Users\\class_student\\Source\\Repos\\Mega_New_Presence\\presence_new\\Demo.csproj", + "projectFilePath": "C:\\Users\\class_student\\source\\repos\\Mega_New_Presence\\presence_new\\Demo.csproj", "expectedPackageFiles": [ "C:\\Users\\class_student\\.nuget\\packages\\closedxml\\0.104.1\\closedxml.0.104.1.nupkg.sha512", "C:\\Users\\class_student\\.nuget\\packages\\closedxml.parser\\1.2.0\\closedxml.parser.1.2.0.nupkg.sha512",