예제 #1
0
        /// <summary>
        /// Creates a spouse relationship between the two specified persons.
        /// </summary>
        /// <param name="person1">A person to be the husband. See remarks.</param>
        /// <param name="person2">A person to be the wife. See remarks.</param>
        /// <param name="options">The options to apply before executing the REST API call.</param>
        /// <returns>
        /// A <see cref="RelationshipState"/> instance containing the REST API response.
        /// </returns>
        /// <remarks>
        /// The person1 parameter does not have to be the husband, it could be the wife; however, person2 must be the opposite. So if you specify a hasband for person1
        /// then person2 must be the wife. Conversely, if you specify a wife for person1 then person2 must be the husband.
        /// </remarks>
        public RelationshipState AddSpouseRelationship(PersonState person1, PersonState person2, params IStateTransitionOption[] options)
        {
            Relationship relationship = new Relationship();

            relationship.Person1   = new ResourceReference(person1.GetSelfUri());
            relationship.Person2   = new ResourceReference(person2.GetSelfUri());
            relationship.KnownType = RelationshipType.Couple;
            return(AddRelationship(relationship, options));
        }
예제 #2
0
        /// <summary>
        /// Creates a parent child relationship for the specified persons.
        /// </summary>
        /// <param name="parent">The <see cref="PersonState"/> representing the parent for the new relationship.</param>
        /// <param name="child">The <see cref="PersonState"/> representing the child for the new relationship.</param>
        /// <param name="options">The options to apply before executing the REST API call.</param>
        /// <returns>
        /// A <see cref="RelationshipState"/> instance containing the REST API response.
        /// </returns>
        public RelationshipState AddParentChildRelationship(PersonState parent, PersonState child, params IStateTransitionOption[] options)
        {
            Relationship relationship = new Relationship();

            relationship.Person1   = new ResourceReference(parent.GetSelfUri());
            relationship.Person2   = new ResourceReference(child.GetSelfUri());
            relationship.KnownType = RelationshipType.ParentChild;
            return(AddRelationship(relationship, options));
        }
예제 #3
0
        /// <summary>
        /// Adds a child and parents relationship to the collection.
        /// </summary>
        /// <param name="child">The child to add in the relationship.</param>
        /// <param name="father">The father to add in the relationship.</param>
        /// <param name="mother">The mother to add in the relationship.</param>
        /// <param name="options">The options to apply before executing the REST API call.</param>
        /// <returns>
        /// A <see cref="ChildAndParentsRelationshipState"/> instance containing the REST API response.
        /// </returns>
        public ChildAndParentsRelationshipState AddChildAndParentsRelationship(PersonState child, PersonState father, PersonState mother, params IStateTransitionOption[] options)
        {
            ChildAndParentsRelationship chap = new ChildAndParentsRelationship();

            chap.Child = new ResourceReference(child.GetSelfUri());
            if (father != null)
            {
                chap.Father = new ResourceReference(father.GetSelfUri());
            }
            if (mother != null)
            {
                chap.Mother = new ResourceReference(mother.GetSelfUri());
            }
            return(AddChildAndParentsRelationship(chap, options));
        }
예제 #4
0
        public static ChildAndParentsRelationship GetCreateChildAndParentsRelationship(PersonState father = null, PersonState mother = null, PersonState child = null)
        {
            var result = new ChildAndParentsRelationship();

            if (father != null)
            {
                result.Father = new ResourceReference(father.GetSelfUri());
            }

            if (mother != null)
            {
                result.Mother = new ResourceReference(mother.GetSelfUri());
            }

            if (child != null)
            {
                result.Child = new ResourceReference(child.GetSelfUri());
            }

            return(result);
        }
예제 #5
0
        public static ChildAndParentsRelationship GetCreateChildAndParentsRelationship(PersonState father = null, PersonState mother = null, PersonState child = null)
        {
            var result = new ChildAndParentsRelationship();

            if (father != null)
            {
                result.Father = new ResourceReference(father.GetSelfUri());
            }

            if (mother != null)
            {
                result.Mother = new ResourceReference(mother.GetSelfUri());
            }

            if (child != null)
            {
                result.Child = new ResourceReference(child.GetSelfUri());
            }

            return result;
        }
 /// <summary>
 /// Adds a child and parents relationship to the collection.
 /// </summary>
 /// <param name="child">The child to add in the relationship.</param>
 /// <param name="father">The father to add in the relationship.</param>
 /// <param name="mother">The mother to add in the relationship.</param>
 /// <param name="options">The options to apply before executing the REST API call.</param>
 /// <returns>
 /// A <see cref="ChildAndParentsRelationshipState"/> instance containing the REST API response.
 /// </returns>
 public ChildAndParentsRelationshipState AddChildAndParentsRelationship(PersonState child, PersonState father, PersonState mother, params IStateTransitionOption[] options)
 {
     ChildAndParentsRelationship chap = new ChildAndParentsRelationship();
     chap.Child = new ResourceReference(child.GetSelfUri());
     if (father != null)
     {
         chap.Father = new ResourceReference(father.GetSelfUri());
     }
     if (mother != null)
     {
         chap.Mother = new ResourceReference(mother.GetSelfUri());
     }
     return AddChildAndParentsRelationship(chap, options);
 }