示例#1
0
        /// <summary>
        /// Returns a EVPersonTypeDependent instance representing a new sevis depenedent with a new sevis exchange visitor.
        /// </summary>
        /// <returns>A EVPersonTypeDependent instance representing a new sevis depenedent with a new sevis exchange visitor.</returns>
        public EVPersonTypeDependent GetEVPersonTypeDependent()
        {
            Contract.Requires(this.BirthDate.HasValue, "The birth date must have a value.");
            Contract.Requires(this.FullName != null, "The full name should be specified.");
            Contract.Requires(this.BirthCountryCode != null, "The BirthCountryCode should be specified.");
            Contract.Requires(this.CitizenshipCountryCode != null, "The CitizenshipCountryCode should be specified.");
            Contract.Requires(this.PermanentResidenceCountryCode != null, "The PermanentResidenceCountryCode should be specified.");
            Contract.Requires(this.Gender != null, "The Gender should be specified.");
            Func <string, bool> isCodeSpecified = (value) =>
            {
                return(!string.IsNullOrWhiteSpace(value));
            };
            var dependent = new EVPersonTypeDependent
            {
                BirthCity                   = this.BirthCity,
                BirthCountryCode            = this.BirthCountryCode.GetBirthCntryCodeType(),
                BirthCountryReasonSpecified = isCodeSpecified(this.BirthCountryReasonCode),
                BirthDate                   = this.BirthDate.Value,
                CitizenshipCountryCode      = this.CitizenshipCountryCode.GetCountryCodeWithType(),
                EmailAddress                = this.EmailAddress,
                FullName = this.FullName.GetNameType(),
                Gender   = this.Gender.GetEVGenderCodeType(),
                PermanentResidenceCountryCode = this.PermanentResidenceCountryCode.GetCountryCodeWithType(),
                Relationship = this.Relationship.GetDependentCodeType(),
            };

            if (dependent.BirthCountryReasonSpecified)
            {
                dependent.BirthCountryReason = this.BirthCountryReasonCode.GetUSBornReasonType();
            }
            var sevisKey = new ParticipantSevisKey(this);

            sevisKey.SetUserDefinedFields(dependent);
            return(dependent);
        }
 /// <summary>
 /// Sets the user defined fields on the given sevis dependent model.
 /// </summary>
 /// <param name="dependent">The dependent to set the user defined fields on.</param>
 public void SetUserDefinedFields(EVPersonTypeDependent dependent)
 {
     Contract.Requires(dependent != null, "The dependent must not be null.");
     dependent.UserDefinedA = GetParticipantIdAsString(this.ParticipantId);
     dependent.UserDefinedB = GetPersonIdAsString(this.PersonId);
 }