private bool WasAlreadyNotified(RegistrationWithParticipant registrationParticipant) { return(_notificationService.HasNotified( registrationParticipant.Registration.Applicant.PhoneNumber, Constants.NotificationIds.ACCOMPLISH_DEMAND_FOR_REGISTRATION, NotificationSubject(registrationParticipant) )); }
public static DemandingCriterias CreateFromRegistration(RegistrationWithParticipant registrationWithParticipant) { return(new DemandingCriterias { CourseType = registrationWithParticipant.RegistrationParticipant.CourseType, Discipline = registrationWithParticipant.RegistrationParticipant.Discipline, NiveauId = registrationWithParticipant.RegistrationParticipant.NiveauId, From = registrationWithParticipant.Registration.AvailableFrom.Date, To = registrationWithParticipant.Registration.AvailableTo.Date, IsCourse = false }); }
private IEnumerable <GroupCourseDemand> GetDemand(RegistrationWithParticipant participantAffectedFromChange) { if (participantAffectedFromChange.RegistrationParticipant.CourseType == CourseType.Group) { return(_demandService.GetGroupCourseDemand( participantAffectedFromChange.RegistrationParticipant.Discipline, participantAffectedFromChange.RegistrationParticipant.NiveauId, participantAffectedFromChange.Registration.AvailableFrom, participantAffectedFromChange.Registration.AvailableTo )); } else { return(Enumerable.Empty <GroupCourseDemand>()); } }
private async Task NotifyAsync(RegistrationWithParticipant registrationParticipant) { using (var unitOfWork = _notificationUnitOfWork.Begin()) { string[] messageLines = { $"Hallo {registrationParticipant.Registration.Applicant.Givenname}", $"Für {registrationParticipant.RegistrationParticipant.Name} wurde eine passende Kursdurchführung gefunden. Schauen Sie bei Gelegenheit vorbei:", string.Format(_environmentOptions.Current().RegistrationFrontendUrl, registrationParticipant.Registration.Id) }; await unitOfWork.Dependent.SendNotification( registrationParticipant.Registration.Applicant.PhoneNumber, Constants.NotificationIds.ACCOMPLISH_DEMAND_FOR_REGISTRATION, new [] { NotificationSubject(registrationParticipant) }, string.Join(Environment.NewLine, messageLines) ); unitOfWork.Commit(); } }
private static string NotificationSubject(RegistrationWithParticipant registrationParticipant) { return($"reg={registrationParticipant.Registration.Id} par={registrationParticipant.RegistrationParticipant.Id}"); }
private static bool HadNoDemandWhenCreatedOrModified(RegistrationWithParticipant participantAffectedFromChange) { return(participantAffectedFromChange.RegistrationParticipant.HasDemandWhenLastCreatedOrModified == false); }