/// <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 ValidateForLC(UserInfo user, ArgsForVPaymentIDLC args, List <CEEException> exceptions) { // On fait à ce niveau des contrôles // pour les valeurs communes ValidCommunValues(user, exceptions, args.GetPOS(), args.GetTravelerCode(), args.GetTravelerName(), args.GetCC1(), args.GetCC2(), args.GetBookingDateString()); // 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()); } // AIR Company if (String.IsNullOrEmpty(args.GetCompany())) { exceptions.Add(CCEExceptionUtil.BuildCCEException("MISSING_AIR_COMPANY", CCEExceptionMap.EXCEPTION_TYPE_FONCTIONAL, CCEExceptionMap.EXCEPTION_SEVERITY_ERROR, user.GetMessages().GetString("VPaymentGeneration.Error.MissingAIRCompany", false))); } // Trip tip if (String.IsNullOrEmpty(args.GetTripType())) { exceptions.Add(CCEExceptionUtil.BuildCCEException("MISSING_TRIP_TYPE", CCEExceptionMap.EXCEPTION_TYPE_FONCTIONAL, CCEExceptionMap.EXCEPTION_SEVERITY_ERROR, user.GetMessages().GetString("VPaymentGeneration.Error.MissingTripType", false))); } // Departure from if (String.IsNullOrEmpty(args.GetDepartureFrom())) { exceptions.Add(CCEExceptionUtil.BuildCCEException("MISSING_DEPARTURE_FROM", CCEExceptionMap.EXCEPTION_TYPE_FONCTIONAL, CCEExceptionMap.EXCEPTION_SEVERITY_ERROR, user.GetMessages().GetString("VPaymentGeneration.Error.MissingDepartureFrom", false))); } // Going from if (String.IsNullOrEmpty(args.GetGoingTo())) { exceptions.Add(CCEExceptionUtil.BuildCCEException("MISSING_GOING_TO", CCEExceptionMap.EXCEPTION_TYPE_FONCTIONAL, CCEExceptionMap.EXCEPTION_SEVERITY_ERROR, user.GetMessages().GetString("VPaymentGeneration.Error.MissingGoingTo", false))); } // Date de départ if (String.IsNullOrEmpty(args.GetDepartureDateString())) { // la date de réservation n'a pas été renseignée exceptions.Add(CCEExceptionUtil.BuildCCEException("MISSING_DEPARTURE_DATE", CCEExceptionMap.EXCEPTION_TYPE_FONCTIONAL, CCEExceptionMap.EXCEPTION_SEVERITY_ERROR, user.GetMessages().GetString("VPaymentGeneration.Error.DepartureDateMissing", 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.DepartureDateInvalid", false))); } } // Date de retour if (args.GetTripType().Equals("RETURN")) { if (String.IsNullOrEmpty(args.GetReturnDateString())) { // la date de retour n'a pas été renseignée exceptions.Add(CCEExceptionUtil.BuildCCEException("MISSING_RETURN_DATE", CCEExceptionMap.EXCEPTION_TYPE_FONCTIONAL, CCEExceptionMap.EXCEPTION_SEVERITY_ERROR, user.GetMessages().GetString("VPaymentGeneration.Error.ReturnDateMissing", false))); } else { // La date de retour a été renseigné // il faut la convertir en date try { args.SetReturnDate(); } catch (Exception) { exceptions.Add(CCEExceptionUtil.BuildCCEException("INVALID_RETURN_DATE", CCEExceptionMap.EXCEPTION_TYPE_FONCTIONAL, CCEExceptionMap.EXCEPTION_SEVERITY_ERROR, user.GetMessages().GetString("VPaymentGeneration.Error.ReturnDateInvalid", false))); } } } else { // One way trip args.SetReturnDate(Util.GetNavisionEmptyDate()); } // 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))); } } }