2024-10-17 11:46:19 +00:00
|
|
|
using Demo.Domain.Models;
|
|
|
|
using Demo.Domain.UseCase;
|
|
|
|
|
|
|
|
namespace Demo.UI
|
|
|
|
{
|
|
|
|
public class MainMenuUI
|
|
|
|
{
|
|
|
|
|
|
|
|
UserConsoleUI _userConsoleUI;
|
|
|
|
GroupConsoleUI _groupConsoleUI;
|
2024-10-22 18:51:54 +00:00
|
|
|
PresenceConsoleUI _presenceConsoleUI;
|
2024-10-17 11:46:19 +00:00
|
|
|
|
2024-10-22 18:51:54 +00:00
|
|
|
public MainMenuUI(IUserUseCase userUseCase, IGroupUseCase groupUseCase, IPresenceUseCase presenceUseCase) {
|
2024-10-17 11:46:19 +00:00
|
|
|
_userConsoleUI = new UserConsoleUI(userUseCase);
|
2024-10-28 10:39:15 +00:00
|
|
|
_groupConsoleUI = new GroupConsoleUI(groupUseCase, userUseCase, presenceUseCase);
|
2024-10-22 18:51:54 +00:00
|
|
|
_presenceConsoleUI = new PresenceConsoleUI(presenceUseCase);
|
2024-10-17 11:46:19 +00:00
|
|
|
DisplayMenu();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private void DisplayMenu() {
|
|
|
|
while (true)
|
|
|
|
{
|
|
|
|
switch (Console.ReadLine())
|
|
|
|
{
|
2024-10-28 10:39:15 +00:00
|
|
|
case "0": _groupConsoleUI.DisplayAllBoutGroup(Convert.ToInt32(Console.ReadLine())); break;
|
2024-10-24 15:57:52 +00:00
|
|
|
case "1": _groupConsoleUI.DisplayAllGroups(); break;
|
|
|
|
case "2": _groupConsoleUI.CreateNewGroup(Console.ReadLine()); break;
|
|
|
|
case "3": _groupConsoleUI.UpdateGroupName(Group.Parse(Console.ReadLine())); break;
|
|
|
|
case "4": _groupConsoleUI.DisplayGroupByID(Convert.ToInt32(Console.ReadLine())); break;
|
|
|
|
case "5": _groupConsoleUI.RemoveGroupByID(Convert.ToInt32(Console.ReadLine())); break;
|
|
|
|
|
|
|
|
case "6": _userConsoleUI.DisplayAllUsers(); break;
|
|
|
|
case "7": _userConsoleUI.DisplayUserByGuid(Guid.Parse(Console.ReadLine())); break;
|
|
|
|
case "8": _userConsoleUI.UpdateUserByGuid(User.Parse(Console.ReadLine())); break;
|
|
|
|
case "9": _userConsoleUI.RemoveUserByGuid(Guid.Parse(Console.ReadLine())); break;
|
2024-10-22 18:51:54 +00:00
|
|
|
|
|
|
|
case "10": Console.WriteLine("писяпопакака"); break;
|
|
|
|
|
2024-10-24 15:57:52 +00:00
|
|
|
case "11": _presenceConsoleUI.DisplayPresenceByGroup(Convert.ToInt32(Console.ReadLine())); break;
|
|
|
|
case "12": _presenceConsoleUI.DisplayPresenceByGroupByTime(Convert.ToInt32(Console.ReadLine()), DateOnly.FromDateTime(Convert.ToDateTime(Console.ReadLine()))); break;
|
|
|
|
case "13": _presenceConsoleUI.GeneratePresence(Convert.ToInt32(Console.ReadLine()), Convert.ToInt32(Console.ReadLine()), Convert.ToInt32(Console.ReadLine()), DateOnly.FromDateTime(Convert.ToDateTime(Console.ReadLine()))); break;
|
|
|
|
case "14": _presenceConsoleUI.GeneratePresenceWeek(Convert.ToInt32(Console.ReadLine()), Convert.ToInt32(Console.ReadLine()), Convert.ToInt32(Console.ReadLine()), DateOnly.FromDateTime(Convert.ToDateTime(Console.ReadLine()))); break;
|
|
|
|
case "15": _presenceConsoleUI.IsAttedance(Convert.ToInt32(Console.ReadLine()), Convert.ToInt32(Console.ReadLine()), DateOnly.FromDateTime(Convert.ToDateTime(Console.ReadLine())), Guid.Parse(Console.ReadLine())); break;
|
2024-10-17 11:46:19 +00:00
|
|
|
|
|
|
|
default: DisplayMenu();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|