コード例 #1
0
 public void AddRequest(GuestRequest guestRequest)
 {
     if (guestRequest.Area < 0 || guestRequest.Area > (Areas)4)
     {
         throw new InvalidEnumArgumentException("Please insert correct area");
     }
     if (guestRequest.ChildrensAttractions < 0 || guestRequest.ChildrensAttractions > (Choice)2 ||
         guestRequest.Garden < 0 || guestRequest.Garden > (Choice)2 ||
         guestRequest.Jacuzzi < 0 || guestRequest.Jacuzzi > (Choice)2 ||
         guestRequest.Pool < 0 || guestRequest.Pool > (Choice)2)
     {
         throw new InvalidEnumArgumentException("Please insert correct choice");
     }
     if (guestRequest.Type < 0 || guestRequest.Type > (Types)2)
     {
         throw new InvalidEnumArgumentException("Please insert correct Type");
     }
     if (guestRequest.EntryDate == guestRequest.ReleaseDate)
     {
         throw new ArgumentException("Guest request have to be for at least 2 days");
     }
     try
     {
         dal.AddRequest(guestRequest);
     }
     catch (DuplicateWaitObjectException exc)
     {
         throw exc;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }