public static string GetDescriptiveDiscountCode(EventOccurrenceAttendee attendee) { if (attendee.DiscountCode != null) { if (attendee.DiscountCode.IsGroupCode) { if (attendee.DiscountCode.DiscountCodeType.Name == "Percentage") { return string.Format(CultureInfo.InvariantCulture, "{0} ({1}% Off {2} or more)", attendee.DiscountCode.Code, attendee.DiscountCode.DiscountValue, attendee.DiscountCode.RequiredGroupSize); } else { return string.Format(CultureInfo.InvariantCulture, "{0} (${1} Off {2} or more)", attendee.DiscountCode.Code, attendee.DiscountCode.DiscountValue, attendee.DiscountCode.RequiredGroupSize); } } else { if (attendee.DiscountCode.DiscountCodeType.Name == "Percentage") { return string.Format(CultureInfo.InvariantCulture, "{0} ({1}% Off)", attendee.DiscountCode.Code, attendee.DiscountCode.DiscountValue); } else { return string.Format(CultureInfo.InvariantCulture, "{0} (${1} Off)", attendee.DiscountCode.Code, attendee.DiscountCode.DiscountValue); } } } return null; }
/// <summary> /// Initializes a new instance of the <see cref="CancelAttendeeEmail"/> class. /// </summary> /// <param name="attendee">The attendee.</param> public CancelAttendeeEmail(EventOccurrenceAttendee attendee) { ToAddress = attendee.EmailAddress; TokenData = new { AttendeeName = attendee.Attendee.Name, EventTitle = attendee.EventOccurrence.Event.Title, EventStartDate = attendee.EventOccurrence.StartDate != null ? attendee.EventOccurrence.StartDate.Value.ToLongDateString() : "(unscheduled)", LocationName = attendee.EventOccurrence.EffectiveLocationName }; }
public CancelAttendeeContactEmail(EventOccurrenceAttendee attendee) { ToAddress = attendee.EventOccurrence.EffectiveContactEmail; TokenData = new { AttendeeName = attendee.Attendee.Name, ContactName = attendee.EventOccurrence.ContactName, EventTitle = attendee.EventOccurrence.Event.Title, EventStartDate = attendee.EventOccurrence.StartDate != null ? attendee.EventOccurrence.StartDate.Value.ToLongDateString() : "(unscheduled)", LocationName = attendee.EventOccurrence.EffectiveLocationName, TransdactionId = attendee.EventRegistration.TransactionId }; }
/// <summary> /// Initializes a new instance of the <see cref="RescheduleAttendeeEmail"/> class. /// </summary> /// <param name="attendee">The attendee.</param> /// <param name="targetEventOccurrence">The target event occurrence.</param> public RescheduleAttendeeEmail(EventOccurrenceAttendee attendee, EventOccurrence targetEventOccurrence) { ToAddress = attendee.EmailAddress; TokenData = new { AttendeeName = attendee.Attendee.Name, PreviousEventTitle = attendee.EventOccurrence.Event.Title, PreviousEventStartDate = attendee.EventOccurrence.StartDate != null ? attendee.EventOccurrence.StartDate.Value.ToLongDateString() : "(unscheduled)", PreviousLocationName = attendee.EventOccurrence.EffectiveLocationName, NewEventTitle = targetEventOccurrence.Event.Title, NewEventStartDate = targetEventOccurrence.StartDate != null ? targetEventOccurrence.StartDate.Value.ToLongDateString() : "(unscheduled)", NewLocationName = targetEventOccurrence.EffectiveLocationName, NewLocationAddress = targetEventOccurrence.EffectiveCompleteAddress, NewDates = GetNewDatesTemplateContext(targetEventOccurrence) }; }
public void TestConstruction() { var registration = new EventRegistration("test"); var occurrence = new EventOccurrence() { Id = 1 }; var attendee = CreateAttendee("John", "Doe"); var subject = new EventOccurrenceAttendee(occurrence, registration, attendee); Assert.AreEqual(occurrence, subject.EventOccurrence); Assert.AreEqual(attendee, subject.Attendee); //TODO: the primitive properties of EventOccurrenceAttendee should be made protected eventually, so these assertions won't be possible or necessary. Assert.AreEqual(attendee.Name.FirstName, subject.FirstName); Assert.AreEqual(attendee.Name.LastName, subject.LastName); Assert.AreEqual(attendee.Address.Line1, subject.Address1); Assert.AreEqual(attendee.Address.Line2, subject.Address2); Assert.AreEqual(attendee.Address.PostalCode, subject.PostalCode); Assert.AreEqual(attendee.Address.City, subject.City); Assert.AreEqual(attendee.Address.StateId, subject.StateId); Assert.AreEqual(attendee.Email.Value, subject.EmailAddress); Assert.AreEqual(attendee.Phone.Value, subject.PrimaryPhone); }
/// <summary> /// Registers the transferred attendee. /// </summary> /// <param name="eventOccurrenceAttendee">The event occurrence attendee.</param> /// <param name="shouldTransferDiscountCode">shouldTransferDiscountCode</param> public void RegisterTransferredAttendee(EventOccurrenceAttendee eventOccurrenceAttendee, bool shouldTransferDiscountCode) { if (eventOccurrenceAttendee == null) throw new ArgumentNullException("eventOccurrenceAttendee"); if (eventOccurrenceAttendee.EventOccurrence.Id == this.Id) throw new BusinessException(string.Format(CultureInfo.CurrentCulture, "Attempt to transfer attendee {0} to same Event Occurrence.", eventOccurrenceAttendee.Attendee.Name)); if (IsAttendeeRegistered(eventOccurrenceAttendee.Attendee)) { throw new BusinessException(string.Format(CultureInfo.CurrentCulture, "Attendee {0} is already registered for the specified occurrence of {1}.", eventOccurrenceAttendee.Attendee.Name, Event.Title)); } var newAttendee = new EventOccurrenceAttendee(this, eventOccurrenceAttendee.EventRegistration, eventOccurrenceAttendee.Attendee); if (shouldTransferDiscountCode) newAttendee.DiscountCodeId = eventOccurrenceAttendee.DiscountCodeId; newAttendee.AmountPaid = eventOccurrenceAttendee.AmountPaid; newAttendee.UpdatedDate = DateTime.UtcNow; newAttendee.DiscountCodeId = eventOccurrenceAttendee.DiscountCodeId; EventOccurrenceAttendees.Add(newAttendee); }
public void RegisterTransferredAttendee(EventOccurrenceAttendee eventOccurrenceAttendee) { RegisterTransferredAttendee(eventOccurrenceAttendee, false); }
/// <summary> /// Registers the attendee. /// </summary> /// <param name="registration">The registration.</param> /// <param name="attendee">The attendee.</param> /// <param name="amountPaid">The amount paid.</param> /// <param name="paymentRequired">Payment required flag.</param> public void RegisterAttendee(EventRegistration registration, EventAttendee attendee, decimal amountPaid, bool paymentRequired) { if (registration == null) throw new ArgumentNullException("registration"); if (attendee == null) throw new ArgumentNullException("attendee"); var eventOccurrenceAttendee = new EventOccurrenceAttendee(this, registration, attendee); eventOccurrenceAttendee.AmountPaid = amountPaid; eventOccurrenceAttendee.PaymentRequired = paymentRequired; eventOccurrenceAttendee.UpdatedDate = DateTime.UtcNow; EventOccurrenceAttendees.Add(eventOccurrenceAttendee); }