public EventOccurrenceAttendee(EventOccurrence eventOccurrence, EventRegistration eventRegistration, EventAttendee attendee) { if (eventOccurrence == null) throw new ArgumentNullException("eventOccurrence"); if (eventRegistration == null) throw new ArgumentNullException("eventRegistration"); if (attendee == null) throw new ArgumentNullException("attendee"); EventRegistration = eventRegistration; EventOccurrence = eventOccurrence; FirstName = attendee.Name.FirstName; LastName = attendee.Name.LastName; Address1 = attendee.Address.Line1; Address2 = attendee.Address.Line2; City = attendee.Address.City; PostalCode = attendee.Address.PostalCode; StateId = attendee.Address.StateId; PrimaryPhone = attendee.Phone.Value; EmailAddress = attendee.Email.Value; DynamicColumnData = attendee.DynamicColumnData; ProfileId = attendee.ProfileId; UserId = attendee.UserId; DidAttend = attendee.DidAttend; DiscountCodeId = attendee.DiscountCodeId; }
/// <summary> /// Registers the attended for the specific event. /// </summary> /// <param name="occurence">The event occurence.</param> /// <param name="registration">The event registration.</param> /// <param name="attendee">The attendee.</param> /// <param name="amountPaid">The amount paid.</param> /// <param name="userProfile">The user profile.</param> /// <param name="sessionId">The session id.</param> /// <param name="context">The Object Context</param> /// <param name="discountCode">The Discount Code used</param> /// <param name="forcePayLater">Flag weather or not to force the PaymentRequired to true</param> public static void Add(EventOccurrence occurence, EventRegistration registration, EventAttendee attendee, decimal amountPaid, UserProfile userProfile, string sessionId, ObjectContext context, string discountCode, bool forcePayLater) { if (!string.IsNullOrEmpty(discountCode)) attendee.DiscountCodeId = FindDiscountCodeId(discountCode, occurence.Id, context); var paymentRequired = (forcePayLater || occurence.AllowPayOnSite && amountPaid == 0 && occurence.Cost > 0) ? true : false; occurence.RegisterAttendee(registration, attendee, amountPaid, paymentRequired); AddActivity(userProfile, attendee.Name, occurence, sessionId); UpdateProfileEventCart(userProfile); var notificationSubscriber = occurence.EventOccurrenceNotifications.SingleOrDefault(n => string.Equals(n.Email, attendee.Email.Value, System.StringComparison.OrdinalIgnoreCase)); if (notificationSubscriber != null) context.DeleteObject(notificationSubscriber); }
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 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); }