implemented presence. not generating for a week
This commit is contained in:
parent
dd18de3865
commit
0705829116
@ -11,7 +11,7 @@ namespace Posechaemost.Data.Repository
|
||||
{
|
||||
List<PresenceLocalEntity> GetPresenceByGroup(int groupId);
|
||||
List<PresenceLocalEntity> GetPresenceByGroupAndDate(int groupId, DateOnly date);
|
||||
bool UncheckAttendence(PresenceLocalEntity presence);
|
||||
bool UncheckAttendence(int firstClass, int lastClass, DateOnly date, Guid userGuid);
|
||||
void AddPresence(PresenceLocalEntity presence);
|
||||
|
||||
}
|
||||
|
@ -36,15 +36,14 @@ namespace Posechaemost.Data.Repository
|
||||
return GetAllPresences;
|
||||
}
|
||||
|
||||
public bool UncheckAttendence(PresenceLocalEntity presence)
|
||||
public bool UncheckAttendence(int firstClass, int lastClass, DateOnly date, Guid userGuid)
|
||||
{
|
||||
var presToUpdate = GetAllPresences
|
||||
.Where(x => x.IsAttendence == presence.IsAttendence
|
||||
&& x.UserGuid == presence.UserGuid && x.Date == presence.Date
|
||||
&& x.ClassNumber == presence.ClassNumber).ToList();
|
||||
.Where(x => x.UserGuid == userGuid && x.ClassNumber >= firstClass
|
||||
&& x.ClassNumber <= lastClass && x.Date == date).ToList();
|
||||
|
||||
foreach (var pres in presToUpdate) {
|
||||
presence.IsAttendence = false;
|
||||
pres.IsAttendence = false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -64,8 +64,20 @@ namespace Posechaemost.Domain.UseCase
|
||||
return presenceByGroupAndDate;
|
||||
}
|
||||
|
||||
public bool UncheckAttendence(PresenceLocalEntity presence) {
|
||||
return _repositoryPresenceImpl.UncheckAttendence(presence);
|
||||
public bool UncheckAttendence(int firstClass, int lastClass, DateOnly date, Guid userGuid) {
|
||||
return _repositoryPresenceImpl.UncheckAttendence(firstClass, lastClass, date, userGuid);
|
||||
}
|
||||
|
||||
public void AddPresence(int firstClass, int lastClass, int groupId,DateOnly date)
|
||||
{
|
||||
var users = _repositoryUserImpl.GetAllUser().Where(x => x.GroupID==groupId).ToList();
|
||||
List<PresenceLocalEntity> presenceList = new List<PresenceLocalEntity>();
|
||||
for (int i = firstClass; i < lastClass; i++) {
|
||||
foreach (var user in users) {
|
||||
PresenceLocalEntity pres = new PresenceLocalEntity {ClassNumber = i, Date = date, UserGuid = user.Guid};
|
||||
presenceList.Add(pres);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -12,11 +12,14 @@ namespace Posechaemost.UI
|
||||
|
||||
UserConsoleUI _userConsoleUI;
|
||||
GroupConsoleUI _groupConsoleUI;
|
||||
PresenceConsoleUI _presenceConsoleUI;
|
||||
|
||||
public MainMenuUI(UserUseCase userUseCase, GroupUseCase groupUseCase)
|
||||
public MainMenuUI(UserUseCase userUseCase, GroupUseCase groupUseCase, PresenceUseCase presenceUseCase)
|
||||
{
|
||||
_userConsoleUI = new UserConsoleUI(userUseCase);
|
||||
_groupConsoleUI = new GroupConsoleUI(groupUseCase);
|
||||
_presenceConsoleUI = new PresenceConsoleUI(presenceUseCase);
|
||||
|
||||
|
||||
DisplayMenu();
|
||||
|
||||
|
32
UI/PresenceConsole.cs
Normal file
32
UI/PresenceConsole.cs
Normal file
@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Posechaemost.Domain.UseCase;
|
||||
|
||||
namespace Posechaemost.UI
|
||||
{
|
||||
public class PresenceConsoleUI
|
||||
{
|
||||
PresenceUseCase _presenceUseCase;
|
||||
public PresenceConsoleUI(PresenceUseCase presenceUseCase) {
|
||||
_presenceUseCase = presenceUseCase;
|
||||
}
|
||||
|
||||
public void GetPresenceByGroup(int groupId) {
|
||||
var presence = _presenceUseCase.GetPresenceByGroup(groupId);
|
||||
}
|
||||
|
||||
public void GetPresenceByGroupAndDate(int groupId, DateOnly date) {
|
||||
var presence = _presenceUseCase.GetPresenceByGroupAndDate(groupId, date);
|
||||
}
|
||||
|
||||
public void UncheckAttendence(int firstClass, int lastClass, DateOnly date, Guid userGuid) {
|
||||
var presence = _presenceUseCase.UncheckAttendence(firstClass, lastClass, date, userGuid);
|
||||
}
|
||||
|
||||
public void AddPresence(int firstClass, int lastClass, int groupId, DateOnly date) {
|
||||
_presenceUseCase.AddPresence(firstClass, lastClass, groupId, date);
|
||||
}
|
||||
}
|
||||
}
|
@ -13,7 +13,7 @@ using System.Reflection;
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("Posechaemost")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+6b32e405d76bb739524c318b227f1fa95db1cba6")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+dd18de386525d2859a6db90bb74a2bdc95bc47e3")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("Posechaemost")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("Posechaemost")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
@ -1 +1 @@
|
||||
4adf1b2c58c78e6eafd52a8be1c408433fb9f4a3525dbf62f4e5019169eebcab
|
||||
e484c6d2be3801b673b3b8bec4389b40f150f0a04dc9544c29a279722a7318c6
|
||||
|
Loading…
Reference in New Issue
Block a user