public void SetArguments(ArgsForVPaymentIDHotel args) { this.HotelArgs = args; }
/// <summary> /// Quality control /// Validation des arguments passés /// </summary> /// <param name="user">Compte utilisateur</param> /// <param name="args">Liste arguments</param> /// <param name="exceptions">Liste d'exceptions à mettre à jour</param> public static void ValidateForHotel(UserInfo user, ArgsForVPaymentIDHotel args, List <CEEException> exceptions) { // On fait à ce niveau des contrôles // avant de rentrer dans le vif du sujet, on va vérifier les dates // pour les valeurs communes ValidCommunValues(user, exceptions, args.GetPOS(), args.GetTravelerCode(), args.GetTravelerName(), args.GetCC1(), args.GetCC2(), args.GetBookingDateString()); if (!String.IsNullOrEmpty(args.GetPOS())) { // On corrige le Pos args.SetPOS(Util.CorrectPos(user, args.GetPOS())); } if (!String.IsNullOrEmpty(args.GetTravelerCode())) { // On corrige leTravelerCode args.SetTravelerCode(args.GetTravelerCode().ToUpper()); } if (!String.IsNullOrEmpty(args.GetCC1())) { // On corrige le CC1 args.SetCC1(args.GetCC1().ToUpper()); } if (!String.IsNullOrEmpty(args.GetCC2())) { // On corrige le CC2 args.SetCC2(args.GetCC2().ToUpper()); } // Type d'hotel if (String.IsNullOrEmpty(args.GetHotelType())) { exceptions.Add(CCEExceptionUtil.BuildCCEException("MISSING_HOTEL_TYPE", CCEExceptionMap.EXCEPTION_TYPE_FONCTIONAL, CCEExceptionMap.EXCEPTION_SEVERITY_ERROR, user.GetMessages().GetString("VPaymentGeneration.Error.MissingHotelType", false))); } // Nom de l'hotel if (String.IsNullOrEmpty(args.GetHotelName())) { exceptions.Add(CCEExceptionUtil.BuildCCEException("MISSING_HOTEL_NAME", CCEExceptionMap.EXCEPTION_TYPE_FONCTIONAL, CCEExceptionMap.EXCEPTION_SEVERITY_ERROR, user.GetMessages().GetString("VPaymentGeneration.Error.MissingHotelName", false))); } // Ville de l'hotel if (String.IsNullOrEmpty(args.GetCity())) { exceptions.Add(CCEExceptionUtil.BuildCCEException("MISSING_HOTEL_CITY", CCEExceptionMap.EXCEPTION_TYPE_FONCTIONAL, CCEExceptionMap.EXCEPTION_SEVERITY_ERROR, user.GetMessages().GetString("VPaymentGeneration.Error.MissingHotelCity", false))); } // Code postal de l'hotel if (String.IsNullOrEmpty(args.GetZipCode())) { exceptions.Add(CCEExceptionUtil.BuildCCEException("MISSING_HOTEL_ZIP_CODE", CCEExceptionMap.EXCEPTION_TYPE_FONCTIONAL, CCEExceptionMap.EXCEPTION_SEVERITY_ERROR, user.GetMessages().GetString("VPaymentGeneration.Error.MissingHotelZipCode", false))); } // Pays if (String.IsNullOrEmpty(args.GetCountry())) { exceptions.Add(CCEExceptionUtil.BuildCCEException("MISSING_HOTEL_COUNTRY", CCEExceptionMap.EXCEPTION_TYPE_FONCTIONAL, CCEExceptionMap.EXCEPTION_SEVERITY_ERROR, user.GetMessages().GetString("VPaymentGeneration.Error.MissingHotelCountry", false))); } else { args.SetPOS(args.GetPOS().ToUpper()); } // Date d'arrivée if (String.IsNullOrEmpty(args.GetArrivalDateString())) { // la date d'arrivée n'a pas été renseignée exceptions.Add(CCEExceptionUtil.BuildCCEException("MISSING_HOTEL_ARRIVAL_DATE", CCEExceptionMap.EXCEPTION_TYPE_FONCTIONAL, CCEExceptionMap.EXCEPTION_SEVERITY_ERROR, user.GetMessages().GetString("VPaymentGeneration.Error.HotelArrivalDateMissing", false))); } else { // La date a été renseignée // Nous devons la convertir en date try { args.SetArrivalDate(); } catch (Exception) { exceptions.Add(CCEExceptionUtil.BuildCCEException("INVALID_ARRIVAL_DATE", CCEExceptionMap.EXCEPTION_TYPE_FONCTIONAL, CCEExceptionMap.EXCEPTION_SEVERITY_ERROR, user.GetMessages().GetString("VPaymentGeneration.Error.HotelArrivalDateInvalid", false))); } } // Date de départ if (String.IsNullOrEmpty(args.GetDepartureDateString())) { // la date de départ n'a pas été renseignée exceptions.Add(CCEExceptionUtil.BuildCCEException("MISSING_HOTEL_DEPARTURE_DATE", CCEExceptionMap.EXCEPTION_TYPE_FONCTIONAL, CCEExceptionMap.EXCEPTION_SEVERITY_ERROR, user.GetMessages().GetString("VPaymentGeneration.Error.HotelDepartureDateMissing", false))); } else { // La date de départ a été renseigné // il faut la convertir en date try { args.SetDepartureDate(); } catch (Exception) { exceptions.Add(CCEExceptionUtil.BuildCCEException("INVALID_DEPARTURE_DATE", CCEExceptionMap.EXCEPTION_TYPE_FONCTIONAL, CCEExceptionMap.EXCEPTION_SEVERITY_ERROR, user.GetMessages().GetString("VPaymentGeneration.Error.HotelDepartureDateInvalid", false))); } } // Date de booking if (String.IsNullOrEmpty(args.GetBookingDateString())) { // la date de réservation n'a pas été renseignée exceptions.Add(CCEExceptionUtil.BuildCCEException("MISSING_BOOKING", CCEExceptionMap.EXCEPTION_TYPE_FONCTIONAL, CCEExceptionMap.EXCEPTION_SEVERITY_ERROR, user.GetMessages().GetString("VPaymentGeneration.Error.BookingDateMissing", false))); } else { // La date de départ a été renseigné // il faut la convertir en date try { args.SetBookingDate(); } catch (Exception) { exceptions.Add(CCEExceptionUtil.BuildCCEException("INVALID_BOOKING_DATE", CCEExceptionMap.EXCEPTION_TYPE_FONCTIONAL, CCEExceptionMap.EXCEPTION_SEVERITY_ERROR, user.GetMessages().GetString("VPaymentGeneration.Error.BookingDateInvalid", false))); } } }