46 lines
2.1 KiB
C#
46 lines
2.1 KiB
C#
|
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);
|
|||
|
}
|
|||
|
|
|||
|
public void DisplayPresenceByGroupByTime(int groupID, DateOnly date){
|
|||
|
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);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|