예제 #1
0
 public static BookingPax FromSource(BookingSource.Pax source, Guid bookingCabinId)
 {
     return(new BookingPax
     {
         BookingCabinId = bookingCabinId,
         Group = source.Group,
         FirstName = source.FirstName,
         LastName = source.LastName,
         Gender = Gender.FromString(source.Gender),
         Dob = new DateOfBirth(source.Dob),
         Nationality = source.Nationality,
         Years = source.Years
     });
 }
예제 #2
0
 public static BookingPax FromSource(BookingSource.PaxSource source, Guid bookingId)
 {
     return(new BookingPax
     {
         BookingId = bookingId,
         FirstName = source.FirstName,
         LastName = source.LastName,
         Gender = Gender.FromString(source.Gender),
         Dob = new DateOfBirth(source.Dob),
         Food = source.Food,
         CabinClassMin = source.CabinClassMin,
         CabinClassPreferred = source.CabinClassPreferred,
         CabinClassMax = source.CabinClassMax
     });
 }
예제 #3
0
        public async Task <BookingResult> CreateSoloAsync(Event evnt, SoloBookingSource source)
        {
            SoloBookingSource.Validate(source);

            var booking = new Booking
            {
                EventId        = evnt.Id,
                Reference      = _credentialsGenerator.GenerateBookingReference(),
                FirstName      = source.FirstName,
                LastName       = source.LastName,
                Email          = source.Email,
                PhoneNo        = source.PhoneNo,
                TeamName       = String.Concat(source.FirstName, ' ', source.LastName),
                SpecialRequest = String.Empty,
                InternalNotes  = String.Empty
            };

            var pax = new BookingPax
            {
                FirstName           = source.FirstName,
                LastName            = source.LastName,
                Gender              = Gender.FromString(source.Gender),
                Dob                 = new DateOfBirth(source.Dob),
                Food                = source.Food,
                CabinClassMin       = 0,
                CabinClassMax       = 0,
                CabinClassPreferred = 0
            };

            using (var db = DbUtil.Open())
            {
                await CreateBooking(db, Guid.Empty, booking);

                pax.BookingId = booking.Id;
                await CreatePax(db, pax, 0);
            }

            var password = _credentialsGenerator.GeneratePinCode();
            await _userManager.CreateAsync(new AecUser { UserName = booking.Reference, IsBooking = true }, password);

            return(new BookingResult {
                Reference = booking.Reference, Password = password
            });
        }