This commit is contained in:
Userok 2024-11-08 11:29:02 +03:00
parent 5124d95d3d
commit d14f30b583
40 changed files with 69 additions and 25 deletions

View File

@ -8,9 +8,10 @@ namespace Data.RemoteData.DAO
{ {
public class GroupDao public class GroupDao
{ {
public int Id { get; set; } internal static List<GroupDao> Name = new List<GroupDao>();
public string Name { get; set; }
public virtual IEnumerable<UserDao> Users { get; set; } public int Id { get; set; }
public required string GroupName { get; set; }
public IEnumerable<UserDao> Users { get; set; }
} }
} }

View File

@ -6,14 +6,13 @@ using System.Threading.Tasks;
namespace Data.RemoteData.DAO namespace Data.RemoteData.DAO
{ {
internal class PresenceDao public class PresnceDao
{ {
public Guid UserGuid { get; set; } public Guid UserGuid { get; set; }
public bool IsAttedance { get; set; } = true; public bool IsAttendensy { get; set; } = true;
public DateOnly Date { get; set; }
public int LessonNumber { get; set; } public int LessonNumber { get; set; }
public DateOnly Date { get; set; }
public virtual UserDao UserDao { get; set; } public UserDao userDao { get; set; }
} }
} }

View File

@ -7,7 +7,7 @@ namespace data.RemoteData
{ {
internal DbSet<GroupDao> Group { get; set; } internal DbSet<GroupDao> Group { get; set; }
internal DbSet<UserDao> User { get; set; } internal DbSet<UserDao> User { get; set; }
internal DbSet<PresenceDao> Presence { get; set; } internal DbSet<PresnceDao> Presence { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{ {
@ -18,9 +18,9 @@ namespace data.RemoteData
{ {
modelBuilder.Entity<GroupDao>().HasKey(group => group.Id); modelBuilder.Entity<GroupDao>().HasKey(group => group.Id);
modelBuilder.Entity<UserDao>().HasKey(user => user.Guid); modelBuilder.Entity<UserDao>().HasKey(user => user.Guid);
modelBuilder.Entity<PresenceDao>().HasKey(presence => new { modelBuilder.Entity<PresnceDao>().HasKey(presence => new {
presence.UserGuid, presence.UserGuid,
presence.IsAttedance, presence.IsAttendensy,
presence.Date, presence.Date,
presence.LessonNumber, presence.LessonNumber,
}); });

View File

@ -20,7 +20,7 @@ namespace Data.Repository
public bool AddGroup(GroupLocalEntity newGroup) public bool AddGroup(GroupLocalEntity newGroup)
{ {
GroupDao groupDao = new GroupDao { Name = newGroup.Name }; GroupDao groupDao = new GroupDao { GroupName = newGroup.Name };
var result = _remoteDataBaseContext.Group.Add(groupDao); var result = _remoteDataBaseContext.Group.Add(groupDao);
if (result != null) { if (result != null) {
_remoteDataBaseContext.SaveChanges(); _remoteDataBaseContext.SaveChanges();
@ -32,7 +32,7 @@ namespace Data.Repository
{ {
return _remoteDataBaseContext.Group.Select(group => new GroupLocalEntity{ return _remoteDataBaseContext.Group.Select(group => new GroupLocalEntity{
Id = group.Id, Id = group.Id,
Name = group.Name} Name = group.GroupName}
).ToList(); ).ToList();
} }

Binary file not shown.

Binary file not shown.

View File

@ -13,7 +13,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("data")] [assembly: System.Reflection.AssemblyCompanyAttribute("data")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+5124d95d3daae0a4fb8c67dff74fc5e25268f700")]
[assembly: System.Reflection.AssemblyProductAttribute("data")] [assembly: System.Reflection.AssemblyProductAttribute("data")]
[assembly: System.Reflection.AssemblyTitleAttribute("data")] [assembly: System.Reflection.AssemblyTitleAttribute("data")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

View File

@ -1 +1 @@
6741393a5fe1cc20988265f6fd0e8bdd33ee4b9cc7b9e110a41e548fdd825a94 f79085eebfdd7035c27d101a32916355d93e5f513df432f9a3075f4253aa1b2c

Binary file not shown.

Binary file not shown.

Binary file not shown.

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.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -13,7 +13,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("domain")] [assembly: System.Reflection.AssemblyCompanyAttribute("domain")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+5124d95d3daae0a4fb8c67dff74fc5e25268f700")]
[assembly: System.Reflection.AssemblyProductAttribute("domain")] [assembly: System.Reflection.AssemblyProductAttribute("domain")]
[assembly: System.Reflection.AssemblyTitleAttribute("domain")] [assembly: System.Reflection.AssemblyTitleAttribute("domain")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

View File

@ -1 +1 @@
50afef9105125301dd1c05ea9fb1e5f605a3f79c6aca753bbf0156749546e4dd 9c029f0b724d07a712a5d941d1aa11410bfa94baebf4624d9063852c950ebe3f

View File

@ -1 +1 @@
06e54d2e250f99be5b9c0d574f3c9686446bd7b207bc068308acbd6c108463f7 dde64b0792f50fd0b7b79f917c9fba1b6079d6bb705e8b58d3634905ee7db9c7

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -13,10 +13,10 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("ui")] [assembly: System.Reflection.AssemblyCompanyAttribute("ui")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+5124d95d3daae0a4fb8c67dff74fc5e25268f700")]
[assembly: System.Reflection.AssemblyProductAttribute("ui")] [assembly: System.Reflection.AssemblyProductAttribute("ui")]
[assembly: System.Reflection.AssemblyTitleAttribute("ui")] [assembly: System.Reflection.AssemblyTitleAttribute("ui")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Generated by the MSBuild WriteCodeFragment class. // Создано классом WriteCodeFragment MSBuild.

View File

@ -1 +1 @@
20ed1ba88db46bd37bf95cc037aa54d55b6a60c0405520a36b7f26aec1c3e1fe 949b5e9c101aeb5918553be7acfbb6a7908a62a118405d2f2df4707237ffb8cf

Binary file not shown.

Binary file not shown.