Exemple #1
0
        private async void Initialize()
        {
            try
            {
                IsBusy           = true;
                IsRefreshVisible = false;
                string userId         = AccountHelper.GetCurrentUserId();
                string userInternalId =
                    await _userDataService.GetUserInternalId(userId, Constants.MainAuthenticationDomain);

                var taskItems = await _taskItemDataService.GetTaskItems(userInternalId);

                TaskSubitems = new ObservableCollection <TaskSubitem>();
                foreach (var taskItem in taskItems)
                {
                    var taskSubitems = await _taskSubitemDataService.GetTaskSubitems(taskItem.Id);

                    Func <TaskSubitem, bool> func = t => t.TaskStatusId == ((int)TaskStatusEnum.InProgress).ToString() &&
                                                    t.EndDateTime.HasValue &&
                                                    t.EndDateTime.Value.Date <= DateTime.Today;
                    taskSubitems.Where(func).ForEach(t => TaskSubitems.Add(t));
                }
            }
            catch (Exception ex)
            {
                new MessageDialog(ex.Message).ShowAsync();
            }
            IsBusy           = false;
            IsRefreshVisible = true;
        }
Exemple #2
0
        private async Task Refresh()
        {
            try
            {
                IsBusy = true;
                var    userId         = AccountHelper.GetCurrentUserId();
                string userInternalId = await _userDataService.GetUserInternalId(userId, Constants.MainAuthenticationDomain);

                TaskItems = await _taskItemDataService.GetTaskItems(userInternalId);

                TaskItems = TaskItems.OrderBy(t => t.Name).ToObservableCollection();
            }
            catch (Exception ex)
            {
                new MessageDialog(ex.Message).ShowAsync();
            }
            IsBusy = false;
        }
Exemple #3
0
        private async Task Initialize()
        {
            var userId = AccountHelper.GetCurrentUserId();

            string userInternalId = await _userDataService.GetUserInternalId(userId, Constants.MainAuthenticationDomain);

            var taskItems = await _taskItemDataService.GetTaskItems(userInternalId);

            var tasksNotCompleted = taskItems.Where(t => t.TaskStatusId != ((int)TaskStatusEnum.Completed).ToString());

            List <TaskSubitem> userTaskSubitems = new List <TaskSubitem>();

            foreach (var taskItem in tasksNotCompleted)
            {
                var taskSubitems = await _taskSubitemDataService.GetTaskSubitems(taskItem.Id);

                var items = taskSubitems.Where(
                    t =>
                    t.ExecutorId == userInternalId &&
                    t.EndDateTime.HasValue &&
                    t.TaskStatusId != ((int)TaskStatusEnum.Completed).ToString()).ToList();
                if (items.Any())
                {
                    userTaskSubitems.AddRange(items);
                }
            }

            var tasksGroupedByEndDate = userTaskSubitems.GroupBy(t => t.EndDateTime.Value.Date);

            foreach (var dateTask in tasksGroupedByEndDate)
            {
                Add(dateTask.Key.Date, new TaskSubitem()
                {
                    Name        = "Deadline: " + String.Join(" || ", dateTask.Select(t => t.Name).ToList()),
                    Description = String.Join(" || ", dateTask.Select(t => t.Description).ToList())
                });
            }
        }