Esempio n. 1
0
        public void Delete(WorkflowTaskSearch request)
        {
            var matches = Get(request) as List <WorkflowTask>;

            if (true != matches?.Any())
            {
                throw new HttpError(HttpStatusCode.NotFound, "No matches for request");
            }
            matches.ForEach(match =>
            {
                Delete(match);
            });
        }
Esempio n. 2
0
 public WorkflowTaskFullTextSearch(WorkflowTaskSearch request) => _request = request;
Esempio n. 3
0
 public object Get(WorkflowTaskSearch request) => GetSearchResultWithCache <WorkflowTask, DocEntityWorkflowTask, WorkflowTaskSearch>(DocConstantModelName.WORKFLOWTASK, request, _ExecSearch);
Esempio n. 4
0
        private IQueryable <DocEntityWorkflowTask> _ExecSearch(WorkflowTaskSearch request, DocQuery query)
        {
            request = InitSearch <WorkflowTask, WorkflowTaskSearch>(request);
            IQueryable <DocEntityWorkflowTask> entities = null;

            query.Run(session =>
            {
                entities = query.SelectAll <DocEntityWorkflowTask>();
                if (!DocTools.IsNullOrEmpty(request.FullTextSearch))
                {
                    var fts  = new WorkflowTaskFullTextSearch(request);
                    entities = GetFullTextSearch <DocEntityWorkflowTask, WorkflowTaskFullTextSearch>(fts, entities);
                }

                if (null != request.Ids && request.Ids.Any())
                {
                    entities = entities.Where(en => en.Id.In(request.Ids));
                }

                if (!DocTools.IsNullOrEmpty(request.Updated))
                {
                    entities = entities.Where(e => null != e.Updated && e.Updated.Value.Date == request.Updated.Value.Date);
                }
                if (!DocTools.IsNullOrEmpty(request.UpdatedBefore))
                {
                    entities = entities.Where(e => null != e.Updated && e.Updated <= request.UpdatedBefore);
                }
                if (!DocTools.IsNullOrEmpty(request.UpdatedAfter))
                {
                    entities = entities.Where(e => null != e.Updated && e.Updated >= request.UpdatedAfter);
                }
                if (!DocTools.IsNullOrEmpty(request.Created))
                {
                    entities = entities.Where(e => null != e.Created && e.Created.Value.Date == request.Created.Value.Date);
                }
                if (!DocTools.IsNullOrEmpty(request.CreatedBefore))
                {
                    entities = entities.Where(e => null != e.Created && e.Created <= request.CreatedBefore);
                }
                if (!DocTools.IsNullOrEmpty(request.CreatedAfter))
                {
                    entities = entities.Where(e => null != e.Created && e.Created >= request.CreatedAfter);
                }
                if (true == request.Archived?.Any() && currentUser.HasProperty(DocConstantModelName.WORKFLOWTASK, nameof(Reference.Archived), DocConstantPermission.VIEW))
                {
                    entities = entities.Where(en => en.Archived.In(request.Archived));
                }
                else
                {
                    entities = entities.Where(en => !en.Archived);
                }
                if (true == request.Locked?.Any())
                {
                    entities = entities.Where(en => en.Locked.In(request.Locked));
                }

                if (!DocTools.IsNullOrEmpty(request.Assignee) && !DocTools.IsNullOrEmpty(request.Assignee.Id))
                {
                    entities = entities.Where(en => en.Assignee.Id == request.Assignee.Id);
                }
                if (true == request.AssigneeIds?.Any())
                {
                    entities = entities.Where(en => en.Assignee.Id.In(request.AssigneeIds));
                }
                if (!DocTools.IsNullOrEmpty(request.Description))
                {
                    entities = entities.Where(en => en.Description.Contains(request.Description));
                }
                if (!DocTools.IsNullOrEmpty(request.DueDate))
                {
                    entities = entities.Where(en => null != en.DueDate && request.DueDate.Value.Date == en.DueDate.Value.Date);
                }
                if (!DocTools.IsNullOrEmpty(request.DueDateBefore))
                {
                    entities = entities.Where(en => en.DueDate <= request.DueDateBefore);
                }
                if (!DocTools.IsNullOrEmpty(request.DueDateAfter))
                {
                    entities = entities.Where(en => en.DueDate >= request.DueDateAfter);
                }
                if (!DocTools.IsNullOrEmpty(request.Reporter) && !DocTools.IsNullOrEmpty(request.Reporter.Id))
                {
                    entities = entities.Where(en => en.Reporter.Id == request.Reporter.Id);
                }
                if (true == request.ReporterIds?.Any())
                {
                    entities = entities.Where(en => en.Reporter.Id.In(request.ReporterIds));
                }
                if (!DocTools.IsNullOrEmpty(request.Status) && !DocTools.IsNullOrEmpty(request.Status.Id))
                {
                    entities = entities.Where(en => en.Status.Id == request.Status.Id);
                }
                if (true == request.StatusIds?.Any())
                {
                    entities = entities.Where(en => en.Status.Id.In(request.StatusIds));
                }
                else if (!DocTools.IsNullOrEmpty(request.Status) && !DocTools.IsNullOrEmpty(request.Status.Name))
                {
                    entities = entities.Where(en => en.Status.Name == request.Status.Name);
                }
                if (true == request.StatusNames?.Any())
                {
                    entities = entities.Where(en => en.Status.Name.In(request.StatusNames));
                }
                if (!DocTools.IsNullOrEmpty(request.Type) && !DocTools.IsNullOrEmpty(request.Type.Id))
                {
                    entities = entities.Where(en => en.Type.Id == request.Type.Id);
                }
                if (true == request.TypeIds?.Any())
                {
                    entities = entities.Where(en => en.Type.Id.In(request.TypeIds));
                }
                else if (!DocTools.IsNullOrEmpty(request.Type) && !DocTools.IsNullOrEmpty(request.Type.Name))
                {
                    entities = entities.Where(en => en.Type.Name == request.Type.Name);
                }
                if (true == request.TypeNames?.Any())
                {
                    entities = entities.Where(en => en.Type.Name.In(request.TypeNames));
                }
                if (!DocTools.IsNullOrEmpty(request.Workflow) && !DocTools.IsNullOrEmpty(request.Workflow.Id))
                {
                    entities = entities.Where(en => en.Workflow.Id == request.Workflow.Id);
                }
                if (true == request.WorkflowIds?.Any())
                {
                    entities = entities.Where(en => en.Workflow.Id.In(request.WorkflowIds));
                }

                entities = ApplyFilters <DocEntityWorkflowTask, WorkflowTaskSearch>(request, entities);

                if (request.Skip > 0)
                {
                    entities = entities.Skip(request.Skip.Value);
                }
                if (request.Take > 0)
                {
                    entities = entities.Take(request.Take.Value);
                }
                if (true == request?.OrderBy?.Any())
                {
                    entities = entities.OrderBy(request.OrderBy);
                }
                if (true == request?.OrderByDesc?.Any())
                {
                    entities = entities.OrderByDescending(request.OrderByDesc);
                }
            });
            return(entities);
        }
Esempio n. 5
0
 public object Post(WorkflowTaskSearch request) => Get(request);