Exemplo n.º 1
0
        private async void Initialize()
        {
            IsBusy          = true;
            AvailableGroups = await _groupDataService.GetGroupsAvailableForUser(AccountHelper.GetCurrentUserId());

            AvailableTaskStatuses = await _taskItemDataService.GetAvailableTaskStatuses();

            SelectedTaskStatus = AvailableTaskStatuses.First();
            SelectedGroup      =
                AvailableGroups.SingleOrDefault(g => g.GroupName.Contains(Constants.DefaultGroupForUserNamePrefix));

            if (_associatedTaskItem != null)
            {
                Id                 = _associatedTaskItem.Id;
                Name               = _associatedTaskItem.Name;
                Description        = _associatedTaskItem.Description;
                SelectedTaskStatus = _availableTaskStatuses.Single(s => s.Id == _associatedTaskItem.TaskStatusId);
                SelectedGroup      = _availableGroups.Single(g => g.Id == _associatedTaskItem.GroupId);
                StartDateTime      = _associatedTaskItem.StartDateTime.Value;
                EndDateTime        = _associatedTaskItem.EndDateTime.Value;
                IsCompleted        = _associatedTaskItem.IsCompleted;
                IsDeleted          = _associatedTaskItem.IsDeleted;
            }
            IsBusy = false;
        }
Exemplo n.º 2
0
        private async void Initialize()
        {
            IsBusy = true;
            AvailableTaskStatuses = await _taskItemDataService.GetAvailableTaskStatuses();

            SelectedTaskStatus = AvailableTaskStatuses.First();
            if (_associatedTaskSubitem != null && _associatedTaskItem != null)
            {
                AvailableTaskSubitems = await _taskSubitemDataService.GetTaskSubitems(_associatedTaskItem.Id);

                Id                  = _associatedTaskSubitem.Id;
                Name                = _associatedTaskSubitem.Name;
                Description         = _associatedTaskSubitem.Description;
                SelectedTaskStatus  = _availableTaskStatuses.Single(s => s.Id == _associatedTaskSubitem.TaskStatusId);
                StartDateTime       = _associatedTaskSubitem.StartDateTime.Value;
                EndDateTime         = _associatedTaskSubitem.EndDateTime.Value;
                EstimationInHours   = _associatedTaskSubitem.EstimationInHours;
                IsCompleted         = _associatedTaskSubitem.IsCompleted;
                IsDeleted           = _associatedTaskSubitem.IsDeleted;
                SelectedPredecessor = !String.IsNullOrWhiteSpace(_associatedTaskSubitem.PredecessorId) ? AvailableTaskSubitems.SingleOrDefault(t => t.Id == _associatedTaskSubitem.PredecessorId) : null;
                SelectedSuccessor   = !String.IsNullOrWhiteSpace(_associatedTaskSubitem.SuccessorId) ? AvailableTaskSubitems.SingleOrDefault(t => t.Id == _associatedTaskSubitem.SuccessorId) : null;
                AvailableGroupUsers = await _userDataService.GetUsersFromGroup(_associatedTaskItem.GroupId);

                SelectedExecutor = !String.IsNullOrWhiteSpace(_associatedTaskSubitem.ExecutorId) ? AvailableGroupUsers.SingleOrDefault(u => u.Id == _associatedTaskSubitem.ExecutorId) : null;
            }
            else if (_associatedTaskItem != null)
            {
                AvailableTaskSubitems = await _taskSubitemDataService.GetTaskSubitems(_associatedTaskItem.Id);

                AvailableGroupUsers = await _userDataService.GetUsersFromGroup(_associatedTaskItem.GroupId);
            }
            IsBusy = false;
        }