private void AddRegistrationPetitions(Registration registration, List<CeremonyParticipation> ceremonyParticipations, ModelStateDictionary modelState) { //var petitions = new List<RegistrationPetition>(); foreach (var a in ceremonyParticipations.Where(a => a.Petition)) { // check for existing petition var noExistingPetition = !_registrationPetitionRepository.Queryable.Any(b => b.Ceremony == a.Ceremony && b.Registration.Student == registration.Student); // check for existing registration var noExistingParticipation = !_participationRepository.Queryable.Any(b => b.Ceremony == a.Ceremony && b.Registration.Student == registration.Student); if (noExistingPetition && noExistingParticipation && a.Ceremony.CanRegister()) { if (a.Tickets == 0) { modelState.AddModelError("Tickets", "You need to select more than 0 tickets."); } var petition = new RegistrationPetition(registration, a.Major, a.Ceremony, a.PetitionReason, a.CompletionTerm, a.Tickets); petition.TransferUnitsFrom = string.IsNullOrEmpty(a.TransferCollege) ? null : a.TransferCollege; petition.TransferUnits = string.IsNullOrEmpty(a.TransferUnits) ? null : a.TransferUnits; petition.TicketDistributionMethod = a.TicketDistributionMethod; registration.AddPetition(petition); } } //return petitions; }
public static Ceremony DeteremineCeremony(IRepository repository, RegistrationPetition registrationPetition, TermCode termCode) { return repository.OfType<Ceremony>().Queryable.Where(a => a.Majors.Contains(registrationPetition.MajorCode) && a.TermCode == termCode).FirstOrDefault(); }
public string GenerateRegistrationPetitionConfirmation(RegistrationPetition registrationPetition, Template template) { Check.Require(registrationPetition != null, "registrationPetition is required."); Check.Require(registrationPetition.Registration != null, "registrationPetition.Registration is required."); Check.Require(template != null, "template is required."); Check.Require(template.TemplateType.Name == StaticValues.Template_RegistrationPetition, "Template mismatch."); Check.Require(registrationPetition.Registration.Student != null, "registrationPetition.Registration.Student is required."); _ceremony = registrationPetition.Ceremony; _student = registrationPetition.Registration.Student; _registrationPetition = registrationPetition; _registration = registrationPetition.Registration; _template = template; return HandleBody(template.BodyText); }
public static RegistrationPetition RegistrationPetition(int? count) { var localCount = 0; if(count != null) { localCount = (int)count; } var rtValue = new RegistrationPetition(); rtValue.Registration = new Registration(); rtValue.MajorCode = new MajorCode(); rtValue.ExceptionReason = "ExceptionReason" + count.Extra(); return rtValue; }
public void QueueRegistrationPetitionDecision(RegistrationPetition registrationPetition) { Check.Require(registrationPetition != null, "registration is required."); var template = registrationPetition.Ceremony.Templates.Where( a => a.TemplateType.Name == StaticValues.Template_RegistrationPetition_Approved && a.IsActive). FirstOrDefault(); if (template != null) { var subject = template.Subject; var body = _letterGenerator.GenerateRegistrationPetitionApproved(registrationPetition, template); var emailQueue = new EmailQueue(registrationPetition.Registration.Student, template, subject, body); emailQueue.Registration = registrationPetition.Registration; emailQueue.RegistrationPetition = registrationPetition; _emailQueueRepository.EnsurePersistent(emailQueue); } }