private IEnumerable <ParticipantPersonSevisCommStatus> DoSendToSevis(ParticipantsToBeSentToSevis model, IEnumerable <ParticipantSevisSubmissionInfo> submissions) { var now = DateTimeOffset.UtcNow; var addedParticipantStatuses = new List <ParticipantPersonSevisCommStatus>(); foreach (var submission in submissions) { if (submission.IsQueuedToSubmit || submission.IsQueuedToValidate) { var newStatus = new ParticipantPersonSevisCommStatus { ParticipantId = submission.ParticipantId, AddedOn = now, SevisOrgId = model.SevisOrgId, SevisUsername = model.SevisUsername, PrincipalId = model.Audit.User.Id }; if (submission.IsQueuedToSubmit) { newStatus.SevisCommStatusId = SevisCommStatus.QueuedToSubmit.Id; } else if (submission.IsQueuedToValidate) { newStatus.SevisCommStatusId = SevisCommStatus.QueuedToValidate.Id; } else { throw new NotSupportedException("The submission type is not supported."); } Context.ParticipantPersonSevisCommStatuses.Add(newStatus); addedParticipantStatuses.Add(newStatus); } } return(addedParticipantStatuses); }
/// <summary> /// Sets sevis communication status for participant ids to queued /// </summary> /// <param name="participants">The participants that will be sent to sevis.</param> /// <returns>List of participant ids that were updated</returns> public int[] SendToSevis(ParticipantsToBeSentToSevis participants) { var statuses = CreateGetCommStatusesThatAreReadyToSubmitQuery(participants.ProjectId, participants.ParticipantIds).ToList(); return(DoSendToSevis(participants, statuses).Select(x => x.ParticipantId).ToArray()); }