Compare commits

...

No commits in common. "develop" and "main" have entirely different histories.

254 changed files with 9638 additions and 3418 deletions

363
.gitignore vendored
View File

@ -1,363 +0,0 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Oo]ut/
[Ll]og/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# ASP.NET Scaffolding
ScaffoldingReadMe.txt
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Coverlet is a free, cross platform Code Coverage Tool
coverage*.json
coverage*.xml
coverage*.info
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
# Fody - auto-generated XML schema
FodyWeavers.xsd

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
.vs/presence/v17/.suo Normal file

Binary file not shown.

View File

@ -0,0 +1,37 @@
{
"Version": 1,
"WorkspaceRootPath": "C:\\Users\\profi\\source\\repos\\aspekt\\",
"Documents": [
{
"AbsoluteMoniker": "D:0:0:{E8BA9216-FC36-455D-8423-EB9F92594CC2}|ui\\ui.csproj|c:\\users\\profi\\source\\repos\\aspekt\\ui\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{E8BA9216-FC36-455D-8423-EB9F92594CC2}|ui\\ui.csproj|solutionrelative:ui\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
}
],
"DocumentGroupContainers": [
{
"Orientation": 0,
"VerticalTabListWidth": 256,
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": 0,
"Children": [
{
"$type": "Document",
"DocumentIndex": 0,
"Title": "Program.cs",
"DocumentMoniker": "C:\\Users\\profi\\source\\repos\\aspekt\\ui\\Program.cs",
"RelativeDocumentMoniker": "ui\\Program.cs",
"ToolTip": "C:\\Users\\profi\\source\\repos\\aspekt\\ui\\Program.cs",
"RelativeToolTip": "ui\\Program.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-11-14T09:54:47.551Z",
"EditorCaption": ""
}
]
}
]
}
]
}

View File

@ -0,0 +1,37 @@
{
"Version": 1,
"WorkspaceRootPath": "C:\\Users\\profi\\source\\repos\\aspekt\\",
"Documents": [
{
"AbsoluteMoniker": "D:0:0:{E8BA9216-FC36-455D-8423-EB9F92594CC2}|ui\\ui.csproj|c:\\users\\profi\\source\\repos\\aspekt\\ui\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{E8BA9216-FC36-455D-8423-EB9F92594CC2}|ui\\ui.csproj|solutionrelative:ui\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
}
],
"DocumentGroupContainers": [
{
"Orientation": 0,
"VerticalTabListWidth": 256,
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": 0,
"Children": [
{
"$type": "Document",
"DocumentIndex": 0,
"Title": "Program.cs",
"DocumentMoniker": "C:\\Users\\profi\\source\\repos\\aspekt\\ui\\Program.cs",
"RelativeDocumentMoniker": "ui\\Program.cs",
"ToolTip": "C:\\Users\\profi\\source\\repos\\aspekt\\ui\\Program.cs",
"RelativeToolTip": "ui\\Program.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAABIAAAATAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-11-14T09:54:47.551Z",
"EditorCaption": ""
}
]
}
]
}
]
}

View File

@ -1,25 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.11.35312.102
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Demo", "Demo\Demo.csproj", "{983820F6-FF31-4B3A-8593-831BC3904E80}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{983820F6-FF31-4B3A-8593-831BC3904E80}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{983820F6-FF31-4B3A-8593-831BC3904E80}.Debug|Any CPU.Build.0 = Debug|Any CPU
{983820F6-FF31-4B3A-8593-831BC3904E80}.Release|Any CPU.ActiveCfg = Release|Any CPU
{983820F6-FF31-4B3A-8593-831BC3904E80}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4F43A963-447C-4FCB-BB78-8D315EC0F1D6}
EndGlobalSection
EndGlobal

View File

@ -1,10 +0,0 @@
using System;
namespace Demo.Data.Exceptions
{
public class GroupNotFoundException : RepositoryException
{
public GroupNotFoundException(int userId)
: base($"Группа с ID {userId} не найдена.") { }
}
}

View File

@ -1,11 +0,0 @@
using System;
namespace Demo.Data.Exceptions
{
public class PresenceNotFoundException : RepositoryException
{
public PresenceNotFoundException(int userId, DateOnly date, int firstLesson, int lastLesson)
: base($"Посещаемость для пользователя ID: {userId} на дату {date.ToShortDateString()}" +
$" с {firstLesson} по {lastLesson} уроки не найдена.") { }
}
}

View File

@ -1,9 +0,0 @@
using System;
namespace Demo.Data.Exceptions
{
public class RepositoryException : Exception
{
public RepositoryException(string message) : base(message) { }
}
}

View File

@ -1,10 +0,0 @@
using System;
namespace Demo.Data.Exceptions
{
public class UserNotFoundException : RepositoryException
{
public UserNotFoundException(int userId)
: base($"Пользователь с ID {userId} не найден.") { }
}
}

View File

@ -1,18 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Demo.domain.Models
{
public class PresenceLocalEntity
{
public required int UserId { 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; }
}
}

View File

@ -1,36 +0,0 @@
using Demo.domain.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.NetworkInformation;
using System.Text;
using System.Threading.Tasks;
namespace Demo.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{ID = 1, FIO = "RandomFio", GroupID = 1 },
new UserLocalEnity{ID = 2, FIO = "RandomFio1", GroupID = 2 },
new UserLocalEnity{ID = 3, FIO = "RandomFio2", GroupID = 3 },
new UserLocalEnity{ID = 4, FIO = "RandomFio3", GroupID = 1 },
new UserLocalEnity{ID = 5, FIO = "RandomFio4", GroupID = 2 },
new UserLocalEnity{ID = 6, FIO = "RandomFio5", GroupID = 3 },
};
public static List<PresenceLocalEntity> presences => new List<PresenceLocalEntity>
{
};
}
}

View File

@ -1,19 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Demo.Data.RemoteData.RemoteDataBase.DAO
{
public class AttendanceRecord
{
public int UserId { 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; }
}
}

View File

@ -1,16 +0,0 @@
using Demo.domain.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Demo.Data.RemoteData.RemoteDataBase.DAO
{
public class GroupDao
{
public int Id { get; set; }
public string Name { get; set; }
public virtual List<UserDao> Users { get; set; }
}
}

View File

@ -1,16 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Demo.Data.RemoteData.RemoteDataBase.DAO
{
public class GroupAttendanceStatistics
{
public int UserCount { get; set; }
public int TotalLessons { get; set; }
public double AttendancePercentage { get; set; }
public List<UserAttendance> UserAttendanceDetails { get; set; } = new List<UserAttendance>();
}
}

View File

@ -1,18 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Demo.Data.RemoteData.RemoteDataBase.DAO
{
public class PresenceDao
{
public int PresenceId { get; set; }
public int UserId { get; set; }
public bool IsAttedance { get; set; } = true;
public DateOnly Date { get; set; }
public int LessonNumber { get; set; }
public int GroupId { get; set; }
}
}

View File

@ -1,16 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Demo.Data.RemoteData.RemoteDataBase.DAO
{
public class UserDao
{
public required string FIO { get; set; }
public required int UserId { get; set; }
public int GroupId { get; set; }
public GroupDao? Group { get; set; }
}
}

View File

@ -1,16 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Demo.Data.RemoteData.RemoteDataBase.DAO
{
public class UserAttendance
{
public int UserId { get; set; }
public double Attended { get; set; }
public double Missed { get; set; }
public double AttendanceRate { get; set; }
}
}

View File

@ -1,35 +0,0 @@
using Microsoft.EntityFrameworkCore;
using Demo.Data.RemoteData.RemoteDataBase.DAO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace Demo.Data.RemoteData.RemoteDataBase
{
public class RemoteDatabaseContext: DbContext
{
public DbSet<GroupDao> Groups { get; set; }
public DbSet<UserDao> Users { get; set; }
public DbSet<PresenceDao> PresenceDaos { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseNpgsql("Host=localhost;Port=5432;Database=presencedb;Username=postgres;Password=123;Include Error Detail=True;");
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<GroupDao>().HasKey(group=>group.Id);
modelBuilder.Entity<GroupDao>().Property(group => group.Id).ValueGeneratedOnAdd();
modelBuilder.Entity<UserDao>().HasKey(user=>user.UserId);
modelBuilder.Entity<UserDao>().Property(user=>user.UserId).ValueGeneratedOnAdd();
modelBuilder.Entity<PresenceDao>().HasKey(presence =>presence.PresenceId);
modelBuilder.Entity<PresenceDao>().Property(presence=>presence.PresenceId).ValueGeneratedOnAdd();
}
}
}

View File

@ -1,60 +0,0 @@
using Demo.Data.Exceptions;
using Demo.Data.LocalData;
using Demo.Data.RemoteData.RemoteDataBase.DAO;
using Demo.Data.Repository;
using Demo.domain.Models;
using System.Collections.Generic;
using System.Linq;
public class GroupRepositoryImpl
{
private List<GroupLocalEntity> _groups = LocalStaticData.groups;
public GroupLocalEntity? GetGroupById(int groupId)
{
foreach (var group in _groups)
{
if (group.Id == groupId)
{
return group;
}
}
return null;
}
// Метод для получения всех групп
public List<GroupLocalEntity> GetAllGroups() => _groups;
// Метод для добавления новой группы
public void AddGroup(GroupLocalEntity group)
{
group.Id = _groups.Any() ? _groups.Max(g => g.Id) + 1 : 1;
_groups.Add(group);
}
// Метод для обновления существующей группы
public void UpdateGroupById(int groupId, GroupLocalEntity updatedGroup)
{
var existingGroup = GetGroupById(groupId);
if (existingGroup == null) throw new GroupNotFoundException(groupId);
}
public void RemoveGroupById(int groupId)
{
var existingGroup = GetGroupById(groupId);
if (existingGroup == null) throw new GroupNotFoundException(groupId);
if (_groups.Contains(existingGroup))
{
_groups.Remove(existingGroup);
}
}
public bool AddGroup(string Name)
{
throw new NotImplementedException();
}
}

View File

@ -1,18 +0,0 @@
using Demo.Data.RemoteData.RemoteDataBase.DAO;
using Demo.domain.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Demo.Data.Repository
{
public interface IGroupRepository
{
List<GroupDao> GetAllGroups();
bool UpdateGroupById(int groupID, GroupDao updatedGroup);
GroupDao GetGroupById(int groupID);
bool AddGroup(string Name);
}
}

View File

@ -1,27 +0,0 @@

using Demo.Data.RemoteData.RemoteDataBase.DAO;
using Demo.domain.Models;
using Demo.Domain.UseCase;
using Microsoft.EntityFrameworkCore.Metadata;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Demo.Data.Repository
{
public interface IPresenceRepository
{
List<PresenceDao> GetPresenceByDateAndGroup(DateTime date, int groupId);
void SavePresence(List<PresenceDao> presences);
List<PresenceDao> GetPresenceByGroup(int groupId);
DateOnly? GetLastDateByGroupId(int groupId);
List<PresenceDao> GetPresenceForAbsent(DateTime date, int GroupId);
GroupAttendanceStatistics GetGeneralPresenceForGroup(int groupId);
void UpdateAtt(int userId, int groupId, int firstLesson, int lastLesson, DateOnly date, bool isAttendance);
List<PresenceDao> GetAttendanceByGroup(int groupId);
}
}

View File

@ -1,14 +0,0 @@
using Demo.Data.RemoteData.RemoteDataBase.DAO;
using Demo.domain.Models;
using System.Collections.Generic;
namespace Demo.Data.Repository
{
public interface IUserRepository
{
List<UserDao> GetAllUsers();
bool RemoveUserById(int userId);
UserDao UpdateUser(int userId, string newFIO, int groupId);
List<UserDao> GetUserNames();
}
}

View File

@ -1,53 +0,0 @@
using Demo.Data.LocalData;
using Demo.Data.RemoteData.RemoteDataBase;
using Demo.Data.RemoteData.RemoteDataBase.DAO;
using Demo.domain.Models;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Demo.Data.Repository
{
public class PresenceRepositoryImpl
{
private List<PresenceLocalEntity> _presences;
public PresenceRepositoryImpl()
{
_presences = new List<PresenceLocalEntity>(); // Ваши реальные данные
}
public void SavePresence(List<PresenceLocalEntity> presences)
{
foreach (var presence in presences)
{
var existingPresence = _presences.FirstOrDefault(p =>
p.Date == presence.Date &&
p.UserId == presence.UserId &&
p.LessonNumber == presence.LessonNumber);
if (existingPresence == null)
{
_presences.Add(presence);
}
else
{
existingPresence.IsAttedance = presence.IsAttedance;
}
}
}
public List<PresenceLocalEntity> GetPresenceByDateAndGroup(DateTime date, int groupId)
{
return _presences.Where(p => p.Date.Date == date.Date &&
LocalStaticData.users.Any(u => u.GroupID == groupId && u.ID == p.UserId)).ToList();
}
public List<PresenceLocalEntity> GetPresenceByGroup(int groupId)
{
return _presences.Where(p => p.GroupId == groupId).ToList();
}
}
}

View File

@ -1,116 +0,0 @@
using Demo.Data.RemoteData.RemoteDataBase;
using Demo.Data.RemoteData.RemoteDataBase.DAO;
using Demo.domain.Models;
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Demo.Data.Repository
{
public class SQLGroupRepositoryImpl : IGroupRepository
{
private readonly RemoteDatabaseContext _remoteDatabaseContext;
public SQLGroupRepositoryImpl(RemoteDatabaseContext remoteDatabaseContext)
{
_remoteDatabaseContext = remoteDatabaseContext;
}
// Метод для добавления новой группы
public bool AddGroup(GroupDao newGroup)
{
var groupDao = new GroupDao
{
Name = newGroup.Name
};
_remoteDatabaseContext.Groups.Add(groupDao);
_remoteDatabaseContext.SaveChanges();
return true;
}
// Метод для получения группы по ID
public GroupDao GetGroupById(int groupId)
{
var groupDao = _remoteDatabaseContext.Groups
.Include(g => g.Users)
.FirstOrDefault(g => g.Id == groupId);
if (groupDao == null) return null;
return new GroupDao
{
Id = groupDao.Id,
Name = groupDao.Name,
Users = groupDao.Users.Select(u => new UserDao
{
UserId = u.UserId,
FIO = u.FIO,
GroupId = u.GroupId
}).ToList()
};
}
// Метод для получения всех групп
public List<GroupDao> GetAllGroups()
{
return _remoteDatabaseContext.Groups
.Include(g => g.Users)
.Select(g => new GroupDao
{
Id = g.Id,
Name = g.Name,
Users = g.Users.Select(u => new UserDao
{
UserId = u.UserId,
FIO = u.FIO,
GroupId = u.GroupId
}).ToList()
})
.ToList();
}
// Метод для обновления группы по ID
public bool UpdateGroupById(int groupId, GroupDao updatedGroup)
{
var groupDao = _remoteDatabaseContext.Groups
.Include(g => g.Users)
.FirstOrDefault(g => g.Id == groupId);
if (groupDao == null) return false;
groupDao.Name = updatedGroup.Name;
// Пример обновления списка пользователей
groupDao.Users = updatedGroup.Users.Select(user => new UserDao
{
UserId = user.UserId,
FIO = user.FIO,
GroupId = user.GroupId
}).ToList();
_remoteDatabaseContext.SaveChanges();
return true;
}
// Метод для удаления группы по ID
public bool RemoveGroupById(int groupId)
{
var groupDao = _remoteDatabaseContext.Groups.Find(groupId);
if (groupDao == null) return false;
_remoteDatabaseContext.Groups.Remove(groupDao);
_remoteDatabaseContext.SaveChanges();
return true;
}
public bool AddGroup(string Name)
{
var groupDao = new GroupDao
{
Name = Name
};
_remoteDatabaseContext.Groups.Add(groupDao);
_remoteDatabaseContext.SaveChanges();
return true;
}
}
}

View File

@ -1,220 +0,0 @@
using Demo.Data.Exceptions;
using Demo.Data.LocalData;
using Demo.Data.RemoteData.RemoteDataBase;
using Demo.Data.RemoteData.RemoteDataBase.DAO;
using Demo.domain.Models;
using DocumentFormat.OpenXml.InkML;
using DocumentFormat.OpenXml.Spreadsheet;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Runtime.InteropServices.JavaScript.JSType;
namespace Demo.Data.Repository
{
public class SQLPresenceRepositoryImpl : IPresenceRepository
{
private readonly RemoteDatabaseContext _remoteDatabaseContext;
public SQLPresenceRepositoryImpl(RemoteDatabaseContext remoteDatabaseContext)
{
_remoteDatabaseContext = remoteDatabaseContext;
}
public List<PresenceDao> GetAttendanceByGroup(int groupId)
{
// Получаем записи посещаемости для указанной группы
return _remoteDatabaseContext.PresenceDaos
.Where(p => p.GroupId == groupId)
.Select(p => new PresenceDao
{
UserId = p.UserId,
GroupId = p.GroupId,
Date = p.Date,
LessonNumber = p.LessonNumber,
IsAttedance = p.IsAttedance
})
.ToList();
}
public List<PresenceDao> GetPresenceForAbsent(DateTime date, int GroupId)
{
return _remoteDatabaseContext.PresenceDaos.Where(p => p.GroupId == GroupId && p.Date == DateOnly.FromDateTime(date)).ToList();
}
public List<PresenceDao> GetPresenceByDateAndGroup(DateTime date, int groupId)
{
return _remoteDatabaseContext.PresenceDaos.Where(p => p.Date == DateOnly.FromDateTime(date) &&
_remoteDatabaseContext.Users.Any(u => u.GroupId == groupId && u.UserId == p.UserId)).ToList();
}
// Реализация метода для получения всех данных по группе
public List<PresenceDao> GetPresenceByGroup(int groupId)
{
return _remoteDatabaseContext.PresenceDaos.Where(p => p.GroupId == groupId)
.OrderBy(p => p.Date)
.ThenBy(p=>p.UserId).ToList();
}
public void SavePresence(List<PresenceDao> presences)
{
_remoteDatabaseContext.PresenceDaos.AddRange(presences.Select(it => new PresenceDao
{
Date = it.Date,
IsAttedance = it.IsAttedance,
LessonNumber = it.LessonNumber,
UserId = it.UserId,
GroupId = it.GroupId
}));
_remoteDatabaseContext.SaveChanges();
}
public void UpdateAtt(int userId, int groupId, int firstLesson, int lastLesson, DateOnly date, bool isAttendance)
{
// Находим все записи по UserId, GroupId, LessonNumber (в диапазоне) и дате
var presences = _remoteDatabaseContext.PresenceDaos
.Where(p => p.UserId == userId
&& p.GroupId == groupId
&& p.LessonNumber >= firstLesson
&& p.LessonNumber <= lastLesson
&& p.Date == date)
.ToList();
// Обновляем значение IsAttendance для всех найденных записей
foreach (var presence in presences)
{
presence.IsAttedance = isAttendance;
}
_remoteDatabaseContext.SaveChanges(); // Сохраняем изменения в базе данных
}
public DateOnly? GetLastDateByGroupId(int groupId)
{
// Проверяем наличие записей о посещаемости в базе данных для данной группы.
var lastDate = _remoteDatabaseContext.PresenceDaos
.Where(p => p.GroupId == groupId)
.OrderByDescending(p => p.Date)
.Select(p => p.Date)
.FirstOrDefault();
return lastDate == default ? (DateOnly?)null : lastDate;
}
public List<PresenceDao> PresenceSort(List<PresenceDao> presences)
{
presences=_remoteDatabaseContext.PresenceDaos.OrderBy(p=>p.Date).ToList();
return presences;
}
public GroupAttendanceStatistics GetGeneralPresenceForGroup(int groupId)
{
var presences = _remoteDatabaseContext.PresenceDaos.Where(p => p.GroupId == groupId).OrderBy(p => p.LessonNumber).ToList();
var dates = _remoteDatabaseContext.PresenceDaos;
var distDates = dates.Select(p => p.Date).Distinct().ToList();
int lesId = 0;
int lesNum = 1;
double att = 0;
int days = -1;
int countAllLes = 0;
DateOnly date = DateOnly.MinValue;
List<int> usersId = new List<int>();
foreach (var presence in presences)
{
if (!usersId.Contains(presence.UserId))
{
usersId.Add(presence.UserId);
}
if (presence.Date != date)
{
date = presence.Date;
lesId++;
lesNum = presence.LessonNumber;
days++;
}
if (presence.LessonNumber != lesNum && date == presence.Date)
{
lesNum = presence.LessonNumber;
countAllLes++;
lesId++;
}
if (presence.IsAttedance)
{
att++;
}
}
List<UserAttendance> a = new List<UserAttendance>();
List<int> ids = new List<int>();
double ok = 0;
double skip = 0;
int userId = 0;
foreach (var user in usersId)
{
var users = _remoteDatabaseContext.PresenceDaos.Where(p => p.UserId == user);
foreach (var usera in users)
{
userId = usera.UserId;
if (!ids.Contains(usera.UserId))
{
skip = 0;
ok = 0;
ids.Add(userId);
a.Add(new UserAttendance { UserId = userId, Attended = ok, Missed = skip });
userId = usera.UserId;
if (usera.IsAttedance)
{
a.First(a => a.UserId == usera.UserId).Attended = ok += 1;
}
else
{
a.First(a => a.UserId == usera.UserId).Missed = skip += 1;
}
}
else
{
if (usera.IsAttedance)
{
a.First(a => a.UserId == usera.UserId).Attended = ok += 1;
}
else
{
a.First(a => a.UserId == usera.UserId).Missed = skip += 1;
}
}
}
}
var statistics = new GroupAttendanceStatistics
{
UserCount = usersId.Count,
TotalLessons = lesId,
AttendancePercentage = att / usersId.Count / lesNum / distDates.Count() * 100
};
foreach (var user in a)
{
statistics.UserAttendanceDetails.Add(new UserAttendance
{
UserId = user.UserId,
Attended = user.Attended,
Missed = user.Missed,
AttendanceRate = user.Attended / (user.Missed + user.Attended) * 100
});
}
return statistics;
}
}
}

View File

@ -1,61 +0,0 @@
using Demo.Data.Exceptions;
using Demo.Data.RemoteData.RemoteDataBase;
using Demo.Data.RemoteData.RemoteDataBase.DAO;
using Demo.domain.Models;
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Demo.Data.Repository
{
public class SQLUserRepositoryImpl : IUserRepository
{
private readonly RemoteDatabaseContext _remoteDatabaseContext;
public SQLUserRepositoryImpl(RemoteDatabaseContext remoteDatabaseContext)
{
_remoteDatabaseContext = remoteDatabaseContext;
}
public bool RemoveUserById(int userId)
{
var user = _remoteDatabaseContext.Users.FirstOrDefault(u => u.UserId == userId);
if (user == null) throw new UserNotFoundException(userId);
_remoteDatabaseContext.Users.Remove(user);
_remoteDatabaseContext.SaveChanges();
return true;
}
public UserDao UpdateUser(int userId, string newFio, int groupId)
{
var existingUser = _remoteDatabaseContext.Users.FirstOrDefault(u => u.UserId == userId);
if (existingUser == null) throw new UserNotFoundException(userId);
// Обновляем поля существующего пользователя
existingUser.FIO = newFio;
existingUser.GroupId = groupId;
_remoteDatabaseContext.SaveChanges();
return existingUser;
}
public List<UserDao> GetAllUsers()
{
// Возвращаем пользователей, отсортированных по UserId
return _remoteDatabaseContext.Users.OrderBy(u => u.UserId).ToList();
}
public List<UserDao> GetUserNames()
{
var users = GetAllUsers();
List<UserDao> names = new List<UserDao>();
foreach (var user in users)
{
names.Add(new UserDao{UserId=user.UserId, FIO=user.FIO });
}
return names;
}
}
}

View File

@ -1,37 +0,0 @@
using Demo.Data.Exceptions;
using Demo.Data.LocalData;
using Demo.Data.RemoteData.RemoteDataBase.DAO;
using Demo.domain.Models;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Demo.Data.Repository
{
public class UserRepositoryImpl
{
private List<UserLocalEnity> _users;
public UserRepositoryImpl()
{
_users = LocalStaticData.users;
}
public IEnumerable<UserLocalEnity> GetAllUsers => _users;
public bool RemoveUserById(int userId)
{
var user = _users.FirstOrDefault(u => u.ID == userId);
if (user == null) throw new UserNotFoundException(userId);
_users.Remove(user);
return true;
}
public UserDao? UpdateUser(UserDao user)
{
throw new NotImplementedException();
}
}
}

View File

@ -1,27 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ClosedXML" Version="0.104.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.10">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.10" />
</ItemGroup>
<ItemGroup>
<Folder Include="Data\RemoteData\RemoteApi\" />
<Folder Include="Migrations\" />
<Folder Include="Reports\" />
</ItemGroup>
</Project>

View File

@ -1,14 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Demo.domain.Models
{
public class Group
{
public required int Id { get; set; }
public required string Name { get; set; }
}
}

View File

@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Demo.domain.Models
{
public class User
{
public required string FIO { get; set; }
public int ID { get; set; }
public required Group Group { get; set; }
}
}

View File

@ -1,88 +0,0 @@
using Demo.Data.LocalData;
using Demo.Data.RemoteData.RemoteDataBase.DAO;
using Demo.Data.Repository;
using Demo.domain.Models;
namespace Demo.Domain.UseCase
{
public class GroupUseCase
{
private readonly IGroupRepository _SQLGroupRepositoryImpl;
public GroupUseCase(IGroupRepository SQlGroupRepositoryImpl)
{
_SQLGroupRepositoryImpl = SQlGroupRepositoryImpl;
}
// Приватный метод для валидации имени группы
private void ValidateGroupName(string groupName)
{
if (string.IsNullOrWhiteSpace(groupName))
{
throw new ArgumentException("Имя группы не может быть пустым.");
}
}
private void ValidateGroupId(int GroupId)
{
if(GroupId < 1)
{
throw new ArgumentException("Введите корректный ID группы.");
}
}
// Приватный метод для валидации существования группы по ID
private GroupDao ValidateGroupExistence(int groupId)
{
var existingGroup = _SQLGroupRepositoryImpl.GetAllGroups()
.FirstOrDefault(g => g.Id == groupId);
if (existingGroup == null)
{
throw new ArgumentException("Группа не найдена.");
}
return existingGroup;
}
// Метод для получения списка всех групп
public List<GroupDao> GetAllGroups()
{
return [.. _SQLGroupRepositoryImpl.GetAllGroups()
.Select(it => new GroupDao { Id = it.Id, Name = it.Name })];
}
// Метод для получения группы по ID
public string FindGroupById(int IdGroup)
{
string groups = _SQLGroupRepositoryImpl.GetGroupById(IdGroup).Name;
return groups;
}
// Метод для добавления новой группы
public void AddGroup(string groupName)
{
ValidateGroupName(groupName);
GroupDao newGroup = new GroupDao
{
Name = groupName
};
_SQLGroupRepositoryImpl.AddGroup(newGroup.Name);
}
// Метод для изменения названия группы
public void UpdateGroup(int groupId, string newGroupName)
{
ValidateGroupName(newGroupName);
var existingGroup = ValidateGroupExistence(groupId);
existingGroup.Name = newGroupName;
_SQLGroupRepositoryImpl.UpdateGroupById(groupId,existingGroup);
}
}
}

View File

@ -1,192 +0,0 @@
using ClosedXML.Excel;
using Demo.Data.RemoteData.RemoteDataBase.DAO;
using Demo.Data.Repository;
using Demo.domain.Models;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Demo.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 Dictionary<string, List<AttendanceRecord>> GetAllAttendanceByGroups()
{
var attendanceByGroup = new Dictionary<string, List<AttendanceRecord>>();
var allGroups = _groupRepository.GetAllGroups();
foreach (var group in allGroups)
{
var groupAttendance = _presenceRepository.GetAttendanceByGroup(group.Id);
var attendanceRecords = new List<AttendanceRecord>();
foreach (var record in groupAttendance)
{
var names = _userRepository.GetUserNames().Where(u => u.UserId == record.UserId);
foreach (var name in names)
{
attendanceRecords.Add(new AttendanceRecord
{
UserName = name.FIO,
UserId = name.UserId,
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.UserId))
{
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;
worksheet.Cell(row, 5).Value = record.IsAttedance ? "Присутствует" : "Отсутствует";
row++;
lesNum = record.LessonNumber;
}
worksheet.Columns().AdjustToContents();
}
workbook.SaveAs(filePath);
}
}
public List<PresenceDao> GetPresenceByDateAndGroup(DateTime date, int groupId)
{
return _presenceRepository.GetPresenceByDateAndGroup(date, groupId);
}
public void GeneratePresenceDaily(int firstLesson, int lastLesson, int groupId)
{
var users = _userRepository.GetAllUsers().Where(u => u.GroupId == groupId).ToList();
// Находим последнюю дату посещаемости для данной группы
DateOnly startDate = _presenceRepository.GetLastDateByGroupId(groupId)?.AddDays(1)
?? DateOnly.FromDateTime(DateTime.Today);
List<PresenceDao> presences = new List<PresenceDao>();
for (int lessonNumber = firstLesson; lessonNumber <= lastLesson; lessonNumber++)
{
foreach (var user in users)
{
var presence = new PresenceDao
{
UserId = user.UserId,
GroupId = user.GroupId,
Date = startDate,
LessonNumber = lessonNumber,
IsAttedance = true
};
_presenceRepository.SavePresence(new List<PresenceDao> { presence });
}
}
}
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);
}
}
// Отметить пользователя как отсутствующего на диапазоне занятий
public bool MarkUserAbsentForLessons(int userId, int groupId, int firstLesson, int lastLesson, DateTime date)
{
List<PresenceDao> presences = _presenceRepository.GetPresenceForAbsent(date, groupId);
if (presences.Where(p => p.UserId == userId).Count() > 0)
{
// Обновляем состояние присутствия для указанных занятий
foreach (var presence in presences.Where(p => p.UserId == userId && p.LessonNumber >= firstLesson && p.LessonNumber <= lastLesson))
{
presence.IsAttedance = false; // Устанавливаем отсутствие
}
// Сохраняем изменения в репозитории
_presenceRepository.UpdateAtt(userId, groupId, firstLesson, lastLesson, DateOnly.FromDateTime(date), false);
return true;
}
else
{
return false;
}
}
public List<PresenceDao> GetAllPresenceByGroup(int groupId)
{
return _presenceRepository.GetPresenceByGroup(groupId);
}
public GroupAttendanceStatistics GetGeneralPresence(int groupId)
{
return _presenceRepository.GetGeneralPresenceForGroup(groupId);
}
}
}

View File

@ -1,146 +0,0 @@
using Demo.Data.Exceptions;
using Demo.Data.RemoteData.RemoteDataBase;
using Demo.Data.RemoteData.RemoteDataBase.DAO;
using Demo.Data.Repository;
using Demo.domain.Models;
namespace Demo.Domain.UseCase
{
public class UserUseCase
{
private readonly IUserRepository _repositoryUserImpl;
private readonly IGroupRepository _repositoryGroupImpl;
private readonly IPresenceRepository _repositoryPresenceImpl;
public UserUseCase(IUserRepository repositoryImpl, IGroupRepository repositoryGroupImpl, IPresenceRepository presenceRepository)
{
_repositoryUserImpl = repositoryImpl;
_repositoryGroupImpl = repositoryGroupImpl;
_repositoryPresenceImpl = presenceRepository;
}
// Приватный метод для валидации ФИО пользователя
private void ValidateUserFIO(string fio)
{
if (string.IsNullOrWhiteSpace(fio))
{
throw new ArgumentException("ФИО не может быть пустым.");
}
}
public void RemovePresenceByUserId(int userId)
{
using (var context = new RemoteDatabaseContext())
{
var presences = context.PresenceDaos.Where(p => p.UserId == userId).ToList();
context.PresenceDaos.RemoveRange(presences);
context.SaveChanges();
}
}
// Приватный метод для валидации существования пользователя по ID
private UserDao ValidateUserExistence(int userId)
{
var user = _repositoryUserImpl.GetAllUsers()
.FirstOrDefault(u => u.UserId == userId);
if (user == null)
{
throw new Exception("Пользователь не найден.");
}
return user;
}
// Приватный метод для валидации существования группы по ID
private GroupDao ValidateGroupExistence(int groupId)
{
var group = _repositoryGroupImpl.GetAllGroups()
.FirstOrDefault(g => g.Id == groupId);
if (group == null)
{
throw new Exception("Группа не найдена.");
}
return group;
}
// Вывести всех пользователей
//упростить под ef
public List<UserDao> GetAllUsers() => _repositoryUserImpl.GetAllUsers()
.Join(_repositoryGroupImpl.GetAllGroups(),
user => user.GroupId, // Ключ для пользователей
group => group.Id, // Ключ для групп
(user, group) => // Результирующий объект
new UserDao
{
UserId = user.UserId,
FIO = user.FIO,
Group = new GroupDao { Id = group.Id, Name = group.Name }
}).ToList();
// Удалить пользователя по id
public bool RemoveUserById(int userId)
{
try
{
return _repositoryUserImpl.RemoveUserById(userId);
}
catch (UserNotFoundException ex)
{
Console.WriteLine($"Ошибка: {ex.Message}");
return false;
}
catch (RepositoryException ex)
{
Console.WriteLine($"Ошибка в репозитории: {ex.Message}");
return false;
}
}
// Обновить пользователя по id
public UserDao UpdateUser(int userId, string newFio, int groupId)
{
ValidateUserFIO(newFio);
ValidateGroupExistence(groupId);
UserDao userDao = new UserDao
{
UserId = userId,
FIO = newFio,
GroupId = groupId
};
UserDao? result = _repositoryUserImpl.UpdateUser(userId, newFio, groupId);
if (result == null)
{
throw new Exception("Ошибка при обновлении пользователя.");
}
var groupEntity = ValidateGroupExistence(result.GroupId);
return new UserDao
{
UserId= userId,
FIO = newFio,
GroupId = groupId
};
}
// Найти пользователя по id
public UserDao FindUserById(int userId)
{
var user = ValidateUserExistence(userId);
var group = ValidateGroupExistence(user.GroupId);
return new UserDao
{
UserId = user.UserId,
FIO = user.FIO,
Group = new GroupDao { Id = group.Id, Name=group.Name }
};
}
}
}

View File

@ -1,28 +0,0 @@
using Demo.Data.RemoteData.RemoteDataBase;
using Demo.Data.Repository;
using Demo.Domain.UseCase;
using Demo.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<MainMenuUI>();
var serviceProvider = services.BuildServiceProvider();
// Создаем пользовательский интерфейс
MainMenuUI mainMenuUI = serviceProvider.GetService<MainMenuUI>();
// Выводим главное меню
mainMenuUI.DisplayMenu();

Binary file not shown.

View File

@ -1,58 +0,0 @@
using Demo.Domain.UseCase;
using System;
using System.Text;
namespace Demo.UI
{
public class GroupConsoleUI
{
private readonly GroupUseCase _groupUseCase;
public GroupConsoleUI(GroupUseCase groupUseCase)
{
_groupUseCase = groupUseCase;
}
public void FindGroupById(int IdGroup)
{
var groups = _groupUseCase.FindGroupById(IdGroup);
Console.WriteLine(groups);
}
// Метод для отображения всех групп
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
{
_groupUseCase.AddGroup(groupName);
Console.WriteLine($"\nГруппа {groupName} добавлена.\n");
}
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");
}
}
}

View File

@ -1,224 +0,0 @@
using Demo.domain.Models;
using Demo.Domain.UseCase;
using System;
using System.Globalization;
namespace Demo.UI
{
public class MainMenuUI
{
private readonly UserConsoleUI _userConsoleUI;
private readonly GroupConsoleUI _groupConsoleUI;
private readonly PresenceConsole _presenceConsoleUI;
public MainMenuUI(UserUseCase userUseCase, GroupUseCase groupUseCase, UseCaseGeneratePresence presenceUseCase)
{
_userConsoleUI = new UserConsoleUI(userUseCase);
_groupConsoleUI = new GroupConsoleUI(groupUseCase);
_presenceConsoleUI = new PresenceConsole(presenceUseCase);
}
public void DisplayMenu()
{
while (true)
{
Console.WriteLine("\n=-= Главное меню =-=\n");
Console.WriteLine("=-= Команды с Пользователями =-=");
Console.WriteLine("1. Вывести всех пользователей");
Console.WriteLine("2. Удалить пользователя по id");
Console.WriteLine("3. Обновить пользователя по id");
Console.WriteLine("4. Найти пользователя по id");
Console.WriteLine();
Console.WriteLine("=-= Команды с Группами =-=");
Console.WriteLine("5. Вывести все группы");
Console.WriteLine("6. Добавить группу");
Console.WriteLine("7. Изменить название группы");
Console.WriteLine("8. Поиск группы по ID");
Console.WriteLine();
Console.WriteLine("=-= Команды Presence =-=");
Console.WriteLine("9. Сгенерировать посещаемость на день");
Console.WriteLine("10. Сгенерировать посещаемость на неделю");
Console.WriteLine("11. Показать посещаемость");
Console.WriteLine("12. Отметить пользователя как отсутствующего");
Console.WriteLine("13. Вывести всю посещаемость группы");
Console.WriteLine("14. Вывести общую информацию об посещаемости по группе");
Console.WriteLine("15. Вывести отчётв Excel");
Console.WriteLine();
Console.WriteLine("0. Выход");
Console.Write("\nВаш выбор: ");
string comand = Console.ReadLine();
Console.WriteLine();
switch (comand)
{
case "1":
// Отображение всех пользователей
_userConsoleUI.DisplayAllUsers();
break;
case "2":
// Удаление пользователя по ID
Console.Write("Введите ID пользователя для удаления: ");
string inputId = Console.ReadLine();
if (int.TryParse(inputId, out int userId))
{
_userConsoleUI.RemoveUserById(userId);
}
else
{
Console.WriteLine("Неверный формат ID");
}
break;
case "3":
// Обновление пользователя по ID
Console.Write("Введите ID пользователя для обновления: ");
string updateIdInput = Console.ReadLine();
if (int.TryParse(updateIdInput, out int updateUserId))
{
_userConsoleUI.UpdateUserById(updateUserId);
}
else
{
Console.WriteLine("Неверный формат ID");
}
break;
case "4":
// Поиск пользователя по ID
Console.Write("Введите ID пользователя для поиска: ");
string findIdInput = Console.ReadLine();
if (int.TryParse(findIdInput, out int findUserId))
{
_userConsoleUI.FindUserById(findUserId);
}
else
{
Console.WriteLine("Неверный формат ID");
}
break;
case "5":
// Отображение всех групп
_groupConsoleUI.DisplayAllGroups();
break;
case "6":
// Добавление новой группы
Console.Write("Введите название новой группы: ");
string newGroupName = Console.ReadLine();
_groupConsoleUI.AddGroup(newGroupName);
break;
case "7":
// Изменение названия группы
Console.Write("Введите ID группы для изменения: ");
if (int.TryParse(Console.ReadLine(), out int groupId))
{
Console.Write("Введите новое название группы: ");
string newName = Console.ReadLine();
_groupConsoleUI.UpdateGroupName(groupId, newName);
}
else
{
Console.WriteLine("Неверный формат ID группы");
}
break;
case "8":
// Поиск группы
Console.Write("Введите ID группы для поиска : ");
if (int.TryParse(Console.ReadLine(), out int IdGroup))
{
_groupConsoleUI.FindGroupById(IdGroup);
}
break;
case "9":
// Генерация посещаемости на день
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 "10":
// Генерация посещаемости на неделю
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 "11":
// Отображение посещаемости
Console.Write("Введите дату (гггг-мм-дд): ");
DateTime date = DateTime.Parse(Console.ReadLine());
Console.Write("Введите ID группы: ");
int groupForPresenceView = int.Parse(Console.ReadLine());
_presenceConsoleUI.DisplayPresence(date, groupForPresenceView);
break;
case "12":
// Отметить пользователя как отсутствующего
Console.Write("Введите ID пользователя: ");
userId = int.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());
Console.Write("Введите дату (дд.мм.гггг): ");
string dateInput = Console.ReadLine();
DateTime absenceDate;
if (!DateTime.TryParseExact(dateInput, "d.M.yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out absenceDate))
{
Console.WriteLine("Ошибка: Введен некорректный формат даты. Пожалуйста, используйте формат дд.мм.гггг.");
return; // Завершает выполнение, если дата некорректна
}
_presenceConsoleUI.MarkUserAbsent(absenceDate, absGroupId, userId, firstAbsLesson, lastAbsLesson);
break;
case "13":
Console.Write("Введите ID группы: ");
int groupIdForAllPresence = int.Parse(Console.ReadLine());
_presenceConsoleUI.DisplayAllPresenceByGroup(groupIdForAllPresence);
break;
case "14":
Console.Write("Введите ID группы: ");
int searchGroupId= int.Parse(Console.ReadLine());
_presenceConsoleUI.DisplayGeneralPresence(searchGroupId);
break;
case "15":
_presenceConsoleUI.ExportAttendanceToExcel();
break;
case "0":
Console.WriteLine("Выход...");
return;
default:
Console.WriteLine("Неверный выбор, попробуйте снова.");
break;
}
Console.WriteLine();
}
}
}
}

View File

@ -1,188 +0,0 @@
using Demo.Data.Exceptions;
using Demo.Data.RemoteData.RemoteDataBase.DAO;
using Demo.domain.Models;
using Demo.Domain.UseCase;
using System;
using System.Collections.Generic;
namespace Demo.UI
{
public class PresenceConsole
{
private readonly UseCaseGeneratePresence _presenceUseCase;
public PresenceConsole(UseCaseGeneratePresence presenceUseCase)
{
_presenceUseCase = presenceUseCase;
}
public void ExportAttendanceToExcel()
{
try
{
_presenceUseCase.ExportAttendanceToExcel();
Console.WriteLine("Данные посещаемости успешно экспортированы в Excel.");
}
catch (Exception ex)
{
Console.WriteLine($"Ошибка при экспорте посещаемости: {ex.Message}");
}
}
// Метод для генерации посещаемости на день
public void GeneratePresenceForDay(DateTime date, int groupId, int firstLesson, int lastLesson)
{
try
{
_presenceUseCase.GeneratePresenceDaily(firstLesson, lastLesson, groupId);
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<PresenceDao> presences = _presenceUseCase.GetPresenceByDateAndGroup(date, groupId);
if (presences == null || presences.Count == 0)
{
Console.WriteLine("Посещаемость на выбранную дату отсутствует.");
return;
}
// Сортируем присутствия по номеру занятия и ID пользователя
var sortedPresences = presences.OrderBy(p => p.LessonNumber)
.ThenBy(p => p.UserId);
Console.WriteLine($"\nПосещаемость на {date.ToShortDateString()} для группы с ID {groupId}:");
Console.WriteLine("---------------------------------------------");
int previousLessonNumber = -1; // Инициализация для сравнения
foreach (var presence in sortedPresences)
{
if (previousLessonNumber != presence.LessonNumber)
{
Console.WriteLine("---------------------------------------------");
previousLessonNumber = presence.LessonNumber;
}
string status = presence.IsAttedance ? "Присутствует" : "Отсутствует";
Console.WriteLine($"Пользователь ID: {presence.UserId}, Занятие {presence.LessonNumber}: {status}");
}
Console.WriteLine("---------------------------------------------");
}
catch (Exception ex)
{
Console.WriteLine($"Ошибка при выводе посещаемости: {ex.Message}");
}
}
public void MarkUserAbsent(DateTime date, int groupId, int userId, int firstLesson, int lastLesson)
{
bool check=_presenceUseCase.MarkUserAbsentForLessons(userId, groupId, firstLesson, lastLesson, date);
if (check)
{
Console.WriteLine("Пользователь отмечен как осутсвующий");
}
else
{
Console.WriteLine($"Посещаемость для пользователя ID: {userId} на дату {date.ToShortDateString()}" +
$" с {firstLesson} по {lastLesson} уроки не найдена.");
}
}
public void DisplayGeneralPresence(int groupId)
{
var statistics = _presenceUseCase.GetGeneralPresence(groupId);
Console.WriteLine($"Человек в группе: {statistics.UserCount}, " +
$"Количество проведённых занятий: {statistics.TotalLessons}, " +
$"Общий процент посещаемости группы: {statistics.AttendancePercentage}%");
foreach (var user in statistics.UserAttendanceDetails)
{
Console.ForegroundColor = user.AttendanceRate < 40 ? ConsoleColor.Red : ConsoleColor.White;
Console.WriteLine($"ID Пользователя: {user.UserId}, Посетил: {user.Attended}, " +
$"Пропустил: {user.Missed}, Процент посещаемости: {user.AttendanceRate}%");
}
Console.ForegroundColor = ConsoleColor.White;
}
public void DisplayAllPresenceByGroup(int groupId)
{
try
{
// Получаем все посещения для группы
var presences = _presenceUseCase.GetAllPresenceByGroup(groupId);
if (presences == null || presences.Count == 0)
{
Console.WriteLine($"Посещаемость для группы с ID {groupId} отсутствует.");
return;
}
// Группируем по дате
var groupedPresences = presences.GroupBy(p => p.Date);
foreach (var group in groupedPresences)
{
Console.WriteLine("===================================================");
Console.WriteLine($"Дата: {group.Key.ToString("dd.MM.yyyy")}");
Console.WriteLine("===================================================");
// Группируем по занятию
var groupedByLesson = group.GroupBy(p => p.LessonNumber);
foreach (var lessonGroup in groupedByLesson)
{
Console.WriteLine($"Занятие {lessonGroup.Key}:");
// Создаем HashSet для уникальных пользователей
var userIds = new HashSet<int>();
foreach (var presence in lessonGroup)
{
// Проверяем, добавляется ли пользователь в HashSet
if (userIds.Add(presence.UserId))
{
string status = presence.IsAttedance ? "Присутствует" : "Отсутствует";
Console.WriteLine($"Пользователь ID: {presence.UserId}, Статус: {status}");
}
}
Console.WriteLine("---------------------------------------------------");
}
}
}
catch (Exception ex)
{
Console.WriteLine($"Ошибка при выводе посещаемости: {ex.Message}");
}
}
}
}

View File

@ -1,81 +0,0 @@
using Demo.Data.RemoteData.RemoteDataBase;
using Demo.Data.Repository;
using Demo.Domain.UseCase;
using System;
using System.Text;
namespace Demo.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.UserId}\t{user.FIO}\t{user.Group.Name}");
}
Console.WriteLine(userOutput);
Console.WriteLine("===============================\n");
}
// Метод для удаления пользователя по ID
public void RemoveUserById(int userId)
{
// Сначала удаляем все записи о присутствии пользователя
_userUseCase.RemovePresenceByUserId(userId);
// Теперь удаляем пользователя
string output = _userUseCase.RemoveUserById(userId) ? "Пользователь удален" : "Пользователь не найден";
Console.WriteLine($"\n{output}\n");
}
// Метод для обновления пользователя по ID
public void UpdateUserById(int userId)
{
try
{
var user = _userUseCase.FindUserById(userId);
Console.WriteLine($"Текущие данные: {user.FIO}");
Console.Write("\nВведите новое ФИО: ");
string newFIO = Console.ReadLine();
Console.Write("\nВведите новый ID группы (или оставьте такой же): ");
int GroupId = int.Parse(Console.ReadLine());
_userUseCase.UpdateUser(userId, newFIO, GroupId);
Console.WriteLine("\nПользователь обновлен.\n");
}
catch (Exception ex)
{
Console.WriteLine($"Ошибка: {ex.Message}\n");
}
}
// Метод для поиска пользователя по ID
public void FindUserById(int userId)
{
var user = _userUseCase.FindUserById(userId);
if (user != null)
{
Console.WriteLine($"\nПользователь найден: {user.UserId}, {user.FIO}, {user.Group.Name}\n");
}
else
{
Console.WriteLine("\nПользователь не найден.\n");
}
}
}
}

View File

@ -0,0 +1,49 @@
namespace Zurnal.Presence
{
internal class UseCaseGeneratePresence
{
internal class AttendanceRecord
{
public int LessonNumber { get; set; }
public required string GroupNumber { get; set; }
public DateTime Date { get; set; }
public bool IsPresent { get; set; }
}
public List<AttendanceRecord> GenerateDailyAttendance(int firstLesson, int lastLesson, string groupNumber, DateTime currentDate)
{
List<AttendanceRecord> attendanceRecords = new List<AttendanceRecord>();
var users = Zurnal.RemaDateBase.DateDao.GroupDao.Name
.FirstOrDefault(g => g.GroupName == groupNumber)?.Users;
foreach (var user in users)
{
for (int lesson = firstLesson; lesson <= lastLesson; lesson++)
{
attendanceRecords.Add(new AttendanceRecord
{
LessonNumber = lesson,
GroupNumber = groupNumber,
Date = currentDate,
IsPresent = true
});
}
}
return attendanceRecords;
}
public List<AttendanceRecord> GenerateWeeklyAttendance(int firstLesson, int lastLesson, string groupNumber, DateTime startDate)
{
List<AttendanceRecord> weeklyAttendanceRecords = new List<AttendanceRecord>();
for (int day = 0; day < 7; day++)
{
DateTime currentDate = startDate.AddDays(day);
weeklyAttendanceRecords.AddRange(GenerateDailyAttendance(firstLesson, lastLesson, groupNumber, currentDate));
}
return weeklyAttendanceRecords;
}
}
}

View File

@ -0,0 +1,12 @@

namespace Zurnal.RemaDateBase.DateDao
{
public class GroupDao
{
internal static List<GroupDao> Name = new List<GroupDao>();
public int Id { get; set; }
public required string GroupName { get; set; }
public IEnumerable<UserDao> Users { get; set; }
}
}

View File

@ -0,0 +1,12 @@
namespace Zurnal.RemaDateBase.DateDao
{
public class PresnceDao
{
public Guid UserGuid { get; set; }
public bool IsAttendensy { get; set; } = true;
public int LessonNumber { get; set; }
public DateOnly Date { get; set; }
public UserDao userDao { get; set; }
}
}

View File

@ -0,0 +1,9 @@
namespace Zurnal.RemaDateBase.DateDao
{
public class UserDao
{
public required string FIO { get; set; }
public Guid UserGuid { get; set; }
public GroupDao Id { get; set; }
}
}

View File

@ -0,0 +1,84 @@
using Zurnal.domain.Models;
using Zurnal.RemaDateBase.DateDao;
using Group = System.Text.RegularExpressions.Group;
namespace Zurnal.RemaDateBase
{
public interface IGroupRepository
{
List<GroupDao> AllGroup { get; }
public IEnumerable<GroupDao> AllGroups()
{
return AllGroup.Select(g => new GroupDao { GroupName = g.GroupName, Id = g.Id });
}
public bool RemoveGroupById(int groupId)
{
var group = AllGroup.FirstOrDefault(g => g.Id == groupId);
if (group != null)
{
AllGroup.Remove(group);
return true;
}
return false;
}
public GroupDao FindGroupById(int groupId)
{
return AllGroup.FirstOrDefault(g => g.Id == groupId);
}
public bool UpdateGroupById(int groupId, GroupDao updatedGroup)
{
if (updatedGroup == null) throw new ArgumentNullException(nameof(updatedGroup));
var group = AllGroup.FirstOrDefault(g => g.Id == groupId);
if (group != null)
{
group.GroupName = updatedGroup.GroupName;
return true;
}
return false;
}
public void DeleteGroup(int id)
{
var group = AllGroup.FirstOrDefault(g => g.Id == id);
if (group != null)
{
AllGroup.Remove(group);
}
}
public IEnumerable<GroupDao> GetAllGroups()
{
return AllGroup;
}
public void UpdateGroupName(int groupId, string name)
{
if (name == null) throw new ArgumentNullException(nameof(name));
var group = AllGroup.FirstOrDefault(g => g.Id == groupId);
if (group != null)
{
group.GroupName = name;
}
}
public bool UpdateUser(Guid userGuid, UserDao updatedUser)
{
if (updatedUser == null) throw new ArgumentNullException(nameof(updatedUser));
var user = AllGroup.SelectMany(g => g.Users).FirstOrDefault(u => u.UserGuid == userGuid);
if (user != null)
{
user.FIO = updatedUser.FIO;
user.GroupID = updatedUser.GroupID;
user.Group = updatedUser.Group;
return true;
}
return false;
}
}
}

View File

@ -0,0 +1,10 @@
using Zurnal.RemaDateBase.DateDao;
public interface IPresenceRepository
{
void AddPresence(PresnceDao presence);
PresnceDao GetPresenceById(int id);
IEnumerable<PresnceDao> GetAllPresences();
void UpdatePresence(PresnceDao presence);
void DeletePresence(int id);
}

View File

@ -0,0 +1,10 @@
using Zurnal.domain.Models;
public interface IUserRepository
{
void AddUser(User user);
User GetUserById(int id);
IEnumerable<User> GetAllUsers();
void UpdateUser(User user);
void DeleteUser(int id);
}

View File

@ -0,0 +1,80 @@
using Zurnal.RemaDateBase.DateDao;
public class PresenceRepository : IPresenceRepository
{
private List<PresnceDao> presences = new List<PresnceDao>();
public void AddPresence(PresnceDao presence)
{
presences.Add(new PresnceDao
{
UserGuid = presence.UserGuid,
IsAttendensy = presence.IsAttendensy,
LessonNumber = presence.LessonNumber,
Date = presence.Date,
userDao = new UserDao
{
FIO = presence.userDao.FIO,
UserGuid = presence.userDao.UserGuid,
GroupID = presence.userDao.GroupID,
Group = new GroupDao { Id = presence.userDao.Group.Id, GroupName = presence.userDao.Group.GroupName }
}
});
}
public PresnceDao GetPresenceById(int id)
{
var presence = presences.FirstOrDefault(p => p.LessonNumber == id);
return presence != null ? new PresnceDao
{
UserGuid = presence.UserGuid,
IsAttendensy = presence.IsAttendensy,
LessonNumber = presence.LessonNumber,
Date = presence.Date,
userDao = new UserDao
{
FIO = presence.userDao.FIO,
GroupID = presence.userDao.GroupID,
Group = presence.userDao.Group
}
} : null;
}
public IEnumerable<PresnceDao> GetAllPresences()
{
return presences.Select(p => new PresnceDao
{
UserGuid = p.UserGuid,
IsAttendensy = p.IsAttendensy,
LessonNumber = p.LessonNumber,
Date = p.Date,
userDao = new UserDao
{
FIO = p.userDao.FIO,
GroupID = p.userDao.GroupID,
Group = p.userDao.Group
}
}).ToList();
}
public void UpdatePresence(PresnceDao presence)
{
var existingPresence = presences.FirstOrDefault(p => p.LessonNumber == presence.LessonNumber);
if (existingPresence != null)
{
existingPresence.IsAttendensy = presence.IsAttendensy;
existingPresence.Date = presence.Date;
existingPresence.userDao.FIO = presence.userDao.FIO;
existingPresence.userDao.GroupID = presence.userDao.GroupID;
existingPresence.userDao.Group.GroupName = presence.userDao.Group.GroupName;
}
}
public void DeletePresence(int id)
{
var presence = presences.FirstOrDefault(p => p.LessonNumber == id);
if (presence != null)
{
presences.Remove(presence);
}
}
}

View File

@ -0,0 +1,32 @@
using Microsoft.EntityFrameworkCore;
using Zurnal.RemaDateBase.DateDao;
public class RemoteDateBaseContext : DbContext
{
public DbSet<GroupDao> Group { get; set; }
public DbSet<UserDao> User { get; set; }
public DbSet<PresnceDao> Presence { get; set; }
public object Groups { get; internal set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseNpgsql("Host=45.67.56.214;Port=5421;Username=user16;Password=dZ28IVE5;Database=user16");
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<GroupDao>().HasKey(group => group.Id);
modelBuilder.Entity<GroupDao>().Property(group => group.Id).ValueGeneratedOnAdd();
modelBuilder.Entity<UserDao>().HasKey(user => user.UserGuid);
modelBuilder.Entity<UserDao>().Property(user => user.UserGuid).ValueGeneratedOnAdd();
modelBuilder.Entity<PresnceDao>().HasKey(presence => new
{
presence.UserGuid,
presence.Date,
presence.IsAttendensy,
presence.LessonNumber
});
}
}

View File

@ -1,11 +0,0 @@
using presence;
using presence.Repository;
RemoteDatabaseContext remoteDatabaseContext = new RemoteDatabaseContext();
SQLGroupRepository groupRepository = new SQLGroupRepository(remoteDatabaseContext);
foreach (var item in groupRepository.GetAllGroup())
{
Console.WriteLine($"{item.IdGroup} {item.NameGroup}");
}

View File

@ -4,14 +4,12 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Demo.domain.Models namespace Data.Models
{ {
public class GroupLocalEntity public class GroupLocalEntity
{ {
public int Id { get; set; } public int Id { get; set; }
public required string Name { get; set; } public required string Name { get; set; }
} }
} }

View File

@ -4,15 +4,14 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Demo.domain.Models namespace Data.Models
{ {
public class Presence internal class PresenceLocalEntity
{ {
public required Guid UserGuid { get; set; }
public required User User { get; set; }
public required int GroupId { get; set; }
public bool IsAttedance { get; set; } = true; public bool IsAttedance { get; set; } = true;
public required DateTime Date { get; set; } public required DateOnly Date { get; set; }
public required int LessonNumber { get; set; } public required int LessonNumber { get; set; }
} }
} }

View File

@ -4,13 +4,12 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Demo.domain.Models namespace Data.Models
{ {
public class UserLocalEnity : IEquatable<UserLocalEnity> public class UserLocalEnity : IEquatable<UserLocalEnity>
{ {
public required string FIO { get; set; } public required string FIO { get; set; }
public int ID { get; set; } public Guid Guid { get; set; }
public required int GroupID { get; set; } public required int GroupID { get; set; }
@ -19,7 +18,7 @@ namespace Demo.domain.Models
public bool Equals(UserLocalEnity? other) public bool Equals(UserLocalEnity? other)
{ {
if (other == null) return false; if (other == null) return false;
return this.ID.Equals(other.ID); return this.Guid.Equals(other.Guid);
} }
} }
} }

View File

@ -0,0 +1,31 @@
using Data.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 },
};
}
}

View File

@ -1,19 +1,19 @@
// <auto-generated /> // <auto-generated />
using System; using System;
using Demo.Data.RemoteData.RemoteDataBase;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using data.RemoteData;
#nullable disable #nullable disable
namespace Demo.Migrations namespace data.Migrations
{ {
[DbContext(typeof(RemoteDatabaseContext))] [DbContext(typeof(RemoteDataBaseContext))]
[Migration("20241103105727_CreateDatabase")] [Migration("20241105212549_InitialCreate")]
partial class CreateDatabase partial class InitialCreate
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
@ -25,7 +25,7 @@ namespace Demo.Migrations
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Demo.Data.RemoteData.RemoteDataBase.DAO.GroupDao", b => modelBuilder.Entity("Data.RemoteData.DAO.GroupDao", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@ -39,44 +39,38 @@ namespace Demo.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.ToTable("Groups"); b.ToTable("Group");
}); });
modelBuilder.Entity("Demo.Data.RemoteData.RemoteDataBase.DAO.PresenceDao", b => modelBuilder.Entity("Data.RemoteData.DAO.PresenceDao", b =>
{ {
b.Property<int>("PresenceId") b.Property<Guid>("UserGuid")
.ValueGeneratedOnAdd() .HasColumnType("uuid");
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("PresenceId"));
b.Property<DateOnly>("Date")
.HasColumnType("date");
b.Property<int>("GroupId")
.HasColumnType("integer");
b.Property<bool>("IsAttedance") b.Property<bool>("IsAttedance")
.HasColumnType("boolean"); .HasColumnType("boolean");
b.Property<DateOnly>("Date")
.HasColumnType("date");
b.Property<int>("LessonNumber") b.Property<int>("LessonNumber")
.HasColumnType("integer"); .HasColumnType("integer");
b.Property<int>("UserId") b.Property<Guid>("UserDaoGuid")
.HasColumnType("integer"); .HasColumnType("uuid");
b.HasKey("PresenceId"); b.HasKey("UserGuid", "IsAttedance", "Date", "LessonNumber");
b.ToTable("PresenceDaos"); b.HasIndex("UserDaoGuid");
b.ToTable("Presence");
}); });
modelBuilder.Entity("Demo.Data.RemoteData.RemoteDataBase.DAO.UserDao", b => modelBuilder.Entity("Data.RemoteData.DAO.UserDao", b =>
{ {
b.Property<int>("UserId") b.Property<Guid>("Guid")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("integer"); .HasColumnType("uuid");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("UserId"));
b.Property<string>("FIO") b.Property<string>("FIO")
.IsRequired() .IsRequired()
@ -85,16 +79,27 @@ namespace Demo.Migrations
b.Property<int>("GroupId") b.Property<int>("GroupId")
.HasColumnType("integer"); .HasColumnType("integer");
b.HasKey("UserId"); b.HasKey("Guid");
b.HasIndex("GroupId"); b.HasIndex("GroupId");
b.ToTable("Users"); b.ToTable("User");
}); });
modelBuilder.Entity("Demo.Data.RemoteData.RemoteDataBase.DAO.UserDao", b => modelBuilder.Entity("Data.RemoteData.DAO.PresenceDao", b =>
{ {
b.HasOne("Demo.Data.RemoteData.RemoteDataBase.DAO.GroupDao", "Group") b.HasOne("Data.RemoteData.DAO.UserDao", "UserDao")
.WithMany()
.HasForeignKey("UserDaoGuid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("UserDao");
});
modelBuilder.Entity("Data.RemoteData.DAO.UserDao", b =>
{
b.HasOne("Data.RemoteData.DAO.GroupDao", "Group")
.WithMany("Users") .WithMany("Users")
.HasForeignKey("GroupId") .HasForeignKey("GroupId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
@ -103,7 +108,7 @@ namespace Demo.Migrations
b.Navigation("Group"); b.Navigation("Group");
}); });
modelBuilder.Entity("Demo.Data.RemoteData.RemoteDataBase.DAO.GroupDao", b => modelBuilder.Entity("Data.RemoteData.DAO.GroupDao", b =>
{ {
b.Navigation("Users"); b.Navigation("Users");
}); });

View File

@ -4,16 +4,16 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable #nullable disable
namespace Demo.Migrations namespace data.Migrations
{ {
/// <inheritdoc /> /// <inheritdoc />
public partial class CreateDatabase : Migration public partial class InitialCreate : Migration
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder) protected override void Up(MigrationBuilder migrationBuilder)
{ {
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "Groups", name: "Group",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "integer", nullable: false) Id = table.Column<int>(type: "integer", nullable: false)
@ -22,49 +22,57 @@ namespace Demo.Migrations
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_Groups", x => x.Id); table.PrimaryKey("PK_Group", x => x.Id);
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "PresenceDaos", name: "User",
columns: table => new columns: table => new
{ {
PresenceId = table.Column<int>(type: "integer", nullable: false) Guid = table.Column<Guid>(type: "uuid", nullable: false),
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
UserId = table.Column<int>(type: "integer", nullable: false),
IsAttedance = table.Column<bool>(type: "boolean", nullable: false),
Date = table.Column<DateOnly>(type: "date", nullable: false),
LessonNumber = table.Column<int>(type: "integer", nullable: false),
GroupId = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_PresenceDaos", x => x.PresenceId);
});
migrationBuilder.CreateTable(
name: "Users",
columns: table => new
{
UserId = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
FIO = table.Column<string>(type: "text", nullable: false), FIO = table.Column<string>(type: "text", nullable: false),
GroupId = table.Column<int>(type: "integer", nullable: false) GroupId = table.Column<int>(type: "integer", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_Users", x => x.UserId); table.PrimaryKey("PK_User", x => x.Guid);
table.ForeignKey( table.ForeignKey(
name: "FK_Users_Groups_GroupId", name: "FK_User_Group_GroupId",
column: x => x.GroupId, column: x => x.GroupId,
principalTable: "Groups", principalTable: "Group",
principalColumn: "Id", principalColumn: "Id",
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
}); });
migrationBuilder.CreateTable(
name: "Presence",
columns: table => new
{
UserGuid = table.Column<Guid>(type: "uuid", nullable: false),
IsAttedance = table.Column<bool>(type: "boolean", nullable: false),
Date = table.Column<DateOnly>(type: "date", nullable: false),
LessonNumber = table.Column<int>(type: "integer", nullable: false),
UserDaoGuid = table.Column<Guid>(type: "uuid", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Presence", x => new { x.UserGuid, x.IsAttedance, x.Date, x.LessonNumber });
table.ForeignKey(
name: "FK_Presence_User_UserDaoGuid",
column: x => x.UserDaoGuid,
principalTable: "User",
principalColumn: "Guid",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Users_GroupId", name: "IX_Presence_UserDaoGuid",
table: "Users", table: "Presence",
column: "UserDaoGuid");
migrationBuilder.CreateIndex(
name: "IX_User_GroupId",
table: "User",
column: "GroupId"); column: "GroupId");
} }
@ -72,13 +80,13 @@ namespace Demo.Migrations
protected override void Down(MigrationBuilder migrationBuilder) protected override void Down(MigrationBuilder migrationBuilder)
{ {
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "PresenceDaos"); name: "Presence");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "Users"); name: "User");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "Groups"); name: "Group");
} }
} }
} }

View File

@ -1,17 +1,17 @@
// <auto-generated /> // <auto-generated />
using System; using System;
using Demo.Data.RemoteData.RemoteDataBase;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using data.RemoteData;
#nullable disable #nullable disable
namespace Demo.Migrations namespace data.Migrations
{ {
[DbContext(typeof(RemoteDatabaseContext))] [DbContext(typeof(RemoteDataBaseContext))]
partial class RemoteDatabaseContextModelSnapshot : ModelSnapshot partial class RemoteDataBaseContextModelSnapshot : ModelSnapshot
{ {
protected override void BuildModel(ModelBuilder modelBuilder) protected override void BuildModel(ModelBuilder modelBuilder)
{ {
@ -22,7 +22,7 @@ namespace Demo.Migrations
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Demo.Data.RemoteData.RemoteDataBase.DAO.GroupDao", b => modelBuilder.Entity("Data.RemoteData.DAO.GroupDao", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@ -36,44 +36,38 @@ namespace Demo.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.ToTable("Groups"); b.ToTable("Group");
}); });
modelBuilder.Entity("Demo.Data.RemoteData.RemoteDataBase.DAO.PresenceDao", b => modelBuilder.Entity("Data.RemoteData.DAO.PresenceDao", b =>
{ {
b.Property<int>("PresenceId") b.Property<Guid>("UserGuid")
.ValueGeneratedOnAdd() .HasColumnType("uuid");
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("PresenceId"));
b.Property<DateOnly>("Date")
.HasColumnType("date");
b.Property<int>("GroupId")
.HasColumnType("integer");
b.Property<bool>("IsAttedance") b.Property<bool>("IsAttedance")
.HasColumnType("boolean"); .HasColumnType("boolean");
b.Property<DateOnly>("Date")
.HasColumnType("date");
b.Property<int>("LessonNumber") b.Property<int>("LessonNumber")
.HasColumnType("integer"); .HasColumnType("integer");
b.Property<int>("UserId") b.Property<Guid>("UserDaoGuid")
.HasColumnType("integer"); .HasColumnType("uuid");
b.HasKey("PresenceId"); b.HasKey("UserGuid", "IsAttedance", "Date", "LessonNumber");
b.ToTable("PresenceDaos"); b.HasIndex("UserDaoGuid");
b.ToTable("Presence");
}); });
modelBuilder.Entity("Demo.Data.RemoteData.RemoteDataBase.DAO.UserDao", b => modelBuilder.Entity("Data.RemoteData.DAO.UserDao", b =>
{ {
b.Property<int>("UserId") b.Property<Guid>("Guid")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("integer"); .HasColumnType("uuid");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("UserId"));
b.Property<string>("FIO") b.Property<string>("FIO")
.IsRequired() .IsRequired()
@ -82,16 +76,27 @@ namespace Demo.Migrations
b.Property<int>("GroupId") b.Property<int>("GroupId")
.HasColumnType("integer"); .HasColumnType("integer");
b.HasKey("UserId"); b.HasKey("Guid");
b.HasIndex("GroupId"); b.HasIndex("GroupId");
b.ToTable("Users"); b.ToTable("User");
}); });
modelBuilder.Entity("Demo.Data.RemoteData.RemoteDataBase.DAO.UserDao", b => modelBuilder.Entity("Data.RemoteData.DAO.PresenceDao", b =>
{ {
b.HasOne("Demo.Data.RemoteData.RemoteDataBase.DAO.GroupDao", "Group") b.HasOne("Data.RemoteData.DAO.UserDao", "UserDao")
.WithMany()
.HasForeignKey("UserDaoGuid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("UserDao");
});
modelBuilder.Entity("Data.RemoteData.DAO.UserDao", b =>
{
b.HasOne("Data.RemoteData.DAO.GroupDao", "Group")
.WithMany("Users") .WithMany("Users")
.HasForeignKey("GroupId") .HasForeignKey("GroupId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
@ -100,7 +105,7 @@ namespace Demo.Migrations
b.Navigation("Group"); b.Navigation("Group");
}); });
modelBuilder.Entity("Demo.Data.RemoteData.RemoteDataBase.DAO.GroupDao", b => modelBuilder.Entity("Data.RemoteData.DAO.GroupDao", b =>
{ {
b.Navigation("Users"); b.Navigation("Users");
}); });

View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Data.RemoteData.DAO
{
public class GroupDao
{
internal static List<GroupDao> Name = new List<GroupDao>();
public int Id { get; set; }
public required string GroupName { get; set; }
public IEnumerable<UserDao> Users { get; set; }
}
}

View File

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Data.RemoteData.DAO
{
public class PresnceDao
{
public Guid UserGuid { get; set; }
public bool IsAttendensy { get; set; } = true;
public int LessonNumber { get; set; }
public DateOnly Date { get; set; }
public UserDao userDao { get; set; }
}
}

View File

@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Data.RemoteData.DAO
{
public class UserDao
{
public required string FIO { get; set; }
public Guid UserGuid { get; set; }
public GroupDao Group { get; set; }
public required int GroupID { get; set; }
public List<PresnceDao> Presences { get; set; } = new List<PresnceDao>();
}
}

View File

@ -0,0 +1,29 @@
using Data.RemoteData.DAO;
using Microsoft.EntityFrameworkCore;
namespace data.RemoteData
{
public class RemoteDataBaseContext: DbContext
{
internal DbSet<GroupDao> Group { get; set; }
internal DbSet<UserDao> User { get; set; }
internal DbSet<PresnceDao> Presence { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseNpgsql("Host=45.67.56.214;Port=5421;Username=user16;Password=dZ28IVE5;Database=user16");
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<GroupDao>().HasKey(Group => Group.Id);
modelBuilder.Entity<UserDao>().HasKey(User => User.UserGuid);
modelBuilder.Entity<PresnceDao>().HasKey(Presence => new {
Presence.UserGuid,
Presence.IsAttendensy,
Presence.Date,
Presence.LessonNumber,
});
}
}
}

View File

@ -0,0 +1,18 @@
using Data.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);
}
}

View File

@ -0,0 +1,56 @@
using data.RemoteData;
using Data.LocalData;
using Data.Models;
using Data.RemoteData.DAO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Data.Repository
{
public class SQLGroupRepositoryImpl:IGroupRepository
{
private readonly RemoteDataBaseContext _remoteDataBaseContext;
public SQLGroupRepositoryImpl(RemoteDataBaseContext remoteDataBaseContext) {
_remoteDataBaseContext = remoteDataBaseContext;
}
public bool AddGroup(GroupLocalEntity newGroup)
{
GroupDao groupDao = new GroupDao { GroupName = newGroup.Name };
var result = _remoteDataBaseContext.Group.Add(groupDao);
if (result != null) {
_remoteDataBaseContext.SaveChanges();
return true; }
return false;
}
public List<GroupLocalEntity> GetAllGroup()
{
return _remoteDataBaseContext.Group.Select(group => new GroupLocalEntity{
Id = group.Id,
Name = group.GroupName}
).ToList();
}
public List<GroupLocalEntity> GetAllGroups() => LocalStaticData.groups;
public GroupLocalEntity GetGroupById(int groupID)
{
throw new NotImplementedException();
}
public bool RemoveGroupById(int groupID)
{
throw new NotImplementedException();
}
public bool UpdateGroupById(int groupID, GroupLocalEntity updatedGroup)
{
throw new NotImplementedException();
}
}
}

View File

@ -0,0 +1,47 @@
using Data.LocalData;
using Data.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Data.Repository
{
public class UserRepositoryImpl
{
public UserRepositoryImpl() {
GetAllUsers = LocalStaticData.users;
}
public List<UserLocalEnity> GetAllUsers
{ get; set; }
public bool RemoveUserByGuid(Guid userGuid)
{
UserLocalEnity? userLocal = GetAllUsers
.Where(x => x.Guid == userGuid).FirstOrDefault();
if (userLocal == null) return false;
return GetAllUsers.Remove(userLocal);
}
public UserLocalEnity? GetUserByGuid(Guid userGuid) {
UserLocalEnity? userLocal = GetAllUsers
.Where(x => x.Guid == userGuid).FirstOrDefault();
if (userLocal == null) return null;
return userLocal;
}
public UserLocalEnity? UpdateUser(UserLocalEnity userUpdateLocalEnity) {
UserLocalEnity? userLocal = GetAllUsers
.Where(x => x.Guid == userUpdateLocalEnity.Guid).FirstOrDefault();
if (userLocal == null) return null;
userLocal.FIO = userUpdateLocalEnity.FIO;
userLocal.GroupID = userUpdateLocalEnity.GroupID;
return userLocal;
}
}
}

View File

@ -0,0 +1,818 @@
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v8.0",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v8.0": {
"data/1.0.0": {
"dependencies": {
"Microsoft.EntityFrameworkCore": "8.0.10",
"Microsoft.EntityFrameworkCore.Design": "8.0.10",
"Npgsql.EntityFrameworkCore.PostgreSQL": "8.0.10"
},
"runtime": {
"data.dll": {}
}
},
"Humanizer.Core/2.14.1": {
"runtime": {
"lib/net6.0/Humanizer.dll": {
"assemblyVersion": "2.14.0.0",
"fileVersion": "2.14.1.48190"
}
}
},
"Microsoft.Bcl.AsyncInterfaces/6.0.0": {
"runtime": {
"lib/netstandard2.1/Microsoft.Bcl.AsyncInterfaces.dll": {
"assemblyVersion": "6.0.0.0",
"fileVersion": "6.0.21.52210"
}
}
},
"Microsoft.CodeAnalysis.Analyzers/3.3.3": {},
"Microsoft.CodeAnalysis.Common/4.5.0": {
"dependencies": {
"Microsoft.CodeAnalysis.Analyzers": "3.3.3",
"System.Collections.Immutable": "6.0.0",
"System.Reflection.Metadata": "6.0.1",
"System.Runtime.CompilerServices.Unsafe": "6.0.0",
"System.Text.Encoding.CodePages": "6.0.0"
},
"runtime": {
"lib/netcoreapp3.1/Microsoft.CodeAnalysis.dll": {
"assemblyVersion": "4.5.0.0",
"fileVersion": "4.500.23.10905"
}
},
"resources": {
"lib/netcoreapp3.1/cs/Microsoft.CodeAnalysis.resources.dll": {
"locale": "cs"
},
"lib/netcoreapp3.1/de/Microsoft.CodeAnalysis.resources.dll": {
"locale": "de"
},
"lib/netcoreapp3.1/es/Microsoft.CodeAnalysis.resources.dll": {
"locale": "es"
},
"lib/netcoreapp3.1/fr/Microsoft.CodeAnalysis.resources.dll": {
"locale": "fr"
},
"lib/netcoreapp3.1/it/Microsoft.CodeAnalysis.resources.dll": {
"locale": "it"
},
"lib/netcoreapp3.1/ja/Microsoft.CodeAnalysis.resources.dll": {
"locale": "ja"
},
"lib/netcoreapp3.1/ko/Microsoft.CodeAnalysis.resources.dll": {
"locale": "ko"
},
"lib/netcoreapp3.1/pl/Microsoft.CodeAnalysis.resources.dll": {
"locale": "pl"
},
"lib/netcoreapp3.1/pt-BR/Microsoft.CodeAnalysis.resources.dll": {
"locale": "pt-BR"
},
"lib/netcoreapp3.1/ru/Microsoft.CodeAnalysis.resources.dll": {
"locale": "ru"
},
"lib/netcoreapp3.1/tr/Microsoft.CodeAnalysis.resources.dll": {
"locale": "tr"
},
"lib/netcoreapp3.1/zh-Hans/Microsoft.CodeAnalysis.resources.dll": {
"locale": "zh-Hans"
},
"lib/netcoreapp3.1/zh-Hant/Microsoft.CodeAnalysis.resources.dll": {
"locale": "zh-Hant"
}
}
},
"Microsoft.CodeAnalysis.CSharp/4.5.0": {
"dependencies": {
"Microsoft.CodeAnalysis.Common": "4.5.0"
},
"runtime": {
"lib/netcoreapp3.1/Microsoft.CodeAnalysis.CSharp.dll": {
"assemblyVersion": "4.5.0.0",
"fileVersion": "4.500.23.10905"
}
},
"resources": {
"lib/netcoreapp3.1/cs/Microsoft.CodeAnalysis.CSharp.resources.dll": {
"locale": "cs"
},
"lib/netcoreapp3.1/de/Microsoft.CodeAnalysis.CSharp.resources.dll": {
"locale": "de"
},
"lib/netcoreapp3.1/es/Microsoft.CodeAnalysis.CSharp.resources.dll": {
"locale": "es"
},
"lib/netcoreapp3.1/fr/Microsoft.CodeAnalysis.CSharp.resources.dll": {
"locale": "fr"
},
"lib/netcoreapp3.1/it/Microsoft.CodeAnalysis.CSharp.resources.dll": {
"locale": "it"
},
"lib/netcoreapp3.1/ja/Microsoft.CodeAnalysis.CSharp.resources.dll": {
"locale": "ja"
},
"lib/netcoreapp3.1/ko/Microsoft.CodeAnalysis.CSharp.resources.dll": {
"locale": "ko"
},
"lib/netcoreapp3.1/pl/Microsoft.CodeAnalysis.CSharp.resources.dll": {
"locale": "pl"
},
"lib/netcoreapp3.1/pt-BR/Microsoft.CodeAnalysis.CSharp.resources.dll": {
"locale": "pt-BR"
},
"lib/netcoreapp3.1/ru/Microsoft.CodeAnalysis.CSharp.resources.dll": {
"locale": "ru"
},
"lib/netcoreapp3.1/tr/Microsoft.CodeAnalysis.CSharp.resources.dll": {
"locale": "tr"
},
"lib/netcoreapp3.1/zh-Hans/Microsoft.CodeAnalysis.CSharp.resources.dll": {
"locale": "zh-Hans"
},
"lib/netcoreapp3.1/zh-Hant/Microsoft.CodeAnalysis.CSharp.resources.dll": {
"locale": "zh-Hant"
}
}
},
"Microsoft.CodeAnalysis.CSharp.Workspaces/4.5.0": {
"dependencies": {
"Humanizer.Core": "2.14.1",
"Microsoft.CodeAnalysis.CSharp": "4.5.0",
"Microsoft.CodeAnalysis.Common": "4.5.0",
"Microsoft.CodeAnalysis.Workspaces.Common": "4.5.0"
},
"runtime": {
"lib/netcoreapp3.1/Microsoft.CodeAnalysis.CSharp.Workspaces.dll": {
"assemblyVersion": "4.5.0.0",
"fileVersion": "4.500.23.10905"
}
},
"resources": {
"lib/netcoreapp3.1/cs/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll": {
"locale": "cs"
},
"lib/netcoreapp3.1/de/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll": {
"locale": "de"
},
"lib/netcoreapp3.1/es/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll": {
"locale": "es"
},
"lib/netcoreapp3.1/fr/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll": {
"locale": "fr"
},
"lib/netcoreapp3.1/it/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll": {
"locale": "it"
},
"lib/netcoreapp3.1/ja/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll": {
"locale": "ja"
},
"lib/netcoreapp3.1/ko/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll": {
"locale": "ko"
},
"lib/netcoreapp3.1/pl/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll": {
"locale": "pl"
},
"lib/netcoreapp3.1/pt-BR/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll": {
"locale": "pt-BR"
},
"lib/netcoreapp3.1/ru/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll": {
"locale": "ru"
},
"lib/netcoreapp3.1/tr/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll": {
"locale": "tr"
},
"lib/netcoreapp3.1/zh-Hans/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll": {
"locale": "zh-Hans"
},
"lib/netcoreapp3.1/zh-Hant/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll": {
"locale": "zh-Hant"
}
}
},
"Microsoft.CodeAnalysis.Workspaces.Common/4.5.0": {
"dependencies": {
"Humanizer.Core": "2.14.1",
"Microsoft.Bcl.AsyncInterfaces": "6.0.0",
"Microsoft.CodeAnalysis.Common": "4.5.0",
"System.Composition": "6.0.0",
"System.IO.Pipelines": "6.0.3",
"System.Threading.Channels": "6.0.0"
},
"runtime": {
"lib/netcoreapp3.1/Microsoft.CodeAnalysis.Workspaces.dll": {
"assemblyVersion": "4.5.0.0",
"fileVersion": "4.500.23.10905"
}
},
"resources": {
"lib/netcoreapp3.1/cs/Microsoft.CodeAnalysis.Workspaces.resources.dll": {
"locale": "cs"
},
"lib/netcoreapp3.1/de/Microsoft.CodeAnalysis.Workspaces.resources.dll": {
"locale": "de"
},
"lib/netcoreapp3.1/es/Microsoft.CodeAnalysis.Workspaces.resources.dll": {
"locale": "es"
},
"lib/netcoreapp3.1/fr/Microsoft.CodeAnalysis.Workspaces.resources.dll": {
"locale": "fr"
},
"lib/netcoreapp3.1/it/Microsoft.CodeAnalysis.Workspaces.resources.dll": {
"locale": "it"
},
"lib/netcoreapp3.1/ja/Microsoft.CodeAnalysis.Workspaces.resources.dll": {
"locale": "ja"
},
"lib/netcoreapp3.1/ko/Microsoft.CodeAnalysis.Workspaces.resources.dll": {
"locale": "ko"
},
"lib/netcoreapp3.1/pl/Microsoft.CodeAnalysis.Workspaces.resources.dll": {
"locale": "pl"
},
"lib/netcoreapp3.1/pt-BR/Microsoft.CodeAnalysis.Workspaces.resources.dll": {
"locale": "pt-BR"
},
"lib/netcoreapp3.1/ru/Microsoft.CodeAnalysis.Workspaces.resources.dll": {
"locale": "ru"
},
"lib/netcoreapp3.1/tr/Microsoft.CodeAnalysis.Workspaces.resources.dll": {
"locale": "tr"
},
"lib/netcoreapp3.1/zh-Hans/Microsoft.CodeAnalysis.Workspaces.resources.dll": {
"locale": "zh-Hans"
},
"lib/netcoreapp3.1/zh-Hant/Microsoft.CodeAnalysis.Workspaces.resources.dll": {
"locale": "zh-Hant"
}
}
},
"Microsoft.EntityFrameworkCore/8.0.10": {
"dependencies": {
"Microsoft.EntityFrameworkCore.Abstractions": "8.0.10",
"Microsoft.EntityFrameworkCore.Analyzers": "8.0.10",
"Microsoft.Extensions.Caching.Memory": "8.0.1",
"Microsoft.Extensions.Logging": "8.0.1"
},
"runtime": {
"lib/net8.0/Microsoft.EntityFrameworkCore.dll": {
"assemblyVersion": "8.0.10.0",
"fileVersion": "8.0.1024.46708"
}
}
},
"Microsoft.EntityFrameworkCore.Abstractions/8.0.10": {
"runtime": {
"lib/net8.0/Microsoft.EntityFrameworkCore.Abstractions.dll": {
"assemblyVersion": "8.0.10.0",
"fileVersion": "8.0.1024.46708"
}
}
},
"Microsoft.EntityFrameworkCore.Analyzers/8.0.10": {},
"Microsoft.EntityFrameworkCore.Design/8.0.10": {
"dependencies": {
"Humanizer.Core": "2.14.1",
"Microsoft.CodeAnalysis.CSharp.Workspaces": "4.5.0",
"Microsoft.EntityFrameworkCore.Relational": "8.0.10",
"Microsoft.Extensions.DependencyModel": "8.0.2",
"Mono.TextTemplating": "2.2.1"
},
"runtime": {
"lib/net8.0/Microsoft.EntityFrameworkCore.Design.dll": {
"assemblyVersion": "8.0.10.0",
"fileVersion": "8.0.1024.46708"
}
}
},
"Microsoft.EntityFrameworkCore.Relational/8.0.10": {
"dependencies": {
"Microsoft.EntityFrameworkCore": "8.0.10",
"Microsoft.Extensions.Configuration.Abstractions": "8.0.0"
},
"runtime": {
"lib/net8.0/Microsoft.EntityFrameworkCore.Relational.dll": {
"assemblyVersion": "8.0.10.0",
"fileVersion": "8.0.1024.46708"
}
}
},
"Microsoft.Extensions.Caching.Abstractions/8.0.0": {
"dependencies": {
"Microsoft.Extensions.Primitives": "8.0.0"
},
"runtime": {
"lib/net8.0/Microsoft.Extensions.Caching.Abstractions.dll": {
"assemblyVersion": "8.0.0.0",
"fileVersion": "8.0.23.53103"
}
}
},
"Microsoft.Extensions.Caching.Memory/8.0.1": {
"dependencies": {
"Microsoft.Extensions.Caching.Abstractions": "8.0.0",
"Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.2",
"Microsoft.Extensions.Logging.Abstractions": "8.0.2",
"Microsoft.Extensions.Options": "8.0.2",
"Microsoft.Extensions.Primitives": "8.0.0"
},
"runtime": {
"lib/net8.0/Microsoft.Extensions.Caching.Memory.dll": {
"assemblyVersion": "8.0.0.0",
"fileVersion": "8.0.1024.46610"
}
}
},
"Microsoft.Extensions.Configuration.Abstractions/8.0.0": {
"dependencies": {
"Microsoft.Extensions.Primitives": "8.0.0"
},
"runtime": {
"lib/net8.0/Microsoft.Extensions.Configuration.Abstractions.dll": {
"assemblyVersion": "8.0.0.0",
"fileVersion": "8.0.23.53103"
}
}
},
"Microsoft.Extensions.DependencyInjection/8.0.1": {
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.2"
},
"runtime": {
"lib/net8.0/Microsoft.Extensions.DependencyInjection.dll": {
"assemblyVersion": "8.0.0.0",
"fileVersion": "8.0.1024.46610"
}
}
},
"Microsoft.Extensions.DependencyInjection.Abstractions/8.0.2": {
"runtime": {
"lib/net8.0/Microsoft.Extensions.DependencyInjection.Abstractions.dll": {
"assemblyVersion": "8.0.0.0",
"fileVersion": "8.0.1024.46610"
}
}
},
"Microsoft.Extensions.DependencyModel/8.0.2": {
"runtime": {
"lib/net8.0/Microsoft.Extensions.DependencyModel.dll": {
"assemblyVersion": "8.0.0.2",
"fileVersion": "8.0.1024.46610"
}
}
},
"Microsoft.Extensions.Logging/8.0.1": {
"dependencies": {
"Microsoft.Extensions.DependencyInjection": "8.0.1",
"Microsoft.Extensions.Logging.Abstractions": "8.0.2",
"Microsoft.Extensions.Options": "8.0.2"
},
"runtime": {
"lib/net8.0/Microsoft.Extensions.Logging.dll": {
"assemblyVersion": "8.0.0.0",
"fileVersion": "8.0.1024.46610"
}
}
},
"Microsoft.Extensions.Logging.Abstractions/8.0.2": {
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.2"
},
"runtime": {
"lib/net8.0/Microsoft.Extensions.Logging.Abstractions.dll": {
"assemblyVersion": "8.0.0.0",
"fileVersion": "8.0.1024.46610"
}
}
},
"Microsoft.Extensions.Options/8.0.2": {
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.2",
"Microsoft.Extensions.Primitives": "8.0.0"
},
"runtime": {
"lib/net8.0/Microsoft.Extensions.Options.dll": {
"assemblyVersion": "8.0.0.0",
"fileVersion": "8.0.224.6711"
}
}
},
"Microsoft.Extensions.Primitives/8.0.0": {
"runtime": {
"lib/net8.0/Microsoft.Extensions.Primitives.dll": {
"assemblyVersion": "8.0.0.0",
"fileVersion": "8.0.23.53103"
}
}
},
"Mono.TextTemplating/2.2.1": {
"dependencies": {
"System.CodeDom": "4.4.0"
},
"runtime": {
"lib/netstandard2.0/Mono.TextTemplating.dll": {
"assemblyVersion": "2.2.0.0",
"fileVersion": "2.2.1.1"
}
}
},
"Npgsql/8.0.5": {
"dependencies": {
"Microsoft.Extensions.Logging.Abstractions": "8.0.2"
},
"runtime": {
"lib/net8.0/Npgsql.dll": {
"assemblyVersion": "8.0.5.0",
"fileVersion": "8.0.5.0"
}
}
},
"Npgsql.EntityFrameworkCore.PostgreSQL/8.0.10": {
"dependencies": {
"Microsoft.EntityFrameworkCore": "8.0.10",
"Microsoft.EntityFrameworkCore.Abstractions": "8.0.10",
"Microsoft.EntityFrameworkCore.Relational": "8.0.10",
"Npgsql": "8.0.5"
},
"runtime": {
"lib/net8.0/Npgsql.EntityFrameworkCore.PostgreSQL.dll": {
"assemblyVersion": "8.0.10.0",
"fileVersion": "8.0.10.0"
}
}
},
"System.CodeDom/4.4.0": {
"runtime": {
"lib/netstandard2.0/System.CodeDom.dll": {
"assemblyVersion": "4.0.0.0",
"fileVersion": "4.6.25519.3"
}
}
},
"System.Collections.Immutable/6.0.0": {
"dependencies": {
"System.Runtime.CompilerServices.Unsafe": "6.0.0"
}
},
"System.Composition/6.0.0": {
"dependencies": {
"System.Composition.AttributedModel": "6.0.0",
"System.Composition.Convention": "6.0.0",
"System.Composition.Hosting": "6.0.0",
"System.Composition.Runtime": "6.0.0",
"System.Composition.TypedParts": "6.0.0"
}
},
"System.Composition.AttributedModel/6.0.0": {
"runtime": {
"lib/net6.0/System.Composition.AttributedModel.dll": {
"assemblyVersion": "6.0.0.0",
"fileVersion": "6.0.21.52210"
}
}
},
"System.Composition.Convention/6.0.0": {
"dependencies": {
"System.Composition.AttributedModel": "6.0.0"
},
"runtime": {
"lib/net6.0/System.Composition.Convention.dll": {
"assemblyVersion": "6.0.0.0",
"fileVersion": "6.0.21.52210"
}
}
},
"System.Composition.Hosting/6.0.0": {
"dependencies": {
"System.Composition.Runtime": "6.0.0"
},
"runtime": {
"lib/net6.0/System.Composition.Hosting.dll": {
"assemblyVersion": "6.0.0.0",
"fileVersion": "6.0.21.52210"
}
}
},
"System.Composition.Runtime/6.0.0": {
"runtime": {
"lib/net6.0/System.Composition.Runtime.dll": {
"assemblyVersion": "6.0.0.0",
"fileVersion": "6.0.21.52210"
}
}
},
"System.Composition.TypedParts/6.0.0": {
"dependencies": {
"System.Composition.AttributedModel": "6.0.0",
"System.Composition.Hosting": "6.0.0",
"System.Composition.Runtime": "6.0.0"
},
"runtime": {
"lib/net6.0/System.Composition.TypedParts.dll": {
"assemblyVersion": "6.0.0.0",
"fileVersion": "6.0.21.52210"
}
}
},
"System.IO.Pipelines/6.0.3": {
"runtime": {
"lib/net6.0/System.IO.Pipelines.dll": {
"assemblyVersion": "6.0.0.0",
"fileVersion": "6.0.522.21309"
}
}
},
"System.Reflection.Metadata/6.0.1": {
"dependencies": {
"System.Collections.Immutable": "6.0.0"
}
},
"System.Runtime.CompilerServices.Unsafe/6.0.0": {},
"System.Text.Encoding.CodePages/6.0.0": {
"dependencies": {
"System.Runtime.CompilerServices.Unsafe": "6.0.0"
}
},
"System.Threading.Channels/6.0.0": {}
}
},
"libraries": {
"data/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"Humanizer.Core/2.14.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-lQKvtaTDOXnoVJ20ibTuSIOf2i0uO0MPbDhd1jm238I+U/2ZnRENj0cktKZhtchBMtCUSRQ5v4xBCUbKNmyVMw==",
"path": "humanizer.core/2.14.1",
"hashPath": "humanizer.core.2.14.1.nupkg.sha512"
},
"Microsoft.Bcl.AsyncInterfaces/6.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-UcSjPsst+DfAdJGVDsu346FX0ci0ah+lw3WRtn18NUwEqRt70HaOQ7lI72vy3+1LxtqI3T5GWwV39rQSrCzAeg==",
"path": "microsoft.bcl.asyncinterfaces/6.0.0",
"hashPath": "microsoft.bcl.asyncinterfaces.6.0.0.nupkg.sha512"
},
"Microsoft.CodeAnalysis.Analyzers/3.3.3": {
"type": "package",
"serviceable": true,
"sha512": "sha512-j/rOZtLMVJjrfLRlAMckJLPW/1rze9MT1yfWqSIbUPGRu1m1P0fuo9PmqapwsmePfGB5PJrudQLvmUOAMF0DqQ==",
"path": "microsoft.codeanalysis.analyzers/3.3.3",
"hashPath": "microsoft.codeanalysis.analyzers.3.3.3.nupkg.sha512"
},
"Microsoft.CodeAnalysis.Common/4.5.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-lwAbIZNdnY0SUNoDmZHkVUwLO8UyNnyyh1t/4XsbFxi4Ounb3xszIYZaWhyj5ZjyfcwqwmtMbE7fUTVCqQEIdQ==",
"path": "microsoft.codeanalysis.common/4.5.0",
"hashPath": "microsoft.codeanalysis.common.4.5.0.nupkg.sha512"
},
"Microsoft.CodeAnalysis.CSharp/4.5.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-cM59oMKAOxvdv76bdmaKPy5hfj+oR+zxikWoueEB7CwTko7mt9sVKZI8Qxlov0C/LuKEG+WQwifepqL3vuTiBQ==",
"path": "microsoft.codeanalysis.csharp/4.5.0",
"hashPath": "microsoft.codeanalysis.csharp.4.5.0.nupkg.sha512"
},
"Microsoft.CodeAnalysis.CSharp.Workspaces/4.5.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-h74wTpmGOp4yS4hj+EvNzEiPgg/KVs2wmSfTZ81upJZOtPkJsVkgfsgtxxqmAeapjT/vLKfmYV0bS8n5MNVP+g==",
"path": "microsoft.codeanalysis.csharp.workspaces/4.5.0",
"hashPath": "microsoft.codeanalysis.csharp.workspaces.4.5.0.nupkg.sha512"
},
"Microsoft.CodeAnalysis.Workspaces.Common/4.5.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-l4dDRmGELXG72XZaonnOeORyD/T5RpEu5LGHOUIhnv+MmUWDY/m1kWXGwtcgQ5CJ5ynkFiRnIYzTKXYjUs7rbw==",
"path": "microsoft.codeanalysis.workspaces.common/4.5.0",
"hashPath": "microsoft.codeanalysis.workspaces.common.4.5.0.nupkg.sha512"
},
"Microsoft.EntityFrameworkCore/8.0.10": {
"type": "package",
"serviceable": true,
"sha512": "sha512-PPkQdIqfR1nU3n6YgGGDk8G+eaYbaAKM1AzIQtlPNTKf10Osg3N9T+iK9AlnSA/ujsK00flPpFHVfJrbuBFS1A==",
"path": "microsoft.entityframeworkcore/8.0.10",
"hashPath": "microsoft.entityframeworkcore.8.0.10.nupkg.sha512"
},
"Microsoft.EntityFrameworkCore.Abstractions/8.0.10": {
"type": "package",
"serviceable": true,
"sha512": "sha512-FV0QlcX9INY4kAD2o72uPtyOh0nZut2jB11Jf9mNYBtHay8gDLe+x4AbXFwuQg+eSvofjT7naV82e827zGfyMg==",
"path": "microsoft.entityframeworkcore.abstractions/8.0.10",
"hashPath": "microsoft.entityframeworkcore.abstractions.8.0.10.nupkg.sha512"
},
"Microsoft.EntityFrameworkCore.Analyzers/8.0.10": {
"type": "package",
"serviceable": true,
"sha512": "sha512-51KkPIc0EMv/gVXhPIUi6cwJE9Mvh+PLr4Lap4naLcsoGZ0lF2SvOPgUUprwRV3MnN7nyD1XPhT5RJ/p+xFAXw==",
"path": "microsoft.entityframeworkcore.analyzers/8.0.10",
"hashPath": "microsoft.entityframeworkcore.analyzers.8.0.10.nupkg.sha512"
},
"Microsoft.EntityFrameworkCore.Design/8.0.10": {
"type": "package",
"serviceable": true,
"sha512": "sha512-uGNjfKvAsql2KHRqxlK5wHo8mMC60G/FecrFKEjJgeIxtUAbSXGOgKGw/gD9flO5Fzzt1C7uxfIcr6ZsMmFkeg==",
"path": "microsoft.entityframeworkcore.design/8.0.10",
"hashPath": "microsoft.entityframeworkcore.design.8.0.10.nupkg.sha512"
},
"Microsoft.EntityFrameworkCore.Relational/8.0.10": {
"type": "package",
"serviceable": true,
"sha512": "sha512-OefBEE47kGKPRPV3OT+FAW6o5BFgLk2D9EoeWVy7NbOepzUneayLQxbVE098FfedTyMwxvZQoDD9LrvZc3MadA==",
"path": "microsoft.entityframeworkcore.relational/8.0.10",
"hashPath": "microsoft.entityframeworkcore.relational.8.0.10.nupkg.sha512"
},
"Microsoft.Extensions.Caching.Abstractions/8.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-3KuSxeHoNYdxVYfg2IRZCThcrlJ1XJqIXkAWikCsbm5C/bCjv7G0WoKDyuR98Q+T607QT2Zl5GsbGRkENcV2yQ==",
"path": "microsoft.extensions.caching.abstractions/8.0.0",
"hashPath": "microsoft.extensions.caching.abstractions.8.0.0.nupkg.sha512"
},
"Microsoft.Extensions.Caching.Memory/8.0.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-HFDnhYLccngrzyGgHkjEDU5FMLn4MpOsr5ElgsBMC4yx6lJh4jeWO7fHS8+TXPq+dgxCmUa/Trl8svObmwW4QA==",
"path": "microsoft.extensions.caching.memory/8.0.1",
"hashPath": "microsoft.extensions.caching.memory.8.0.1.nupkg.sha512"
},
"Microsoft.Extensions.Configuration.Abstractions/8.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-3lE/iLSutpgX1CC0NOW70FJoGARRHbyKmG7dc0klnUZ9Dd9hS6N/POPWhKhMLCEuNN5nXEY5agmlFtH562vqhQ==",
"path": "microsoft.extensions.configuration.abstractions/8.0.0",
"hashPath": "microsoft.extensions.configuration.abstractions.8.0.0.nupkg.sha512"
},
"Microsoft.Extensions.DependencyInjection/8.0.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-BmANAnR5Xd4Oqw7yQ75xOAYODybZQRzdeNucg7kS5wWKd2PNnMdYtJ2Vciy0QLylRmv42DGl5+AFL9izA6F1Rw==",
"path": "microsoft.extensions.dependencyinjection/8.0.1",
"hashPath": "microsoft.extensions.dependencyinjection.8.0.1.nupkg.sha512"
},
"Microsoft.Extensions.DependencyInjection.Abstractions/8.0.2": {
"type": "package",
"serviceable": true,
"sha512": "sha512-3iE7UF7MQkCv1cxzCahz+Y/guQbTqieyxyaWKhrRO91itI9cOKO76OHeQDahqG4MmW5umr3CcCvGmK92lWNlbg==",
"path": "microsoft.extensions.dependencyinjection.abstractions/8.0.2",
"hashPath": "microsoft.extensions.dependencyinjection.abstractions.8.0.2.nupkg.sha512"
},
"Microsoft.Extensions.DependencyModel/8.0.2": {
"type": "package",
"serviceable": true,
"sha512": "sha512-mUBDZZRgZrSyFOsJ2qJJ9fXfqd/kXJwf3AiDoqLD9m6TjY5OO/vLNOb9fb4juC0487eq4hcGN/M2Rh/CKS7QYw==",
"path": "microsoft.extensions.dependencymodel/8.0.2",
"hashPath": "microsoft.extensions.dependencymodel.8.0.2.nupkg.sha512"
},
"Microsoft.Extensions.Logging/8.0.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-4x+pzsQEbqxhNf1QYRr5TDkLP9UsLT3A6MdRKDDEgrW7h1ljiEPgTNhKYUhNCCAaVpQECVQ+onA91PTPnIp6Lw==",
"path": "microsoft.extensions.logging/8.0.1",
"hashPath": "microsoft.extensions.logging.8.0.1.nupkg.sha512"
},
"Microsoft.Extensions.Logging.Abstractions/8.0.2": {
"type": "package",
"serviceable": true,
"sha512": "sha512-nroMDjS7hNBPtkZqVBbSiQaQjWRDxITI8Y7XnDs97rqG3EbzVTNLZQf7bIeUJcaHOV8bca47s1Uxq94+2oGdxA==",
"path": "microsoft.extensions.logging.abstractions/8.0.2",
"hashPath": "microsoft.extensions.logging.abstractions.8.0.2.nupkg.sha512"
},
"Microsoft.Extensions.Options/8.0.2": {
"type": "package",
"serviceable": true,
"sha512": "sha512-dWGKvhFybsaZpGmzkGCbNNwBD1rVlWzrZKANLW/CcbFJpCEceMCGzT7zZwHOGBCbwM0SzBuceMj5HN1LKV1QqA==",
"path": "microsoft.extensions.options/8.0.2",
"hashPath": "microsoft.extensions.options.8.0.2.nupkg.sha512"
},
"Microsoft.Extensions.Primitives/8.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-bXJEZrW9ny8vjMF1JV253WeLhpEVzFo1lyaZu1vQ4ZxWUlVvknZ/+ftFgVheLubb4eZPSwwxBeqS1JkCOjxd8g==",
"path": "microsoft.extensions.primitives/8.0.0",
"hashPath": "microsoft.extensions.primitives.8.0.0.nupkg.sha512"
},
"Mono.TextTemplating/2.2.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-KZYeKBET/2Z0gY1WlTAK7+RHTl7GSbtvTLDXEZZojUdAPqpQNDL6tHv7VUpqfX5VEOh+uRGKaZXkuD253nEOBQ==",
"path": "mono.texttemplating/2.2.1",
"hashPath": "mono.texttemplating.2.2.1.nupkg.sha512"
},
"Npgsql/8.0.5": {
"type": "package",
"serviceable": true,
"sha512": "sha512-zRG5V8cyeZLpzJlKzFKjEwkRMYIYnHWJvEor2lWXeccS2E1G2nIWYYhnukB51iz5XsWSVEtqg3AxTWM0QJ6vfg==",
"path": "npgsql/8.0.5",
"hashPath": "npgsql.8.0.5.nupkg.sha512"
},
"Npgsql.EntityFrameworkCore.PostgreSQL/8.0.10": {
"type": "package",
"serviceable": true,
"sha512": "sha512-gFPl9Dmxih7Yi4tZ3bITzZFzbxFMBx04gqTqcjoL2r5VEW+O2TA5UVw/wm/XW26NAJ7sg59Je0+9QrwiZt6MPQ==",
"path": "npgsql.entityframeworkcore.postgresql/8.0.10",
"hashPath": "npgsql.entityframeworkcore.postgresql.8.0.10.nupkg.sha512"
},
"System.CodeDom/4.4.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-2sCCb7doXEwtYAbqzbF/8UAeDRMNmPaQbU2q50Psg1J9KzumyVVCgKQY8s53WIPTufNT0DpSe9QRvVjOzfDWBA==",
"path": "system.codedom/4.4.0",
"hashPath": "system.codedom.4.4.0.nupkg.sha512"
},
"System.Collections.Immutable/6.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-l4zZJ1WU2hqpQQHXz1rvC3etVZN+2DLmQMO79FhOTZHMn8tDRr+WU287sbomD0BETlmKDn0ygUgVy9k5xkkJdA==",
"path": "system.collections.immutable/6.0.0",
"hashPath": "system.collections.immutable.6.0.0.nupkg.sha512"
},
"System.Composition/6.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-d7wMuKQtfsxUa7S13tITC8n1cQzewuhD5iDjZtK2prwFfKVzdYtgrTHgjaV03Zq7feGQ5gkP85tJJntXwInsJA==",
"path": "system.composition/6.0.0",
"hashPath": "system.composition.6.0.0.nupkg.sha512"
},
"System.Composition.AttributedModel/6.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-WK1nSDLByK/4VoC7fkNiFuTVEiperuCN/Hyn+VN30R+W2ijO1d0Z2Qm0ScEl9xkSn1G2MyapJi8xpf4R8WRa/w==",
"path": "system.composition.attributedmodel/6.0.0",
"hashPath": "system.composition.attributedmodel.6.0.0.nupkg.sha512"
},
"System.Composition.Convention/6.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-XYi4lPRdu5bM4JVJ3/UIHAiG6V6lWWUlkhB9ab4IOq0FrRsp0F4wTyV4Dj+Ds+efoXJ3qbLqlvaUozDO7OLeXA==",
"path": "system.composition.convention/6.0.0",
"hashPath": "system.composition.convention.6.0.0.nupkg.sha512"
},
"System.Composition.Hosting/6.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-w/wXjj7kvxuHPLdzZ0PAUt++qJl03t7lENmb2Oev0n3zbxyNULbWBlnd5J5WUMMv15kg5o+/TCZFb6lSwfaUUQ==",
"path": "system.composition.hosting/6.0.0",
"hashPath": "system.composition.hosting.6.0.0.nupkg.sha512"
},
"System.Composition.Runtime/6.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-qkRH/YBaMPTnzxrS5RDk1juvqed4A6HOD/CwRcDGyPpYps1J27waBddiiq1y93jk2ZZ9wuA/kynM+NO0kb3PKg==",
"path": "system.composition.runtime/6.0.0",
"hashPath": "system.composition.runtime.6.0.0.nupkg.sha512"
},
"System.Composition.TypedParts/6.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-iUR1eHrL8Cwd82neQCJ00MpwNIBs4NZgXzrPqx8NJf/k4+mwBO0XCRmHYJT4OLSwDDqh5nBLJWkz5cROnrGhRA==",
"path": "system.composition.typedparts/6.0.0",
"hashPath": "system.composition.typedparts.6.0.0.nupkg.sha512"
},
"System.IO.Pipelines/6.0.3": {
"type": "package",
"serviceable": true,
"sha512": "sha512-ryTgF+iFkpGZY1vRQhfCzX0xTdlV3pyaTTqRu2ETbEv+HlV7O6y7hyQURnghNIXvctl5DuZ//Dpks6HdL/Txgw==",
"path": "system.io.pipelines/6.0.3",
"hashPath": "system.io.pipelines.6.0.3.nupkg.sha512"
},
"System.Reflection.Metadata/6.0.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-III/lNMSn0ZRBuM9m5Cgbiho5j81u0FAEagFX5ta2DKbljZ3T0IpD8j+BIiHQPeKqJppWS9bGEp6JnKnWKze0g==",
"path": "system.reflection.metadata/6.0.1",
"hashPath": "system.reflection.metadata.6.0.1.nupkg.sha512"
},
"System.Runtime.CompilerServices.Unsafe/6.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg==",
"path": "system.runtime.compilerservices.unsafe/6.0.0",
"hashPath": "system.runtime.compilerservices.unsafe.6.0.0.nupkg.sha512"
},
"System.Text.Encoding.CodePages/6.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-ZFCILZuOvtKPauZ/j/swhvw68ZRi9ATCfvGbk1QfydmcXBkIWecWKn/250UH7rahZ5OoDBaiAudJtPvLwzw85A==",
"path": "system.text.encoding.codepages/6.0.0",
"hashPath": "system.text.encoding.codepages.6.0.0.nupkg.sha512"
},
"System.Threading.Channels/6.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-TY8/9+tI0mNaUMgntOxxaq2ndTkdXqLSxvPmas7XEqOlv9lQtB7wLjYGd756lOaO7Dvb5r/WXhluM+0Xe87v5Q==",
"path": "system.threading.channels/6.0.0",
"hashPath": "system.threading.channels.6.0.0.nupkg.sha512"
}
}
}

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,13 @@
{
"runtimeOptions": {
"tfm": "net8.0",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "8.0.0"
},
"configProperties": {
"System.Reflection.NullabilityInfoContext.IsSupported": true,
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
}
}
}

View File

@ -7,11 +7,6 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<None Include="DAO\Visits.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.10" /> <PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.10"> <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.10">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>

View File

@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]

View File

@ -0,0 +1,22 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </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+e27cafe094d18bae057fbde323cb6838d569328c")]
[assembly: System.Reflection.AssemblyProductAttribute("data")]
[assembly: System.Reflection.AssemblyTitleAttribute("data")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Generated by the MSBuild WriteCodeFragment class.

View File

@ -0,0 +1 @@
e95f73bf9f179d39b2dfa2d90546b9f47aaac6da2dcaa72f3b4f20ee39266e0c

View File

@ -0,0 +1,15 @@
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\profi\source\repos\aspekt\data\
build_property.EnableComHosting =
build_property.EnableGeneratedComInterfaceComImportInterop =
build_property.EffectiveAnalysisLevelStyle = 8.0
build_property.EnableCodeStyleSeverity =

View 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;

Binary file not shown.

View File

@ -0,0 +1 @@
2546fe69b50282b1741e2a88dacc0a9d6709341ca6ec2f88b0ea9c92255ca175

View File

@ -0,0 +1,42 @@
C:/Users/laptop/Desktop/presnce/data/obj/Debug/net8.0/data.GeneratedMSBuildEditorConfig.editorconfig
C:/Users/laptop/Desktop/presnce/data/obj/Debug/net8.0/data.AssemblyInfoInputs.cache
C:/Users/laptop/Desktop/presnce/data/obj/Debug/net8.0/data.AssemblyInfo.cs
C:/Users/laptop/Desktop/presnce/data/obj/Debug/net8.0/data.csproj.CoreCompileInputs.cache
C:/Users/laptop/Desktop/presnce/data/obj/Debug/net8.0/data.csproj.AssemblyReference.cache
C:/Users/laptop/Desktop/presnce/data/bin/Debug/net8.0/data.deps.json
C:/Users/laptop/Desktop/presnce/data/bin/Debug/net8.0/data.runtimeconfig.json
C:/Users/laptop/Desktop/presnce/data/bin/Debug/net8.0/data.dll
C:/Users/laptop/Desktop/presnce/data/bin/Debug/net8.0/data.pdb
C:/Users/laptop/Desktop/presnce/data/obj/Debug/net8.0/data.dll
C:/Users/laptop/Desktop/presnce/data/obj/Debug/net8.0/refint/data.dll
C:/Users/laptop/Desktop/presnce/data/obj/Debug/net8.0/data.pdb
C:/Users/laptop/Desktop/presnce/data/obj/Debug/net8.0/data.genruntimeconfig.cache
C:/Users/laptop/Desktop/presnce/data/obj/Debug/net8.0/ref/data.dll
/home/laptop/projects/demp_with_asp/data/bin/Debug/net8.0/data.deps.json
/home/laptop/projects/demp_with_asp/data/bin/Debug/net8.0/data.runtimeconfig.json
/home/laptop/projects/demp_with_asp/data/bin/Debug/net8.0/data.dll
/home/laptop/projects/demp_with_asp/data/bin/Debug/net8.0/data.pdb
/home/laptop/projects/demp_with_asp/data/obj/Debug/net8.0/data.csproj.AssemblyReference.cache
/home/laptop/projects/demp_with_asp/data/obj/Debug/net8.0/data.GeneratedMSBuildEditorConfig.editorconfig
/home/laptop/projects/demp_with_asp/data/obj/Debug/net8.0/data.AssemblyInfoInputs.cache
/home/laptop/projects/demp_with_asp/data/obj/Debug/net8.0/data.AssemblyInfo.cs
/home/laptop/projects/demp_with_asp/data/obj/Debug/net8.0/data.csproj.CoreCompileInputs.cache
/home/laptop/projects/demp_with_asp/data/obj/Debug/net8.0/data.dll
/home/laptop/projects/demp_with_asp/data/obj/Debug/net8.0/refint/data.dll
/home/laptop/projects/demp_with_asp/data/obj/Debug/net8.0/data.pdb
/home/laptop/projects/demp_with_asp/data/obj/Debug/net8.0/data.genruntimeconfig.cache
/home/laptop/projects/demp_with_asp/data/obj/Debug/net8.0/ref/data.dll
C:\Users\profi\source\repos\aspekt\data\bin\Debug\net8.0\data.deps.json
C:\Users\profi\source\repos\aspekt\data\bin\Debug\net8.0\data.runtimeconfig.json
C:\Users\profi\source\repos\aspekt\data\bin\Debug\net8.0\data.dll
C:\Users\profi\source\repos\aspekt\data\bin\Debug\net8.0\data.pdb
C:\Users\profi\source\repos\aspekt\data\obj\Debug\net8.0\data.csproj.AssemblyReference.cache
C:\Users\profi\source\repos\aspekt\data\obj\Debug\net8.0\data.GeneratedMSBuildEditorConfig.editorconfig
C:\Users\profi\source\repos\aspekt\data\obj\Debug\net8.0\data.AssemblyInfoInputs.cache
C:\Users\profi\source\repos\aspekt\data\obj\Debug\net8.0\data.AssemblyInfo.cs
C:\Users\profi\source\repos\aspekt\data\obj\Debug\net8.0\data.csproj.CoreCompileInputs.cache
C:\Users\profi\source\repos\aspekt\data\obj\Debug\net8.0\data.dll
C:\Users\profi\source\repos\aspekt\data\obj\Debug\net8.0\refint\data.dll
C:\Users\profi\source\repos\aspekt\data\obj\Debug\net8.0\data.pdb
C:\Users\profi\source\repos\aspekt\data\obj\Debug\net8.0\data.genruntimeconfig.cache
C:\Users\profi\source\repos\aspekt\data\obj\Debug\net8.0\ref\data.dll

Binary file not shown.

View File

@ -0,0 +1 @@
bcd7f87f0b401050eb172b2e4181e09542fc66ec799ce84025aeb6ee763558e9

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="GetEFProjectMetadata">
<MSBuild Condition=" '$(TargetFramework)' == '' "
Projects="$(MSBuildProjectFile)"
Targets="GetEFProjectMetadata"
Properties="TargetFramework=$(TargetFrameworks.Split(';')[0]);EFProjectMetadataFile=$(EFProjectMetadataFile)" />
<ItemGroup Condition=" '$(TargetFramework)' != '' ">
<EFProjectMetadata Include="AssemblyName: $(AssemblyName)" />
<EFProjectMetadata Include="Language: $(Language)" />
<EFProjectMetadata Include="OutputPath: $(OutputPath)" />
<EFProjectMetadata Include="Platform: $(Platform)" />
<EFProjectMetadata Include="PlatformTarget: $(PlatformTarget)" />
<EFProjectMetadata Include="ProjectAssetsFile: $(ProjectAssetsFile)" />
<EFProjectMetadata Include="ProjectDir: $(ProjectDir)" />
<EFProjectMetadata Include="RootNamespace: $(RootNamespace)" />
<EFProjectMetadata Include="RuntimeFrameworkVersion: $(RuntimeFrameworkVersion)" />
<EFProjectMetadata Include="TargetFileName: $(TargetFileName)" />
<EFProjectMetadata Include="TargetFrameworkMoniker: $(TargetFrameworkMoniker)" />
<EFProjectMetadata Include="Nullable: $(Nullable)" />
<EFProjectMetadata Include="TargetFramework: $(TargetFramework)" />
<EFProjectMetadata Include="TargetPlatformIdentifier: $(TargetPlatformIdentifier)" />
</ItemGroup>
<WriteLinesToFile Condition=" '$(TargetFramework)' != '' "
File="$(EFProjectMetadataFile)"
Lines="@(EFProjectMetadata)" />
</Target>
</Project>

View File

@ -0,0 +1,89 @@
{
"format": 1,
"restore": {
"C:\\Users\\profi\\source\\repos\\aspekt\\data\\data.csproj": {}
},
"projects": {
"C:\\Users\\profi\\source\\repos\\aspekt\\data\\data.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "C:\\Users\\profi\\source\\repos\\aspekt\\data\\data.csproj",
"projectName": "data",
"projectPath": "C:\\Users\\profi\\source\\repos\\aspekt\\data\\data.csproj",
"packagesPath": "C:\\Users\\profi\\.nuget\\packages\\",
"outputPath": "C:\\Users\\profi\\source\\repos\\aspekt\\data\\obj\\",
"projectStyle": "PackageReference",
"fallbackFolders": [
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
],
"configFilePaths": [
"C:\\Users\\profi\\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": "all"
},
"SdkAnalysisLevel": "9.0.100"
},
"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\\9.0.100/PortableRuntimeIdentifierGraph.json"
}
}
}
}
}

View 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\profi\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.12.1</NuGetToolVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="C:\Users\profi\.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\profi\.nuget\packages\microsoft.codeanalysis.analyzers\3.3.3</PkgMicrosoft_CodeAnalysis_Analyzers>
</PropertyGroup>
</Project>

View 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>

2197
data/obj/project.assets.json Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,47 @@
{
"version": 2,
"dgSpecHash": "L3E+alyl/Ys=",
"success": true,
"projectFilePath": "C:\\Users\\profi\\source\\repos\\aspekt\\data\\data.csproj",
"expectedPackageFiles": [
"C:\\Users\\profi\\.nuget\\packages\\humanizer.core\\2.14.1\\humanizer.core.2.14.1.nupkg.sha512",
"C:\\Users\\profi\\.nuget\\packages\\microsoft.bcl.asyncinterfaces\\6.0.0\\microsoft.bcl.asyncinterfaces.6.0.0.nupkg.sha512",
"C:\\Users\\profi\\.nuget\\packages\\microsoft.codeanalysis.analyzers\\3.3.3\\microsoft.codeanalysis.analyzers.3.3.3.nupkg.sha512",
"C:\\Users\\profi\\.nuget\\packages\\microsoft.codeanalysis.common\\4.5.0\\microsoft.codeanalysis.common.4.5.0.nupkg.sha512",
"C:\\Users\\profi\\.nuget\\packages\\microsoft.codeanalysis.csharp\\4.5.0\\microsoft.codeanalysis.csharp.4.5.0.nupkg.sha512",
"C:\\Users\\profi\\.nuget\\packages\\microsoft.codeanalysis.csharp.workspaces\\4.5.0\\microsoft.codeanalysis.csharp.workspaces.4.5.0.nupkg.sha512",
"C:\\Users\\profi\\.nuget\\packages\\microsoft.codeanalysis.workspaces.common\\4.5.0\\microsoft.codeanalysis.workspaces.common.4.5.0.nupkg.sha512",
"C:\\Users\\profi\\.nuget\\packages\\microsoft.entityframeworkcore\\8.0.10\\microsoft.entityframeworkcore.8.0.10.nupkg.sha512",
"C:\\Users\\profi\\.nuget\\packages\\microsoft.entityframeworkcore.abstractions\\8.0.10\\microsoft.entityframeworkcore.abstractions.8.0.10.nupkg.sha512",
"C:\\Users\\profi\\.nuget\\packages\\microsoft.entityframeworkcore.analyzers\\8.0.10\\microsoft.entityframeworkcore.analyzers.8.0.10.nupkg.sha512",
"C:\\Users\\profi\\.nuget\\packages\\microsoft.entityframeworkcore.design\\8.0.10\\microsoft.entityframeworkcore.design.8.0.10.nupkg.sha512",
"C:\\Users\\profi\\.nuget\\packages\\microsoft.entityframeworkcore.relational\\8.0.10\\microsoft.entityframeworkcore.relational.8.0.10.nupkg.sha512",
"C:\\Users\\profi\\.nuget\\packages\\microsoft.extensions.caching.abstractions\\8.0.0\\microsoft.extensions.caching.abstractions.8.0.0.nupkg.sha512",
"C:\\Users\\profi\\.nuget\\packages\\microsoft.extensions.caching.memory\\8.0.1\\microsoft.extensions.caching.memory.8.0.1.nupkg.sha512",
"C:\\Users\\profi\\.nuget\\packages\\microsoft.extensions.configuration.abstractions\\8.0.0\\microsoft.extensions.configuration.abstractions.8.0.0.nupkg.sha512",
"C:\\Users\\profi\\.nuget\\packages\\microsoft.extensions.dependencyinjection\\8.0.1\\microsoft.extensions.dependencyinjection.8.0.1.nupkg.sha512",
"C:\\Users\\profi\\.nuget\\packages\\microsoft.extensions.dependencyinjection.abstractions\\8.0.2\\microsoft.extensions.dependencyinjection.abstractions.8.0.2.nupkg.sha512",
"C:\\Users\\profi\\.nuget\\packages\\microsoft.extensions.dependencymodel\\8.0.2\\microsoft.extensions.dependencymodel.8.0.2.nupkg.sha512",
"C:\\Users\\profi\\.nuget\\packages\\microsoft.extensions.logging\\8.0.1\\microsoft.extensions.logging.8.0.1.nupkg.sha512",
"C:\\Users\\profi\\.nuget\\packages\\microsoft.extensions.logging.abstractions\\8.0.2\\microsoft.extensions.logging.abstractions.8.0.2.nupkg.sha512",
"C:\\Users\\profi\\.nuget\\packages\\microsoft.extensions.options\\8.0.2\\microsoft.extensions.options.8.0.2.nupkg.sha512",
"C:\\Users\\profi\\.nuget\\packages\\microsoft.extensions.primitives\\8.0.0\\microsoft.extensions.primitives.8.0.0.nupkg.sha512",
"C:\\Users\\profi\\.nuget\\packages\\mono.texttemplating\\2.2.1\\mono.texttemplating.2.2.1.nupkg.sha512",
"C:\\Users\\profi\\.nuget\\packages\\npgsql\\8.0.5\\npgsql.8.0.5.nupkg.sha512",
"C:\\Users\\profi\\.nuget\\packages\\npgsql.entityframeworkcore.postgresql\\8.0.10\\npgsql.entityframeworkcore.postgresql.8.0.10.nupkg.sha512",
"C:\\Users\\profi\\.nuget\\packages\\system.codedom\\4.4.0\\system.codedom.4.4.0.nupkg.sha512",
"C:\\Users\\profi\\.nuget\\packages\\system.collections.immutable\\6.0.0\\system.collections.immutable.6.0.0.nupkg.sha512",
"C:\\Users\\profi\\.nuget\\packages\\system.composition\\6.0.0\\system.composition.6.0.0.nupkg.sha512",
"C:\\Users\\profi\\.nuget\\packages\\system.composition.attributedmodel\\6.0.0\\system.composition.attributedmodel.6.0.0.nupkg.sha512",
"C:\\Users\\profi\\.nuget\\packages\\system.composition.convention\\6.0.0\\system.composition.convention.6.0.0.nupkg.sha512",
"C:\\Users\\profi\\.nuget\\packages\\system.composition.hosting\\6.0.0\\system.composition.hosting.6.0.0.nupkg.sha512",
"C:\\Users\\profi\\.nuget\\packages\\system.composition.runtime\\6.0.0\\system.composition.runtime.6.0.0.nupkg.sha512",
"C:\\Users\\profi\\.nuget\\packages\\system.composition.typedparts\\6.0.0\\system.composition.typedparts.6.0.0.nupkg.sha512",
"C:\\Users\\profi\\.nuget\\packages\\system.io.pipelines\\6.0.3\\system.io.pipelines.6.0.3.nupkg.sha512",
"C:\\Users\\profi\\.nuget\\packages\\system.reflection.metadata\\6.0.1\\system.reflection.metadata.6.0.1.nupkg.sha512",
"C:\\Users\\profi\\.nuget\\packages\\system.runtime.compilerservices.unsafe\\6.0.0\\system.runtime.compilerservices.unsafe.6.0.0.nupkg.sha512",
"C:\\Users\\profi\\.nuget\\packages\\system.text.encoding.codepages\\6.0.0\\system.text.encoding.codepages.6.0.0.nupkg.sha512",
"C:\\Users\\profi\\.nuget\\packages\\system.threading.channels\\6.0.0\\system.threading.channels.6.0.0.nupkg.sha512"
],
"logs": []
}

29
domain/GroupUseCase.cs Normal file
View File

@ -0,0 +1,29 @@
using Data.Models;
using Data.Repository;
using domain.Models.RequestModels;
namespace domain;
public class GroupUseCase
{
private readonly IGroupRepository _repository;
public GroupUseCase(IGroupRepository repository) {
_repository = repository;
}
public void addGroup(GroupAddRequest groupAddRequest) {
GroupLocalEntity groupLocalEntity = new GroupLocalEntity { Name = groupAddRequest.Name };
_repository.AddGroup(groupLocalEntity);
}
public List<GroupResponse> getAllGroup(){
return _repository.GetAllGroup().Select(group =>
new GroupResponse {
Id = group.Id,
Name = group.Name
}
).ToList();
}
}

View File

@ -4,9 +4,10 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Demo.Data.RemoteData.RemoteDataBase namespace domain.Models.RequestModels
{ {
internal class RemoteDatabase public class GroupAddRequest
{ {
public string Name { get; set; }
} }
} }

View File

@ -0,0 +1,4 @@
public class GroupResponse{
public int Id {get; set;}
public string Name {get; set;}
}

View File

@ -0,0 +1,44 @@
using Data.RemoteData.DAO;
namespace Data.domain.UseCase
{
internal class UseCasePresence
{
private List<PresnceDao> attendanceRecords;
public UseCasePresence(List<PresnceDao> attendanceRecords)
{
this.attendanceRecords = attendanceRecords;
}
public List<PresnceDao> GetAttendanceByGroup(string groupNumber)
{
return attendanceRecords.Where(record => record.userDao.Group.GroupName == groupNumber).ToList();
}
public List<PresnceDao> GetAttendanceByGroupAndDate(string groupNumber, DateOnly date)
{
return attendanceRecords.Where(record => record.userDao.Group.GroupName == groupNumber && record.Date == date).ToList();
}
public void MarkUserAsAbsent(string groupNumber, int firstLesson, int lastLesson, DateOnly date)
{
foreach (var lesson in Enumerable.Range(firstLesson, lastLesson - firstLesson + 1))
{
var record = attendanceRecords.FirstOrDefault(r => r.userDao.Group.GroupName == groupNumber && r.LessonNumber == lesson && r.Date == date);
if (record != null)
{
record.IsAttendensy = false;
}
}
}
public void MarkUserAsAbsentForWeek(string groupNumber, int firstLesson, int lastLesson, DateOnly startDate)
{
foreach (var day in Enumerable.Range(0, 7))
{
var date = startDate.AddDays(day);
MarkUserAsAbsent(groupNumber, firstLesson, lastLesson, date);
}
}
}
}

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More