This commit is contained in:
Class_Student 2024-11-08 09:28:46 +03:00
parent f0f13fd990
commit f738e1e578
18 changed files with 54 additions and 22 deletions

View File

@ -19,14 +19,36 @@ namespace Demo.Data.Repository
public void SavePresence(List<PresenceLocalEntity> 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));

View File

@ -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")]

View File

@ -1 +1 @@
dd902f0088e730c458698a5604cc9ccee9e7331bc32a1270f6f471ef0788085f
926ddea3ff12cb8f4f0ca8122c04de8f5c0b00ba69e9b8f0048baf56e27cb1cf

View File

@ -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 =

View File

@ -1 +1 @@
8bfd3511ab889b8490352355df4ad111bccdd9af0463ad3198e9d919d614764e
66e4c1bba691035b8d023c5ab70479699ad4d8c58a5e6d5f7ad60ecde8af2bcb

View File

@ -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": [

View File

@ -5,12 +5,13 @@
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\class_student\.nuget\packages\</NuGetPackageFolders>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\class_student\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.9.2</NuGetToolVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="C:\Users\class_student\.nuget\packages\" />
<SourceRoot Include="C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages\" />
</ItemGroup>
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<Import Project="$(NuGetPackageRoot)microsoft.entityframeworkcore\8.0.10\buildTransitive\net8.0\Microsoft.EntityFrameworkCore.props" Condition="Exists('$(NuGetPackageRoot)microsoft.entityframeworkcore\8.0.10\buildTransitive\net8.0\Microsoft.EntityFrameworkCore.props')" />

View File

@ -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": [

View File

@ -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",