示例#1
0
 public static void Validate(BookingCandidate candidate)
 {
     if (string.IsNullOrWhiteSpace(candidate.FirstName))
     {
         throw new BookingException("First name must be set.");
     }
     if (string.IsNullOrWhiteSpace(candidate.LastName))
     {
         throw new BookingException("Last name must be set.");
     }
     if (string.IsNullOrWhiteSpace(candidate.Email))
     {
         throw new BookingException("E-mail must be set.");
     }
     if (string.IsNullOrWhiteSpace(candidate.PhoneNo))
     {
         throw new BookingException("Phone number must be set.");
     }
     if (string.IsNullOrWhiteSpace(candidate.TeamName))
     {
         throw new BookingException("Team name must be set.");
     }
     if (candidate.TeamSize <= 0)
     {
         throw new BookingException("Team size must be greater than zero.");
     }
     if (candidate.TeamSize > BookingSource.MaximumPaxInBooking)
     {
         throw new BookingException("Team size is too large.");
     }
 }
示例#2
0
 public static Booking FromCandidate(BookingCandidate candidate, int placeInQueue, Guid evntId, string reference)
 {
     return(new Booking
     {
         EventId = evntId,
         Reference = reference,
         FirstName = candidate.FirstName,
         LastName = candidate.LastName,
         Email = candidate.Email,
         PhoneNo = candidate.PhoneNo,
         TeamName = candidate.TeamName,
         QueueNo = placeInQueue
     });
 }