/// <summary> /// Updates a participant person SEVIS info with given updated SEVIS information. /// </summary> /// <param name="updatedParticipantPersonSevis">The updated participant person SEVIS info.</param> /// <returns>The task.</returns> public async Task UpdateAsync(UpdatedParticipantPersonSevis updatedParticipantPersonSevis) { var participantPerson = await CreateGetParticipantPersonsByIdQuery(updatedParticipantPersonSevis.ParticipantId).FirstOrDefaultAsync(); throwIfModelDoesNotExist(updatedParticipantPersonSevis.ParticipantId, participantPerson, typeof(ParticipantPerson)); var participant = await GetParticipantByPersonIdAsync((int)participantPerson.Participant.PersonId); if (participantPerson.Participant != null) { throwValidationErrorIfParticipantSevisInfoIsLocked(participant); } DoUpdate(participantPerson, updatedParticipantPersonSevis); }
private void DoUpdate(ParticipantPerson participantPerson, UpdatedParticipantPersonSevis updatedParticipantPersonSevis) { updatedParticipantPersonSevis.Audit.SetHistory(participantPerson); /// typically only one of the below would be changed in the record at a time. If more than one, this is the order to add them. if (!participantPerson.IsSentToSevisViaRTI && updatedParticipantPersonSevis.IsSentToSevisViaRTI) { // User manual clicked Sent to SEVIS via RTI AddSevisCommStatus(SevisCommStatus.SentToDhsViaRti.Id, participantPerson.ParticipantId, updatedParticipantPersonSevis.Audit.User.Id); } if (!participantPerson.IsDS2019Printed && updatedParticipantPersonSevis.IsDS2019Printed) { // User printed DS-2019 AddSevisCommStatus(SevisCommStatus.Ds2019Printed.Id, participantPerson.ParticipantId, updatedParticipantPersonSevis.Audit.User.Id); } if (!participantPerson.IsDS2019SentToTraveler && updatedParticipantPersonSevis.IsDS2019SentToTraveler) { // TODO: Check if this is correct AddSevisCommStatus(SevisCommStatus.Ds2019SentToTraveler.Id, participantPerson.ParticipantId, updatedParticipantPersonSevis.Audit.User.Id); } if (!participantPerson.IsValidatedViaRTI && updatedParticipantPersonSevis.IsValidatedViaRTI) { // User manually validated AddSevisCommStatus(SevisCommStatus.ValidatedViaRti.Id, participantPerson.ParticipantId, updatedParticipantPersonSevis.Audit.User.Id); } if (!participantPerson.IsCancelled && updatedParticipantPersonSevis.IsCancelled) { // User manually clicked cancel, add event to ParticipantPersonSevisCommStatus AddSevisCommStatus(SevisCommStatus.Cancelled.Id, participantPerson.ParticipantId, updatedParticipantPersonSevis.Audit.User.Id); } participantPerson.SevisId = updatedParticipantPersonSevis.SevisId; participantPerson.IsSentToSevisViaRTI = updatedParticipantPersonSevis.IsSentToSevisViaRTI; participantPerson.IsValidatedViaRTI = updatedParticipantPersonSevis.IsValidatedViaRTI; participantPerson.IsCancelled = updatedParticipantPersonSevis.IsCancelled; participantPerson.IsDS2019Printed = updatedParticipantPersonSevis.IsDS2019Printed; participantPerson.IsDS2019SentToTraveler = updatedParticipantPersonSevis.IsDS2019SentToTraveler; participantPerson.StartDate = updatedParticipantPersonSevis.StartDate; participantPerson.EndDate = updatedParticipantPersonSevis.EndDate; }
private UpdatedParticipantPersonSevisValidationEntity GetUpdatedParticipantPersonSevisValidationEntity(ParticipantPerson participantPerson, UpdatedParticipantPersonSevis participantPersonSevis) { return(new UpdatedParticipantPersonSevisValidationEntity(participantPerson, participantPersonSevis)); }
/// <summary> /// Creates a new instance. /// </summary> /// <param name="participantPerson">The participant person.</param> /// <param name="updatedParticipantPersonSevis">The participant person sevis.</param> public UpdatedParticipantPersonSevisValidationEntity(ParticipantPerson participantPerson, UpdatedParticipantPersonSevis updatedParticipantPersonSevis) { this.participantPerson = participantPerson; this.updatedParticipantPersonSevis = updatedParticipantPersonSevis; }