Beispiel #1
0
        /// <summary>
        /// Ecriture des informations vers les systemes de trace
        /// Syslog
        /// Log fichier (optionnel)
        /// </summary>
        /// <param name="message">Message à tracer</param>
        /// <param name="facility">Facilité (Syslog)</param>
        /// <param name="level">Niveau (Syslog)</param>
        private static void WriteToLog(string message, int facility, int level)
        {
            string CleanedMessage = CCEExceptionUtil.CleanMessage(message, facility, level);

            // Ecriture du message dans le fichier de trace
            WriteToLogFile(CleanedMessage);
        }
Beispiel #2
0
 public string GetString(string resKey, string arg, bool exception)
 {
     if (exception)
     {
         return(CCEExceptionUtil.GetEnhancedMessage(resKey, arg, String.Format(dictionary[resKey], new String[] { arg })));
     }
     else
     {
         return(String.Format(dictionary[resKey], new String[] { arg }));
     }
 }
Beispiel #3
0
 public string GetString(string resKey, bool exception)
 {
     if (exception)
     {
         return(CCEExceptionUtil.GetEnhancedMessage(resKey, dictionary[resKey], dictionary[resKey]));
     }
     else
     {
         return(dictionary[resKey]);
     }
 }
Beispiel #4
0
        /// <summary>
        /// Affectation du message si la carte est invalide
        /// </summary>
        /// <param name="unvalidMsg">Message</param>
        public void SetUnValidMsg(UserInfo user, string unvalidMsg)
        {
            this.UnValidMsg = unvalidMsg;
            // Clean message by removing exception tag
            string cleanUnvalidMessage = CCEExceptionUtil.CleanMessage(unvalidMsg);

            // On va tracer ce rejet dans la table des traces des carte rejetées
            Services.LogRejectedCreditCard(user, this, string.Empty,
                                           Const.StatusRefused,
                                           cleanUnvalidMessage, cleanUnvalidMessage);
        }
Beispiel #5
0
        /// <summary>
        /// Retourne le message si la carte est invalide
        /// On retire du messages les éventuelles balises
        /// d'erreur
        /// </summary>
        /// <returns>Raison d'invalidité de la carte</returns>
        public string GetCleanedUnValidMsg()
        {
            if (GetUnValidMsg() == null)
            {
                return(null);
            }

            if (GetUnValidMsg().StartsWith(CCEExceptionUtil.EXCEPTION_TAG_OPEN))
            {
                return(CCEExceptionUtil.GetExceptionOnlyMessage(GetUnValidMsg()));
            }
            return(GetUnValidMsg());
        }
Beispiel #6
0
        public static void ValidCommunValues(UserInfo user, List <CEEException> exceptions, string pos, string travelerCode, string travelerName,
                                             string cc1, string cc2, string bookingDate)
        {
            // Point de vente
            if (String.IsNullOrEmpty(pos))
            {
                exceptions.Add(CCEExceptionUtil.BuildCCEException("MISSING_POS",
                                                                  CCEExceptionMap.EXCEPTION_TYPE_FONCTIONAL,
                                                                  CCEExceptionMap.EXCEPTION_SEVERITY_ERROR,
                                                                  user.GetMessages().GetString("VPaymentGeneration.Error.MissingPOS", false)));
            }

            // Code voyageur
            if (String.IsNullOrEmpty(travelerCode))
            {
                exceptions.Add(CCEExceptionUtil.BuildCCEException("MISSING_TRAVELER_CODE",
                                                                  CCEExceptionMap.EXCEPTION_TYPE_FONCTIONAL,
                                                                  CCEExceptionMap.EXCEPTION_SEVERITY_ERROR,
                                                                  user.GetMessages().GetString("VPaymentGeneration.Error.MissingTravelerCode", false)));
            }

            // Nom voyageur
            if (String.IsNullOrEmpty(travelerName))
            {
                exceptions.Add(CCEExceptionUtil.BuildCCEException("MISSING_TRAVELER_NAME",
                                                                  CCEExceptionMap.EXCEPTION_TYPE_FONCTIONAL,
                                                                  CCEExceptionMap.EXCEPTION_SEVERITY_ERROR,
                                                                  user.GetMessages().GetString("VPaymentGeneration.Error.MissingTravelerName", false)));
            }

            /*
             * // CC1
             * if (String.IsNullOrEmpty(cc1))
             * {
             *  exceptions.Add(CCEExceptionUtil.BuildCCEException("MISSING_MAIN_COST_CENTER",
             *      CCEExceptionMap.EXCEPTION_TYPE_FONCTIONAL,
             *      CCEExceptionMap.EXCEPTION_SEVERITY_ERROR,
             * user.GetMessages().GetString("VPaymentGeneration.Error.MissingCC1", false)));
             * }
             *
             * // CC2
             * if (String.IsNullOrEmpty(cc2))
             * {
             *  exceptions.Add(CCEExceptionUtil.BuildCCEException("MISSING_SECONDARY_COST_CENTER",
             *      CCEExceptionMap.EXCEPTION_TYPE_FONCTIONAL,
             *      CCEExceptionMap.EXCEPTION_SEVERITY_ERROR,
             * user.GetMessages().GetString("VPaymentGeneration.Error.MissingCC2", false)));
             * }
             */
        }
Beispiel #7
0
 /// <summary>
 /// Décomposition de l'exception si cette dernière est enrichie
 /// On va extraire le code de l'exception
 /// le degré de sévérité de l'exception
 /// le type d'exception
 /// </summary>
 private void SplitException()
 {
     if (GetExceptionMessage().StartsWith(CCEExceptionUtil.EXCEPTION_TAG_OPEN))
     {
         // Ce message est enrichi
         // par le code, le type et la sévérité du message
         this.ExceptionCode     = CCEExceptionUtil.GetExceptionCode(GetExceptionMessage());
         this.ExceptionSeverity = CCEExceptionUtil.GetExceptionSeverity(GetExceptionMessage());
         this.ExceptionType     = CCEExceptionUtil.GetExceptionType(GetExceptionMessage());
         this.ExceptionMessage  = CCEExceptionUtil.GetExceptionOnlyMessage(GetExceptionMessage());
     }
     else
     {
         // Cette exception n'est pas enrichie
         // On va mettre les valeurs par défaut
         this.ExceptionCode     = CCEExceptionMap.EXCEPTION_CODE_DEFAULT;
         this.ExceptionSeverity = CCEExceptionMap.EXCEPTION_SEVERITY_DEFAULT;
         this.ExceptionType     = CCEExceptionMap.EXCEPTION_TYPE_SYSTEM;
     }
 }
Beispiel #8
0
 /// <summary>
 /// Split exception
 /// </summary>
 private void SplitException()
 {
     if (GetExceptionMessage().StartsWith(CCEExceptionUtil.EXCEPTION_TAG_OPEN))
     {
         // the exception message contains details
         // we will extract the code, severity, type and message
         this.ExceptionCode     = CCEExceptionUtil.GetExceptionCode(GetExceptionMessage());
         this.ExceptionSeverity = CCEExceptionUtil.GetExceptionSeverity(GetExceptionMessage());
         this.ExceptionType     = CCEExceptionUtil.GetExceptionType(GetExceptionMessage());
         this.ExceptionMessage  = CCEExceptionUtil.GetExceptionOnlyMessage(GetExceptionMessage());
     }
     else
     {
         // the exception do not contain details
         // on will put default values
         this.ExceptionCode     = CCEExceptionMap.EXCEPTION_CODE_DEFAULT;
         this.ExceptionSeverity = CCEExceptionMap.EXCEPTION_SEVERITY_DEFAULT;
         this.ExceptionType     = CCEExceptionMap.EXCEPTION_TYPE_SYSTEM;
     }
 }
Beispiel #9
0
 /// <summary>
 /// Clean message
 /// </summary>
 /// <param name="message">Message</param>
 /// <returns></returns>
 public static string CleanMessage(string message)
 {
     return(CCEExceptionUtil.CleanMessage(message, Logger.LogFacilityUser, Logger.LogLevelError));
 }
Beispiel #10
0
 public void SetNavisionWssFailed(Exception e)
 {
     this.NavisionWssStatus = Const.Failed;
     this.NavisionWssError  = CCEExceptionUtil.GetExceptionMessage(e.Message);
     SetGlobalStatusFailed();
 }
Beispiel #11
0
 public void SetVCardLogDatabaseFailed(Exception e)
 {
     this.VCardLogDatabaseStatus = Const.Failed;
     this.VCardLogDatabaseError  = CCEExceptionUtil.GetExceptionMessage(e.Message);
     SetGlobalStatusFailed();
 }
Beispiel #12
0
 public void SetSyslogFailed(Exception e)
 {
     this.SyslogStatus = Const.Failed;
     this.SyslogError  = CCEExceptionUtil.GetExceptionMessage(e.Message);
     SetGlobalStatusFailed();
 }
Beispiel #13
0
 public void SetActiveDirectoryFailed(Exception e)
 {
     this.ActiveDirectoryStatus = Const.Failed;
     this.ActiveDirectoryError  = CCEExceptionUtil.GetExceptionMessage(e.Message);
     SetGlobalStatusFailed();
 }
Beispiel #14
0
        /// <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)));
                }
            }
        }
Beispiel #15
0
        /// <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)));
                }
            }
        }