Demo/UI/PresenceConsole.cs

46 lines
2.1 KiB
C#
Raw Normal View History

2024-10-23 19:46:46 +00:00
using Demo.Domain.UseCase;
using Demo.domain.Models;
using System.Text;
namespace Demo.UI
{
public class PresenceConsoleUI {
IPresenceUseCase _presenceUseCase;
public PresenceConsoleUI (IPresenceUseCase presenceUseCase){
_presenceUseCase = presenceUseCase;
}
public void DisplayPresenceByGroup(int groupID){
StringBuilder stringBuilder = new StringBuilder();
foreach(Presence presence in _presenceUseCase.GetPresencesByGroup(groupID)){
stringBuilder.AppendLine($"{presence.User.FIO}, {presence.User.Group.Name}, {presence.IsAttedance}, {presence.Date}, {presence.LessonNumber}");
}
Console.WriteLine(stringBuilder);
}
2024-10-24 20:41:31 +00:00
public void DisplayPresenceByGroupAndDate(int groupID, DateOnly date){
2024-10-23 19:46:46 +00:00
StringBuilder stringBuilder = new StringBuilder();
foreach(Presence presence in _presenceUseCase.GetPresencesByGroupAndDate(groupID, date)){
stringBuilder.AppendLine($"{presence.User.FIO}, {presence.User.Group.Name}, {presence.IsAttedance}, {presence.Date}, {presence.LessonNumber}");
}
Console.WriteLine(stringBuilder);
}
public void GeneratePresence(int firstLesson, int lastLesson, int groupID, DateOnly date){
string output = _presenceUseCase.GeneratePresence(firstLesson, lastLesson, groupID, date) ? "Сгенерированно" : "Не сгенерированно";
Console.WriteLine(output);
}
public void GeneratePresenceWeek(int firstLesson, int lastLesson, int groupID, DateOnly date){
string output = _presenceUseCase.GenerateWeekPresence(firstLesson, lastLesson, groupID, date) ? "Сгенерированно" : "Не сгенерированно";
Console.WriteLine(output);
}
public void IsAttedance(int firstLesson, int lastLesson, DateOnly date, Guid UserGuid){
string output = _presenceUseCase.UpdateAttedance(firstLesson, lastLesson, date, UserGuid) ? "Обновлено" : "Не обновлено";
Console.WriteLine(output);
}
}
}