public TaskListPage(UserDTO user)
        {
            _user          = user;
            _provider      = new TaskManagerProvider();
            _businessLogic = new TaskManagerBusinessLogic();

            _tasks = _provider.GetTasksByUser(_user);
            _businessLogic.SortTasks(_tasks);

            string status;

            foreach (TaskDTO task in _tasks)
            {
                if (task.IsDone)
                {
                    status = "Done";
                }
                else
                {
                    status = "In progress";
                }

                buttons.Add(new Button
                {
                    Content      = $"{task.PublisherName}  to group {task.GroupTitle}  \n{task.PublicationDate}    {status} \n{task.Content}",
                    ButtonAction = MarkTaskAsDone
                });
            }

            buttons.Add(new Button {
                Content = "<-- back to Main Menu", ButtonAction = BackToMainMenu
            });
        }
Beispiel #2
0
        public GroupPage(GroupDTO group, UserDTO user)
        {
            _group         = group;
            _user          = user;
            _provider      = new TaskManagerProvider();
            _businessLogic = new TaskManagerBusinessLogic();

            _tasks = _provider.GetTasksByGroup(_group);
            _businessLogic.SortTasks(_tasks);

            buttons.Add(new Button {
                Content = $"Group : {group.Title}\n", ButtonAction = NullAction, AbilityToChange = false
            });

            string status = string.Empty;

            foreach (TaskDTO task in _tasks)
            {
                if (task.IsDone)
                {
                    status = "Done";
                }
                else
                {
                    status = "In progress";
                }

                buttons.Add(new Button
                {
                    Content      = $"{task.PublisherName}   {task.PublicationDate}   {status} \n{task.Content}",
                    ButtonAction = MarkTaskAsDone
                });
            }

            buttons.Add(new Button {
                Content = "Add new task", ButtonAction = AddNewTask, AbilityToChange = false
            });
            buttons.Add(new Button {
                Content = "Add new user", ButtonAction = AddNewUserToGroup, AbilityToChange = false
            });
            buttons.Add(new Button {
                Content = "Leave group", ButtonAction = LeaveGroup, AbilityToChange = false
            });
            buttons.Add(new Button {
                Content = "<-- back to groups", ButtonAction = BackToGroups, AbilityToChange = false
            });
        }