private EventOccurrenceAttendee CreateAttendee() { var occurrence = new EventOccurrence(); occurrence.OrgUnit = new OrgUnit(); occurrence.OrgUnit.OrgUnitPublished = new OrgUnitPublished(); occurrence.OrgUnit.OrgUnitPublished.Name = "TestLocation"; occurrence.Event = new Event() { Id = 1 }; occurrence.Event.Title = "Test Event"; occurrence.RegisterAttendee(new EventRegistration("transId"), new EventAttendee(new PersonName("John", "Doe"), new Address("123 Main St.", "Apt 2.", "Hoover", 1, "90036"), new EmailAddress("*****@*****.**"), new PhoneNumber("333-444-5555"), "John", "Doe"), 0M, false); return occurrence.EventOccurrenceAttendees.ElementAt(0); }
/// <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 TestRegisterTransferredAttendee_AlreadyRegistered() { var attendee = CreateAttendee("John", "Doe"); var originalOccurrence = new EventOccurrence() { Id = 1, Event = new Event() { Title = "Test event 1" } }; originalOccurrence.RegisterAttendee(_registration, attendee, 5M,false); var originalEventOccurrenceAttendee = originalOccurrence.EventOccurrenceAttendees.ElementAt(0); var newOccurrence = new EventOccurrence() { Id = 2, Event = new Event() { Title = "Test event 2" } }; newOccurrence.RegisterAttendee(_registration, attendee, 0M, false); newOccurrence.RegisterTransferredAttendee(originalEventOccurrenceAttendee); }
public void TestRegisterTransferredAttendee() { var attendee = CreateAttendee("John", "Doe"); var originalOccurrence = new EventOccurrence() { Id = 1 }; originalOccurrence.RegisterAttendee(_registration, attendee, 5M, false); var originalEventOccurrenceAttendee = originalOccurrence.EventOccurrenceAttendees.ElementAt(0); var newOccurrence = new EventOccurrence() { Id = 2 }; newOccurrence.RegisterTransferredAttendee(originalEventOccurrenceAttendee); Assert.AreEqual(1, newOccurrence.EventOccurrenceAttendees.Count()); var newEventOccurrenceAttendee = newOccurrence.EventOccurrenceAttendees.ElementAt(0); Assert.AreEqual(attendee, newEventOccurrenceAttendee.Attendee); Assert.AreEqual(_registration, newEventOccurrenceAttendee.EventRegistration); Assert.AreEqual(5M, newEventOccurrenceAttendee.AmountPaid); }
public void TestRegisterAttendee() { var occurrence = new EventOccurrence(); Assert.AreEqual(0, occurrence.EventOccurrenceAttendees.Count()); var attendee = CreateAttendee("John", "Doe"); occurrence.RegisterAttendee(_registration, attendee, 10.5M, false); Assert.AreEqual(1, occurrence.EventOccurrenceAttendees.Count()); Assert.AreEqual(attendee, occurrence.EventOccurrenceAttendees.ElementAt(0).Attendee); Assert.AreEqual(_registration, occurrence.EventOccurrenceAttendees.ElementAt(0).EventRegistration); Assert.AreEqual(10.5M, occurrence.EventOccurrenceAttendees.ElementAt(0).AmountPaid); }
public void TestIsAttendeeRegistered() { var occurrence = new EventOccurrence(); var attendee = CreateAttendee("John", "Doe"); Assert.IsFalse(occurrence.IsAttendeeRegistered(attendee)); occurrence.RegisterAttendee(_registration, attendee, 0M, false); Assert.IsTrue(occurrence.IsAttendeeRegistered(attendee)); }