Ejemplo n.º 1
0
        public static void Validate(BookingSource bookingSource)
        {
            if (null == bookingSource)
            {
                throw new ArgumentNullException(nameof(bookingSource), "Booking data not present.");
            }

            bookingSource.ValidateDetails();
            bookingSource.ValidateCabins();
            bookingSource.ValidateProducts();
        }
Ejemplo n.º 2
0
        public static void ValidateCabins(BookingSource bookingSource)
        {
            if (null == bookingSource)
            {
                throw new ArgumentNullException(nameof(bookingSource), "Booking data not present.");
            }
            if (null == bookingSource.SubCruise)
            {
                throw new BookingException("Sub-cruise must be set.");
            }

            bookingSource.ValidateCabins();
        }
Ejemplo n.º 3
0
 public static Booking FromSource(BookingSource source, Guid cruiseId, string reference)
 {
     // Note that some fields are intentionally not set
     return(new Booking
     {
         CruiseId = cruiseId,
         Reference = reference,
         FirstName = source.FirstName,
         LastName = source.LastName,
         Email = source.Email,
         PhoneNo = source.PhoneNo,
         Lunch = source.Lunch,
         InternalNotes = source.InternalNotes,
         SubCruise = SubCruiseCode.FromString(source.SubCruise)
     });
 }