init commit
This commit is contained in:
commit
e6111032d1
31
console_ui/Program.cs
Normal file
31
console_ui/Program.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using data.RemoteData.RemoteDataBase;
|
||||
using data.Repository;
|
||||
using domain.UseCase;
|
||||
using ui;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
// Создаем экземпляр репозиториев
|
||||
|
||||
IServiceCollection services = new ServiceCollection();
|
||||
|
||||
services
|
||||
.AddDbContext<RemoteDatabaseContext>()
|
||||
.AddSingleton<IGroupRepository, SQLGroupRepositoryImpl>()
|
||||
.AddSingleton<IUserRepository, SQLUserRepositoryImpl>()
|
||||
.AddSingleton<IPresenceRepository, SQLPresenceRepositoryImpl>()
|
||||
.AddSingleton<UserUseCase>()
|
||||
.AddSingleton<GroupUseCase>()
|
||||
.AddSingleton<UseCaseGeneratePresence>()
|
||||
.AddSingleton<GroupConsoleUI>()
|
||||
.AddSingleton<PresenceConsole>()
|
||||
.AddSingleton<MainMenuUI>();
|
||||
|
||||
|
||||
|
||||
|
||||
var serviceProvider = services.BuildServiceProvider();
|
||||
// Создаем пользовательский интерфейс
|
||||
MainMenuUI mainMenuUI = serviceProvider.GetService<MainMenuUI>();
|
||||
|
||||
// Выводим главное меню
|
||||
mainMenuUI.DisplayMenu();
|
20
console_ui/console_ui.csproj
Normal file
20
console_ui/console_ui.csproj
Normal file
@ -0,0 +1,20 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\domain\domain.csproj" />
|
||||
<ProjectReference Include="..\data\data.csproj" />
|
||||
<ProjectReference Include="..\ui\ui.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
@ -0,0 +1,4 @@
|
||||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]
|
23
console_ui/obj/Debug/net8.0/console_ui.AssemblyInfo.cs
Normal file
23
console_ui/obj/Debug/net8.0/console_ui.AssemblyInfo.cs
Normal file
@ -0,0 +1,23 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Этот код создан программой.
|
||||
// Исполняемая версия:4.0.30319.42000
|
||||
//
|
||||
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
||||
// повторной генерации кода.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("console_ui")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("console_ui")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("console_ui")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
// Создано классом WriteCodeFragment MSBuild.
|
||||
|
@ -0,0 +1 @@
|
||||
ba882f03fdfa9546ef7659464bc47e4a0ca2d53498595f377280140f0c41eed4
|
@ -0,0 +1,13 @@
|
||||
is_global = true
|
||||
build_property.TargetFramework = net8.0
|
||||
build_property.TargetPlatformMinVersion =
|
||||
build_property.UsingMicrosoftNETSdkWeb =
|
||||
build_property.ProjectTypeGuids =
|
||||
build_property.InvariantGlobalization =
|
||||
build_property.PlatformNeutralAssembly =
|
||||
build_property.EnforceExtendedAnalyzerRules =
|
||||
build_property._SupportedPlatformList = Linux,macOS,Windows
|
||||
build_property.RootNamespace = console_ui
|
||||
build_property.ProjectDir = C:\Users\class_student\source\repos\presence\console_ui\
|
||||
build_property.EnableComHosting =
|
||||
build_property.EnableGeneratedComInterfaceComImportInterop =
|
8
console_ui/obj/Debug/net8.0/console_ui.GlobalUsings.g.cs
Normal file
8
console_ui/obj/Debug/net8.0/console_ui.GlobalUsings.g.cs
Normal file
@ -0,0 +1,8 @@
|
||||
// <auto-generated/>
|
||||
global using global::System;
|
||||
global using global::System.Collections.Generic;
|
||||
global using global::System.IO;
|
||||
global using global::System.Linq;
|
||||
global using global::System.Net.Http;
|
||||
global using global::System.Threading;
|
||||
global using global::System.Threading.Tasks;
|
BIN
console_ui/obj/Debug/net8.0/console_ui.assets.cache
Normal file
BIN
console_ui/obj/Debug/net8.0/console_ui.assets.cache
Normal file
Binary file not shown.
Binary file not shown.
310
console_ui/obj/console_ui.csproj.nuget.dgspec.json
Normal file
310
console_ui/obj/console_ui.csproj.nuget.dgspec.json
Normal file
@ -0,0 +1,310 @@
|
||||
{
|
||||
"format": 1,
|
||||
"restore": {
|
||||
"C:\\Users\\class_student\\source\\repos\\presence\\console_ui\\console_ui.csproj": {}
|
||||
},
|
||||
"projects": {
|
||||
"C:\\Users\\class_student\\source\\repos\\presence\\console_ui\\console_ui.csproj": {
|
||||
"version": "1.0.0",
|
||||
"restore": {
|
||||
"projectUniqueName": "C:\\Users\\class_student\\source\\repos\\presence\\console_ui\\console_ui.csproj",
|
||||
"projectName": "console_ui",
|
||||
"projectPath": "C:\\Users\\class_student\\source\\repos\\presence\\console_ui\\console_ui.csproj",
|
||||
"packagesPath": "C:\\Users\\class_student\\.nuget\\packages\\",
|
||||
"outputPath": "C:\\Users\\class_student\\source\\repos\\presence\\console_ui\\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": [
|
||||
"net8.0"
|
||||
],
|
||||
"sources": {
|
||||
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
||||
"https://api.nuget.org/v3/index.json": {}
|
||||
},
|
||||
"frameworks": {
|
||||
"net8.0": {
|
||||
"targetAlias": "net8.0",
|
||||
"projectReferences": {
|
||||
"C:\\Users\\class_student\\source\\repos\\presence\\data\\data.csproj": {
|
||||
"projectPath": "C:\\Users\\class_student\\source\\repos\\presence\\data\\data.csproj"
|
||||
},
|
||||
"C:\\Users\\class_student\\source\\repos\\presence\\domain\\domain.csproj": {
|
||||
"projectPath": "C:\\Users\\class_student\\source\\repos\\presence\\domain\\domain.csproj"
|
||||
},
|
||||
"C:\\Users\\class_student\\source\\repos\\presence\\ui\\ui.csproj": {
|
||||
"projectPath": "C:\\Users\\class_student\\source\\repos\\presence\\ui\\ui.csproj"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"warningProperties": {
|
||||
"warnAsError": [
|
||||
"NU1605"
|
||||
]
|
||||
},
|
||||
"restoreAuditProperties": {
|
||||
"enableAudit": "true",
|
||||
"auditLevel": "low",
|
||||
"auditMode": "direct"
|
||||
}
|
||||
},
|
||||
"frameworks": {
|
||||
"net8.0": {
|
||||
"targetAlias": "net8.0",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.DependencyInjection": {
|
||||
"target": "Package",
|
||||
"version": "[8.0.1, )"
|
||||
}
|
||||
},
|
||||
"imports": [
|
||||
"net461",
|
||||
"net462",
|
||||
"net47",
|
||||
"net471",
|
||||
"net472",
|
||||
"net48",
|
||||
"net481"
|
||||
],
|
||||
"assetTargetFallback": true,
|
||||
"warn": true,
|
||||
"frameworkReferences": {
|
||||
"Microsoft.NETCore.App": {
|
||||
"privateAssets": "all"
|
||||
}
|
||||
},
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.204/PortableRuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
},
|
||||
"C:\\Users\\class_student\\source\\repos\\presence\\data\\data.csproj": {
|
||||
"version": "1.0.0",
|
||||
"restore": {
|
||||
"projectUniqueName": "C:\\Users\\class_student\\source\\repos\\presence\\data\\data.csproj",
|
||||
"projectName": "data",
|
||||
"projectPath": "C:\\Users\\class_student\\source\\repos\\presence\\data\\data.csproj",
|
||||
"packagesPath": "C:\\Users\\class_student\\.nuget\\packages\\",
|
||||
"outputPath": "C:\\Users\\class_student\\source\\repos\\presence\\data\\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": [
|
||||
"net8.0"
|
||||
],
|
||||
"sources": {
|
||||
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
||||
"https://api.nuget.org/v3/index.json": {}
|
||||
},
|
||||
"frameworks": {
|
||||
"net8.0": {
|
||||
"targetAlias": "net8.0",
|
||||
"projectReferences": {}
|
||||
}
|
||||
},
|
||||
"warningProperties": {
|
||||
"warnAsError": [
|
||||
"NU1605"
|
||||
]
|
||||
},
|
||||
"restoreAuditProperties": {
|
||||
"enableAudit": "true",
|
||||
"auditLevel": "low",
|
||||
"auditMode": "direct"
|
||||
}
|
||||
},
|
||||
"frameworks": {
|
||||
"net8.0": {
|
||||
"targetAlias": "net8.0",
|
||||
"dependencies": {
|
||||
"Microsoft.EntityFrameworkCore": {
|
||||
"target": "Package",
|
||||
"version": "[8.0.10, )"
|
||||
},
|
||||
"Microsoft.EntityFrameworkCore.Design": {
|
||||
"include": "Runtime, Build, Native, ContentFiles, Analyzers, BuildTransitive",
|
||||
"suppressParent": "All",
|
||||
"target": "Package",
|
||||
"version": "[8.0.10, )"
|
||||
},
|
||||
"Npgsql.EntityFrameworkCore.PostgreSQL": {
|
||||
"target": "Package",
|
||||
"version": "[8.0.10, )"
|
||||
}
|
||||
},
|
||||
"imports": [
|
||||
"net461",
|
||||
"net462",
|
||||
"net47",
|
||||
"net471",
|
||||
"net472",
|
||||
"net48",
|
||||
"net481"
|
||||
],
|
||||
"assetTargetFallback": true,
|
||||
"warn": true,
|
||||
"frameworkReferences": {
|
||||
"Microsoft.NETCore.App": {
|
||||
"privateAssets": "all"
|
||||
}
|
||||
},
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.204/PortableRuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
},
|
||||
"C:\\Users\\class_student\\source\\repos\\presence\\domain\\domain.csproj": {
|
||||
"version": "1.0.0",
|
||||
"restore": {
|
||||
"projectUniqueName": "C:\\Users\\class_student\\source\\repos\\presence\\domain\\domain.csproj",
|
||||
"projectName": "domain",
|
||||
"projectPath": "C:\\Users\\class_student\\source\\repos\\presence\\domain\\domain.csproj",
|
||||
"packagesPath": "C:\\Users\\class_student\\.nuget\\packages\\",
|
||||
"outputPath": "C:\\Users\\class_student\\source\\repos\\presence\\domain\\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": [
|
||||
"net8.0"
|
||||
],
|
||||
"sources": {
|
||||
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
||||
"https://api.nuget.org/v3/index.json": {}
|
||||
},
|
||||
"frameworks": {
|
||||
"net8.0": {
|
||||
"targetAlias": "net8.0",
|
||||
"projectReferences": {
|
||||
"C:\\Users\\class_student\\source\\repos\\presence\\data\\data.csproj": {
|
||||
"projectPath": "C:\\Users\\class_student\\source\\repos\\presence\\data\\data.csproj"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"warningProperties": {
|
||||
"warnAsError": [
|
||||
"NU1605"
|
||||
]
|
||||
},
|
||||
"restoreAuditProperties": {
|
||||
"enableAudit": "true",
|
||||
"auditLevel": "low",
|
||||
"auditMode": "direct"
|
||||
}
|
||||
},
|
||||
"frameworks": {
|
||||
"net8.0": {
|
||||
"targetAlias": "net8.0",
|
||||
"dependencies": {
|
||||
"ClosedXML": {
|
||||
"target": "Package",
|
||||
"version": "[0.104.1, )"
|
||||
}
|
||||
},
|
||||
"imports": [
|
||||
"net461",
|
||||
"net462",
|
||||
"net47",
|
||||
"net471",
|
||||
"net472",
|
||||
"net48",
|
||||
"net481"
|
||||
],
|
||||
"assetTargetFallback": true,
|
||||
"warn": true,
|
||||
"frameworkReferences": {
|
||||
"Microsoft.NETCore.App": {
|
||||
"privateAssets": "all"
|
||||
}
|
||||
},
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.204/PortableRuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
},
|
||||
"C:\\Users\\class_student\\source\\repos\\presence\\ui\\ui.csproj": {
|
||||
"version": "1.0.0",
|
||||
"restore": {
|
||||
"projectUniqueName": "C:\\Users\\class_student\\source\\repos\\presence\\ui\\ui.csproj",
|
||||
"projectName": "ui",
|
||||
"projectPath": "C:\\Users\\class_student\\source\\repos\\presence\\ui\\ui.csproj",
|
||||
"packagesPath": "C:\\Users\\class_student\\.nuget\\packages\\",
|
||||
"outputPath": "C:\\Users\\class_student\\source\\repos\\presence\\ui\\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": [
|
||||
"net8.0"
|
||||
],
|
||||
"sources": {
|
||||
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
||||
"https://api.nuget.org/v3/index.json": {}
|
||||
},
|
||||
"frameworks": {
|
||||
"net8.0": {
|
||||
"targetAlias": "net8.0",
|
||||
"projectReferences": {
|
||||
"C:\\Users\\class_student\\source\\repos\\presence\\domain\\domain.csproj": {
|
||||
"projectPath": "C:\\Users\\class_student\\source\\repos\\presence\\domain\\domain.csproj"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"warningProperties": {
|
||||
"warnAsError": [
|
||||
"NU1605"
|
||||
]
|
||||
},
|
||||
"restoreAuditProperties": {
|
||||
"enableAudit": "true",
|
||||
"auditLevel": "low",
|
||||
"auditMode": "direct"
|
||||
}
|
||||
},
|
||||
"frameworks": {
|
||||
"net8.0": {
|
||||
"targetAlias": "net8.0",
|
||||
"imports": [
|
||||
"net461",
|
||||
"net462",
|
||||
"net47",
|
||||
"net471",
|
||||
"net472",
|
||||
"net48",
|
||||
"net481"
|
||||
],
|
||||
"assetTargetFallback": true,
|
||||
"warn": true,
|
||||
"frameworkReferences": {
|
||||
"Microsoft.NETCore.App": {
|
||||
"privateAssets": "all"
|
||||
}
|
||||
},
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.204/PortableRuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
19
console_ui/obj/console_ui.csproj.nuget.g.props
Normal file
19
console_ui/obj/console_ui.csproj.nuget.g.props
Normal file
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
|
||||
<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\;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')" />
|
||||
</ImportGroup>
|
||||
</Project>
|
7
console_ui/obj/console_ui.csproj.nuget.g.targets
Normal file
7
console_ui/obj/console_ui.csproj.nuget.g.targets
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<Import Project="$(NuGetPackageRoot)microsoft.extensions.logging.abstractions\8.0.2\buildTransitive\net6.0\Microsoft.Extensions.Logging.Abstractions.targets" Condition="Exists('$(NuGetPackageRoot)microsoft.extensions.logging.abstractions\8.0.2\buildTransitive\net6.0\Microsoft.Extensions.Logging.Abstractions.targets')" />
|
||||
<Import Project="$(NuGetPackageRoot)microsoft.extensions.options\8.0.2\buildTransitive\net6.0\Microsoft.Extensions.Options.targets" Condition="Exists('$(NuGetPackageRoot)microsoft.extensions.options\8.0.2\buildTransitive\net6.0\Microsoft.Extensions.Options.targets')" />
|
||||
</ImportGroup>
|
||||
</Project>
|
1144
console_ui/obj/project.assets.json
Normal file
1144
console_ui/obj/project.assets.json
Normal file
File diff suppressed because it is too large
Load Diff
32
console_ui/obj/project.nuget.cache
Normal file
32
console_ui/obj/project.nuget.cache
Normal file
@ -0,0 +1,32 @@
|
||||
{
|
||||
"version": 2,
|
||||
"dgSpecHash": "E1s2H8T8vOF8/RmQcwMKqWYSz4jZg9lB0dshd1kgyFkjOIdZxs1AH482+/GwmYcJnZVYfh9yNQ9egqvgSbtP2Q==",
|
||||
"success": true,
|
||||
"projectFilePath": "C:\\Users\\class_student\\source\\repos\\presence\\console_ui\\console_ui.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",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\documentformat.openxml\\3.0.1\\documentformat.openxml.3.0.1.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\documentformat.openxml.framework\\3.0.1\\documentformat.openxml.framework.3.0.1.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\excelnumberformat\\1.1.0\\excelnumberformat.1.1.0.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.entityframeworkcore\\8.0.10\\microsoft.entityframeworkcore.8.0.10.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.entityframeworkcore.abstractions\\8.0.10\\microsoft.entityframeworkcore.abstractions.8.0.10.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.entityframeworkcore.analyzers\\8.0.10\\microsoft.entityframeworkcore.analyzers.8.0.10.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.entityframeworkcore.relational\\8.0.10\\microsoft.entityframeworkcore.relational.8.0.10.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.extensions.caching.abstractions\\8.0.0\\microsoft.extensions.caching.abstractions.8.0.0.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.extensions.caching.memory\\8.0.1\\microsoft.extensions.caching.memory.8.0.1.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.extensions.configuration.abstractions\\8.0.0\\microsoft.extensions.configuration.abstractions.8.0.0.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.extensions.dependencyinjection\\8.0.1\\microsoft.extensions.dependencyinjection.8.0.1.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.extensions.dependencyinjection.abstractions\\8.0.2\\microsoft.extensions.dependencyinjection.abstractions.8.0.2.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.extensions.logging\\8.0.1\\microsoft.extensions.logging.8.0.1.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.extensions.logging.abstractions\\8.0.2\\microsoft.extensions.logging.abstractions.8.0.2.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.extensions.options\\8.0.2\\microsoft.extensions.options.8.0.2.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.extensions.primitives\\8.0.0\\microsoft.extensions.primitives.8.0.0.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\npgsql\\8.0.5\\npgsql.8.0.5.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\npgsql.entityframeworkcore.postgresql\\8.0.10\\npgsql.entityframeworkcore.postgresql.8.0.10.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\rbush\\3.2.0\\rbush.3.2.0.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\sixlabors.fonts\\1.0.0\\sixlabors.fonts.1.0.0.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\system.io.packaging\\8.0.0\\system.io.packaging.8.0.0.nupkg.sha512"
|
||||
],
|
||||
"logs": []
|
||||
}
|
10
data/Exceptions/GroupNotFoundException.cs
Normal file
10
data/Exceptions/GroupNotFoundException.cs
Normal file
@ -0,0 +1,10 @@
|
||||
using System;
|
||||
|
||||
namespace Dataceptions
|
||||
{
|
||||
public class GroupNotFoundException : RepositoryException
|
||||
{
|
||||
public GroupNotFoundException(int groupId)
|
||||
: base($"Группа с ID {groupId} не найдена.") { }
|
||||
}
|
||||
}
|
9
data/Exceptions/RepositoryException.cs
Normal file
9
data/Exceptions/RepositoryException.cs
Normal file
@ -0,0 +1,9 @@
|
||||
using System;
|
||||
|
||||
namespace Dataceptions
|
||||
{
|
||||
public class RepositoryException : Exception
|
||||
{
|
||||
public RepositoryException(string message) : base(message) { }
|
||||
}
|
||||
}
|
10
data/Exceptions/UserNotFoundException.cs
Normal file
10
data/Exceptions/UserNotFoundException.cs
Normal file
@ -0,0 +1,10 @@
|
||||
using System;
|
||||
|
||||
namespace Dataceptions
|
||||
{
|
||||
public class UserNotFoundException : RepositoryException
|
||||
{
|
||||
public UserNotFoundException(Guid userGuid)
|
||||
: base($"Пользователь с GUID {userGuid} не найден.") { }
|
||||
}
|
||||
}
|
15
data/LocalData/Entity/Group.cs
Normal file
15
data/LocalData/Entity/Group.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace domain.Models
|
||||
{
|
||||
public class GroupLocalEntity
|
||||
{
|
||||
public required int Id { get; set; }
|
||||
public required string Name { get; set; }
|
||||
|
||||
}
|
||||
}
|
19
data/LocalData/Entity/Presence.cs
Normal file
19
data/LocalData/Entity/Presence.cs
Normal file
@ -0,0 +1,19 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace domain.Models
|
||||
{
|
||||
public class PresenceLocalEntity
|
||||
{
|
||||
public Guid UserGuid { get; set; } // Замените int на Guid
|
||||
public int GroupId { get; set; }
|
||||
public int LessonNumber { get; set; }
|
||||
public DateTime Date { get; set; }
|
||||
public bool IsAttedance { get; set; }
|
||||
}
|
||||
|
||||
}
|
25
data/LocalData/Entity/User.cs
Normal file
25
data/LocalData/Entity/User.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace domain.Models
|
||||
{
|
||||
public class UserLocalEnity : IEquatable<UserLocalEnity>
|
||||
{
|
||||
|
||||
public required string FIO { get; set; }
|
||||
public Guid Guid { get; set; }
|
||||
|
||||
public required int GroupID { get; set; }
|
||||
|
||||
|
||||
|
||||
public bool Equals(UserLocalEnity? other)
|
||||
{
|
||||
if (other == null) return false;
|
||||
return this.Guid.Equals(other.Guid);
|
||||
}
|
||||
}
|
||||
}
|
36
data/LocalData/LocalStaticData.cs
Normal file
36
data/LocalData/LocalStaticData.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using domain.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace data.LocalData
|
||||
{
|
||||
public static class LocalStaticData
|
||||
{
|
||||
public static List<GroupLocalEntity> groups => new List<GroupLocalEntity>
|
||||
|
||||
{
|
||||
new GroupLocalEntity{ Id = 1, Name = "ИП1-21" },
|
||||
new GroupLocalEntity{ Id = 2, Name = "ИП1-22" },
|
||||
new GroupLocalEntity{ Id = 3, Name = "ИП1-23" },
|
||||
};
|
||||
|
||||
public static List<UserLocalEnity> users => new List<UserLocalEnity>
|
||||
{
|
||||
new UserLocalEnity{Guid=Guid.Parse("e6b9964d-ea9f-420a-84b9-af9633bbfab9"), FIO = "RandomFio", GroupID = 1 },
|
||||
new UserLocalEnity{Guid=Guid.Parse("8388d931-5bef-41be-a152-78f1aca980ed"), FIO = "RandomFio1", GroupID = 2 },
|
||||
new UserLocalEnity{Guid=Guid.Parse("ed174548-49ed-4503-a902-c970cbf27173"), FIO = "RandomFio2", GroupID = 3 },
|
||||
new UserLocalEnity{Guid=Guid.Parse("614c0a23-5bd5-43ae-b48e-d5750afbc282"), FIO = "RandomFio3", GroupID = 1 },
|
||||
new UserLocalEnity{Guid=Guid.Parse("efcc1473-c116-4244-b3f7-f2341a5c3003"), FIO = "RandomFio4", GroupID = 2 },
|
||||
new UserLocalEnity{Guid=Guid.Parse("60640fb3-ace2-4cad-81d5-a0a58bc2dbbd"), FIO = "RandomFio5", GroupID = 3 },
|
||||
};
|
||||
|
||||
public static List<PresenceLocalEntity> presences => new List<PresenceLocalEntity>
|
||||
{
|
||||
|
||||
};
|
||||
}
|
||||
}
|
19
data/RemoteData/RemoteDataBase/DAO/Excel.cs
Normal file
19
data/RemoteData/RemoteDataBase/DAO/Excel.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace data.RemoteData.RemoteDataBase.DAO
|
||||
{
|
||||
public class Excel
|
||||
{
|
||||
public Guid UserGuid { get; set; }
|
||||
public string UserName { get; set; }
|
||||
public string FullName { get; set; }
|
||||
public DateOnly Date { get; set; }
|
||||
public bool IsAttedance { get; set; }
|
||||
public int LessonNumber { get; set; }
|
||||
public string GroupName { get; set; }
|
||||
}
|
||||
}
|
15
data/RemoteData/RemoteDataBase/DAO/Group.cs
Normal file
15
data/RemoteData/RemoteDataBase/DAO/Group.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace data.RemoteData.RemoteDataBase.DAO
|
||||
{
|
||||
public class GroupDao
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public virtual IEnumerable<UserDao> Users { get; set; }
|
||||
}
|
||||
}
|
19
data/RemoteData/RemoteDataBase/DAO/Presence.cs
Normal file
19
data/RemoteData/RemoteDataBase/DAO/Presence.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace data.RemoteData.RemoteDataBase.DAO
|
||||
{
|
||||
public class PresenceDao
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public Guid UserGuid { get; set; }
|
||||
public bool IsAttedance { get; set; } = true;
|
||||
public DateOnly Date { get; set; }
|
||||
public int LessonNumber { get; set; }
|
||||
public virtual UserDao? UserDao { get; set; }
|
||||
|
||||
}
|
||||
}
|
19
data/RemoteData/RemoteDataBase/DAO/User.cs
Normal file
19
data/RemoteData/RemoteDataBase/DAO/User.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace data.RemoteData.RemoteDataBase.DAO
|
||||
{
|
||||
public class UserDao
|
||||
{
|
||||
public string FIO { get; set; }
|
||||
public Guid Guid { get; set; }
|
||||
|
||||
public int GroupID { get; set; }
|
||||
|
||||
public virtual GroupDao Group { get; set; }
|
||||
public virtual IEnumerable<PresenceDao> Presences{ get; set; }
|
||||
}
|
||||
}
|
15
data/RemoteData/RemoteDataBase/DAO/UserAttendance.cs
Normal file
15
data/RemoteData/RemoteDataBase/DAO/UserAttendance.cs
Normal file
@ -0,0 +1,15 @@
|
||||
public class UserAttendance
|
||||
{
|
||||
public Guid UserGuid { get; set; }
|
||||
public double Attended { get; set; }
|
||||
public double Missed { get; set; }
|
||||
public double AttendanceRate { get; set; }
|
||||
}
|
||||
|
||||
public class GroupPresenceSummary
|
||||
{
|
||||
public int UserCount { get; set; }
|
||||
public int LessonCount { get; set; }
|
||||
public double TotalAttendancePercentage { get; set; }
|
||||
public List<UserAttendance> UserAttendances { get; set; }
|
||||
}
|
43
data/RemoteData/RemoteDataBase/RemoteDatabaseContext.cs
Normal file
43
data/RemoteData/RemoteDataBase/RemoteDatabaseContext.cs
Normal file
@ -0,0 +1,43 @@
|
||||
using data.RemoteData.RemoteDataBase.DAO;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace data.RemoteData.RemoteDataBase
|
||||
{
|
||||
public class RemoteDatabaseContext : DbContext
|
||||
{
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
optionsBuilder.UseNpgsql("Host=45.67.56.214;Port=5421;Username=user15;Database=user15;Password=3XkvwMOb");
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
// Настройка ключа и автоматической генерации для GroupDao
|
||||
modelBuilder.Entity<GroupDao>().HasKey(group => group.Id);
|
||||
modelBuilder.Entity<GroupDao>().Property(group => group.Id).ValueGeneratedOnAdd();
|
||||
|
||||
// Настройка ключа и автоматической генерации для UserDao
|
||||
modelBuilder.Entity<UserDao>().HasKey(user => user.Guid);
|
||||
modelBuilder.Entity<UserDao>().Property(user => user.Guid).ValueGeneratedOnAdd();
|
||||
|
||||
// Настройка составного ключа для PresenceDao
|
||||
modelBuilder.Entity<PresenceDao>().HasKey(presense => new
|
||||
{
|
||||
presense.Id
|
||||
|
||||
});
|
||||
|
||||
|
||||
// Настройка связи UserDao с PresenceDao
|
||||
modelBuilder.Entity<PresenceDao>()
|
||||
.Property(presence => presence.Id)
|
||||
.ValueGeneratedOnAdd();
|
||||
modelBuilder.Entity<PresenceDao>().HasOne(presence => presence.UserDao).WithMany(user => user.Presences).HasForeignKey(presence => presence.UserGuid);
|
||||
|
||||
}
|
||||
|
||||
public DbSet<GroupDao> Groups { get; set; }
|
||||
public DbSet<UserDao> Users { get; set; }
|
||||
public DbSet<PresenceDao> PresenceDaos { get; set; }
|
||||
}
|
||||
}
|
53
data/Repository/GroupRepositoryImpl.cs
Normal file
53
data/Repository/GroupRepositoryImpl.cs
Normal file
@ -0,0 +1,53 @@
|
||||
using Dataceptions;
|
||||
using data.LocalData;
|
||||
using data.RemoteData.RemoteDataBase.DAO;
|
||||
using data.Repository;
|
||||
using domain.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
public class GroupRepositoryImpl : IGroupRepository
|
||||
{
|
||||
private List<GroupLocalEntity> _groups = LocalStaticData.groups;
|
||||
|
||||
public GroupLocalEntity? GetGroupById(int groupId)
|
||||
{
|
||||
return _groups.FirstOrDefault(g => g.Id == groupId);
|
||||
}
|
||||
|
||||
// Метод для получения всех групп
|
||||
public List<GroupLocalEntity> GetAllGroup() => _groups;
|
||||
|
||||
// Метод для добавления новой группы
|
||||
public bool AddGroup(GroupLocalEntity group)
|
||||
{
|
||||
if (_groups.Any(g => g.Id == group.Id))
|
||||
return false;
|
||||
|
||||
group.Id = _groups.Any() ? _groups.Max(g => g.Id) + 1 : 1;
|
||||
_groups.Add(group);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Метод для обновления существующей группы
|
||||
public bool UpdateGroupById(int groupID, GroupLocalEntity updatedGroup)
|
||||
{
|
||||
var existingGroup = GetGroupById(groupID);
|
||||
if (existingGroup == null)
|
||||
return false;
|
||||
|
||||
existingGroup.Name = updatedGroup.Name;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public bool RemoveGroupById(int groupID)
|
||||
{
|
||||
var existingGroup = GetGroupById(groupID);
|
||||
if (existingGroup == null)
|
||||
return false;
|
||||
|
||||
_groups.Remove(existingGroup);
|
||||
return true;
|
||||
}
|
||||
}
|
20
data/Repository/IGroupRepository.cs
Normal file
20
data/Repository/IGroupRepository.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using data.RemoteData.RemoteDataBase.DAO;
|
||||
using domain.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace data.Repository
|
||||
{
|
||||
public interface IGroupRepository
|
||||
{
|
||||
List<GroupLocalEntity> GetAllGroup();
|
||||
bool RemoveGroupById(int groupID);
|
||||
bool UpdateGroupById(int groupID, GroupLocalEntity updatedGroup);
|
||||
GroupLocalEntity GetGroupById(int groupID);
|
||||
bool AddGroup(GroupLocalEntity newGroup);
|
||||
|
||||
}
|
||||
}
|
21
data/Repository/IPresenceRepository.cs
Normal file
21
data/Repository/IPresenceRepository.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using data.RemoteData.RemoteDataBase.DAO;
|
||||
using domain.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace data.Repository
|
||||
{
|
||||
public interface IPresenceRepository
|
||||
{
|
||||
void SavePresence(List<PresenceLocalEntity> presences);
|
||||
List<PresenceLocalEntity> GetPresenceByGroup(int groupId);
|
||||
List<PresenceLocalEntity> GetPresenceByGroupAndDate(int groupId, DateTime date);
|
||||
DateOnly? GetLastDateByGroupId(int groupId);
|
||||
public GroupPresenceSummary GetGeneralPresenceForGroup(int groupId);
|
||||
bool UpdateAtt(Guid UserGuid, int groupId, int firstLesson, int lastLesson, DateOnly date, bool isAttendance);
|
||||
|
||||
void MarkUserAsAbsent(Guid userGuid, int firstLessonNumber, int lastLessonNumber);
|
||||
void AddPresence(PresenceLocalEntity presence);
|
||||
List<PresenceDao> GetAttendanceByGroup(int groupId);
|
||||
}
|
||||
}
|
19
data/Repository/IUserRepository.cs
Normal file
19
data/Repository/IUserRepository.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using data.RemoteData.RemoteDataBase.DAO;
|
||||
using domain.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace data.Repository
|
||||
{
|
||||
public interface IUserRepository
|
||||
{
|
||||
IEnumerable<UserLocalEnity> GetAllUsers { get; }
|
||||
bool RemoveUserById(Guid userGuid);
|
||||
UserLocalEnity? UpdateUser(UserLocalEnity user);
|
||||
List<UserDao> GetUserNames();
|
||||
|
||||
}
|
||||
}
|
62
data/Repository/PresenceRepositoryImpl.cs
Normal file
62
data/Repository/PresenceRepositoryImpl.cs
Normal file
@ -0,0 +1,62 @@
|
||||
using data.RemoteData.RemoteDataBase.DAO;
|
||||
using domain.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace data.Repository
|
||||
{
|
||||
public class PresenceRepositoryImpl
|
||||
{
|
||||
private readonly List<PresenceLocalEntity> _presences = new List<PresenceLocalEntity>();
|
||||
|
||||
public void SavePresence(List<PresenceLocalEntity> presences)
|
||||
{
|
||||
foreach (var presence in presences)
|
||||
{
|
||||
var existing = _presences.FirstOrDefault(p =>
|
||||
p.Date == presence.Date &&
|
||||
p.UserGuid == presence.UserGuid &&
|
||||
p.LessonNumber == presence.LessonNumber);
|
||||
|
||||
if (existing == null)
|
||||
{
|
||||
_presences.Add(presence);
|
||||
}
|
||||
else
|
||||
{
|
||||
existing.IsAttedance = presence.IsAttedance;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void AddPresence(PresenceLocalEntity presence)
|
||||
{
|
||||
if (presence == null) throw new ArgumentNullException(nameof(presence));
|
||||
|
||||
_presences.Add(presence);
|
||||
}
|
||||
|
||||
public List<PresenceLocalEntity> GetPresenceByGroup(int groupId)
|
||||
{
|
||||
return _presences.Where(p => p.GroupId == groupId).ToList();
|
||||
}
|
||||
|
||||
public List<PresenceLocalEntity> GetPresenceByGroupAndDate(int groupId, DateTime date)
|
||||
{
|
||||
return _presences.Where(p => p.GroupId == groupId && p.Date.Date == date.Date).ToList();
|
||||
}
|
||||
|
||||
public void MarkUserAsAbsent(Guid userGuid, int firstLessonNumber, int lastLessonNumber)
|
||||
{
|
||||
foreach (var lesson in Enumerable.Range(firstLessonNumber, lastLessonNumber - firstLessonNumber + 1))
|
||||
{
|
||||
var presence = _presences.FirstOrDefault(p => p.UserGuid == userGuid && p.LessonNumber == lesson);
|
||||
if (presence != null)
|
||||
{
|
||||
presence.IsAttedance = false; // Помечаем как отсутствующего
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
69
data/Repository/SQLGroupRepositoryImpl.cs
Normal file
69
data/Repository/SQLGroupRepositoryImpl.cs
Normal file
@ -0,0 +1,69 @@
|
||||
using Dataceptions;
|
||||
using data.LocalData;
|
||||
using data.RemoteData.RemoteDataBase;
|
||||
using data.RemoteData.RemoteDataBase.DAO;
|
||||
using data.Repository;
|
||||
using domain.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
public class SQLGroupRepositoryImpl : IGroupRepository
|
||||
{
|
||||
private readonly RemoteDatabaseContext _remoteDatabaseContext;
|
||||
|
||||
public SQLGroupRepositoryImpl(RemoteDatabaseContext remoteDatabaseContext)
|
||||
{
|
||||
_remoteDatabaseContext = remoteDatabaseContext;
|
||||
}
|
||||
|
||||
// Метод для получения группы по ID
|
||||
public GroupLocalEntity? GetGroupById(int groupId)
|
||||
{
|
||||
var groupDao = _remoteDatabaseContext.Groups.FirstOrDefault(g => g.Id == groupId);
|
||||
return groupDao != null ? new GroupLocalEntity { Id = groupDao.Id, Name = groupDao.Name } : null;
|
||||
}
|
||||
|
||||
// Метод для получения всех групп
|
||||
public List<GroupLocalEntity> GetAllGroup()
|
||||
{
|
||||
return _remoteDatabaseContext.Groups
|
||||
.Select(g => new GroupLocalEntity { Id = g.Id, Name = g.Name })
|
||||
.ToList();
|
||||
}
|
||||
|
||||
// Метод для добавления новой группы
|
||||
public bool AddGroup(GroupLocalEntity group)
|
||||
{
|
||||
if (_remoteDatabaseContext.Groups.Any(g => g.Id == group.Id))
|
||||
return false;
|
||||
|
||||
var groupDao = new GroupDao { Id = group.Id, Name = group.Name };
|
||||
_remoteDatabaseContext.Groups.Add(groupDao);
|
||||
_remoteDatabaseContext.SaveChanges();
|
||||
return true;
|
||||
}
|
||||
|
||||
// Метод для обновления существующей группы
|
||||
public bool UpdateGroupById(int groupID, GroupLocalEntity updatedGroup)
|
||||
{
|
||||
var existingGroup = _remoteDatabaseContext.Groups.FirstOrDefault(g => g.Id == groupID);
|
||||
if (existingGroup == null)
|
||||
return false;
|
||||
|
||||
existingGroup.Name = updatedGroup.Name;
|
||||
_remoteDatabaseContext.SaveChanges();
|
||||
return true;
|
||||
}
|
||||
|
||||
// Метод для удаления группы по ID
|
||||
public bool RemoveGroupById(int groupID)
|
||||
{
|
||||
var existingGroup = _remoteDatabaseContext.Groups.FirstOrDefault(g => g.Id == groupID);
|
||||
if (existingGroup == null)
|
||||
return false;
|
||||
|
||||
_remoteDatabaseContext.Groups.Remove(existingGroup);
|
||||
_remoteDatabaseContext.SaveChanges();
|
||||
return true;
|
||||
}
|
||||
}
|
219
data/Repository/SQLPresenceRepositoryImpl.cs
Normal file
219
data/Repository/SQLPresenceRepositoryImpl.cs
Normal file
@ -0,0 +1,219 @@
|
||||
using data.RemoteData.RemoteDataBase;
|
||||
using data.RemoteData.RemoteDataBase.DAO;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using domain.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace data.Repository
|
||||
{
|
||||
public class SQLPresenceRepositoryImpl : IPresenceRepository
|
||||
{
|
||||
private readonly RemoteDatabaseContext _remoteDatabaseContext;
|
||||
|
||||
public SQLPresenceRepositoryImpl(RemoteDatabaseContext remoteDatabaseContext)
|
||||
{
|
||||
_remoteDatabaseContext = remoteDatabaseContext;
|
||||
}
|
||||
|
||||
public void SavePresence(List<PresenceLocalEntity> presences)
|
||||
{
|
||||
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));
|
||||
|
||||
var newPresence = new PresenceDao
|
||||
{
|
||||
Date = DateOnly.FromDateTime(presence.Date),
|
||||
UserGuid = presence.UserGuid,
|
||||
LessonNumber = presence.LessonNumber,
|
||||
IsAttedance = presence.IsAttedance
|
||||
};
|
||||
_remoteDatabaseContext.PresenceDaos.Add(newPresence);
|
||||
}
|
||||
|
||||
public List<PresenceLocalEntity> GetPresenceByGroup(int groupId)
|
||||
{
|
||||
return _remoteDatabaseContext.PresenceDaos.Include(user => user.UserDao)
|
||||
.Where(p => p.UserDao != null && p.UserDao.GroupID == groupId) // Проверяем на null перед использованием
|
||||
.Select(p => new PresenceLocalEntity
|
||||
{
|
||||
Date = p.Date.ToDateTime(TimeOnly.MinValue),
|
||||
UserGuid = p.UserGuid,
|
||||
LessonNumber = p.LessonNumber,
|
||||
IsAttedance = p.IsAttedance
|
||||
})
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public List<PresenceLocalEntity> GetPresenceByGroupAndDate(int groupId, DateTime date)
|
||||
{
|
||||
return _remoteDatabaseContext.PresenceDaos
|
||||
.Where(p => p.UserDao != null && p.UserDao.GroupID == groupId && p.Date == DateOnly.FromDateTime(date))
|
||||
.Select(p => new PresenceLocalEntity
|
||||
{
|
||||
Date = p.Date.ToDateTime(TimeOnly.MinValue),
|
||||
UserGuid = p.UserGuid,
|
||||
LessonNumber = p.LessonNumber,
|
||||
IsAttedance = p.IsAttedance
|
||||
})
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public void MarkUserAsAbsent(Guid userGuid, int firstLessonNumber, int lastLessonNumber)
|
||||
{
|
||||
foreach (var lesson in Enumerable.Range(firstLessonNumber, lastLessonNumber - firstLessonNumber + 1))
|
||||
{
|
||||
var presence = _remoteDatabaseContext.PresenceDaos.FirstOrDefault(p =>
|
||||
p.UserGuid == userGuid &&
|
||||
p.LessonNumber == lesson);
|
||||
|
||||
if (presence != null)
|
||||
{
|
||||
presence.IsAttedance = false; // Помечаем как отсутствующего
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public DateOnly? GetLastDateByGroupId(int groupId)
|
||||
{
|
||||
// Проверяем наличие записей о посещаемости в базе данных для данной группы.
|
||||
var lastDate = _remoteDatabaseContext.PresenceDaos
|
||||
.Where(p => p.UserDao.GroupID == groupId)
|
||||
.OrderByDescending(p => p.Date)
|
||||
.Select(p => p.Date)
|
||||
.FirstOrDefault();
|
||||
|
||||
return lastDate == default ? (DateOnly?)null : lastDate;
|
||||
}
|
||||
|
||||
public GroupPresenceSummary GetGeneralPresenceForGroup(int groupId)
|
||||
{
|
||||
var presences = _remoteDatabaseContext.PresenceDaos
|
||||
.Where(p => p.UserDao.GroupID == groupId)
|
||||
.OrderBy(p => p.Date).ThenBy(p => p.LessonNumber)
|
||||
.ToList();
|
||||
|
||||
// Уникальные пары "дата + номер занятия"
|
||||
var distinctLessonDates = presences
|
||||
.Select(p => new { p.Date, p.LessonNumber })
|
||||
.Distinct()
|
||||
.ToList();
|
||||
|
||||
int lessonCount = distinctLessonDates.Count;
|
||||
|
||||
// Считаем количество уникальных пользователей в группе
|
||||
var userGuids = presences
|
||||
.Select(p => p.UserGuid)
|
||||
.Distinct()
|
||||
.ToHashSet();
|
||||
|
||||
// Подсчитываем общее количество посещений и общее количество возможных посещений
|
||||
double totalAttendance = presences.Count(p => p.IsAttedance);
|
||||
double totalPossibleAttendance = userGuids.Count * lessonCount;
|
||||
|
||||
var userAttendances = userGuids.Select(userGuid =>
|
||||
{
|
||||
var userPresences = presences.Where(p => p.UserGuid == userGuid).ToList();
|
||||
double attended = userPresences.Count(p => p.IsAttedance);
|
||||
double missed = userPresences.Count(p => !p.IsAttedance);
|
||||
|
||||
return new UserAttendance
|
||||
{
|
||||
UserGuid = userGuid,
|
||||
Attended = attended,
|
||||
Missed = missed,
|
||||
AttendanceRate = (attended / (attended + missed)) * 100
|
||||
};
|
||||
}).ToList();
|
||||
|
||||
// Рассчитываем общий процент посещаемости группы
|
||||
double totalAttendancePercentage = (totalAttendance / totalPossibleAttendance) * 100;
|
||||
|
||||
return new GroupPresenceSummary
|
||||
{
|
||||
UserCount = userGuids.Count,
|
||||
LessonCount = lessonCount,
|
||||
TotalAttendancePercentage = totalAttendancePercentage,
|
||||
UserAttendances = userAttendances
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public bool UpdateAtt(Guid UserGuid, int groupId, int firstLesson, int lastLesson, DateOnly date, bool isAttendance)
|
||||
{
|
||||
var presences = _remoteDatabaseContext.PresenceDaos
|
||||
.Where(p => p.UserGuid == UserGuid && p.UserDao.GroupID == groupId &&
|
||||
p.LessonNumber >= firstLesson && p.LessonNumber <= lastLesson && p.Date == date)
|
||||
.ToList();
|
||||
|
||||
if (presences.Any())
|
||||
{
|
||||
foreach (var presence in presences)
|
||||
{
|
||||
presence.IsAttedance = isAttendance;
|
||||
}
|
||||
_remoteDatabaseContext.SaveChanges();
|
||||
return true; // Успех
|
||||
}
|
||||
return false; // Данные не найдены
|
||||
}
|
||||
public List<PresenceDao> GetAttendanceByGroup(int groupId)
|
||||
{
|
||||
// Получаем пользователей указанной группы
|
||||
var userGuidsInGroup = _remoteDatabaseContext.Users
|
||||
.Where(u => u.GroupID == groupId)
|
||||
.Select(u => u.Guid)
|
||||
.ToList();
|
||||
|
||||
// Фильтруем посещаемость по пользователям из этой группы
|
||||
return _remoteDatabaseContext.PresenceDaos
|
||||
.Where(p => userGuidsInGroup.Contains(p.UserGuid))
|
||||
.Select(p => new PresenceDao
|
||||
{
|
||||
UserGuid = p.UserGuid,
|
||||
Id = p.Id,
|
||||
Date = p.Date,
|
||||
LessonNumber = p.LessonNumber,
|
||||
IsAttedance = p.IsAttedance
|
||||
})
|
||||
.ToList();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
71
data/Repository/SQLUserRepositoryImpl.cs
Normal file
71
data/Repository/SQLUserRepositoryImpl.cs
Normal file
@ -0,0 +1,71 @@
|
||||
using Dataceptions;
|
||||
using data.RemoteData.RemoteDataBase;
|
||||
using data.RemoteData.RemoteDataBase.DAO;
|
||||
using domain.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace data.Repository
|
||||
{
|
||||
public class SQLUserRepositoryImpl : IUserRepository
|
||||
{
|
||||
private readonly RemoteDatabaseContext _remoteDatabaseContext;
|
||||
|
||||
public SQLUserRepositoryImpl(RemoteDatabaseContext remoteDatabaseContext)
|
||||
{
|
||||
_remoteDatabaseContext = remoteDatabaseContext;
|
||||
}
|
||||
|
||||
// Метод для получения всех пользователей
|
||||
public IEnumerable<UserLocalEnity> GetAllUsers => _remoteDatabaseContext.Users
|
||||
.Select(u => new UserLocalEnity
|
||||
{
|
||||
Guid = u.Guid,
|
||||
FIO = u.FIO,
|
||||
GroupID = u.GroupID
|
||||
})
|
||||
.ToList();
|
||||
|
||||
// Метод для удаления пользователя по GUID
|
||||
public bool RemoveUserById(Guid userGuid)
|
||||
{
|
||||
var user = _remoteDatabaseContext.Users.FirstOrDefault(u => u.Guid == userGuid);
|
||||
if (user == null) throw new UserNotFoundException(userGuid);
|
||||
|
||||
_remoteDatabaseContext.Users.Remove(user);
|
||||
_remoteDatabaseContext.SaveChanges(); // Сохранение изменений в базе данных
|
||||
return true;
|
||||
}
|
||||
|
||||
// Метод для обновления данных пользователя
|
||||
public UserLocalEnity? UpdateUser(UserLocalEnity user)
|
||||
{
|
||||
var existingUser = _remoteDatabaseContext.Users.FirstOrDefault(u => u.Guid == user.Guid);
|
||||
if (existingUser == null) throw new UserNotFoundException(user.Guid);
|
||||
|
||||
existingUser.FIO = user.FIO;
|
||||
existingUser.GroupID = user.GroupID;
|
||||
_remoteDatabaseContext.SaveChanges(); // Сохранение изменений в базе данных
|
||||
|
||||
// Возвращаем обновленный объект UserLocalEnity
|
||||
return new UserLocalEnity
|
||||
{
|
||||
Guid = existingUser.Guid,
|
||||
FIO = existingUser.FIO,
|
||||
GroupID = existingUser.GroupID
|
||||
};
|
||||
}
|
||||
|
||||
// Дополнительный метод для DAO, если требуется
|
||||
public IEnumerable<RemoteData.RemoteDataBase.DAO.UserDao> GetAllUsersDao => _remoteDatabaseContext.Users.ToList();
|
||||
|
||||
public List<UserDao> GetUserNames()
|
||||
{
|
||||
return _remoteDatabaseContext.Users
|
||||
.Select(u => new UserDao { Guid = u.Guid, FIO = u.FIO })
|
||||
.ToList();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
53
data/Repository/UserRepositoryImpl.cs
Normal file
53
data/Repository/UserRepositoryImpl.cs
Normal file
@ -0,0 +1,53 @@
|
||||
using Dataceptions;
|
||||
using data.LocalData;
|
||||
using data.RemoteData.RemoteDataBase.DAO;
|
||||
using domain.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace data.Repository
|
||||
{
|
||||
public class UserRepositoryImpl : IUserRepository
|
||||
{
|
||||
private List<UserLocalEnity> _users;
|
||||
|
||||
public UserRepositoryImpl()
|
||||
{
|
||||
_users = LocalStaticData.users;
|
||||
}
|
||||
|
||||
public IEnumerable<UserLocalEnity> GetAllUsers => _users;
|
||||
|
||||
public bool RemoveUserById(Guid userGuid) // Оставил Guid
|
||||
{
|
||||
var user = _users.FirstOrDefault(u => u.Guid == userGuid);
|
||||
if (user == null) throw new UserNotFoundException(userGuid);
|
||||
|
||||
_users.Remove(user);
|
||||
return true;
|
||||
}
|
||||
|
||||
public UserLocalEnity? UpdateUser(UserLocalEnity user)
|
||||
{
|
||||
var existingUser = _users.FirstOrDefault(u => u.Guid == user.Guid);
|
||||
if (existingUser == null) throw new UserNotFoundException(user.Guid);
|
||||
|
||||
existingUser.FIO = user.FIO;
|
||||
existingUser.GroupID = user.GroupID;
|
||||
|
||||
return existingUser;
|
||||
}
|
||||
|
||||
public List<UserDao> GetUserNames()
|
||||
{
|
||||
return _users
|
||||
.Select(u => new UserDao
|
||||
{
|
||||
Guid = u.Guid,
|
||||
FIO = u.FIO
|
||||
})
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
}
|
18
data/data.csproj
Normal file
18
data/data.csproj
Normal file
@ -0,0 +1,18 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.10" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.10">
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.10" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -0,0 +1,4 @@
|
||||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]
|
23
data/obj/Debug/net8.0/data.AssemblyInfo.cs
Normal file
23
data/obj/Debug/net8.0/data.AssemblyInfo.cs
Normal file
@ -0,0 +1,23 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Этот код создан программой.
|
||||
// Исполняемая версия:4.0.30319.42000
|
||||
//
|
||||
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
||||
// повторной генерации кода.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("data")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("data")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("data")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
// Создано классом WriteCodeFragment MSBuild.
|
||||
|
1
data/obj/Debug/net8.0/data.AssemblyInfoInputs.cache
Normal file
1
data/obj/Debug/net8.0/data.AssemblyInfoInputs.cache
Normal file
@ -0,0 +1 @@
|
||||
6741393a5fe1cc20988265f6fd0e8bdd33ee4b9cc7b9e110a41e548fdd825a94
|
@ -0,0 +1,13 @@
|
||||
is_global = true
|
||||
build_property.TargetFramework = net8.0
|
||||
build_property.TargetPlatformMinVersion =
|
||||
build_property.UsingMicrosoftNETSdkWeb =
|
||||
build_property.ProjectTypeGuids =
|
||||
build_property.InvariantGlobalization =
|
||||
build_property.PlatformNeutralAssembly =
|
||||
build_property.EnforceExtendedAnalyzerRules =
|
||||
build_property._SupportedPlatformList = Linux,macOS,Windows
|
||||
build_property.RootNamespace = data
|
||||
build_property.ProjectDir = C:\Users\class_student\source\repos\presence\data\
|
||||
build_property.EnableComHosting =
|
||||
build_property.EnableGeneratedComInterfaceComImportInterop =
|
8
data/obj/Debug/net8.0/data.GlobalUsings.g.cs
Normal file
8
data/obj/Debug/net8.0/data.GlobalUsings.g.cs
Normal file
@ -0,0 +1,8 @@
|
||||
// <auto-generated/>
|
||||
global using global::System;
|
||||
global using global::System.Collections.Generic;
|
||||
global using global::System.IO;
|
||||
global using global::System.Linq;
|
||||
global using global::System.Net.Http;
|
||||
global using global::System.Threading;
|
||||
global using global::System.Threading.Tasks;
|
BIN
data/obj/Debug/net8.0/data.assets.cache
Normal file
BIN
data/obj/Debug/net8.0/data.assets.cache
Normal file
Binary file not shown.
BIN
data/obj/Debug/net8.0/data.csproj.AssemblyReference.cache
Normal file
BIN
data/obj/Debug/net8.0/data.csproj.AssemblyReference.cache
Normal file
Binary file not shown.
88
data/obj/data.csproj.nuget.dgspec.json
Normal file
88
data/obj/data.csproj.nuget.dgspec.json
Normal file
@ -0,0 +1,88 @@
|
||||
{
|
||||
"format": 1,
|
||||
"restore": {
|
||||
"C:\\Users\\class_student\\source\\repos\\presence\\data\\data.csproj": {}
|
||||
},
|
||||
"projects": {
|
||||
"C:\\Users\\class_student\\source\\repos\\presence\\data\\data.csproj": {
|
||||
"version": "1.0.0",
|
||||
"restore": {
|
||||
"projectUniqueName": "C:\\Users\\class_student\\source\\repos\\presence\\data\\data.csproj",
|
||||
"projectName": "data",
|
||||
"projectPath": "C:\\Users\\class_student\\source\\repos\\presence\\data\\data.csproj",
|
||||
"packagesPath": "C:\\Users\\class_student\\.nuget\\packages\\",
|
||||
"outputPath": "C:\\Users\\class_student\\source\\repos\\presence\\data\\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": [
|
||||
"net8.0"
|
||||
],
|
||||
"sources": {
|
||||
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
||||
"https://api.nuget.org/v3/index.json": {}
|
||||
},
|
||||
"frameworks": {
|
||||
"net8.0": {
|
||||
"targetAlias": "net8.0",
|
||||
"projectReferences": {}
|
||||
}
|
||||
},
|
||||
"warningProperties": {
|
||||
"warnAsError": [
|
||||
"NU1605"
|
||||
]
|
||||
},
|
||||
"restoreAuditProperties": {
|
||||
"enableAudit": "true",
|
||||
"auditLevel": "low",
|
||||
"auditMode": "direct"
|
||||
}
|
||||
},
|
||||
"frameworks": {
|
||||
"net8.0": {
|
||||
"targetAlias": "net8.0",
|
||||
"dependencies": {
|
||||
"Microsoft.EntityFrameworkCore": {
|
||||
"target": "Package",
|
||||
"version": "[8.0.10, )"
|
||||
},
|
||||
"Microsoft.EntityFrameworkCore.Design": {
|
||||
"include": "Runtime, Build, Native, ContentFiles, Analyzers, BuildTransitive",
|
||||
"suppressParent": "All",
|
||||
"target": "Package",
|
||||
"version": "[8.0.10, )"
|
||||
},
|
||||
"Npgsql.EntityFrameworkCore.PostgreSQL": {
|
||||
"target": "Package",
|
||||
"version": "[8.0.10, )"
|
||||
}
|
||||
},
|
||||
"imports": [
|
||||
"net461",
|
||||
"net462",
|
||||
"net47",
|
||||
"net471",
|
||||
"net472",
|
||||
"net48",
|
||||
"net481"
|
||||
],
|
||||
"assetTargetFallback": true,
|
||||
"warn": true,
|
||||
"frameworkReferences": {
|
||||
"Microsoft.NETCore.App": {
|
||||
"privateAssets": "all"
|
||||
}
|
||||
},
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.204/PortableRuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
23
data/obj/data.csproj.nuget.g.props
Normal file
23
data/obj/data.csproj.nuget.g.props
Normal file
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
|
||||
<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\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages</NuGetPackageFolders>
|
||||
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
|
||||
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.9.1</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')" />
|
||||
<Import Project="$(NuGetPackageRoot)microsoft.entityframeworkcore.design\8.0.10\build\net8.0\Microsoft.EntityFrameworkCore.Design.props" Condition="Exists('$(NuGetPackageRoot)microsoft.entityframeworkcore.design\8.0.10\build\net8.0\Microsoft.EntityFrameworkCore.Design.props')" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<PkgMicrosoft_CodeAnalysis_Analyzers Condition=" '$(PkgMicrosoft_CodeAnalysis_Analyzers)' == '' ">C:\Users\class_student\.nuget\packages\microsoft.codeanalysis.analyzers\3.3.3</PkgMicrosoft_CodeAnalysis_Analyzers>
|
||||
</PropertyGroup>
|
||||
</Project>
|
7
data/obj/data.csproj.nuget.g.targets
Normal file
7
data/obj/data.csproj.nuget.g.targets
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<Import Project="$(NuGetPackageRoot)microsoft.extensions.logging.abstractions\8.0.2\buildTransitive\net6.0\Microsoft.Extensions.Logging.Abstractions.targets" Condition="Exists('$(NuGetPackageRoot)microsoft.extensions.logging.abstractions\8.0.2\buildTransitive\net6.0\Microsoft.Extensions.Logging.Abstractions.targets')" />
|
||||
<Import Project="$(NuGetPackageRoot)microsoft.extensions.options\8.0.2\buildTransitive\net6.0\Microsoft.Extensions.Options.targets" Condition="Exists('$(NuGetPackageRoot)microsoft.extensions.options\8.0.2\buildTransitive\net6.0\Microsoft.Extensions.Options.targets')" />
|
||||
</ImportGroup>
|
||||
</Project>
|
2196
data/obj/project.assets.json
Normal file
2196
data/obj/project.assets.json
Normal file
File diff suppressed because it is too large
Load Diff
47
data/obj/project.nuget.cache
Normal file
47
data/obj/project.nuget.cache
Normal file
@ -0,0 +1,47 @@
|
||||
{
|
||||
"version": 2,
|
||||
"dgSpecHash": "dq+xJQNSo82BcvI1YOEsRM5SyN3J419X1oAn1yZywg6ptvxskzy0YvsVYIchdWZwskiwWAGbewHiRF0FFD64Gg==",
|
||||
"success": true,
|
||||
"projectFilePath": "C:\\Users\\class_student\\source\\repos\\presence\\data\\data.csproj",
|
||||
"expectedPackageFiles": [
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\humanizer.core\\2.14.1\\humanizer.core.2.14.1.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.bcl.asyncinterfaces\\6.0.0\\microsoft.bcl.asyncinterfaces.6.0.0.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.codeanalysis.analyzers\\3.3.3\\microsoft.codeanalysis.analyzers.3.3.3.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.codeanalysis.common\\4.5.0\\microsoft.codeanalysis.common.4.5.0.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.codeanalysis.csharp\\4.5.0\\microsoft.codeanalysis.csharp.4.5.0.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.codeanalysis.csharp.workspaces\\4.5.0\\microsoft.codeanalysis.csharp.workspaces.4.5.0.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.codeanalysis.workspaces.common\\4.5.0\\microsoft.codeanalysis.workspaces.common.4.5.0.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.entityframeworkcore\\8.0.10\\microsoft.entityframeworkcore.8.0.10.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.entityframeworkcore.abstractions\\8.0.10\\microsoft.entityframeworkcore.abstractions.8.0.10.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.entityframeworkcore.analyzers\\8.0.10\\microsoft.entityframeworkcore.analyzers.8.0.10.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.entityframeworkcore.design\\8.0.10\\microsoft.entityframeworkcore.design.8.0.10.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.entityframeworkcore.relational\\8.0.10\\microsoft.entityframeworkcore.relational.8.0.10.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.extensions.caching.abstractions\\8.0.0\\microsoft.extensions.caching.abstractions.8.0.0.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.extensions.caching.memory\\8.0.1\\microsoft.extensions.caching.memory.8.0.1.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.extensions.configuration.abstractions\\8.0.0\\microsoft.extensions.configuration.abstractions.8.0.0.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.extensions.dependencyinjection\\8.0.1\\microsoft.extensions.dependencyinjection.8.0.1.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.extensions.dependencyinjection.abstractions\\8.0.2\\microsoft.extensions.dependencyinjection.abstractions.8.0.2.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.extensions.dependencymodel\\8.0.2\\microsoft.extensions.dependencymodel.8.0.2.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.extensions.logging\\8.0.1\\microsoft.extensions.logging.8.0.1.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.extensions.logging.abstractions\\8.0.2\\microsoft.extensions.logging.abstractions.8.0.2.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.extensions.options\\8.0.2\\microsoft.extensions.options.8.0.2.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.extensions.primitives\\8.0.0\\microsoft.extensions.primitives.8.0.0.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\mono.texttemplating\\2.2.1\\mono.texttemplating.2.2.1.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\npgsql\\8.0.5\\npgsql.8.0.5.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\npgsql.entityframeworkcore.postgresql\\8.0.10\\npgsql.entityframeworkcore.postgresql.8.0.10.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\system.codedom\\4.4.0\\system.codedom.4.4.0.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\system.collections.immutable\\6.0.0\\system.collections.immutable.6.0.0.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\system.composition\\6.0.0\\system.composition.6.0.0.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\system.composition.attributedmodel\\6.0.0\\system.composition.attributedmodel.6.0.0.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\system.composition.convention\\6.0.0\\system.composition.convention.6.0.0.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\system.composition.hosting\\6.0.0\\system.composition.hosting.6.0.0.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\system.composition.runtime\\6.0.0\\system.composition.runtime.6.0.0.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\system.composition.typedparts\\6.0.0\\system.composition.typedparts.6.0.0.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\system.io.pipelines\\6.0.3\\system.io.pipelines.6.0.3.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\system.reflection.metadata\\6.0.1\\system.reflection.metadata.6.0.1.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\system.runtime.compilerservices.unsafe\\6.0.0\\system.runtime.compilerservices.unsafe.6.0.0.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\system.text.encoding.codepages\\6.0.0\\system.text.encoding.codepages.6.0.0.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\system.threading.channels\\6.0.0\\system.threading.channels.6.0.0.nupkg.sha512"
|
||||
],
|
||||
"logs": []
|
||||
}
|
14
domain/Models/Group.cs
Normal file
14
domain/Models/Group.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace domain.Models
|
||||
{
|
||||
public class Group
|
||||
{
|
||||
public required int Id { get; set; }
|
||||
public required string Name { get; set; }
|
||||
}
|
||||
}
|
19
domain/Models/Presence.cs
Normal file
19
domain/Models/Presence.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace domain.Models
|
||||
{
|
||||
public class Presence
|
||||
{
|
||||
|
||||
public required User User { get; set; }
|
||||
public required int GroupId { get; set; }
|
||||
public bool IsAttedance { get; set; } = true;
|
||||
public required DateTime Date { get; set; }
|
||||
|
||||
public required int LessonNumber { get; set; }
|
||||
}
|
||||
}
|
15
domain/Models/User.cs
Normal file
15
domain/Models/User.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace domain.Models
|
||||
{
|
||||
public class User
|
||||
{
|
||||
public required string FIO { get; set; }
|
||||
public Guid Guid { get; set; }
|
||||
public required Group Group { get; set; }
|
||||
}
|
||||
}
|
107
domain/UseCase/GroupUseCase.cs
Normal file
107
domain/UseCase/GroupUseCase.cs
Normal file
@ -0,0 +1,107 @@
|
||||
using data.LocalData;
|
||||
using data.Repository;
|
||||
using domain.Models;
|
||||
|
||||
|
||||
namespace domain.UseCase
|
||||
{
|
||||
public class GroupUseCase
|
||||
{
|
||||
private readonly IGroupRepository _repositoryGroupImpl;
|
||||
|
||||
public GroupUseCase(IGroupRepository repositoryGroupImpl)
|
||||
{
|
||||
_repositoryGroupImpl = repositoryGroupImpl;
|
||||
}
|
||||
|
||||
// Приватный метод для валидации имени группы
|
||||
|
||||
|
||||
// Приватный метод для валидации существования группы по ID
|
||||
private GroupLocalEntity ValidateGroupExistence(int groupId)
|
||||
{
|
||||
var existingGroup = _repositoryGroupImpl.GetAllGroup()
|
||||
.FirstOrDefault(g => g.Id == groupId);
|
||||
|
||||
if (existingGroup == null)
|
||||
{
|
||||
throw new ArgumentException("Группа не найдена.");
|
||||
}
|
||||
|
||||
return existingGroup;
|
||||
}
|
||||
|
||||
|
||||
// Метод для получения списка всех групп
|
||||
public List<Group> GetAllGroups()
|
||||
{
|
||||
return [.. _repositoryGroupImpl.GetAllGroup()
|
||||
.Select(it => new Group { Id = it.Id, Name = it.Name })];
|
||||
}
|
||||
|
||||
|
||||
public Group FindGroupById(int groupId)
|
||||
{
|
||||
var group = GetAllGroups().FirstOrDefault(g => g.Id == groupId);
|
||||
|
||||
if (group == null)
|
||||
{
|
||||
throw new ArgumentException("Группа не найдена.");
|
||||
}
|
||||
|
||||
return group;
|
||||
}
|
||||
|
||||
|
||||
// Метод для добавления новой группы
|
||||
public void AddGroup(string groupName)
|
||||
{
|
||||
|
||||
|
||||
var newId = _repositoryGroupImpl.GetAllGroup().Any()
|
||||
? _repositoryGroupImpl.GetAllGroup().Max(g => g.Id) + 1
|
||||
: 1;
|
||||
|
||||
GroupLocalEntity newGroup = new GroupLocalEntity
|
||||
{
|
||||
Id = newId,
|
||||
Name = groupName
|
||||
};
|
||||
|
||||
_repositoryGroupImpl.AddGroup(newGroup);
|
||||
}
|
||||
|
||||
public void RemoveGroupById(int groupId)
|
||||
{
|
||||
|
||||
var existingGroup = ValidateGroupExistence(groupId);
|
||||
List<Group> _groups = GetAllGroups();
|
||||
|
||||
// Находим группу по ID и удаляем ее
|
||||
var groupToRemove = _groups.FirstOrDefault(g => g.Id == existingGroup.Id);
|
||||
if (groupToRemove != null)
|
||||
{
|
||||
_groups.Remove(groupToRemove);
|
||||
_repositoryGroupImpl.RemoveGroupById(existingGroup.Id);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ArgumentException("Группа не найдена.");
|
||||
// Обработка случая, если группа не найдена (например, выброс исключения)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Метод для изменения названия группы
|
||||
public void UpdateGroup(int groupId, string newGroupName)
|
||||
{
|
||||
|
||||
var existingGroup = ValidateGroupExistence(groupId);
|
||||
|
||||
existingGroup.Name = newGroupName;
|
||||
_repositoryGroupImpl.UpdateGroupById(existingGroup.Id, existingGroup);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
175
domain/UseCase/UseCaseGeneratePresence.cs
Normal file
175
domain/UseCase/UseCaseGeneratePresence.cs
Normal file
@ -0,0 +1,175 @@
|
||||
using ClosedXML.Excel;
|
||||
using data.RemoteData.RemoteDataBase.DAO;
|
||||
using data.Repository;
|
||||
using domain.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace domain.UseCase
|
||||
{
|
||||
public class UseCaseGeneratePresence
|
||||
{
|
||||
public readonly IUserRepository _userRepository;
|
||||
public readonly IPresenceRepository _presenceRepository;
|
||||
private readonly IGroupRepository _groupRepository;
|
||||
|
||||
public UseCaseGeneratePresence(IUserRepository userRepository, IPresenceRepository presenceRepository, IGroupRepository groupRepository)
|
||||
{
|
||||
_userRepository = userRepository;
|
||||
_presenceRepository = presenceRepository;
|
||||
_groupRepository = groupRepository;
|
||||
}
|
||||
|
||||
public List<PresenceLocalEntity> GetPresenceByGroupAndDate(int groupId, DateTime date)
|
||||
{
|
||||
return _presenceRepository.GetPresenceByGroupAndDate(groupId, date);
|
||||
}
|
||||
|
||||
|
||||
public void GeneratePresenceDaily(int firstLesson, int lastLesson, int groupId, DateTime currentDate)
|
||||
{
|
||||
var users = _userRepository.GetAllUsers.Where(u => u.GroupID == groupId).ToList();
|
||||
List<PresenceLocalEntity> presences = new List<PresenceLocalEntity>();
|
||||
for (int lessonNumber = firstLesson; lessonNumber <= lastLesson; lessonNumber++)
|
||||
{
|
||||
foreach (var user in users)
|
||||
{
|
||||
presences.Add(new PresenceLocalEntity
|
||||
{
|
||||
UserGuid = user.Guid,
|
||||
Date = currentDate,
|
||||
LessonNumber = lessonNumber,
|
||||
IsAttedance = true
|
||||
});
|
||||
}
|
||||
}
|
||||
_presenceRepository.SavePresence(presences);
|
||||
}
|
||||
|
||||
public void GenerateWeeklyPresence(int firstLesson, int lastLesson, int groupId, DateTime startTime)
|
||||
{
|
||||
for (int i = 0; i < 7; i++)
|
||||
{
|
||||
DateTime currentTime = startTime.AddDays(i);
|
||||
GeneratePresenceDaily(firstLesson, lastLesson, groupId, currentTime);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Отметить пользователя как отсутствующего на диапазоне занятий
|
||||
public void MarkUserAsAbsent(Guid userGuid, int groupId, int firstLesson, int lastLesson, DateTime date)
|
||||
{
|
||||
var presences = _presenceRepository.GetPresenceByGroupAndDate(groupId, date);
|
||||
foreach (var presence in presences.Where(p => p.UserGuid == userGuid && p.LessonNumber >= firstLesson && p.LessonNumber <= lastLesson))
|
||||
{
|
||||
presence.IsAttedance = false;
|
||||
|
||||
|
||||
|
||||
}
|
||||
_presenceRepository.SavePresence(presences);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public List<PresenceLocalEntity> GetAllPresenceByGroup(int groupId)
|
||||
{
|
||||
return _presenceRepository.GetPresenceByGroup(groupId);
|
||||
}
|
||||
|
||||
public GroupPresenceSummary GetGeneralPresenceForGroup(int groupId)
|
||||
{
|
||||
return _presenceRepository.GetGeneralPresenceForGroup(groupId);
|
||||
}
|
||||
|
||||
public Dictionary<string, List<Excel>> GetAllAttendanceByGroups()
|
||||
{
|
||||
var attendanceByGroup = new Dictionary<string, List<Excel>>();
|
||||
var allGroups = _groupRepository.GetAllGroup();
|
||||
|
||||
foreach (var group in allGroups)
|
||||
{
|
||||
var groupAttendance = _presenceRepository.GetAttendanceByGroup(group.Id);
|
||||
var attendanceRecords = new List<Excel>();
|
||||
|
||||
foreach (var record in groupAttendance)
|
||||
{
|
||||
var names = _userRepository.GetUserNames().Where(u => u.Guid == record.UserGuid);
|
||||
foreach (var name in names)
|
||||
{
|
||||
attendanceRecords.Add(new Excel
|
||||
{
|
||||
UserName = name.FIO,
|
||||
UserGuid = name.Guid,
|
||||
Date = record.Date,
|
||||
IsAttedance = record.IsAttedance,
|
||||
LessonNumber = record.LessonNumber,
|
||||
GroupName = group.Name
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
attendanceByGroup.Add(group.Name, attendanceRecords);
|
||||
}
|
||||
|
||||
return attendanceByGroup;
|
||||
}
|
||||
|
||||
public void ExportAttendanceToExcel()
|
||||
{
|
||||
var attendanceByGroup = GetAllAttendanceByGroups();
|
||||
string projectDirectory = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.Parent.FullName;
|
||||
string reportsFolderPath = Path.Combine(projectDirectory, "Reports");
|
||||
string filePath = Path.Combine(reportsFolderPath, "AttendanceReport.xlsx");
|
||||
|
||||
// Создаем папку, если она не существует
|
||||
if (!Directory.Exists(reportsFolderPath))
|
||||
{
|
||||
Directory.CreateDirectory(reportsFolderPath);
|
||||
}
|
||||
using (var workbook = new XLWorkbook())
|
||||
{
|
||||
foreach (var group in attendanceByGroup)
|
||||
{
|
||||
var worksheet = workbook.Worksheets.Add($"{group.Key}");
|
||||
worksheet.Cell(1, 1).Value = "ФИО";
|
||||
worksheet.Cell(1, 2).Value = "Группа";
|
||||
worksheet.Cell(1, 3).Value = "Дата";
|
||||
worksheet.Cell(1, 4).Value = "Занятие";
|
||||
worksheet.Cell(1, 5).Value = "Статус";
|
||||
|
||||
int row = 2;
|
||||
int lesNum = 1;
|
||||
foreach (var record in group.Value.OrderBy(r => r.Date).ThenBy(r => r.LessonNumber).ThenBy(r => r.UserGuid))
|
||||
{
|
||||
if (lesNum != record.LessonNumber)
|
||||
{
|
||||
row++;
|
||||
}
|
||||
worksheet.Cell(row, 1).Value = record.UserName;
|
||||
worksheet.Cell(row, 2).Value = record.GroupName;
|
||||
worksheet.Cell(row, 3).Value = record.Date.ToString("dd.MM.yyyy");
|
||||
worksheet.Cell(row, 4).Value = record.LessonNumber.ToString();
|
||||
worksheet.Cell(row, 5).Value = record.IsAttedance ? "Присутствует" : "Отсутствует";
|
||||
row++;
|
||||
|
||||
|
||||
|
||||
lesNum = record.LessonNumber;
|
||||
}
|
||||
|
||||
worksheet.Columns().AdjustToContents();
|
||||
}
|
||||
|
||||
workbook.SaveAs(filePath);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
111
domain/UseCase/UserUseCase.cs
Normal file
111
domain/UseCase/UserUseCase.cs
Normal file
@ -0,0 +1,111 @@
|
||||
using Dataceptions;
|
||||
using data.Repository;
|
||||
using domain.Models;
|
||||
|
||||
namespace domain.UseCase
|
||||
{
|
||||
public class UserUseCase
|
||||
{
|
||||
private readonly IUserRepository _repositoryUserImpl;
|
||||
private readonly IGroupRepository _repositoryGroupImpl;
|
||||
|
||||
public UserUseCase(IUserRepository repositoryImpl, IGroupRepository repositoryGroupImpl)
|
||||
{
|
||||
_repositoryUserImpl = repositoryImpl;
|
||||
_repositoryGroupImpl = repositoryGroupImpl;
|
||||
}
|
||||
|
||||
// Вывести всех пользователей
|
||||
public List<User> GetAllUsers() => _repositoryUserImpl.GetAllUsers
|
||||
.Join(_repositoryGroupImpl.GetAllGroup(),
|
||||
user => user.GroupID,
|
||||
group => group.Id,
|
||||
(user, group) =>
|
||||
new User
|
||||
{
|
||||
FIO = user.FIO,
|
||||
Guid = user.Guid,
|
||||
Group = new Group { Id = group.Id, Name = group.Name }
|
||||
}).ToList();
|
||||
|
||||
// Удалить пользователя по id
|
||||
public bool RemoveUserById(Guid userGuid)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _repositoryUserImpl.RemoveUserById(userGuid);
|
||||
}
|
||||
catch (UserNotFoundException)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
catch (RepositoryException)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Обновить пользователя по guid
|
||||
public User UpdateUser(User user)
|
||||
{
|
||||
UserLocalEnity userLocalEnity = new UserLocalEnity
|
||||
{
|
||||
FIO = user.FIO,
|
||||
GroupID = user.Group.Id,
|
||||
Guid = user.Guid
|
||||
};
|
||||
|
||||
UserLocalEnity? result = _repositoryUserImpl.UpdateUser(userLocalEnity);
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
throw new Exception("Ошибка при обновлении пользователя.");
|
||||
}
|
||||
|
||||
var groupEntity = _repositoryGroupImpl.GetAllGroup().FirstOrDefault(g => g.Id == result.GroupID);
|
||||
|
||||
if (groupEntity == null)
|
||||
{
|
||||
throw new Exception("Группа не найдена.");
|
||||
}
|
||||
|
||||
return new User
|
||||
{
|
||||
FIO = result.FIO,
|
||||
Guid = result.Guid,
|
||||
Group = new Group
|
||||
{
|
||||
Id = groupEntity.Id,
|
||||
Name = groupEntity.Name
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Найти пользователя по id
|
||||
public User FindUserById(Guid userGuid)
|
||||
{
|
||||
var user = _repositoryUserImpl.GetAllUsers
|
||||
.FirstOrDefault(u => u.Guid == userGuid);
|
||||
|
||||
if (user == null)
|
||||
{
|
||||
throw new Exception("Пользователь не найден.");
|
||||
}
|
||||
|
||||
var group = _repositoryGroupImpl.GetAllGroup()
|
||||
.FirstOrDefault(g => g.Id == user.GroupID);
|
||||
|
||||
if (group == null)
|
||||
{
|
||||
throw new Exception("Группа не найдена.");
|
||||
}
|
||||
|
||||
return new User
|
||||
{
|
||||
FIO = user.FIO,
|
||||
Guid = user.Guid,
|
||||
Group = new Group { Id = group.Id, Name = group.Name }
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
17
domain/domain.csproj
Normal file
17
domain/domain.csproj
Normal file
@ -0,0 +1,17 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ClosedXML" Version="0.104.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\data\data.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
@ -0,0 +1,4 @@
|
||||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]
|
23
domain/obj/Debug/net8.0/domain.AssemblyInfo.cs
Normal file
23
domain/obj/Debug/net8.0/domain.AssemblyInfo.cs
Normal file
@ -0,0 +1,23 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Этот код создан программой.
|
||||
// Исполняемая версия:4.0.30319.42000
|
||||
//
|
||||
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
||||
// повторной генерации кода.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("domain")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("domain")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("domain")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
// Создано классом WriteCodeFragment MSBuild.
|
||||
|
1
domain/obj/Debug/net8.0/domain.AssemblyInfoInputs.cache
Normal file
1
domain/obj/Debug/net8.0/domain.AssemblyInfoInputs.cache
Normal file
@ -0,0 +1 @@
|
||||
50afef9105125301dd1c05ea9fb1e5f605a3f79c6aca753bbf0156749546e4dd
|
@ -0,0 +1,13 @@
|
||||
is_global = true
|
||||
build_property.TargetFramework = net8.0
|
||||
build_property.TargetPlatformMinVersion =
|
||||
build_property.UsingMicrosoftNETSdkWeb =
|
||||
build_property.ProjectTypeGuids =
|
||||
build_property.InvariantGlobalization =
|
||||
build_property.PlatformNeutralAssembly =
|
||||
build_property.EnforceExtendedAnalyzerRules =
|
||||
build_property._SupportedPlatformList = Linux,macOS,Windows
|
||||
build_property.RootNamespace = domain
|
||||
build_property.ProjectDir = C:\Users\class_student\source\repos\presence\domain\
|
||||
build_property.EnableComHosting =
|
||||
build_property.EnableGeneratedComInterfaceComImportInterop =
|
8
domain/obj/Debug/net8.0/domain.GlobalUsings.g.cs
Normal file
8
domain/obj/Debug/net8.0/domain.GlobalUsings.g.cs
Normal file
@ -0,0 +1,8 @@
|
||||
// <auto-generated/>
|
||||
global using global::System;
|
||||
global using global::System.Collections.Generic;
|
||||
global using global::System.IO;
|
||||
global using global::System.Linq;
|
||||
global using global::System.Net.Http;
|
||||
global using global::System.Threading;
|
||||
global using global::System.Threading.Tasks;
|
BIN
domain/obj/Debug/net8.0/domain.assets.cache
Normal file
BIN
domain/obj/Debug/net8.0/domain.assets.cache
Normal file
Binary file not shown.
BIN
domain/obj/Debug/net8.0/domain.csproj.AssemblyReference.cache
Normal file
BIN
domain/obj/Debug/net8.0/domain.csproj.AssemblyReference.cache
Normal file
Binary file not shown.
162
domain/obj/domain.csproj.nuget.dgspec.json
Normal file
162
domain/obj/domain.csproj.nuget.dgspec.json
Normal file
@ -0,0 +1,162 @@
|
||||
{
|
||||
"format": 1,
|
||||
"restore": {
|
||||
"C:\\Users\\class_student\\source\\repos\\presence\\domain\\domain.csproj": {}
|
||||
},
|
||||
"projects": {
|
||||
"C:\\Users\\class_student\\source\\repos\\presence\\data\\data.csproj": {
|
||||
"version": "1.0.0",
|
||||
"restore": {
|
||||
"projectUniqueName": "C:\\Users\\class_student\\source\\repos\\presence\\data\\data.csproj",
|
||||
"projectName": "data",
|
||||
"projectPath": "C:\\Users\\class_student\\source\\repos\\presence\\data\\data.csproj",
|
||||
"packagesPath": "C:\\Users\\class_student\\.nuget\\packages\\",
|
||||
"outputPath": "C:\\Users\\class_student\\source\\repos\\presence\\data\\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": [
|
||||
"net8.0"
|
||||
],
|
||||
"sources": {
|
||||
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
||||
"https://api.nuget.org/v3/index.json": {}
|
||||
},
|
||||
"frameworks": {
|
||||
"net8.0": {
|
||||
"targetAlias": "net8.0",
|
||||
"projectReferences": {}
|
||||
}
|
||||
},
|
||||
"warningProperties": {
|
||||
"warnAsError": [
|
||||
"NU1605"
|
||||
]
|
||||
},
|
||||
"restoreAuditProperties": {
|
||||
"enableAudit": "true",
|
||||
"auditLevel": "low",
|
||||
"auditMode": "direct"
|
||||
}
|
||||
},
|
||||
"frameworks": {
|
||||
"net8.0": {
|
||||
"targetAlias": "net8.0",
|
||||
"dependencies": {
|
||||
"Microsoft.EntityFrameworkCore": {
|
||||
"target": "Package",
|
||||
"version": "[8.0.10, )"
|
||||
},
|
||||
"Microsoft.EntityFrameworkCore.Design": {
|
||||
"include": "Runtime, Build, Native, ContentFiles, Analyzers, BuildTransitive",
|
||||
"suppressParent": "All",
|
||||
"target": "Package",
|
||||
"version": "[8.0.10, )"
|
||||
},
|
||||
"Npgsql.EntityFrameworkCore.PostgreSQL": {
|
||||
"target": "Package",
|
||||
"version": "[8.0.10, )"
|
||||
}
|
||||
},
|
||||
"imports": [
|
||||
"net461",
|
||||
"net462",
|
||||
"net47",
|
||||
"net471",
|
||||
"net472",
|
||||
"net48",
|
||||
"net481"
|
||||
],
|
||||
"assetTargetFallback": true,
|
||||
"warn": true,
|
||||
"frameworkReferences": {
|
||||
"Microsoft.NETCore.App": {
|
||||
"privateAssets": "all"
|
||||
}
|
||||
},
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.204/PortableRuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
},
|
||||
"C:\\Users\\class_student\\source\\repos\\presence\\domain\\domain.csproj": {
|
||||
"version": "1.0.0",
|
||||
"restore": {
|
||||
"projectUniqueName": "C:\\Users\\class_student\\source\\repos\\presence\\domain\\domain.csproj",
|
||||
"projectName": "domain",
|
||||
"projectPath": "C:\\Users\\class_student\\source\\repos\\presence\\domain\\domain.csproj",
|
||||
"packagesPath": "C:\\Users\\class_student\\.nuget\\packages\\",
|
||||
"outputPath": "C:\\Users\\class_student\\source\\repos\\presence\\domain\\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": [
|
||||
"net8.0"
|
||||
],
|
||||
"sources": {
|
||||
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
||||
"https://api.nuget.org/v3/index.json": {}
|
||||
},
|
||||
"frameworks": {
|
||||
"net8.0": {
|
||||
"targetAlias": "net8.0",
|
||||
"projectReferences": {
|
||||
"C:\\Users\\class_student\\source\\repos\\presence\\data\\data.csproj": {
|
||||
"projectPath": "C:\\Users\\class_student\\source\\repos\\presence\\data\\data.csproj"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"warningProperties": {
|
||||
"warnAsError": [
|
||||
"NU1605"
|
||||
]
|
||||
},
|
||||
"restoreAuditProperties": {
|
||||
"enableAudit": "true",
|
||||
"auditLevel": "low",
|
||||
"auditMode": "direct"
|
||||
}
|
||||
},
|
||||
"frameworks": {
|
||||
"net8.0": {
|
||||
"targetAlias": "net8.0",
|
||||
"dependencies": {
|
||||
"ClosedXML": {
|
||||
"target": "Package",
|
||||
"version": "[0.104.1, )"
|
||||
}
|
||||
},
|
||||
"imports": [
|
||||
"net461",
|
||||
"net462",
|
||||
"net47",
|
||||
"net471",
|
||||
"net472",
|
||||
"net48",
|
||||
"net481"
|
||||
],
|
||||
"assetTargetFallback": true,
|
||||
"warn": true,
|
||||
"frameworkReferences": {
|
||||
"Microsoft.NETCore.App": {
|
||||
"privateAssets": "all"
|
||||
}
|
||||
},
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.204/PortableRuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
19
domain/obj/domain.csproj.nuget.g.props
Normal file
19
domain/obj/domain.csproj.nuget.g.props
Normal file
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
|
||||
<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\;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')" />
|
||||
</ImportGroup>
|
||||
</Project>
|
7
domain/obj/domain.csproj.nuget.g.targets
Normal file
7
domain/obj/domain.csproj.nuget.g.targets
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<Import Project="$(NuGetPackageRoot)microsoft.extensions.logging.abstractions\8.0.2\buildTransitive\net6.0\Microsoft.Extensions.Logging.Abstractions.targets" Condition="Exists('$(NuGetPackageRoot)microsoft.extensions.logging.abstractions\8.0.2\buildTransitive\net6.0\Microsoft.Extensions.Logging.Abstractions.targets')" />
|
||||
<Import Project="$(NuGetPackageRoot)microsoft.extensions.options\8.0.2\buildTransitive\net6.0\Microsoft.Extensions.Options.targets" Condition="Exists('$(NuGetPackageRoot)microsoft.extensions.options\8.0.2\buildTransitive\net6.0\Microsoft.Extensions.Options.targets')" />
|
||||
</ImportGroup>
|
||||
</Project>
|
1099
domain/obj/project.assets.json
Normal file
1099
domain/obj/project.assets.json
Normal file
File diff suppressed because it is too large
Load Diff
32
domain/obj/project.nuget.cache
Normal file
32
domain/obj/project.nuget.cache
Normal file
@ -0,0 +1,32 @@
|
||||
{
|
||||
"version": 2,
|
||||
"dgSpecHash": "lJTJ14wBwjXFnaVaxoabnlDogMX3Sp0lQVlqyaedGyWhAz5YJhifXah8drXyM7t4sf35FH72dxhiyf+6Qi+IXA==",
|
||||
"success": true,
|
||||
"projectFilePath": "C:\\Users\\class_student\\source\\repos\\presence\\domain\\domain.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",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\documentformat.openxml\\3.0.1\\documentformat.openxml.3.0.1.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\documentformat.openxml.framework\\3.0.1\\documentformat.openxml.framework.3.0.1.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\excelnumberformat\\1.1.0\\excelnumberformat.1.1.0.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.entityframeworkcore\\8.0.10\\microsoft.entityframeworkcore.8.0.10.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.entityframeworkcore.abstractions\\8.0.10\\microsoft.entityframeworkcore.abstractions.8.0.10.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.entityframeworkcore.analyzers\\8.0.10\\microsoft.entityframeworkcore.analyzers.8.0.10.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.entityframeworkcore.relational\\8.0.10\\microsoft.entityframeworkcore.relational.8.0.10.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.extensions.caching.abstractions\\8.0.0\\microsoft.extensions.caching.abstractions.8.0.0.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.extensions.caching.memory\\8.0.1\\microsoft.extensions.caching.memory.8.0.1.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.extensions.configuration.abstractions\\8.0.0\\microsoft.extensions.configuration.abstractions.8.0.0.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.extensions.dependencyinjection\\8.0.1\\microsoft.extensions.dependencyinjection.8.0.1.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.extensions.dependencyinjection.abstractions\\8.0.2\\microsoft.extensions.dependencyinjection.abstractions.8.0.2.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.extensions.logging\\8.0.1\\microsoft.extensions.logging.8.0.1.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.extensions.logging.abstractions\\8.0.2\\microsoft.extensions.logging.abstractions.8.0.2.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.extensions.options\\8.0.2\\microsoft.extensions.options.8.0.2.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.extensions.primitives\\8.0.0\\microsoft.extensions.primitives.8.0.0.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\npgsql\\8.0.5\\npgsql.8.0.5.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\npgsql.entityframeworkcore.postgresql\\8.0.10\\npgsql.entityframeworkcore.postgresql.8.0.10.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\rbush\\3.2.0\\rbush.3.2.0.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\sixlabors.fonts\\1.0.0\\sixlabors.fonts.1.0.0.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\system.io.packaging\\8.0.0\\system.io.packaging.8.0.0.nupkg.sha512"
|
||||
],
|
||||
"logs": []
|
||||
}
|
40
presence.sln
Normal file
40
presence.sln
Normal file
@ -0,0 +1,40 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.0.31903.59
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "data", "data\data.csproj", "{7E1D482B-6976-4984-85C3-AE6E789E7FC2}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "domain", "domain\domain.csproj", "{53B2C28F-CCC6-4399-BA63-8A21E2D26B73}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ui", "ui\ui.csproj", "{1904560F-B17D-4598-AE5C-5FA0D0C2517B}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "console_ui", "console_ui\console_ui.csproj", "{214169B6-E77C-4C7D-8D64-6E5126C243FA}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{7E1D482B-6976-4984-85C3-AE6E789E7FC2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{7E1D482B-6976-4984-85C3-AE6E789E7FC2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{7E1D482B-6976-4984-85C3-AE6E789E7FC2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{7E1D482B-6976-4984-85C3-AE6E789E7FC2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{53B2C28F-CCC6-4399-BA63-8A21E2D26B73}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{53B2C28F-CCC6-4399-BA63-8A21E2D26B73}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{53B2C28F-CCC6-4399-BA63-8A21E2D26B73}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{53B2C28F-CCC6-4399-BA63-8A21E2D26B73}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{1904560F-B17D-4598-AE5C-5FA0D0C2517B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1904560F-B17D-4598-AE5C-5FA0D0C2517B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1904560F-B17D-4598-AE5C-5FA0D0C2517B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1904560F-B17D-4598-AE5C-5FA0D0C2517B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{214169B6-E77C-4C7D-8D64-6E5126C243FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{214169B6-E77C-4C7D-8D64-6E5126C243FA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{214169B6-E77C-4C7D-8D64-6E5126C243FA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{214169B6-E77C-4C7D-8D64-6E5126C243FA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
97
ui/GroupConsole.cs
Normal file
97
ui/GroupConsole.cs
Normal file
@ -0,0 +1,97 @@
|
||||
using domain.UseCase;
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
namespace ui
|
||||
{
|
||||
public class GroupConsoleUI
|
||||
{
|
||||
private readonly GroupUseCase _groupUseCase;
|
||||
|
||||
public GroupConsoleUI(GroupUseCase groupUseCase)
|
||||
{
|
||||
_groupUseCase = groupUseCase;
|
||||
}
|
||||
|
||||
public void FindGroupById(int groupId)
|
||||
{
|
||||
try
|
||||
{
|
||||
var group = _groupUseCase.FindGroupById(groupId);
|
||||
Console.WriteLine($"ID группы: {group.Id} Название группы: {group.Name}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"Ошибка: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
// Метод для отображения всех групп
|
||||
public void DisplayAllGroups()
|
||||
{
|
||||
Console.WriteLine("\n=== Список всех групп ===");
|
||||
StringBuilder groupOutput = new StringBuilder();
|
||||
|
||||
foreach (var group in _groupUseCase.GetAllGroups())
|
||||
{
|
||||
groupOutput.AppendLine($"{group.Id}\t{group.Name}");
|
||||
}
|
||||
|
||||
Console.WriteLine(groupOutput);
|
||||
Console.WriteLine("===========================\n");
|
||||
}
|
||||
|
||||
// Метод для добавления новой группы
|
||||
public void AddGroup(string groupName)
|
||||
{
|
||||
try
|
||||
{
|
||||
ValidateGroupName(groupName); // Валидация в интерфейсе
|
||||
_groupUseCase.AddGroup(groupName);
|
||||
Console.WriteLine($"\nГруппа {groupName} добавлена.\n");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"Ошибка: {ex.Message}\n");
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveGroup(string groupIdStr)
|
||||
{
|
||||
try
|
||||
{
|
||||
int groupId = int.Parse(groupIdStr);
|
||||
ValidateGroupId(groupId); // Валидация в интерфейсе
|
||||
_groupUseCase.RemoveGroupById(groupId);
|
||||
Console.WriteLine($"Группа с ID: {groupId} удалена");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"Ошибка: {ex.Message}\n");
|
||||
}
|
||||
}
|
||||
|
||||
// Метод для обновления названия группы
|
||||
public void UpdateGroupName(int groupId, string newGroupName)
|
||||
{
|
||||
_groupUseCase.UpdateGroup(groupId, newGroupName);
|
||||
Console.WriteLine($"\nНазвание группы с ID {groupId} изменено на {newGroupName}.\n");
|
||||
}
|
||||
|
||||
private void ValidateGroupName(string groupName)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(groupName))
|
||||
{
|
||||
throw new ArgumentException("Имя группы не может быть пустым.");
|
||||
}
|
||||
}
|
||||
|
||||
private void ValidateGroupId(int GroupId)
|
||||
{
|
||||
if (GroupId < 1)
|
||||
{
|
||||
throw new ArgumentException("Введите корректный ID группы.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
229
ui/MainMenu.cs
Normal file
229
ui/MainMenu.cs
Normal file
@ -0,0 +1,229 @@
|
||||
using data.Repository;
|
||||
using domain.Models;
|
||||
using domain.UseCase;
|
||||
using System;
|
||||
|
||||
namespace ui
|
||||
{
|
||||
public class MainMenuUI
|
||||
{
|
||||
private readonly UserConsoleUI _userConsoleUI;
|
||||
private readonly GroupConsoleUI _groupConsoleUI;
|
||||
private readonly PresenceConsole _presenceConsoleUI;
|
||||
|
||||
public MainMenuUI(UserUseCase userUseCase, GroupUseCase groupUseCase, UseCaseGeneratePresence presenceUseCase, IPresenceRepository presenceRepository)
|
||||
{
|
||||
_userConsoleUI = new UserConsoleUI(userUseCase);
|
||||
_groupConsoleUI = new GroupConsoleUI(groupUseCase);
|
||||
_presenceConsoleUI = new PresenceConsole(presenceUseCase, presenceRepository); // Передаем presenceRepository
|
||||
}
|
||||
|
||||
|
||||
public void DisplayMenu()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
Console.WriteLine("\n==================== Главная Панель ====================\n");
|
||||
|
||||
Console.WriteLine("~~~~~~~~~~~~~~~ УПРАВЛЕНИЕ ПОЛЬЗОВАТЕЛЯМИ ~~~~~~~~~~~~~~~");
|
||||
Console.WriteLine("1. Показать список всех пользователей");
|
||||
Console.WriteLine("2. Удалить пользователя по его Guid");
|
||||
Console.WriteLine("3. Обновить данные пользователя по Guid");
|
||||
Console.WriteLine("4. Найти пользователя по его Guid");
|
||||
Console.WriteLine();
|
||||
|
||||
Console.WriteLine("~~~~~~~~~~~~~~~ УПРАВЛЕНИЕ ГРУППАМИ ~~~~~~~~~~~~~~~");
|
||||
Console.WriteLine("5. Показать список всех групп");
|
||||
Console.WriteLine("6. Создать новую группу");
|
||||
Console.WriteLine("7. Удалить группу по ID");
|
||||
Console.WriteLine("8. Изменить название существующей группы");
|
||||
Console.WriteLine("9. Найти группу по ее ID");
|
||||
Console.WriteLine();
|
||||
|
||||
Console.WriteLine("~~~~~~~~~~~~~~~ УПРАВЛЕНИЕ ПОСЕЩАЕМОСТЬЮ ~~~~~~~~~~~~~~~");
|
||||
Console.WriteLine("10. Сгенерировать посещаемость на текущий день");
|
||||
Console.WriteLine("11. Сгенерировать посещаемость на текущую неделю");
|
||||
Console.WriteLine("12. Показать посещаемость всех пользователей");
|
||||
Console.WriteLine("13. Отметить пользователя как отсутствующего");
|
||||
Console.WriteLine("14. Вывести посещаемость группы по ID");
|
||||
Console.WriteLine("15. Создать Excel файл");
|
||||
Console.WriteLine("16. Информация о посещаемости");
|
||||
|
||||
Console.WriteLine();
|
||||
|
||||
Console.WriteLine("========================================================");
|
||||
Console.WriteLine("0. Выход из программы");
|
||||
|
||||
Console.Write("\nВыберите команду: ");
|
||||
string command = Console.ReadLine();
|
||||
Console.WriteLine();
|
||||
|
||||
switch (command)
|
||||
{
|
||||
case "1":
|
||||
_userConsoleUI.DisplayAllUsers();
|
||||
break;
|
||||
|
||||
case "2":
|
||||
Console.Write("Введите Guid пользователя для удаления: ");
|
||||
if (Guid.TryParse(Console.ReadLine(), out Guid userGuid))
|
||||
{
|
||||
_userConsoleUI.RemoveUserById(userGuid);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Неверный формат Guid");
|
||||
}
|
||||
break;
|
||||
|
||||
case "3":
|
||||
Console.Write("Введите Guid пользователя для обновления: ");
|
||||
if (Guid.TryParse(Console.ReadLine(), out Guid updateUserGuid))
|
||||
{
|
||||
_userConsoleUI.UpdateUserById(updateUserGuid);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Неверный формат Guid");
|
||||
}
|
||||
break;
|
||||
|
||||
case "4":
|
||||
Console.Write("Введите Guid пользователя для поиска: ");
|
||||
if (Guid.TryParse(Console.ReadLine(), out Guid findUserGuid))
|
||||
{
|
||||
_userConsoleUI.FindUserById(findUserGuid);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Неверный формат Guid");
|
||||
}
|
||||
break;
|
||||
|
||||
case "5":
|
||||
_groupConsoleUI.DisplayAllGroups();
|
||||
break;
|
||||
|
||||
case "6":
|
||||
Console.Write("Введите название новой группы: ");
|
||||
string newGroupName = Console.ReadLine();
|
||||
_groupConsoleUI.AddGroup(newGroupName);
|
||||
break;
|
||||
|
||||
case "7":
|
||||
Console.Write("Введите ID группы для удаления: ");
|
||||
string groupIdForDeleteStr = Console.ReadLine(); // Считываем ID как строку
|
||||
if (!string.IsNullOrWhiteSpace(groupIdForDeleteStr) && int.TryParse(groupIdForDeleteStr, out int groupIdForDelete)) // Проверяем, что строка не пустая и может быть преобразована в int
|
||||
{
|
||||
_groupConsoleUI.RemoveGroup(groupIdForDeleteStr); // Передаем строку в метод
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Неверный формат ID группы");
|
||||
}
|
||||
break;
|
||||
|
||||
case "8":
|
||||
Console.Write("Введите ID группы для изменения: ");
|
||||
if (int.TryParse(Console.ReadLine(), out int groupIdToUpdate))
|
||||
{
|
||||
Console.Write("Введите новое название группы: ");
|
||||
string newName = Console.ReadLine();
|
||||
_groupConsoleUI.UpdateGroupName(groupIdToUpdate, newName);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Неверный формат ID группы");
|
||||
}
|
||||
break;
|
||||
|
||||
case "9":
|
||||
Console.Write("Введите ID группы для поиска: ");
|
||||
if (int.TryParse(Console.ReadLine(), out int idGroupToFind))
|
||||
{
|
||||
_groupConsoleUI.FindGroupById(idGroupToFind);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Неверный формат ID группы");
|
||||
}
|
||||
break;
|
||||
|
||||
case "10":
|
||||
Console.Write("Введите номер первого занятия: ");
|
||||
int firstLesson = int.Parse(Console.ReadLine());
|
||||
Console.Write("Введите номер последнего занятия: ");
|
||||
int lastLesson = int.Parse(Console.ReadLine());
|
||||
Console.Write("Введите ID группы: ");
|
||||
int groupIdForPresence = int.Parse(Console.ReadLine());
|
||||
|
||||
_presenceConsoleUI.GeneratePresenceForDay(DateTime.Now, groupIdForPresence, firstLesson, lastLesson);
|
||||
Console.WriteLine("Посещаемость на день сгенерирована.");
|
||||
break;
|
||||
|
||||
case "11":
|
||||
Console.Write("Введите номер первого занятия: ");
|
||||
int firstLessonForWeek = int.Parse(Console.ReadLine());
|
||||
Console.Write("Введите номер последнего занятия: ");
|
||||
int lastLessonForWeek = int.Parse(Console.ReadLine());
|
||||
Console.Write("Введите ID группы: ");
|
||||
int groupIdForWeekPresence = int.Parse(Console.ReadLine());
|
||||
|
||||
_presenceConsoleUI.GeneratePresenceForWeek(DateTime.Now, groupIdForWeekPresence, firstLessonForWeek, lastLessonForWeek);
|
||||
Console.WriteLine("Посещаемость на неделю сгенерирована.");
|
||||
break;
|
||||
|
||||
case "12":
|
||||
Console.Write("Введите дату (гггг-мм-дд): ");
|
||||
DateTime date = DateTime.Parse(Console.ReadLine());
|
||||
Console.Write("Введите ID группы: ");
|
||||
int groupForPresenceView = int.Parse(Console.ReadLine());
|
||||
|
||||
_presenceConsoleUI.DisplayPresence(date, groupForPresenceView);
|
||||
break;
|
||||
|
||||
case "13":
|
||||
Console.Write("Введите пользователя: ");
|
||||
userGuid = Guid.Parse(Console.ReadLine());
|
||||
Console.Write("Введите номер первого занятия: ");
|
||||
int firstAbsLesson = int.Parse(Console.ReadLine());
|
||||
Console.Write("Введите номер последнего занятия: ");
|
||||
int lastAbsLesson = int.Parse(Console.ReadLine());
|
||||
Console.Write("Введите ID группы: ");
|
||||
int absGroupId = int.Parse(Console.ReadLine());
|
||||
|
||||
_presenceConsoleUI.MarkUserAsAbsent(DateTime.Now, absGroupId, userGuid, firstAbsLesson, lastAbsLesson);
|
||||
Console.WriteLine("Пользователь отмечен как отсутствующий.");
|
||||
break;
|
||||
|
||||
case "14":
|
||||
Console.Write("Введите ID группы: ");
|
||||
int groupIdForAllPresence = int.Parse(Console.ReadLine());
|
||||
_presenceConsoleUI.DisplayAllPresenceByGroup(groupIdForAllPresence);
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case "15":
|
||||
_presenceConsoleUI.ExportAttendanceToExcel();
|
||||
break;
|
||||
|
||||
case "16":
|
||||
Console.Write("Введите ID группы: ");
|
||||
int searchGroupId = int.Parse(Console.ReadLine());
|
||||
_presenceConsoleUI.DisplayGeneralPresenceForGroup(searchGroupId);
|
||||
break;
|
||||
|
||||
case "0":
|
||||
Console.WriteLine("Выход...");
|
||||
return;
|
||||
|
||||
default:
|
||||
Console.WriteLine("Неверный выбор, попробуйте снова.");
|
||||
break;
|
||||
}
|
||||
Console.WriteLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
210
ui/PresenceConsole.cs
Normal file
210
ui/PresenceConsole.cs
Normal file
@ -0,0 +1,210 @@
|
||||
using data.Repository;
|
||||
using domain.Models;
|
||||
using domain.UseCase;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ui
|
||||
{
|
||||
public class PresenceConsole
|
||||
{
|
||||
private readonly UseCaseGeneratePresence _presenceUseCase;
|
||||
private readonly IPresenceRepository _presenceRepository;
|
||||
|
||||
public PresenceConsole(UseCaseGeneratePresence presenceUseCase, IPresenceRepository presenceRepository)
|
||||
{
|
||||
_presenceUseCase = presenceUseCase;
|
||||
_presenceRepository = presenceRepository;
|
||||
}
|
||||
|
||||
// Метод для генерации посещаемости на день
|
||||
public void GeneratePresenceForDay(DateTime date, int groupId, int firstLesson, int lastLesson)
|
||||
{
|
||||
try
|
||||
{
|
||||
_presenceUseCase.GeneratePresenceDaily(firstLesson, lastLesson, groupId, date);
|
||||
Console.WriteLine("Посещаемость на день успешно сгенерирована.");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"Ошибка при генерации посещаемости: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
// Метод для генерации посещаемости на неделю
|
||||
public void GeneratePresenceForWeek(DateTime date, int groupId, int firstLesson, int lastLesson)
|
||||
{
|
||||
try
|
||||
{
|
||||
_presenceUseCase.GenerateWeeklyPresence(firstLesson, lastLesson, groupId, date);
|
||||
Console.WriteLine("Посещаемость на неделю успешно сгенерирована.");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"Ошибка при генерации посещаемости: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
// Метод для отображения посещаемости на конкретную дату и группу
|
||||
public void DisplayPresence(DateTime date, int groupId)
|
||||
{
|
||||
try
|
||||
{
|
||||
List<PresenceLocalEntity> presences = _presenceUseCase.GetPresenceByGroupAndDate(groupId, date);
|
||||
|
||||
if (presences == null || presences.Count == 0)
|
||||
{
|
||||
Console.WriteLine("Нет данных о посещаемости на выбранную дату.");
|
||||
return;
|
||||
}
|
||||
|
||||
Console.WriteLine($"\n Посещаемость на {date:dd.MM.yyyy} ");
|
||||
Console.WriteLine("-----------------------------------------------------");
|
||||
|
||||
// Сохраняем номер занятия для сравнения
|
||||
int previousLessonNumber = -1;
|
||||
|
||||
foreach (var presence in presences)
|
||||
{
|
||||
// Проверяем, изменился ли номер занятия
|
||||
if (previousLessonNumber != presence.LessonNumber)
|
||||
{
|
||||
Console.WriteLine("-----------------------------------------------------");
|
||||
Console.WriteLine($" Занятие: {presence.LessonNumber} ");
|
||||
Console.WriteLine("-----------------------------------------------------");
|
||||
previousLessonNumber = presence.LessonNumber;
|
||||
}
|
||||
|
||||
// Форматируем статус присутствия
|
||||
string status = presence.IsAttedance ? "Присутствует" : "Отсутствует";
|
||||
Console.WriteLine($"Пользователь (ID: {presence.UserGuid}) - Статус: {status}");
|
||||
}
|
||||
|
||||
Console.WriteLine("-----------------------------------------------------");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"Ошибка при отображении посещаемости: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void MarkUserAsAbsent(DateTime date, int groupId, Guid userGuid, int firstLesson, int lastLesson)
|
||||
{
|
||||
_presenceUseCase.MarkUserAsAbsent(userGuid, groupId, firstLesson, lastLesson, date);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public void DisplayAllPresenceByGroup(int groupId)
|
||||
{
|
||||
try
|
||||
{
|
||||
var presences = _presenceUseCase.GetAllPresenceByGroup(groupId);
|
||||
|
||||
if (presences == null || !presences.Any())
|
||||
{
|
||||
Console.WriteLine($"Нет данных о посещаемости для группы с ID: {groupId}.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Группируем записи посещаемости по дате
|
||||
var groupedPresences = presences.GroupBy(p => p.Date);
|
||||
|
||||
foreach (var group in groupedPresences)
|
||||
{
|
||||
Console.WriteLine("===================================================");
|
||||
Console.WriteLine($" Дата: {group.Key:dd.MM.yyyy} ");
|
||||
Console.WriteLine("===================================================");
|
||||
|
||||
// Сохраняем номер занятия для сравнения
|
||||
int previousLessonNumber = -1;
|
||||
|
||||
foreach (var presence in group)
|
||||
{
|
||||
// Проверяем, изменился ли номер занятия
|
||||
if (previousLessonNumber != presence.LessonNumber)
|
||||
{
|
||||
Console.WriteLine("---------------------------------------------------");
|
||||
Console.WriteLine($" Занятие: {presence.LessonNumber} ");
|
||||
Console.WriteLine("---------------------------------------------------");
|
||||
previousLessonNumber = presence.LessonNumber;
|
||||
}
|
||||
|
||||
// Форматируем статус присутствия
|
||||
string status = presence.IsAttedance ? "✅ Присутствует" : "❌ Отсутствует";
|
||||
Console.WriteLine($"Пользователь (ID: {presence.UserGuid}) - Статус: {status}");
|
||||
}
|
||||
|
||||
Console.WriteLine("---------------------------------------------------");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"Ошибка при отображении посещаемости: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
public void DisplayGeneralPresenceForGroup(int groupId)
|
||||
{
|
||||
var summary = _presenceRepository.GetGeneralPresenceForGroup(groupId);
|
||||
|
||||
Console.WriteLine($"Человек в группе: {summary.UserCount}, " +
|
||||
$"Количество проведённых занятий: {summary.LessonCount}, " +
|
||||
$"Общий процент посещаемости группы: {summary.TotalAttendancePercentage}%");
|
||||
|
||||
foreach (var user in summary.UserAttendances)
|
||||
{
|
||||
if (user.AttendanceRate < 40)
|
||||
{
|
||||
Console.ForegroundColor = ConsoleColor.Red;
|
||||
}
|
||||
|
||||
Console.WriteLine($"GUID Пользователя: {user.UserGuid}, " +
|
||||
$"Посетил: {user.Attended}, " +
|
||||
$"Пропустил: {user.Missed}, " +
|
||||
$"Процент посещаемости: {user.AttendanceRate}%");
|
||||
Console.ResetColor();
|
||||
}
|
||||
}
|
||||
public void ExportAttendanceToExcel()
|
||||
{
|
||||
try
|
||||
{
|
||||
_presenceUseCase.ExportAttendanceToExcel();
|
||||
Console.WriteLine("Данные посещаемости успешно экспортированы в Excel.");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"Ошибка при экспорте посещаемости: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateUserAttendance(Guid userGuid, int groupId, int firstLesson, int lastLesson, DateOnly date, bool isAttendance)
|
||||
{
|
||||
try
|
||||
{
|
||||
bool result = _presenceRepository.UpdateAtt(userGuid, groupId, firstLesson, lastLesson, date, isAttendance);
|
||||
|
||||
if (result)
|
||||
{
|
||||
Console.WriteLine($"Статус посещаемости для пользователя {userGuid} обновлён.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine($"Данные о посещаемости для пользователя ID: {userGuid} не найдены.");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"Ошибка при обновлении посещаемости: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
98
ui/UserConsole.cs
Normal file
98
ui/UserConsole.cs
Normal file
@ -0,0 +1,98 @@
|
||||
using domain.Models;
|
||||
using domain.UseCase;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace ui
|
||||
{
|
||||
public class UserConsoleUI
|
||||
{
|
||||
private readonly UserUseCase _userUseCase;
|
||||
|
||||
public UserConsoleUI(UserUseCase userUseCase)
|
||||
{
|
||||
_userUseCase = userUseCase;
|
||||
}
|
||||
|
||||
// Метод для отображения всех пользователей
|
||||
public void DisplayAllUsers()
|
||||
{
|
||||
Console.WriteLine("\n=== Список всех пользователей ===");
|
||||
StringBuilder userOutput = new StringBuilder();
|
||||
|
||||
foreach (var user in _userUseCase.GetAllUsers())
|
||||
{
|
||||
userOutput.AppendLine($"{user.Guid}\t{user.FIO}\t{user.Group.Name}");
|
||||
}
|
||||
|
||||
Console.WriteLine(userOutput);
|
||||
Console.WriteLine("===============================\n");
|
||||
}
|
||||
|
||||
// Метод для удаления пользователя по ID
|
||||
public void RemoveUserById(Guid userGuid)
|
||||
{
|
||||
string output = _userUseCase.RemoveUserById(userGuid) ? "Пользователь удален" : "Пользователь не найден";
|
||||
Console.WriteLine($"\n{output}\n");
|
||||
}
|
||||
|
||||
// Метод для обновления пользователя по ID
|
||||
public void UpdateUserById(Guid userGuid)
|
||||
{
|
||||
try
|
||||
{
|
||||
var user = _userUseCase.FindUserById(userGuid);
|
||||
Console.WriteLine($"Текущие данные: {user.FIO}, {user.Group.Name}");
|
||||
Console.Write("\nВведите новое ФИО: ");
|
||||
string newFIO = Console.ReadLine();
|
||||
user.FIO = newFIO;
|
||||
_userUseCase.UpdateUser(user);
|
||||
Console.WriteLine("\nПользователь обновлен.\n");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"Ошибка: {ex.Message}\n");
|
||||
}
|
||||
}
|
||||
|
||||
// Метод для поиска пользователя по ID
|
||||
public void FindUserById(Guid userGuid)
|
||||
{
|
||||
try
|
||||
{
|
||||
var user = _userUseCase.FindUserById(userGuid);
|
||||
Console.WriteLine($"\nПользователь найден: {user.Guid}, {user.FIO}, {user.Group.Name}\n");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"Ошибка: {ex.Message}\n");
|
||||
}
|
||||
}
|
||||
|
||||
private void ValidateUserFIO(string fio)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(fio))
|
||||
{
|
||||
throw new ArgumentException("ФИО не может быть пустым.");
|
||||
}
|
||||
}
|
||||
|
||||
// Приватный метод для валидации существования группы по ID
|
||||
private GroupLocalEntity ValidateGroupExistence(int groupId)
|
||||
{
|
||||
var group = _userUseCase.GetAllUsers().FirstOrDefault(u => u.Group.Id == groupId)?.Group;
|
||||
if (group == null)
|
||||
{
|
||||
throw new Exception("Группа не найдена.");
|
||||
}
|
||||
|
||||
// Возвращаем правильный объект типа GroupLocalEntity
|
||||
return new GroupLocalEntity
|
||||
{
|
||||
Id = group.Id,
|
||||
Name = group.Name
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]
|
23
ui/obj/Debug/net8.0/ui.AssemblyInfo.cs
Normal file
23
ui/obj/Debug/net8.0/ui.AssemblyInfo.cs
Normal file
@ -0,0 +1,23 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Этот код создан программой.
|
||||
// Исполняемая версия:4.0.30319.42000
|
||||
//
|
||||
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
||||
// повторной генерации кода.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("ui")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("ui")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("ui")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
// Создано классом WriteCodeFragment MSBuild.
|
||||
|
1
ui/obj/Debug/net8.0/ui.AssemblyInfoInputs.cache
Normal file
1
ui/obj/Debug/net8.0/ui.AssemblyInfoInputs.cache
Normal file
@ -0,0 +1 @@
|
||||
20ed1ba88db46bd37bf95cc037aa54d55b6a60c0405520a36b7f26aec1c3e1fe
|
@ -0,0 +1,13 @@
|
||||
is_global = true
|
||||
build_property.TargetFramework = net8.0
|
||||
build_property.TargetPlatformMinVersion =
|
||||
build_property.UsingMicrosoftNETSdkWeb =
|
||||
build_property.ProjectTypeGuids =
|
||||
build_property.InvariantGlobalization =
|
||||
build_property.PlatformNeutralAssembly =
|
||||
build_property.EnforceExtendedAnalyzerRules =
|
||||
build_property._SupportedPlatformList = Linux,macOS,Windows
|
||||
build_property.RootNamespace = ui
|
||||
build_property.ProjectDir = C:\Users\class_student\source\repos\presence\ui\
|
||||
build_property.EnableComHosting =
|
||||
build_property.EnableGeneratedComInterfaceComImportInterop =
|
8
ui/obj/Debug/net8.0/ui.GlobalUsings.g.cs
Normal file
8
ui/obj/Debug/net8.0/ui.GlobalUsings.g.cs
Normal file
@ -0,0 +1,8 @@
|
||||
// <auto-generated/>
|
||||
global using global::System;
|
||||
global using global::System.Collections.Generic;
|
||||
global using global::System.IO;
|
||||
global using global::System.Linq;
|
||||
global using global::System.Net.Http;
|
||||
global using global::System.Threading;
|
||||
global using global::System.Threading.Tasks;
|
BIN
ui/obj/Debug/net8.0/ui.assets.cache
Normal file
BIN
ui/obj/Debug/net8.0/ui.assets.cache
Normal file
Binary file not shown.
BIN
ui/obj/Debug/net8.0/ui.csproj.AssemblyReference.cache
Normal file
BIN
ui/obj/Debug/net8.0/ui.csproj.AssemblyReference.cache
Normal file
Binary file not shown.
1111
ui/obj/project.assets.json
Normal file
1111
ui/obj/project.assets.json
Normal file
File diff suppressed because it is too large
Load Diff
32
ui/obj/project.nuget.cache
Normal file
32
ui/obj/project.nuget.cache
Normal file
@ -0,0 +1,32 @@
|
||||
{
|
||||
"version": 2,
|
||||
"dgSpecHash": "dNHY0PWkVJ9yqh4r350Pq7u6mnT7d9z4cJfYez8zScnFgIivUdw2P/yHSkjOeyGZ9zBEiinHHbXHbVE6f2TWUw==",
|
||||
"success": true,
|
||||
"projectFilePath": "C:\\Users\\class_student\\source\\repos\\presence\\ui\\ui.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",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\documentformat.openxml\\3.0.1\\documentformat.openxml.3.0.1.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\documentformat.openxml.framework\\3.0.1\\documentformat.openxml.framework.3.0.1.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\excelnumberformat\\1.1.0\\excelnumberformat.1.1.0.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.entityframeworkcore\\8.0.10\\microsoft.entityframeworkcore.8.0.10.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.entityframeworkcore.abstractions\\8.0.10\\microsoft.entityframeworkcore.abstractions.8.0.10.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.entityframeworkcore.analyzers\\8.0.10\\microsoft.entityframeworkcore.analyzers.8.0.10.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.entityframeworkcore.relational\\8.0.10\\microsoft.entityframeworkcore.relational.8.0.10.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.extensions.caching.abstractions\\8.0.0\\microsoft.extensions.caching.abstractions.8.0.0.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.extensions.caching.memory\\8.0.1\\microsoft.extensions.caching.memory.8.0.1.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.extensions.configuration.abstractions\\8.0.0\\microsoft.extensions.configuration.abstractions.8.0.0.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.extensions.dependencyinjection\\8.0.1\\microsoft.extensions.dependencyinjection.8.0.1.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.extensions.dependencyinjection.abstractions\\8.0.2\\microsoft.extensions.dependencyinjection.abstractions.8.0.2.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.extensions.logging\\8.0.1\\microsoft.extensions.logging.8.0.1.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.extensions.logging.abstractions\\8.0.2\\microsoft.extensions.logging.abstractions.8.0.2.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.extensions.options\\8.0.2\\microsoft.extensions.options.8.0.2.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\microsoft.extensions.primitives\\8.0.0\\microsoft.extensions.primitives.8.0.0.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\npgsql\\8.0.5\\npgsql.8.0.5.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\npgsql.entityframeworkcore.postgresql\\8.0.10\\npgsql.entityframeworkcore.postgresql.8.0.10.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\rbush\\3.2.0\\rbush.3.2.0.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\sixlabors.fonts\\1.0.0\\sixlabors.fonts.1.0.0.nupkg.sha512",
|
||||
"C:\\Users\\class_student\\.nuget\\packages\\system.io.packaging\\8.0.0\\system.io.packaging.8.0.0.nupkg.sha512"
|
||||
],
|
||||
"logs": []
|
||||
}
|
230
ui/obj/ui.csproj.nuget.dgspec.json
Normal file
230
ui/obj/ui.csproj.nuget.dgspec.json
Normal file
@ -0,0 +1,230 @@
|
||||
{
|
||||
"format": 1,
|
||||
"restore": {
|
||||
"C:\\Users\\class_student\\source\\repos\\presence\\ui\\ui.csproj": {}
|
||||
},
|
||||
"projects": {
|
||||
"C:\\Users\\class_student\\source\\repos\\presence\\data\\data.csproj": {
|
||||
"version": "1.0.0",
|
||||
"restore": {
|
||||
"projectUniqueName": "C:\\Users\\class_student\\source\\repos\\presence\\data\\data.csproj",
|
||||
"projectName": "data",
|
||||
"projectPath": "C:\\Users\\class_student\\source\\repos\\presence\\data\\data.csproj",
|
||||
"packagesPath": "C:\\Users\\class_student\\.nuget\\packages\\",
|
||||
"outputPath": "C:\\Users\\class_student\\source\\repos\\presence\\data\\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": [
|
||||
"net8.0"
|
||||
],
|
||||
"sources": {
|
||||
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
||||
"https://api.nuget.org/v3/index.json": {}
|
||||
},
|
||||
"frameworks": {
|
||||
"net8.0": {
|
||||
"targetAlias": "net8.0",
|
||||
"projectReferences": {}
|
||||
}
|
||||
},
|
||||
"warningProperties": {
|
||||
"warnAsError": [
|
||||
"NU1605"
|
||||
]
|
||||
},
|
||||
"restoreAuditProperties": {
|
||||
"enableAudit": "true",
|
||||
"auditLevel": "low",
|
||||
"auditMode": "direct"
|
||||
}
|
||||
},
|
||||
"frameworks": {
|
||||
"net8.0": {
|
||||
"targetAlias": "net8.0",
|
||||
"dependencies": {
|
||||
"Microsoft.EntityFrameworkCore": {
|
||||
"target": "Package",
|
||||
"version": "[8.0.10, )"
|
||||
},
|
||||
"Microsoft.EntityFrameworkCore.Design": {
|
||||
"include": "Runtime, Build, Native, ContentFiles, Analyzers, BuildTransitive",
|
||||
"suppressParent": "All",
|
||||
"target": "Package",
|
||||
"version": "[8.0.10, )"
|
||||
},
|
||||
"Npgsql.EntityFrameworkCore.PostgreSQL": {
|
||||
"target": "Package",
|
||||
"version": "[8.0.10, )"
|
||||
}
|
||||
},
|
||||
"imports": [
|
||||
"net461",
|
||||
"net462",
|
||||
"net47",
|
||||
"net471",
|
||||
"net472",
|
||||
"net48",
|
||||
"net481"
|
||||
],
|
||||
"assetTargetFallback": true,
|
||||
"warn": true,
|
||||
"frameworkReferences": {
|
||||
"Microsoft.NETCore.App": {
|
||||
"privateAssets": "all"
|
||||
}
|
||||
},
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.204/PortableRuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
},
|
||||
"C:\\Users\\class_student\\source\\repos\\presence\\domain\\domain.csproj": {
|
||||
"version": "1.0.0",
|
||||
"restore": {
|
||||
"projectUniqueName": "C:\\Users\\class_student\\source\\repos\\presence\\domain\\domain.csproj",
|
||||
"projectName": "domain",
|
||||
"projectPath": "C:\\Users\\class_student\\source\\repos\\presence\\domain\\domain.csproj",
|
||||
"packagesPath": "C:\\Users\\class_student\\.nuget\\packages\\",
|
||||
"outputPath": "C:\\Users\\class_student\\source\\repos\\presence\\domain\\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": [
|
||||
"net8.0"
|
||||
],
|
||||
"sources": {
|
||||
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
||||
"https://api.nuget.org/v3/index.json": {}
|
||||
},
|
||||
"frameworks": {
|
||||
"net8.0": {
|
||||
"targetAlias": "net8.0",
|
||||
"projectReferences": {
|
||||
"C:\\Users\\class_student\\source\\repos\\presence\\data\\data.csproj": {
|
||||
"projectPath": "C:\\Users\\class_student\\source\\repos\\presence\\data\\data.csproj"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"warningProperties": {
|
||||
"warnAsError": [
|
||||
"NU1605"
|
||||
]
|
||||
},
|
||||
"restoreAuditProperties": {
|
||||
"enableAudit": "true",
|
||||
"auditLevel": "low",
|
||||
"auditMode": "direct"
|
||||
}
|
||||
},
|
||||
"frameworks": {
|
||||
"net8.0": {
|
||||
"targetAlias": "net8.0",
|
||||
"dependencies": {
|
||||
"ClosedXML": {
|
||||
"target": "Package",
|
||||
"version": "[0.104.1, )"
|
||||
}
|
||||
},
|
||||
"imports": [
|
||||
"net461",
|
||||
"net462",
|
||||
"net47",
|
||||
"net471",
|
||||
"net472",
|
||||
"net48",
|
||||
"net481"
|
||||
],
|
||||
"assetTargetFallback": true,
|
||||
"warn": true,
|
||||
"frameworkReferences": {
|
||||
"Microsoft.NETCore.App": {
|
||||
"privateAssets": "all"
|
||||
}
|
||||
},
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.204/PortableRuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
},
|
||||
"C:\\Users\\class_student\\source\\repos\\presence\\ui\\ui.csproj": {
|
||||
"version": "1.0.0",
|
||||
"restore": {
|
||||
"projectUniqueName": "C:\\Users\\class_student\\source\\repos\\presence\\ui\\ui.csproj",
|
||||
"projectName": "ui",
|
||||
"projectPath": "C:\\Users\\class_student\\source\\repos\\presence\\ui\\ui.csproj",
|
||||
"packagesPath": "C:\\Users\\class_student\\.nuget\\packages\\",
|
||||
"outputPath": "C:\\Users\\class_student\\source\\repos\\presence\\ui\\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": [
|
||||
"net8.0"
|
||||
],
|
||||
"sources": {
|
||||
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
||||
"https://api.nuget.org/v3/index.json": {}
|
||||
},
|
||||
"frameworks": {
|
||||
"net8.0": {
|
||||
"targetAlias": "net8.0",
|
||||
"projectReferences": {
|
||||
"C:\\Users\\class_student\\source\\repos\\presence\\domain\\domain.csproj": {
|
||||
"projectPath": "C:\\Users\\class_student\\source\\repos\\presence\\domain\\domain.csproj"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"warningProperties": {
|
||||
"warnAsError": [
|
||||
"NU1605"
|
||||
]
|
||||
},
|
||||
"restoreAuditProperties": {
|
||||
"enableAudit": "true",
|
||||
"auditLevel": "low",
|
||||
"auditMode": "direct"
|
||||
}
|
||||
},
|
||||
"frameworks": {
|
||||
"net8.0": {
|
||||
"targetAlias": "net8.0",
|
||||
"imports": [
|
||||
"net461",
|
||||
"net462",
|
||||
"net47",
|
||||
"net471",
|
||||
"net472",
|
||||
"net48",
|
||||
"net481"
|
||||
],
|
||||
"assetTargetFallback": true,
|
||||
"warn": true,
|
||||
"frameworkReferences": {
|
||||
"Microsoft.NETCore.App": {
|
||||
"privateAssets": "all"
|
||||
}
|
||||
},
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.204/PortableRuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
19
ui/obj/ui.csproj.nuget.g.props
Normal file
19
ui/obj/ui.csproj.nuget.g.props
Normal file
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
|
||||
<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\;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')" />
|
||||
</ImportGroup>
|
||||
</Project>
|
7
ui/obj/ui.csproj.nuget.g.targets
Normal file
7
ui/obj/ui.csproj.nuget.g.targets
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<Import Project="$(NuGetPackageRoot)microsoft.extensions.logging.abstractions\8.0.2\buildTransitive\net6.0\Microsoft.Extensions.Logging.Abstractions.targets" Condition="Exists('$(NuGetPackageRoot)microsoft.extensions.logging.abstractions\8.0.2\buildTransitive\net6.0\Microsoft.Extensions.Logging.Abstractions.targets')" />
|
||||
<Import Project="$(NuGetPackageRoot)microsoft.extensions.options\8.0.2\buildTransitive\net6.0\Microsoft.Extensions.Options.targets" Condition="Exists('$(NuGetPackageRoot)microsoft.extensions.options\8.0.2\buildTransitive\net6.0\Microsoft.Extensions.Options.targets')" />
|
||||
</ImportGroup>
|
||||
</Project>
|
13
ui/ui.csproj
Normal file
13
ui/ui.csproj
Normal file
@ -0,0 +1,13 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\domain\domain.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
Loading…
Reference in New Issue
Block a user