Exemplo 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);
        }
Exemplo n.º 2
0
        public Ticket GetTicketByReference(TicketReference reference)
        {
            if (reference == null)
            {
                return(null);
            }

            var spec = specFactory(reference);

            return(repo
                   .Query <Ticket>()
                   .Where(spec)
                   .SingleOrDefault());
        }