Exemple #1
0
 /// <summary>
 /// Creates a new instance.
 /// </summary>
 /// <param name="updater">The user performing the update.</param>
 /// <param name="participantId">The participant id.</param>
 /// <param name="projectId">The project id.</param>
 /// <param name="hostInstitutionId">The host institution id.</param>
 /// <param name="homeInstitutionId">The home institution id.</param>
 /// <param name="hostInstitutionAddressId">The host instutition address id.</param>
 /// <param name="homeInstitutionAddressId">The home institutution address id.</param>
 /// <param name="participantTypeId">The participant type id.</param>
 /// <param name="participantStatusId">The participant status id.</param>
 public UpdatedParticipantPerson(
     User updater,
     int participantId,
     int projectId,
     int?hostInstitutionId,
     int?homeInstitutionId,
     int?hostInstitutionAddressId,
     int?homeInstitutionAddressId,
     int participantTypeId,
     int?participantStatusId,
     int?placementOrganizationId,
     int?placementOrganizationAddressId)
 {
     if (ParticipantType.GetStaticLookup(participantTypeId) == null)
     {
         throw new UnknownStaticLookupException(String.Format("The participant type id [{0}] is not recognized.", participantTypeId));
     }
     if (participantStatusId.HasValue && ParticipantStatus.GetStaticLookup(participantStatusId.Value) == null)
     {
         throw new UnknownStaticLookupException(String.Format("The participant status id [{0}] is not recognized.", participantStatusId));
     }
     this.Audit                          = new Update(updater);
     this.ProjectId                      = projectId;
     this.ParticipantId                  = participantId;
     this.HostInstitutionId              = hostInstitutionId;
     this.HostInstitutionAddressId       = hostInstitutionAddressId;
     this.HomeInstitutionAddressId       = homeInstitutionAddressId;
     this.HomeInstitutionId              = homeInstitutionId;
     this.ParticipantTypeId              = participantTypeId;
     this.ParticipantStatusId            = participantStatusId;
     this.PlacementOrganizationId        = placementOrganizationId;
     this.PlacementOrganizationAddressId = placementOrganizationAddressId;
 }
Exemple #2
0
        /// <summary>
        /// Creates a new AdditionalProjectParticipant with the project owner that is adding the participant
        /// and the project id.
        /// </summary>
        /// <param name="projectOwner">The user adding the participant.</param>
        /// <param name="projectId">The project id.</param>
        /// <param name="participantTypeId">The participant type id.</param>
        public AdditionalProjectParticipant(User projectOwner, int projectId, int participantTypeId)
        {
            Contract.Requires(projectOwner != null, "The project owner must not be null.");
            this.Audit               = new Create(projectOwner);
            this.ProjectId           = projectId;
            this.ParticipantStatusId = ParticipantStatus.Active.Id;
            var participantType = ParticipantType.GetStaticLookup(participantTypeId);

            if (participantType == null)
            {
                throw new UnknownStaticLookupException(String.Format("The participant type with id [{0}] is not recognized.", participantTypeId));
            }
            this.ParticipantTypeId = participantTypeId;
        }