2024-11-11 20:02:21 +00:00
|
|
|
using Posechaemost.Data.Repository;
|
2024-10-17 16:08:02 +00:00
|
|
|
using Posechaemost.Domain.UseCase;
|
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Text;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
namespace Posechaemost.UI
|
|
|
|
{
|
|
|
|
public class MainMenuUI
|
|
|
|
{
|
|
|
|
|
|
|
|
UserConsoleUI _userConsoleUI;
|
|
|
|
GroupConsoleUI _groupConsoleUI;
|
2024-10-28 08:32:57 +00:00
|
|
|
PresenceConsoleUI _presenceConsoleUI;
|
2024-10-17 16:08:02 +00:00
|
|
|
|
2024-11-11 20:02:21 +00:00
|
|
|
public MainMenuUI(UserUseCase userUseCase, GroupUseCase groupUseCase, PresenceUseCase presenceUseCase, IPresenceRepository presenceRepository)
|
2024-10-17 16:08:02 +00:00
|
|
|
{
|
|
|
|
_userConsoleUI = new UserConsoleUI(userUseCase);
|
|
|
|
_groupConsoleUI = new GroupConsoleUI(groupUseCase);
|
2024-11-11 20:02:21 +00:00
|
|
|
_presenceConsoleUI = new PresenceConsoleUI(presenceUseCase, presenceRepository);
|
2024-10-28 08:32:57 +00:00
|
|
|
|
2024-10-17 16:08:02 +00:00
|
|
|
|
|
|
|
DisplayMenu();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2024-11-11 20:02:21 +00:00
|
|
|
public void DisplayMenu()
|
2024-10-17 16:08:02 +00:00
|
|
|
{
|
|
|
|
while (true)
|
|
|
|
{
|
|
|
|
switch (Console.ReadLine())
|
|
|
|
{
|
|
|
|
case "1": _userConsoleUI.DisplayAllUsers(); break;
|
2024-11-06 04:10:09 +00:00
|
|
|
case "2": _userConsoleUI.RemoveUserById(int.Parse(Console.ReadLine())); break;
|
2024-10-17 16:08:02 +00:00
|
|
|
case "3": _groupConsoleUI.DisplayAllGroups(); break;
|
2024-11-06 04:10:09 +00:00
|
|
|
case "4": _userConsoleUI.GetUserById(int.Parse(Console.ReadLine())); break;
|
|
|
|
case "5": _userConsoleUI.UpdateUserById(int.Parse(Console.ReadLine()), Console.ReadLine(), int.Parse(Console.ReadLine())); break;
|
2024-10-18 08:27:50 +00:00
|
|
|
case "6": _groupConsoleUI.UpdateGroupName(Console.ReadLine(), Console.ReadLine()); break;
|
2024-10-18 08:43:40 +00:00
|
|
|
case "7": _groupConsoleUI.AddGroup(Console.ReadLine(), Console.ReadLine()); break;
|
2024-11-06 04:10:09 +00:00
|
|
|
case "8": _presenceConsoleUI.GetPresenceByGroup(int.Parse(Console.ReadLine())); break;
|
|
|
|
case "9": _presenceConsoleUI.GetPresenceByGroupAndDate(int.Parse(Console.ReadLine()), DateOnly.Parse(Console.ReadLine())); break;
|
|
|
|
case "10": _presenceConsoleUI.UncheckAttendence(int.Parse(Console.ReadLine()), int.Parse(Console.ReadLine()), DateOnly.Parse(Console.ReadLine()), int.Parse(Console.ReadLine())); break;
|
|
|
|
case "11": _presenceConsoleUI.AddPresence(int.Parse(Console.ReadLine()), int.Parse(Console.ReadLine()), int.Parse(Console.ReadLine()), DateOnly.Parse(Console.ReadLine())); break;
|
2024-11-11 20:02:21 +00:00
|
|
|
case "12": _presenceConsoleUI.ExportPresenceToExcel(int.Parse(Console.ReadLine()), Console.ReadLine()); break;
|
|
|
|
case "13": _presenceConsoleUI.GenerateWeeklyPresence(int.Parse(Console.ReadLine()), int.Parse(Console.ReadLine()), int.Parse(Console.ReadLine()), DateOnly.Parse(Console.ReadLine())); break;
|
2024-10-17 16:08:02 +00:00
|
|
|
default: DisplayMenu();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|