Ejemplo n.º 1
0
        public TicketRelationship CreateTicketRelationship(IIdentity <Relationship> relationshipId,
                                                           TicketReference relatedTicketReference,
                                                           RelationshipParticipant participationType)
        {
            if (relationshipId == null || relatedTicketReference == null || !participationType.IsDefinedValue())
            {
                return(null);
            }

            var relatedTicket = ticketQuery.GetTicketByReference(relatedTicketReference);

            if (relatedTicket == null)
            {
                return(null);
            }

            var relationship = new TicketRelationship {
                Relationship = data.Theorise(relationshipId),
            };

            if (participationType == RelationshipParticipant.Primary)
            {
                relationship.SecondaryTicket = relatedTicket;
            }

            if (participationType == RelationshipParticipant.Secondary)
            {
                relationship.PrimaryTicket = relatedTicket;
            }

            return(relationship);
        }
Ejemplo n.º 2
0
        public Expression <Func <Project, bool> > GetExpression()
        {
            var user = data.Theorise(userId);

            return(project => user.SiteAdministrator ||
                   project.Administrators.Contains(user) ||
                   project.Contributors.Contains(user));
        }
Ejemplo n.º 3
0
        public Ticket CreateTicket(CreateTicketRequest request)
        {
            var ticket = wrappedInstance.CreateTicket(request);

            ticket.Type = data.Theorise(request.TicketTypeIdentity);

            return(ticket);
        }
Ejemplo n.º 4
0
        Project GetProject(ListSprintsRequest request)
        {
            if (request.Project != null)
            {
                return(data.Theorise(request.Project));
            }

            return(currentProjectProvider.GetCurrentProject());
        }
        public Ticket CreateTicket(CreateTicketRequest request)
        {
            var ticket = wrappedInstance.CreateTicket(request);

            if (request.SprintIdentity != null)
            {
                ticket.Sprint = data.Theorise(request.SprintIdentity);
            }

            return(ticket);
        }
Ejemplo n.º 6
0
        protected override RuleOutcome GetOutcome(EditProjectRequest validated)
        {
            if (String.IsNullOrEmpty(validated.Code))
            {
                return(RuleOutcome.Success);
            }
            if (validated.Identity == null)
            {
                return(RuleOutcome.Success);
            }

            var project          = data.Theorise(validated.Identity);
            var hasDuplicateCode = data.Query <Project>()
                                   .Any(x => x != project && x.Code == validated.Code);

            return(hasDuplicateCode ? RuleOutcome.Failure : RuleOutcome.Success);
        }
Ejemplo n.º 7
0
        public Ticket GetTicket(IIdentity <Ticket> ticket)
        {
            if (ticket == null)
            {
                throw new ArgumentNullException(nameof(ticket));
            }

            var ticketTheory = repo.Theorise(ticket);

            return(repo
                   .Query <Ticket>()
                   .Where(x => x == ticketTheory)
                   .FetchChildren(x => x.Comments)
                   .FetchChild(x => x.Type)
                   .ToArray()
                   .FirstOrDefault());
        }
Ejemplo n.º 8
0
        public Sprint GetSprint(IIdentity <Sprint> identity)
        {
            if (ReferenceEquals(identity, null))
            {
                return(null);
            }

            var theory = repo.Theorise(identity);

            return(repo
                   .Query <Sprint>()
                   .Where(x => x == theory)
                   .FetchChild(x => x.Project)
                   .FetchChildren(x => x.Tickets)
                   .ThenFetchGrandchild(x => x.Type)
                   .ToList()
                   .SingleOrDefault());
        }
        List <TheoreticalRelationship> GetExistingRelationships(IIdentity <Ticket> ticketIdentity)
        {
            if (ReferenceEquals(ticketIdentity, null))
            {
                return(new List <TheoreticalRelationship>());
            }

            var ticket = data.Theorise(ticketIdentity);

            return((from rel in data.Query <TicketRelationship>()
                    where
                    rel.PrimaryTicket == ticket ||
                    rel.SecondaryTicket == ticket
                    select rel)
                   .FetchChild(x => x.Relationship)
                   .AsEnumerable()
                   .Select(MapToTheoreticalRelationship)
                   .ToList());
        }
Ejemplo n.º 10
0
        public Expression <Func <Ticket, bool> > GetExpression()
        {
            var project = data.Theorise(projectId);

            return(x => x.Project == project);
        }