예제 #1
0
        public async Task <IEnumerable <WorkflowVariableViewModel> > GetVariablesAsync(int id)
        {
            var list = await this.repository.ListAsync(new WorkflowVariablesForWorkflow(id));

            var workflow = list.FirstOrDefault();

            if (workflow == null)
            {
                throw new KeyNotFoundException(nameof(id));
            }

            var viewModels = workflow.WorkflowVariables.OrderBy(v => v.Type);

            return(ViewModelMapper.ToWorkflowVariableViewModelList(viewModels));
        }
예제 #2
0
        public async Task <IEnumerable <WorkflowHistoryViewModel> > GetHistoryAsync(int id)
        {
            var list = await this.repository.ListAsync(new WorkflowHistoryForWorkflow(id));

            var workflow = list.FirstOrDefault();

            if (workflow == null)
            {
                throw new KeyNotFoundException(nameof(id));
            }

            var viewModels = workflow.WorkflowHistories.OrderByDescending(h => h.Created);

            return(ViewModelMapper.ToWorkflowHistoryViewModelList(viewModels));
        }
예제 #3
0
        public async Task <PaginatedList <WorkItemViewModel> > GetFailedAsync(
            PagingParameters pagingParameters
            )
        {
            var count = await this.repository
                        .CountAsync(new WorkItemRetryLimitHitCount(WorkItem.WORKITEM_RETRIES));

            var items = await this.repository
                        .ListAsync(new WorkItemRetryLimitHitCountOrderedPaginated(
                                       WorkItem.WORKITEM_RETRIES,
                                       pagingParameters.SkipCount,
                                       pagingParameters.PageSize
                                       ));

            return(new PaginatedList <WorkItemViewModel>(
                       ViewModelMapper.ToWorkItemViewModelList(items),
                       count,
                       pagingParameters.PageIndex,
                       pagingParameters.PageSize
                       ));
        }
예제 #4
0
        public async Task <PaginatedList <WorkItemViewModel> > GetUpCommingsAsync(
            PagingParameters pagingParameters
            )
        {
            var now = SystemTime.Now();

            var count = await this.repository
                        .CountAsync(new WorkItemDueDateGreaterThanNowCount(now));

            var items = await this.repository
                        .ListAsync(new WorkItemDueDateGreaterThanNowOrderedPaginated(
                                       now,
                                       pagingParameters.SkipCount,
                                       pagingParameters.PageSize
                                       ));

            return(new PaginatedList <WorkItemViewModel>(
                       ViewModelMapper.ToWorkItemViewModelList(items),
                       count,
                       pagingParameters.PageIndex,
                       pagingParameters.PageSize
                       ));
        }
예제 #5
0
 public IEnumerable <WorkItemViewModel> GetSnapshot()
 {
     return(ViewModelMapper.ToWorkItemViewModelList(this.Items.ToArray()));
 }