コード例 #1
0
        /// <summary>
        /// Query to get a list of participant people
        /// </summary>
        /// <param name="context">The context to query</param>
        /// <returns>List of participant people</returns>
        public static IQueryable <SimpleParticipantPersonDTO> CreateGetSimpleParticipantPersonsDTOQuery(EcaContext context)
        {
            Contract.Requires(context != null, "The context must not be null.");

            var organizationQuery = OrganizationQueries.CreateGetOrganizationDTOsQuery(context);
            var query             = (from p in context.ParticipantPersons
                                     select new SimpleParticipantPersonDTO
            {
                ParticipantId = p.ParticipantId,
                SevisId = p.SevisId,
                ProjectId = p.Participant.ProjectId,
                HomeInstitutionAddressId = p.HomeInstitutionAddressId,
                HostInstitutionAddressId = p.HostInstitutionAddressId,
                ParticipantType = p.Participant.ParticipantType != null ? p.Participant.ParticipantType.Name : null,
                ParticipantTypeId = p.Participant.ParticipantTypeId,
                ParticipantStatus = p.Participant.Status != null ? p.Participant.Status.Status : null,
                ParticipantStatusId = p.Participant.ParticipantStatusId,
                HomeInstitution = organizationQuery.Where(x => x.OrganizationId == p.HomeInstitutionId).FirstOrDefault(),
                HostInstitution = organizationQuery.Where(x => x.OrganizationId == p.HostInstitutionId).FirstOrDefault(),
                SevisStatus = p.ParticipantPersonSevisCommStatuses.Count == 0 ? "None" : p.ParticipantPersonSevisCommStatuses.OrderByDescending(s => s.AddedOn).FirstOrDefault().SevisCommStatus.SevisCommStatusName,
                SevisStatusId = p.ParticipantPersonSevisCommStatuses.Count == 0 ? 0 : p.ParticipantPersonSevisCommStatuses.OrderByDescending(s => s.AddedOn).FirstOrDefault().SevisCommStatus.SevisCommStatusId,
                PlacementOrganization = organizationQuery.Where(x => x.OrganizationId == p.PlacementOrganizationId).FirstOrDefault(),
                PlacementOrganizationAddressId = p.PlacementOrganizationAddressId
            });

            return(query);
        }
コード例 #2
0
 /// <summary>
 /// Returns a query to get organization dtos.
 /// </summary>
 /// <returns>The query.</returns>
 public override IQueryable <OrganizationDTO> CreateGetDocumentsQuery()
 {
     return(OrganizationQueries.CreateGetOrganizationDTOsQuery(this.Context)
            .Where(x => !Organization.OFFICE_ORGANIZATION_TYPE_IDS.Contains(x.OrganizationTypeId))
            .OrderBy(x => x.OrganizationId));
 }