public static string csConvenio()
        {
            string sConvenio = string.Empty;

            try
            {
                clsCache cCache = new csCache().cCache();
                if (cCache != null)
                {
                    //if (cCache.Corporativo != null)
                    //{
                    //    int iTotal = cCache.Corporativo.Count;
                    //    for (int i = 0; i < iTotal; i++)
                    //    {
                    //        if (cCache.Corporativo[i].ProveedorWs.Equals(Enum_ProveedorWebServices.Sabre))
                    //        {
                    //            try
                    //            {
                    //                int iTotalConvenio = cCache.Corporativo[i].Convenio.Count;
                    //                for (int j = 0; j < iTotalConvenio; j++)
                    //                {
                    //                    int iTotalOpertaConvenio = cCache.Corporativo[i].Convenio[j].OperaConvenio.Count;
                    //                    for (int k = 0; k < iTotalOpertaConvenio; k++)
                    //                    {
                    //                        if (cCache.Corporativo[i].Convenio[j].OperaConvenio[k].Operador.Equals("SnapCode"))
                    //                        {
                    //                            sConvenio = cCache.Corporativo[i].Convenio[j].OperaConvenio[k].Convenio;
                    //                        }
                    //                    }
                    //                }
                    //            }
                    //            catch { }
                    //        }
                    //    }
                    //}
                }
                if (sConvenio.Length.Equals(0))
                {
                    VO_OTA_AirLowFareSearchLLSRQ vo_OTA_AirLowFareSearchLLSRQ = clsSesiones.getParametrosAirBargain();
                    if (vo_OTA_AirLowFareSearchLLSRQ != null)
                    {
                        if (vo_OTA_AirLowFareSearchLLSRQ.SCodTarifaNegociada != null)
                        {
                            sConvenio = vo_OTA_AirLowFareSearchLLSRQ.SCodTarifaNegociada;
                        }
                    }
                }
            }
            catch
            {
            }
            return(sConvenio);
        }
Esempio n. 2
0
        public static void GuardarSession(VO_OTA_AirLowFareSearchLLSRQ vo_OTA_AirLowFareSearchLLSRQ)
        {
            clsNegocioSabre cWs       = new clsNegocioSabre();
            string          sAdultos  = "0";
            string          sTrayecto = vo_OTA_AirLowFareSearchLLSRQ.ETipoTrayecto.ToString() + " " + vo_OTA_AirLowFareSearchLLSRQ.ETipoVuelo.ToString();
            string          sIp       = HttpContext.Current.Request.UserHostAddress;

            for (int i = 0; i < vo_OTA_AirLowFareSearchLLSRQ.Lvo_Pasajeros.Count; i++)
            {
                if (vo_OTA_AirLowFareSearchLLSRQ.Lvo_Pasajeros[i].SCodigo == "ADT")
                {
                    sAdultos = vo_OTA_AirLowFareSearchLLSRQ.Lvo_Pasajeros[i].SCantidad.ToString();
                }
            }
            cWs.Conexion = ConfigurationManager.AppSettings["strConexion"].ToString();
            cWs.GuardarSession(AutenticacionSabre.GET_SabreSession(), "Sabre", sTrayecto, vo_OTA_AirLowFareSearchLLSRQ.Lvo_Rutas[0].Vo_AeropuertoOrigen.SCodigo, vo_OTA_AirLowFareSearchLLSRQ.Lvo_Rutas[0].Vo_AeropuertoDestino.SCodigo, vo_OTA_AirLowFareSearchLLSRQ.Lvo_Rutas[0].SFechaSalida.ToString(), sAdultos, sIp);
        }
Esempio n. 3
0
        public VO_OTA_AirLowFareSearchLLSRQ cRecuperaParamAir()
        {
            VO_OTA_AirLowFareSearchLLSRQ vo_Object = null;

            try
            {
                string        idSession    = new clsCacheControl().RecuperarSesionId();
                string        FileCache    = "vo_OTA_AirLowFareSearchLLSRQ_" + idSession;
                string        strPathXML   = clsValidaciones.CacheTempCrea();
                TextReader    txtReader    = new StreamReader(strPathXML + FileCache + ".xml");
                XmlSerializer SerializerRS = new XmlSerializer(typeof(VO_OTA_AirLowFareSearchLLSRQ));
                vo_Object = (VO_OTA_AirLowFareSearchLLSRQ)SerializerRS.Deserialize(txtReader);
                txtReader.Close();
                txtReader.Dispose();
            }
            catch { }
            return(vo_Object);
        }
Esempio n. 4
0
 public void cGuardaParamAir(VO_OTA_AirLowFareSearchLLSRQ vo_Object)
 {
     try
     {
         string idSession  = new clsCacheControl().RecuperarSesionId();
         string FileCache  = "vo_OTA_AirLowFareSearchLLSRQ_" + idSession;
         string strPathXML = clsValidaciones.CacheTempCrea();
         try
         {
             XmlSerializer SerializerRQ = new XmlSerializer(typeof(VO_OTA_AirLowFareSearchLLSRQ));
             StreamWriter  WriterRQ     = new StreamWriter(strPathXML + FileCache + ".xml");
             SerializerRQ.Serialize(WriterRQ, vo_Object);
             WriterRQ.Flush();
             WriterRQ.Close();
         }
         catch { }
     }
     catch { }
 }
Esempio n. 5
0
        public static VO_Credentials Credentials()
        {
            VO_Credentials vo_Credentials = new VO_Credentials();
            clsParametros  cParametros    = new clsParametros();
            VO_OTA_AirLowFareSearchLLSRQ vo_OTA_AirLowFareSearchLLSRQ = clsSesiones.getParametrosAirBargain();
            bool   bCredentials = false;
            string sPccPais     = clsValidaciones.GetKeyOrAdd("PaisDefault", "COL");

            try
            {
                if (clsConfiguracionSabre.PccPais != null)
                {
                    sPccPais = clsConfiguracionSabre.PccPais;
                }
            }
            catch { }
            try
            {
                clsCache cCache = new csCache().cCache();
                if (cCache != null)
                {
                    //if (cCache.Corporativo != null)
                    //{
                    //    int iTotal = cCache.Corporativo.Count;
                    //    for (int i = 0; i < iTotal; i++)
                    //    {
                    //        if (cCache.Corporativo[i].ProveedorWs.Equals(Enum_ProveedorWebServices.Sabre))
                    //        {
                    //            vo_Credentials = cCache.Corporativo[i].Credentials;
                    bCredentials = false;
                    //        }
                    //    }
                    //}
                }
                if (!bCredentials)
                {
                    vo_Credentials.User                       = clsConfiguracionSabre.User;
                    vo_Credentials.Password                   = clsConfiguracionSabre.Password;
                    vo_Credentials.Conversacion               = clsConfiguracionSabre.Conversacion;
                    vo_Credentials.Dominio                    = clsConfiguracionSabre.Dominio;
                    vo_Credentials.From                       = clsConfiguracionSabre.From;
                    vo_Credentials.Ipcc                       = clsConfiguracionSabre.Ipcc;
                    vo_Credentials.Pcc                        = clsConfiguracionSabre.Pcc;
                    vo_Credentials.PccDefault                 = clsConfiguracionSabre.Pcc;
                    vo_Credentials.Pseudo                     = 0;
                    vo_Credentials.PseudoDefault              = 0;
                    vo_Credentials.PccDefaultPais             = sPccPais;
                    vo_Credentials.Mensaje                    = clsConfiguracionSabre.Mensaje;
                    vo_Credentials.QNumber                    = clsConfiguracionSabre.QNumber;
                    vo_Credentials.To                         = clsConfiguracionSabre.To;
                    vo_Credentials.SnapCode                   = clsConfiguracionSabre.SnapCode;
                    vo_Credentials.PseudoPerfil               = clsConfiguracionSabre.PseudoPerfil;
                    vo_Credentials.UrlWebServices             = clsConfiguracionSabre.UrlWebService;
                    vo_Credentials.Agencia_Ciudad             = clsConfiguracionSabre.Agencia_Ciudad;
                    vo_Credentials.Agencia_CodigoArea         = clsConfiguracionSabre.Agencia_CodigoArea;
                    vo_Credentials.Agencia_CodigoEstado       = clsConfiguracionSabre.Agencia_CodigoEstado;
                    vo_Credentials.Agencia_CodigoLocalizacion = clsConfiguracionSabre.Agencia_CodigoLocalizacion;
                    vo_Credentials.Agencia_CodigoPais         = clsConfiguracionSabre.Agencia_CodigoPais;
                    vo_Credentials.Agencia_CodigoPostal       = clsConfiguracionSabre.Agencia_CodigoPostal;
                    vo_Credentials.Agencia_Direccion          = clsConfiguracionSabre.Agencia_Direccion;
                    vo_Credentials.Agencia_Nombre             = clsConfiguracionSabre.Agencia_Nombre;
                    vo_Credentials.Agencia_Telefono           = clsConfiguracionSabre.Agencia_Telefono;
                    vo_Credentials.Agencia_TiketeId           = clsConfiguracionSabre.Agencia_TicketeId;
                    vo_Credentials.Agencia_TiketeManual       = clsConfiguracionSabre.Agencia_TicketeManual;
                    vo_Credentials.Agencia_TiketTimeLimit     = clsConfiguracionSabre.Agencia_TicketTimeLimit;
                    vo_Credentials.NameEspace                 = clsConfiguracionSabre.Namespace;
                    vo_Credentials.SegmentoFuturo             = clsConfiguracionSabre.SegmentoFuturo;
                    vo_Credentials.TimeLimit                  = clsConfiguracionSabre.TimeLimit;
                }
                try
                {
                    if (vo_OTA_AirLowFareSearchLLSRQ != null)
                    {
                        if (vo_OTA_AirLowFareSearchLLSRQ.SPseudoPlanes != null)
                        {
                            vo_Credentials.Pcc = vo_OTA_AirLowFareSearchLLSRQ.SPseudoPlanes.ToString();
                        }
                    }
                }
                catch { }
            }
            catch
            {
                if (!bCredentials)
                {
                    try
                    {
                        vo_Credentials.User                       = clsConfiguracionSabre.User;
                        vo_Credentials.Password                   = clsConfiguracionSabre.Password;
                        vo_Credentials.Conversacion               = clsConfiguracionSabre.Conversacion;
                        vo_Credentials.Dominio                    = clsConfiguracionSabre.Dominio;
                        vo_Credentials.From                       = clsConfiguracionSabre.From;
                        vo_Credentials.Ipcc                       = clsConfiguracionSabre.Ipcc;
                        vo_Credentials.Pcc                        = clsConfiguracionSabre.Pcc;
                        vo_Credentials.PccDefault                 = clsConfiguracionSabre.Pcc;
                        vo_Credentials.Pseudo                     = 0;
                        vo_Credentials.PseudoDefault              = 0;
                        vo_Credentials.PccDefaultPais             = sPccPais;
                        vo_Credentials.Mensaje                    = clsConfiguracionSabre.Mensaje;
                        vo_Credentials.QNumber                    = clsConfiguracionSabre.QNumber;
                        vo_Credentials.To                         = clsConfiguracionSabre.To;
                        vo_Credentials.SnapCode                   = clsConfiguracionSabre.SnapCode;
                        vo_Credentials.PseudoPerfil               = clsConfiguracionSabre.PseudoPerfil;
                        vo_Credentials.UrlWebServices             = clsConfiguracionSabre.UrlWebService;
                        vo_Credentials.Agencia_Ciudad             = clsConfiguracionSabre.Agencia_Ciudad;
                        vo_Credentials.Agencia_CodigoArea         = clsConfiguracionSabre.Agencia_CodigoArea;
                        vo_Credentials.Agencia_CodigoEstado       = clsConfiguracionSabre.Agencia_CodigoEstado;
                        vo_Credentials.Agencia_CodigoLocalizacion = clsConfiguracionSabre.Agencia_CodigoLocalizacion;
                        vo_Credentials.Agencia_CodigoPais         = clsConfiguracionSabre.Agencia_CodigoPais;
                        vo_Credentials.Agencia_CodigoPostal       = clsConfiguracionSabre.Agencia_CodigoPostal;
                        vo_Credentials.Agencia_Direccion          = clsConfiguracionSabre.Agencia_Direccion;
                        vo_Credentials.Agencia_Nombre             = clsConfiguracionSabre.Agencia_Nombre;
                        vo_Credentials.Agencia_Telefono           = clsConfiguracionSabre.Agencia_Telefono;
                        vo_Credentials.Agencia_TiketeId           = clsConfiguracionSabre.Agencia_TicketeId;
                        vo_Credentials.Agencia_TiketeManual       = clsConfiguracionSabre.Agencia_TicketeManual;
                        vo_Credentials.Agencia_TiketTimeLimit     = clsConfiguracionSabre.Agencia_TicketTimeLimit;
                        vo_Credentials.NameEspace                 = clsConfiguracionSabre.Namespace;
                        vo_Credentials.SegmentoFuturo             = clsConfiguracionSabre.SegmentoFuturo;
                        vo_Credentials.TimeLimit                  = clsConfiguracionSabre.TimeLimit;
                    }
                    catch
                    {
                    }
                }
                try
                {
                    if (vo_OTA_AirLowFareSearchLLSRQ != null)
                    {
                        if (vo_OTA_AirLowFareSearchLLSRQ.SPseudoPlanes != null)
                        {
                            vo_Credentials.Pcc = vo_OTA_AirLowFareSearchLLSRQ.SPseudoPlanes.ToString();
                        }
                    }
                }
                catch { }
            }
            return(vo_Credentials);
        }
        public OTA_AirPriceRQ.OTA_AirPriceRS _Sabre_BuscarTarifa(VO_OTA_AirLowFareSearchLLSRQ vo_OTA_AirLowFareSearchLLSRQ)
        {
            OTA_AirPriceRQ.OTA_AirPriceRS BargainResultado_ = new OTA_AirPriceRQ.OTA_AirPriceRS();
            objvo_Credentials = Ssoft.Utils.clsSesiones.getCredentials();
            StringBuilder consulta    = new StringBuilder();
            clsParametros cParametros = new clsParametros();

            cParametros.TipoWs = Enum_ProveedorWebServices.Sabre;
            try
            {
                OTA_AirPriceRQ.MessageHeader Mensaje_ = clsSabreBase.__ISabre_OTA_AirPrice();

                if (Mensaje_ != null)
                {
                    OTA_AirPriceRQ.Security Seguridad_ = new OTA_AirPriceRQ.Security();
                    Seguridad_.BinarySecurityToken = Session_;

                    OTA_AirPriceRQ.OTA_AirPriceRQ          Bargain_       = new OTA_AirPriceRQ.OTA_AirPriceRQ();
                    OTA_AirPriceRQ.OTA_AirPriceRQPOS       BargainPos_    = new OTA_AirPriceRQ.OTA_AirPriceRQPOS();
                    OTA_AirPriceRQ.OTA_AirPriceRQPOSSource BargainSource_ = new OTA_AirPriceRQ.OTA_AirPriceRQPOSSource();

                    BargainSource_.PseudoCityCode = objvo_Credentials.Pcc;//ConfigurationManager.AppSettings["Sabre_Ipcc"];
                    BargainPos_.Source            = BargainSource_;
                    Bargain_.POS = BargainPos_;

                    //OTA_AirPriceRQ.OTA_AirPriceRQTravelerInfoSummary Bargain_Info_ = new OTA_AirPriceRQ.OTA_AirPriceRQTravelerInfoSummary();
                    OTA_AirPriceRQ.OTA_AirPriceRQTravelerInfoSummary oTravelerInfoSummary          = new OTA_AirPriceRQ.OTA_AirPriceRQTravelerInfoSummary();
                    OTA_AirPriceRQ.OTA_AirPriceRQTravelerInfoSummaryTPA_Extensions oTPA_Extensions = new OTA_AirPriceRQ.OTA_AirPriceRQTravelerInfoSummaryTPA_Extensions();
                    OTA_AirPriceRQ.OTA_AirPriceRQTravelerInfoSummaryTPA_ExtensionsBargainFinder       oExtensionsBargainFinder = new OTA_AirPriceRQ.OTA_AirPriceRQTravelerInfoSummaryTPA_ExtensionsBargainFinder();
                    OTA_AirPriceRQ.OTA_AirPriceRQTravelerInfoSummaryTPA_ExtensionsBargainFinderRebook oRebook         = new OTA_AirPriceRQ.OTA_AirPriceRQTravelerInfoSummaryTPA_ExtensionsBargainFinderRebook();
                    OTA_AirPriceRQ.OTA_AirPriceRQTravelerInfoSummaryTPA_ExtensionsPriceRetention      oPriceRetention = new OTA_AirPriceRQ.OTA_AirPriceRQTravelerInfoSummaryTPA_ExtensionsPriceRetention();

                    //oRebook.Ind = false;
                    //oPriceRetention.Default = true;
                    //oExtensionsBargainFinder.Ind = false;

                    oRebook.Ind                  = true;
                    oPriceRetention.Default      = true;
                    oExtensionsBargainFinder.Ind = true;

                    oExtensionsBargainFinder.Rebook     = oRebook;
                    oTPA_Extensions.BargainFinder       = oExtensionsBargainFinder;
                    oTPA_Extensions.PriceRetention      = oPriceRetention;
                    oTravelerInfoSummary.TPA_Extensions = oTPA_Extensions;
                    #region [ PRICEREQUESTINFORMATION ]

                    string sMonedaCotizar   = vo_OTA_AirLowFareSearchLLSRQ.SCodMonedaCotizacion;
                    string sTarifaNegociada = vo_OTA_AirLowFareSearchLLSRQ.SCodTarifaNegociada;
                    OTA_AirPriceRQ.OTA_AirPriceRQTravelerInfoSummaryPriceRequestInformation Bargain_InfoPrice_ = new OTA_AirPriceRQ.OTA_AirPriceRQTravelerInfoSummaryPriceRequestInformation();
                    OTA_AirPriceRQ.OTA_AirPriceRQTravelerInfoSummaryPriceRequestInformationTPA_Extensions          Bargain_InfoPriceTPA_ = new OTA_AirPriceRQ.OTA_AirPriceRQTravelerInfoSummaryPriceRequestInformationTPA_Extensions();
                    OTA_AirPriceRQ.OTA_AirPriceRQTravelerInfoSummaryPriceRequestInformationTPA_ExtensionsCorporate oTourCode             = new OTA_AirPriceRQ.OTA_AirPriceRQTravelerInfoSummaryPriceRequestInformationTPA_ExtensionsCorporate();
                    OTA_AirPriceRQ.OTA_AirPriceRQTravelerInfoSummaryPriceRequestInformationTPA_ExtensionsAccount   oAccountCode          = new OTA_AirPriceRQ.OTA_AirPriceRQTravelerInfoSummaryPriceRequestInformationTPA_ExtensionsAccount();
                    if (clsValidaciones.getValidarString(sTarifaNegociada))
                    {
                        oAccountCode.Code = sTarifaNegociada;
                        //Bargain_InfoPriceTPA_.Corporate = oTourCode;
                        Bargain_InfoPriceTPA_.Account     = oAccountCode;
                        Bargain_InfoPrice_.TPA_Extensions = Bargain_InfoPriceTPA_;
                        if (clsValidaciones.getValidarString(sMonedaCotizar))
                        {
                            Bargain_InfoPrice_.CurrencyCode = sMonedaCotizar;
                        }
                        oTravelerInfoSummary.PriceRequestInformation = Bargain_InfoPrice_;
                    }
                    else
                    {
                        if (clsValidaciones.getValidarString(sMonedaCotizar))
                        {
                            Bargain_InfoPrice_.CurrencyCode = sMonedaCotizar;
                        }
                        oTravelerInfoSummary.PriceRequestInformation = Bargain_InfoPrice_;
                    }

                    #endregion

                    System.Collections.Generic.List <VO_Pasajero> lvo_Pasajeros = vo_OTA_AirLowFareSearchLLSRQ.Lvo_Pasajeros;
                    // Para tomar tarifa de niños como en la busqueda normal, pero no retorna resultados reales
                    int iContPaxTotal = 0;
                    if (lvo_Pasajeros != null)
                    {
                        foreach (VO_Pasajero vo_PasajeroTotal in lvo_Pasajeros)
                        {
                            if (vo_PasajeroTotal.SCodigo.Equals("CNN"))
                            {
                                iContPaxTotal += int.Parse(vo_PasajeroTotal.SCantidad);
                            }
                            else
                            {
                                iContPaxTotal++;
                            }
                        }
                    }
                    OTA_AirPriceRQ.OTA_AirPriceRQTravelerInfoSummaryTPA_ExtensionsPassengerType[] oPassengerType_ = new OTA_AirPriceRQ.OTA_AirPriceRQTravelerInfoSummaryTPA_ExtensionsPassengerType[iContPaxTotal];

                    if (lvo_Pasajeros != null)
                    {
                        int iContador = 0;
                        foreach (VO_Pasajero vo_Pasajero in lvo_Pasajeros)
                        {
                            if (!(vo_Pasajero.SCantidad.Equals("0")))
                            {
                                if (vo_Pasajero.SCodigo.Equals("CNN"))
                                {
                                    foreach (VO_ClasificaPasajero vo_CatPasajero in vo_Pasajero.LvPasajeroNino)
                                    {
                                        OTA_AirPriceRQ.OTA_AirPriceRQTravelerInfoSummaryTPA_ExtensionsPassengerType oPassengerType = null;
                                        oPassengerType          = new OTA_AirPriceRQ.OTA_AirPriceRQTravelerInfoSummaryTPA_ExtensionsPassengerType();
                                        oPassengerType.Quantity = vo_CatPasajero.SCantidad;
                                        oPassengerType.Code     = vo_CatPasajero.SCodigo;
                                        oPassengerType.AlternatePassengerType          = true;
                                        oPassengerType.AlternatePassengerTypeSpecified = true;

                                        oPassengerType_.SetValue(oPassengerType, iContador++);
                                    }
                                }
                                else
                                {
                                    OTA_AirPriceRQ.OTA_AirPriceRQTravelerInfoSummaryTPA_ExtensionsPassengerType oPassengerType = null;
                                    oPassengerType          = new OTA_AirPriceRQ.OTA_AirPriceRQTravelerInfoSummaryTPA_ExtensionsPassengerType();
                                    oPassengerType.Quantity = vo_Pasajero.SCantidad;
                                    oPassengerType.Code     = vo_Pasajero.SCodigo;
                                    oPassengerType.AlternatePassengerType          = true;
                                    oPassengerType.AlternatePassengerTypeSpecified = true;

                                    oPassengerType_.SetValue(oPassengerType, iContador++);
                                }
                            }
                        }
                    }

                    //int iContPaxTotal = 0;
                    //if (lvo_Pasajeros != null)
                    //{
                    //    iContPaxTotal = lvo_Pasajeros.Count;
                    //}
                    //OTA_AirPriceRQ.OTA_AirPriceRQTravelerInfoSummaryTPA_ExtensionsPassengerType[] oPassengerType_ = new OTA_AirPriceRQ.OTA_AirPriceRQTravelerInfoSummaryTPA_ExtensionsPassengerType[iContPaxTotal];

                    //if (lvo_Pasajeros != null)
                    //{
                    //    int iContador = 0;
                    //    foreach (VO_Pasajero vo_Pasajero in lvo_Pasajeros)
                    //    {
                    //        if (!(vo_Pasajero.SCantidad.Equals("0")))
                    //        {
                    //            OTA_AirPriceRQ.OTA_AirPriceRQTravelerInfoSummaryTPA_ExtensionsPassengerType oPassengerType = null;
                    //            oPassengerType = new OTA_AirPriceRQ.OTA_AirPriceRQTravelerInfoSummaryTPA_ExtensionsPassengerType();
                    //            oPassengerType.Quantity = vo_Pasajero.SCantidad;
                    //            oPassengerType.Code = vo_Pasajero.SCodigo;
                    //            oPassengerType.AlternatePassengerType = true;
                    //            oPassengerType.AlternatePassengerTypeSpecified = true;

                    //            oPassengerType_.SetValue(oPassengerType, iContador++);
                    //        }
                    //    }
                    //}

                    Bargain_.TravelerInfoSummary = oTravelerInfoSummary;
                    Bargain_.TravelerInfoSummary.TPA_Extensions.PassengerType = oPassengerType_;

                    //Bargain_.TravelerInfoSummary = oTravelerInfoSummary;
                    //Bargain_.TravelerInfoSummary.TPA_Extensions.PassengerType = oPassengerType_;

                    Bargain_.Version = clsSabreBase.SABRE_VERSION_OTA_AIRPRICE;

                    OTA_AirPriceRQ.OTA_AirPriceService BargainServicio_ = new OTA_AirPriceRQ.OTA_AirPriceService();
                    BargainServicio_.MessageHeaderValue = Mensaje_;
                    BargainServicio_.SecurityValue      = Seguridad_;
                    BargainServicio_.Url = objvo_Credentials.UrlWebServices;

                    BargainResultado_ = BargainServicio_.OTA_AirPriceRQ(Bargain_);
                    // Para verificar la tarifa //
                    //string sComand = "WPP" + "JCB" + "¥NCB";
                    //string sVenta = Negocios_WebServiceSabreCommand._EjecutarComando(sComand);
                    // Termina

                    if (BargainResultado_.Errors != null)
                    {
                        cParametros.Id          = 0;
                        cParametros.Code        = BargainResultado_.Errors.Error.ErrorCode;
                        cParametros.Info        = BargainResultado_.Errors.Error.ErrorInfo.Message;
                        cParametros.Message     = BargainResultado_.Errors.Error.ErrorMessage;
                        cParametros.Severity    = BargainResultado_.Errors.Error.Severity;
                        cParametros.Complemento = "HostCommand: " + BargainResultado_.TPA_Extensions.HostCommand;
                        cParametros.Metodo      = "_Sabre_BuscarTarifa";
                        cParametros.Tipo        = clsTipoError.WebServices;
                        consulta.AppendLine("Credenciales: ");
                        try
                        {
                            if (objvo_Credentials != null)
                            {
                                consulta.AppendLine("User: "******"Password: "******"Ipcc: " + objvo_Credentials.Ipcc);
                                consulta.AppendLine("Pcc: " + objvo_Credentials.Pcc);
                                consulta.AppendLine("QNumber: " + objvo_Credentials.QNumber);
                                consulta.AppendLine("Dominio: " + objvo_Credentials.Dominio);
                                consulta.AppendLine("Session Sabre: " + Session_.ToString());
                                consulta.AppendLine("Url Sabre: " + objvo_Credentials.UrlWebServices);
                            }
                        }
                        catch { }
                        cParametros.TargetSite = consulta.ToString();
                        try
                        {
                            clsCache cCache = new csCache().cCache();
                            if (cCache != null)
                            {
                                cParametros.Source = "Sesion Local: " + cCache.SessionID.ToString();
                            }
                            else
                            {
                                cParametros.Source = "Sesion Local: No hay cache ";
                            }
                        }
                        catch
                        {
                            cParametros.Source = "Sesion Local: Error ";
                        }
                        cParametros.TipoLog = Enum_Error.Log;
                        ExceptionHandled.Publicar(cParametros);
                    }
                    else
                    {
                        cParametros.Id      = 1;
                        cParametros.TipoLog = Enum_Error.Transac;
                        cParametros.Message = BargainResultado_.Success;
                        consulta.AppendLine("Credenciales: ");
                        try
                        {
                            if (objvo_Credentials != null)
                            {
                                consulta.AppendLine("User: "******"Password: "******"Ipcc: " + objvo_Credentials.Ipcc);
                                consulta.AppendLine("Pcc: " + objvo_Credentials.Pcc);
                                consulta.AppendLine("QNumber: " + objvo_Credentials.QNumber);
                                consulta.AppendLine("Dominio: " + objvo_Credentials.Dominio);
                                consulta.AppendLine("Session Sabre: " + Session_.ToString());
                                consulta.AppendLine("Url Sabre: " + objvo_Credentials.UrlWebServices);
                            }
                        }
                        catch { }
                        cParametros.TargetSite = consulta.ToString();
                        try
                        {
                            clsCache cCache = new csCache().cCache();
                            if (cCache != null)
                            {
                                cParametros.Source = "Sesion Local: " + cCache.SessionID.ToString();
                            }
                            else
                            {
                                cParametros.Source = "Sesion Local: No hay cache ";
                            }
                        }
                        catch
                        {
                            cParametros.Source = "Sesion Local: Error ";
                        }
                        cParametros.Metodo      = "_Sabre_BuscarTarifa";
                        cParametros.Complemento = "HostCommand: " + BargainResultado_.TPA_Extensions.HostCommand;
                        cParametros.Tipo        = clsTipoError.WebServices;
                        cParametros.Severity    = clsSeveridad.Moderada;
                        ExceptionHandled.Publicar(cParametros);
                    }
                }
            }
            catch (Exception Ex)
            {
                cParametros.Id         = 0;
                cParametros.Message    = Ex.Message;
                cParametros.StackTrace = Ex.StackTrace;
                cParametros.Source     = Ex.Source;
                cParametros.TargetSite = Ex.TargetSite.ToString();
                cParametros.Severity   = clsSeveridad.Alta;
                cParametros.Metodo     = "_Sabre_BuscarTarifa";
                cParametros.Tipo       = clsTipoError.WebServices;
                ExceptionHandled.Publicar(cParametros);
            }
            return(BargainResultado_);
        }
Esempio n. 7
0
        /// <summary>
        /// getBargainFinderMaxRQ returns up to 200 diferent options for the availability
        /// </summary>
        /// <param name="vo_BargainFinderMax_ADRQ"></param>
        public override object getExecuteSWS(params object[] ota_AirPriceRQ)
        {
            VO_BargainFinderMax_ADRQ vo_BargainFinderMax_ADRQ = (VO_BargainFinderMax_ADRQ)ota_AirPriceRQ[0];

            OTA_AirLowFareSearchRQ ota_AirLowFareSearchRQ = new OTA_AirLowFareSearchRQ();

            session_ = AutenticacionSabre.GET_SabreSession();

            objvo_Credentials = Ssoft.Utils.clsSesiones.getCredentials();

            SWS_BargainFinderMaxRQ.Security security = new SWS_BargainFinderMaxRQ.Security();
            security.BinarySecurityToken = session_;// vo_BargainFinderMax_ADRQ.Vo_SessionCreateRQ.;

            //exluimos aerolineas
            //hceron
            //29042013
            csVuelos      cVuelos        = new csVuelos();
            List <string> lsExcluirAerol = cVuelos.ExcluirAerolineas();

            #region [ POS ]
            //Source
            SourceType[] sourceTypes = new SourceType[1];
            SourceType   sourceType  = new SourceType();

            VO_SessionCreateRQ vo_SessionCreateRQ = vo_BargainFinderMax_ADRQ.Vo_SessionCreateRQ;
            sourceType.PseudoCityCode = objvo_Credentials.Ipcc;

            //RequestorID
            UniqueID_Type uniqueID_Type = new UniqueID_Type();
            uniqueID_Type.ID   = "1"; //"ID" (required) Not used for processing. Use a value of "1".
            uniqueID_Type.Type = "1"; //"Type" (required) Not used for processing. Use a value of "1".

            CompanyNameType companyNameType = new CompanyNameType();
            companyNameType.Code      = "TN";
            uniqueID_Type.CompanyName = companyNameType; //"Code" (required) Customer code. Use the value "TN".
            sourceType.RequestorID    = uniqueID_Type;

            sourceTypes[0]             = sourceType;
            ota_AirLowFareSearchRQ.POS = sourceTypes;
            #endregion

            #region [ VERSION ]
            ota_AirLowFareSearchRQ.Version = WS_SsoftSabre.Air.Constant.SWS_Sevirce_Versions.BARGAINFINDERMAXRQ;
            #endregion

            #region [ ORIGINDESTINATIONINFORMATION ]

            List <string> lsContadorOpciones = new List <string>();
            List <VO_OriginDestinationInformation> lvo_OriginDestinationInformation = vo_BargainFinderMax_ADRQ.Lvo_Segments;

            if (lvo_OriginDestinationInformation == null)
            {
                throw new Exception("lvo_OriginDestinationInformation is null,Pls check");
            }
            else
            {
                int iSegmentsCounter = 0;
                OTA_AirLowFareSearchRQOriginDestinationInformation[] aota_AirLowFareSearchRQOriginDestinationInformation =
                    new OTA_AirLowFareSearchRQOriginDestinationInformation[lvo_OriginDestinationInformation.Count];

                int iOriginDestinationInformation = 0;
                foreach (VO_OriginDestinationInformation vo_OriginDestinationInformation in lvo_OriginDestinationInformation)
                {
                    WS_SsoftSabre.SWS_BargainFinderMaxRQ.OTA_AirLowFareSearchRQOriginDestinationInformation ota_AirLowFareSearchRQOriginDestinationInformation = new WS_SsoftSabre.SWS_BargainFinderMaxRQ.OTA_AirLowFareSearchRQOriginDestinationInformation();

                    TimeInstantType timeInstantType = new TimeInstantType();
                    timeInstantType.Value = Convert.ToDateTime(vo_OriginDestinationInformation.SFechaSalida).ToString(Constant.FORMATO_TIME_STAMP);
                    ota_AirLowFareSearchRQOriginDestinationInformation.Item            = timeInstantType;
                    ota_AirLowFareSearchRQOriginDestinationInformation.ItemElementName = ItemChoiceType.DepartureDateTime;

                    ota_AirLowFareSearchRQOriginDestinationInformation.DepartureWindow = vo_OriginDestinationInformation.SIntervaloSalida;
                    ota_AirLowFareSearchRQOriginDestinationInformation.ArrivalWindow   = vo_OriginDestinationInformation.SIntervaloSalida;

                    //OriginLocation

                    LocationType originLocationType = new LocationType();
                    originLocationType.CodeContext  = vo_OriginDestinationInformation.Vo_AeropuertoOrigen.SContexto;
                    originLocationType.LocationCode = vo_OriginDestinationInformation.Vo_AeropuertoOrigen.SCodigo;
                    ota_AirLowFareSearchRQOriginDestinationInformation.OriginLocation = originLocationType;

                    //DestinationLocation

                    LocationType destinationLocationType = new LocationType();
                    destinationLocationType.LocationCode = vo_OriginDestinationInformation.Vo_AeropuertoDestino.SCodigo;
                    destinationLocationType.CodeContext  = vo_OriginDestinationInformation.Vo_AeropuertoDestino.SContexto;
                    ota_AirLowFareSearchRQOriginDestinationInformation.DestinationLocation = destinationLocationType;

                    #region [ TPA_EXTENSIONS ]

                    OTA_AirLowFareSearchRQOriginDestinationInformationTPA_Extensions originDestinationInformationTPA_Extensions =
                        new OTA_AirLowFareSearchRQOriginDestinationInformationTPA_Extensions();

                    //SegmentType
                    OTA_AirLowFareSearchRQOriginDestinationInformationTPA_ExtensionsSegmentType oTPA_ExtensionsSegmentType =
                        new OTA_AirLowFareSearchRQOriginDestinationInformationTPA_ExtensionsSegmentType();

                    oTPA_ExtensionsSegmentType.CodeSpecified = true;
                    switch (vo_OriginDestinationInformation.OTipoSegmento.ToString())
                    {
                    case TipoSegmento.O:
                        oTPA_ExtensionsSegmentType.Code = OTA_AirLowFareSearchRQOriginDestinationInformationTPA_ExtensionsSegmentTypeCode.O;
                        break;

                    case TipoSegmento.ARUNK:
                        oTPA_ExtensionsSegmentType.Code = OTA_AirLowFareSearchRQOriginDestinationInformationTPA_ExtensionsSegmentTypeCode.ARUNK;
                        break;

                    case TipoSegmento.X:
                        oTPA_ExtensionsSegmentType.Code = OTA_AirLowFareSearchRQOriginDestinationInformationTPA_ExtensionsSegmentTypeCode.X;
                        break;
                    }

                    // oTPA_ExtensionsSegmentType.Code = (OTA_AirLowFareSearchRQOriginDestinationInformationTPA_ExtensionsSegmentTypeCode)vo_OriginDestinationInformation.;
                    originDestinationInformationTPA_Extensions.SegmentType = oTPA_ExtensionsSegmentType;

                    //AlternateTime
                    string StrAlternateTime = vo_OriginDestinationInformation.STiempoAlternativo;
                    if (!String.IsNullOrEmpty(StrAlternateTime))
                    {
                        OTA_AirLowFareSearchRQOriginDestinationInformationTPA_ExtensionsAlternateTime oTPA_ExtensionsAlternateTime =
                            new OTA_AirLowFareSearchRQOriginDestinationInformationTPA_ExtensionsAlternateTime();

                        oTPA_ExtensionsAlternateTime.PlusMinus = StrAlternateTime;
                        originDestinationInformationTPA_Extensions.AlternateTime = oTPA_ExtensionsAlternateTime;
                    }

                    //CabinPrefrencial
                    //VO_CabinPref vo_CabinPref = vo_OriginDestinationInformation.;
                    //if (vo_CabinPref != null)
                    //{
                    //CabinPrefType cabinPrefType = new CabinPrefType();
                    //cabinPrefType.Cabin = (CabinType)vo_CabinPref.Enum_CabinType;
                    //cabinPrefType.CabinSpecified = true;
                    //cabinPrefType.PreferLevel = (PreferLevelType)vo_CabinPref.Enum_PreferLevelType;
                    //originDestinationInformationTPA_Extensions.CabinPref = cabinPrefType;
                    // }

                    //ConnectionTime por definir usa
                    //hceron
                    int intConnectionTimeMax = 0; //vo_OriginDestinationInformation.IntConnectionTimeMax;
                    int intConnectionTimeMin = 0; //vo_OriginDestinationInformation.IntConnectionTimeMin;
                    if (intConnectionTimeMax > 0 && intConnectionTimeMin > 0)
                    {
                        OTA_AirLowFareSearchRQOriginDestinationInformationTPA_ExtensionsConnectionTime connectionTime = new OTA_AirLowFareSearchRQOriginDestinationInformationTPA_ExtensionsConnectionTime();
                        connectionTime.Max = intConnectionTimeMax.ToString();
                        connectionTime.Min = intConnectionTimeMin.ToString();
                        originDestinationInformationTPA_Extensions.ConnectionTime = connectionTime;
                    }

                    //VendorPref por definr
                    //hceron
                    VO_VendorPref[] vo_VendorPrefs = null;// vo_BargainFinderMax_ADRQ.Vo_VendorPref;

                    if (vo_VendorPrefs != null && vo_VendorPrefs.Length > 0)
                    {
                        int iContadorAerolinea = 0;
                        OTA_AirLowFareSearchRQOriginDestinationInformationTPA_ExtensionsIncludeVendorPref[] includeVendorPrefs = new OTA_AirLowFareSearchRQOriginDestinationInformationTPA_ExtensionsIncludeVendorPref[vo_VendorPrefs.Length];

                        foreach (string sOpcion in lsContadorOpciones)
                        {
                            foreach (VO_VendorPref Vo_VendorPref in vo_VendorPrefs)
                            {
                                OTA_AirLowFareSearchRQOriginDestinationInformationTPA_ExtensionsIncludeVendorPref includeVendorPref = new OTA_AirLowFareSearchRQOriginDestinationInformationTPA_ExtensionsIncludeVendorPref();
                                includeVendorPref.Code = Vo_VendorPref.StrCode;
                                includeVendorPrefs.SetValue(includeVendorPref, iContadorAerolinea);
                                iContadorAerolinea++;
                            }
                        }
                        originDestinationInformationTPA_Extensions.IncludeVendorPref = includeVendorPrefs;
                    }

                    //TPA_Extensions
                    ota_AirLowFareSearchRQOriginDestinationInformation.TPA_Extensions = originDestinationInformationTPA_Extensions;

                    #endregion

                    iOriginDestinationInformation = iSegmentsCounter + 1;
                    lsContadorOpciones.Add(iOriginDestinationInformation.ToString());
                    ota_AirLowFareSearchRQOriginDestinationInformation.RPH = iOriginDestinationInformation.ToString();
                    aota_AirLowFareSearchRQOriginDestinationInformation[iSegmentsCounter] =
                        ota_AirLowFareSearchRQOriginDestinationInformation;

                    iSegmentsCounter++;
                }
                ota_AirLowFareSearchRQ.OriginDestinationInformation =
                    aota_AirLowFareSearchRQOriginDestinationInformation;
            }
            #endregion

            #region [ TRAVELPREFERENCES ]

            AirSearchPrefsType airSearchPrefsType = new AirSearchPrefsType();

            AirSearchPrefsType airSearchExcluPrefsType = new AirSearchPrefsType();
            string             sMaximasParadas         = vo_BargainFinderMax_ADRQ.SMaxStopsQuantity;

            if (!String.IsNullOrEmpty(sMaximasParadas))
            {
                if (!sMaximasParadas.Equals("0"))
                {
                    airSearchPrefsType.MaxStopsQuantity = sMaximasParadas;
                }
            }

            VO_CabinPref[] vo_CabinPrefs = null;//vo_BargainFinderMax_ADRQ.Vo_CabinPrefs;
            if (vo_CabinPrefs != null && vo_CabinPrefs.Length > 0)
            {
                int             intCounterCabinPref = 0;
                CabinPrefType[] CabinPrefTypes      = new CabinPrefType[vo_CabinPrefs.Length];
                foreach (VO_CabinPref vo_CabinPref in vo_CabinPrefs)
                {
                    CabinPrefType cabinPrefType = new CabinPrefType();
                    cabinPrefType.Cabin          = (CabinType)vo_CabinPref.Enum_CabinType;
                    cabinPrefType.CabinSpecified = true;
                    cabinPrefType.PreferLevel    = (PreferLevelType)vo_CabinPref.Enum_PreferLevelType;
                    CabinPrefTypes.SetValue(cabinPrefType, intCounterCabinPref);
                    intCounterCabinPref++;
                }
                airSearchPrefsType.CabinPref = CabinPrefTypes;
            }



            //VendorPref
            VO_VendorPref[] lvo_VendorPref = null;//vo_BargainFinderMax_ADRQ.Vo_VendorPref;
            if (lvo_VendorPref != null && lvo_VendorPref.Length > 0)
            {
                int intCounterVendorPref = 0;
                CompanyNamePrefType[] companyNamePrefTypes = new CompanyNamePrefType[lvo_VendorPref.Length];
                foreach (VO_VendorPref vo_VendorPref in lvo_VendorPref)
                {
                    CompanyNamePrefType companyNamePrefType = new CompanyNamePrefType();
                    companyNamePrefType.PreferLevel = (PreferLevelType)vo_VendorPref.Enum_PreferLevelType;
                    companyNamePrefType.Code        = vo_VendorPref.StrCode;
                    companyNamePrefTypes.SetValue(companyNamePrefType, intCounterVendorPref);
                    intCounterVendorPref++;
                }
                airSearchPrefsType.VendorPref = companyNamePrefTypes;
            }


            //Excluir Aerolineas
            //

            #region [ Exlude Airline ]

            if (lsExcluirAerol.Count > 0)
            {
                List <AirSearchPrefsTypeTPA_ExtensionsExcludeVendorPref> companyNameExcludeTypes = new List <AirSearchPrefsTypeTPA_ExtensionsExcludeVendorPref>();

                foreach (string sExludeCode in lsExcluirAerol)
                {
                    AirSearchPrefsTypeTPA_ExtensionsExcludeVendorPref companyNamePrefType = new AirSearchPrefsTypeTPA_ExtensionsExcludeVendorPref();
                    companyNamePrefType.Code = sExludeCode;
                    companyNameExcludeTypes.Add(companyNamePrefType);
                }

                airSearchPrefsType.TPA_Extensions = new AirSearchPrefsTypeTPA_Extensions();
                airSearchPrefsType.TPA_Extensions.ExcludeVendorPref = companyNameExcludeTypes.ToArray();
            }
            #endregion

            //TravelPreferences
            ota_AirLowFareSearchRQ.TravelPreferences = airSearchPrefsType;
            ota_AirLowFareSearchRQ.TravelPreferences.ValidInterlineTicket = true;

            #endregion

            #region [ TRAVELERINFORMATION ]

            TravelerInfoSummaryType travelerInfoSummaryType = new TravelerInfoSummaryType();
            List <VO_Pasajero>      lvo_Passengers          = vo_BargainFinderMax_ADRQ.Lvo_Passengers;

            if (lvo_Passengers == null)
            {
                throw new Exception("lvo_Passengers mandatory");
            }
            else
            {
                TravelerInformationType travelerInformationType = new TravelerInformationType();


                int iContPasajeros = 0;
                int iContPaxTotal  = 0;
                foreach (VO_Pasajero vo_PasajeroTotal in lvo_Passengers)
                {
                    if (vo_PasajeroTotal.SCodigo.Equals("CNN"))
                    {
                        iContPaxTotal += int.Parse(vo_PasajeroTotal.SCantidad);
                    }
                    else
                    {
                        iContPaxTotal++;
                    }
                }
                //best to get search
                //hceron 06062013
                PassengerTypeQuantityType[] passengerTypeQuantityTypes = new PassengerTypeQuantityType[iContPaxTotal];
                #region paxes MAX


                foreach (VO_Pasajero vo_Pasajero in lvo_Passengers)
                {
                    if (vo_Pasajero.SCodigo.Equals("CNN"))
                    {
                        foreach (VO_ClasificaPasajero vo_CatPasajero in vo_Pasajero.LvPasajeroNino)
                        {
                            PassengerTypeQuantityType passengerTypeQuantityType = new PassengerTypeQuantityType();
                            passengerTypeQuantityType.Code             = vo_CatPasajero.SCodigo;
                            passengerTypeQuantityType.Quantity         = vo_CatPasajero.SCantidad;
                            passengerTypeQuantityTypes[iContPasajeros] = passengerTypeQuantityType;
                            iContPasajeros++;
                        }
                    }
                    else
                    {
                        PassengerTypeQuantityType passengerTypeQuantityType = new PassengerTypeQuantityType();


                        passengerTypeQuantityType.Code     = vo_Pasajero.SCodigo;
                        passengerTypeQuantityType.Quantity = vo_Pasajero.SCantidad;

                        passengerTypeQuantityTypes[iContPasajeros] = passengerTypeQuantityType;
                        iContPasajeros++;
                    }
                }
                #endregion
                //foreach (VO_Pasajero vo_Passenger in lvo_Passengers)
                //{
                //    PassengerTypeQuantityType passengerTypeQuantityType = new PassengerTypeQuantityType();
                //    passengerTypeQuantityType.Code = "ADT";//vo_Passenger.;
                //    passengerTypeQuantityType.Quantity = "1";// vo_Passenger.ToString();

                //    passengerTypeQuantityTypes[iContPasajeros] = passengerTypeQuantityType;
                //    iContPasajeros++;
                //}
                travelerInformationType.PassengerTypeQuantity = passengerTypeQuantityTypes;

                TravelerInformationType[] travelerInformationTypes = new TravelerInformationType[] { travelerInformationType };
                travelerInfoSummaryType.AirTravelerAvail = travelerInformationTypes;
            }

            PriceRequestInformationType priceRequestInformationType = new PriceRequestInformationType();
            if (vo_BargainFinderMax_ADRQ.StrNegotiatedFareCode != null && vo_BargainFinderMax_ADRQ.StrNegotiatedFareCode.Length > 0)
            {
                PriceRequestInformationTypeNegotiatedFareCode[] NegotiatedFareCode = new PriceRequestInformationTypeNegotiatedFareCode[1];

                int intContadorCorporateID = 0;
                foreach (string strCorporateID in vo_BargainFinderMax_ADRQ.StrNegotiatedFareCode)
                {
                    NegotiatedFareCode[intContadorCorporateID]          = new PriceRequestInformationTypeNegotiatedFareCode();
                    NegotiatedFareCode[intContadorCorporateID].Code     = vo_BargainFinderMax_ADRQ.StrNegotiatedFareCode[intContadorCorporateID];
                    NegotiatedFareCode[intContadorCorporateID].Supplier = new CompanyNameType[] { new CompanyNameType()
                                                                                                  {
                                                                                                      Code = "AAA"
                                                                                                  } };
                    intContadorCorporateID++;
                }
                priceRequestInformationType.Items = NegotiatedFareCode;
            }

            if (vo_BargainFinderMax_ADRQ.Vo_Priority.isValid())
            {
                PriceRequestInformationTypeTPA_Extensions priceRequestInformationTypeTPA_Extensions = new PriceRequestInformationTypeTPA_Extensions();

                priceRequestInformationTypeTPA_Extensions.Priority = new PriceRequestInformationTypeTPA_ExtensionsPriority()
                {
                    DirectFlights = new PriceRequestInformationTypeTPA_ExtensionsPriorityDirectFlights()
                    {
                        Priority = vo_BargainFinderMax_ADRQ.Vo_Priority.IntDirectFlights
                    },
                    Price = new PriceRequestInformationTypeTPA_ExtensionsPriorityPrice()
                    {
                        Priority = vo_BargainFinderMax_ADRQ.Vo_Priority.IntPrice
                    },
                    Time = new PriceRequestInformationTypeTPA_ExtensionsPriorityTime()
                    {
                        Priority = vo_BargainFinderMax_ADRQ.Vo_Priority.IntTime
                    },
                    Vendor = new PriceRequestInformationTypeTPA_ExtensionsPriorityVendor()
                    {
                        Priority = vo_BargainFinderMax_ADRQ.Vo_Priority.IntVendor
                    }
                };

                priceRequestInformationType.TPA_Extensions = priceRequestInformationTypeTPA_Extensions;
            }

            PriceRequestInformationTypeTPA_Extensions priceRequestInformationTypeTPA_Extensions_tkt = new PriceRequestInformationTypeTPA_Extensions();
            priceRequestInformationTypeTPA_Extensions_tkt.Indicators = new PriceRequestInformationTypeTPA_ExtensionsIndicators()
            {
                ResTicketing = new PriceRequestInformationTypeTPA_ExtensionsIndicatorsResTicketing()
                {
                    Ind = true
                }
            };
            priceRequestInformationType.TPA_Extensions = priceRequestInformationTypeTPA_Extensions_tkt;


            VO_OTA_AirLowFareSearchLLSRQ vo_OTA_AirLowFareSearchLLSRQ = clsSesiones.getParametrosAirBargain();
            if (vo_BargainFinderMax_ADRQ != null)
            {
                priceRequestInformationType.CurrencyCode        = vo_OTA_AirLowFareSearchLLSRQ.SCodMonedaCotizacion.ToString();
                travelerInfoSummaryType.PriceRequestInformation = priceRequestInformationType;
            }
            else
            {
                travelerInfoSummaryType.PriceRequestInformation = priceRequestInformationType;
            }

            ota_AirLowFareSearchRQ.TravelerInfoSummary = travelerInfoSummaryType;

            #endregion

            OTA_AirLowFareSearchRQTPA_Extensions ota_AirLowFareSearchRQTPA_Extensions = new OTA_AirLowFareSearchRQTPA_Extensions();
            TransactionType transactionType = new TransactionType();
            TransactionTypeClientSessionID transactionTypeClientSessionID = new TransactionTypeClientSessionID();
            transactionTypeClientSessionID.Value = session_;
            transactionType.ClientSessionID      = transactionTypeClientSessionID;

            TransactionTypeRequestType transactionTypeRequestType = new TransactionTypeRequestType();
            transactionTypeRequestType.Name = str200;
            switch (vo_BargainFinderMax_ADRQ.Enum_IntelliSellTransaction)
            {
            case Enum_IntelliSellTransaction.BFM_50:
                transactionTypeRequestType.Name = str50;
                break;

            case Enum_IntelliSellTransaction.BFM_100:
                transactionTypeRequestType.Name = str100;
                break;

            case Enum_IntelliSellTransaction.BFM_200:
                transactionTypeRequestType.Name = str200;
                break;
            }

            transactionType.RequestType = transactionTypeRequestType;
            ota_AirLowFareSearchRQTPA_Extensions.IntelliSellTransaction = transactionType;

            ota_AirLowFareSearchRQ.TPA_Extensions = ota_AirLowFareSearchRQTPA_Extensions;

            BargainFinderMaxService bargainFinderMaxService = new BargainFinderMaxService();

            SWS_BargainFinderMaxRQ.MessageHeader messageHeader =
                (SWS_BargainFinderMaxRQ.MessageHeader)getMessageHeader(typeof(MessageHeader), vo_BargainFinderMax_ADRQ.Vo_MessageHeader);
            bargainFinderMaxService.MessageHeaderValue = messageHeader;
            bargainFinderMaxService.SecurityValue      = security;
            OTA_AirLowFareSearchRS ota_AirLowFareSearchRS = bargainFinderMaxService.BargainFinderMaxRQ(ota_AirLowFareSearchRQ);

            //XmlSerializer mySerializer = new XmlSerializer(typeof(OTA_AirLowFareSearchRQ));
            ////To write to a file, create a StreamWriter object.
            //System.IO.StreamWriter myWriter = new System.IO.StreamWriter("D://bfmRQ-Integradov5" + DateTime.Now.Hour + DateTime.Now.Minute + ".xml");
            //mySerializer.Serialize(myWriter, ota_AirLowFareSearchRQ);
            //myWriter.Close();

            //mySerializer = new XmlSerializer(typeof(OTA_AirLowFareSearchRS));
            ////To write to a file, create a StreamWriter object.
            //myWriter = new System.IO.StreamWriter("D://bfmRS-Integradov6" + DateTime.Now.Hour + DateTime.Now.Minute + ".xml");
            //mySerializer.Serialize(myWriter, ota_AirLowFareSearchRS);
            //myWriter.Close();

            return(ota_AirLowFareSearchRS);
        }
Esempio n. 8
0
        public OTA_AirAvailRS getBusquedaHora(VO_OTA_AirLowFareSearchLLSRQ vo_OTA_AirLowFareSearchLLSRQ)
        {
            /*METODO PRINCICPAL QUE RETORNA EL OBJETO DE RESULTADOS DE SABRE*/
            clsParametros cParametros = new clsParametros();
            StringBuilder consulta    = new StringBuilder();

            cParametros.TipoWs = Enum_ProveedorWebServices.Sabre;
            csVuelos cVuelos = new csVuelos();

            try
            {
                if (vo_OTA_AirLowFareSearchLLSRQ.LsAerolineaPreferida.Count.Equals(0))
                {
                    vo_OTA_AirLowFareSearchLLSRQ.LsAerolineaPreferida = cVuelos.AerolineasPreferidas();
                }
            }
            catch { }
            if (vo_OTA_AirLowFareSearchLLSRQ.LsAerolineaPreferida.Count.Equals(0))
            {
                vo_OTA_AirLowFareSearchLLSRQ.LsExcluirAerolinea = cVuelos.ExcluirAerolineas();
            }
            //bool PriorityTime = true;

            OTA_AirAvailRQ.OTA_AirAvailRQ oOTA_AirLowFareSearchRQ = new OTA_AirAvailRQ.OTA_AirAvailRQ();
            OTA_AirAvailRS oOTA_AirLowFareSearchRS = new OTA_AirAvailRS();

            objvo_Credentials = Ssoft.Utils.clsSesiones.getCredentials();

            try
            {
                List <string> lsContadorOpciones    = new List <string>();
                OTA_AirAvail.MessageHeader Mensaje_ = clsSabreBase.OTA_AirAvail();

                if (Mensaje_ != null)
                {
                    OTA_AirAvail.Security Seguridad_ = new OTA_AirAvail.Security();
                    Seguridad_.BinarySecurityToken = Session_;

                    #region [ POS ]
                    OTA_AirAvailRQPOS       oOTA_AirLowFareSearchRQPOS       = new OTA_AirAvailRQPOS();
                    OTA_AirAvailRQPOSSource oOTA_AirLowFareSearchRQPOSSource = new OTA_AirAvailRQPOSSource();

                    oOTA_AirLowFareSearchRQPOSSource.PseudoCityCode = objvo_Credentials.Pcc;//ConfigurationManager.AppSettings["Sabre_Ipcc"];
                    oOTA_AirLowFareSearchRQPOS.Source = oOTA_AirLowFareSearchRQPOSSource;
                    oOTA_AirLowFareSearchRQ.POS       = oOTA_AirLowFareSearchRQPOS;
                    #endregion

                    #region [ VERSION ]
                    oOTA_AirLowFareSearchRQ.Version = clsSabreBase.SABRE_VERSION_OTA_AIRAVAIL;
                    #endregion

                    #region [ ORIGINDESTINATIONINFORMATION ]

                    List <VO_OriginDestinationInformation> lvo_Rutas = vo_OTA_AirLowFareSearchLLSRQ.Lvo_Rutas;

                    if (lvo_Rutas == null)
                    {
                        throw new Exception("No se recibieron rutas a procesar");
                    }
                    else
                    {
                        int iOriginDestinationInformation = vo_OTA_AirLowFareSearchLLSRQ.Ruta;
                        VO_OriginDestinationInformation            vo_OriginDestinationInformation = lvo_Rutas[iOriginDestinationInformation];
                        OTA_AirAvailRQOriginDestinationInformation oOTA_AirLowFareSearchRQOriginDestinationInformation = new OTA_AirAvailRQOriginDestinationInformation();

                        OTA_AirAvailRQOriginDestinationInformationDepartureDateTime DepartureDateTime =
                            new OTA_AirAvailRQOriginDestinationInformationDepartureDateTime();

                        //oOTA_AirLowFareSearchRQOriginDestinationInformation.ExcludeCodeShare = false;

                        DepartureDateTime.DateTime = vo_OriginDestinationInformation.SFechaSalida;
                        oOTA_AirLowFareSearchRQOriginDestinationInformation.DepartureDateTime = DepartureDateTime;

                        if (vo_OriginDestinationInformation.Vo_AeropuertoOrigen != null)
                        {
                            VO_Aeropuerto vo_Origen = vo_OriginDestinationInformation.Vo_AeropuertoOrigen;

                            OTA_AirAvailRQOriginDestinationInformationOriginLocation oOriginLocation = new OTA_AirAvailRQOriginDestinationInformationOriginLocation();

                            oOriginLocation.CodeContext  = vo_Origen.SContexto;
                            oOriginLocation.LocationCode = vo_Origen.SCodigo;

                            oOTA_AirLowFareSearchRQOriginDestinationInformation.OriginLocation = oOriginLocation;
                        }
                        VO_Aeropuerto vo_Destino = vo_OriginDestinationInformation.Vo_AeropuertoDestino;
                        OTA_AirAvailRQOriginDestinationInformationDestinationLocation oDestinationLocation =
                            new OTA_AirAvailRQOriginDestinationInformationDestinationLocation();
                        oDestinationLocation.LocationCode = vo_Destino.SCodigo;
                        oDestinationLocation.CodeContext  = vo_Destino.SContexto;
                        oOTA_AirLowFareSearchRQOriginDestinationInformation.DestinationLocation = oDestinationLocation;

                        #region [ TPA_EXTENSIONS ]

                        //OTA_AirAvailRQOriginDestinationInformationTPA_Extensions oOriginDestinationInformationTPA_Extensions =
                        //    new OTA_AirAvailRQOriginDestinationInformationTPA_Extensions();

                        //OTA_AirAvailRQOriginDestinationInformationTPA_ExtensionsArrivalDateTime TPA_ExtensionsArrivalDateTime =
                        //    new OTA_AirAvailRQOriginDestinationInformationTPA_ExtensionsArrivalDateTime();

                        //OTA_AirAvailRQOriginDestinationInformationTPA_ExtensionsScan TPA_ExtensionsScan =
                        //    new OTA_AirAvailRQOriginDestinationInformationTPA_ExtensionsScan();

                        //TPA_ExtensionsArrivalDateTime.DateTime = vo_OriginDestinationInformation.SFechaSalida;
                        //TPA_ExtensionsScan.Ind = true;
                        //TPA_ExtensionsScan.IndSpecified = true;

                        //oOriginDestinationInformationTPA_Extensions.ArrivalDateTime = TPA_ExtensionsArrivalDateTime;
                        //oOriginDestinationInformationTPA_Extensions.Scan = TPA_ExtensionsScan;

                        //oOTA_AirLowFareSearchRQOriginDestinationInformation.TPA_Extensions =
                        //                            oOriginDestinationInformationTPA_Extensions;

                        #endregion

                        oOTA_AirLowFareSearchRQ.OriginDestinationInformation =
                            oOTA_AirLowFareSearchRQOriginDestinationInformation;
                    }
                    #endregion

                    #region [ TRAVELPREFERENCES ]

                    OTA_AirAvailRQTravelPreferences oOTA_AirLowFareSearchRQTravelPreferences =
                        new OTA_AirAvailRQTravelPreferences();

                    string sMaximasParadas = vo_OTA_AirLowFareSearchLLSRQ.SMaximasParadas;

                    if (clsValidaciones.getValidarString(sMaximasParadas))
                    {
                        if (sMaximasParadas.Equals("0"))
                        {
                            oOTA_AirLowFareSearchRQTravelPreferences.MaxStopsQuantity = sMaximasParadas;
                        }
                    }

                    List <string> lsAerolineaPreferida = vo_OTA_AirLowFareSearchLLSRQ.LsAerolineaPreferida;

                    if (lsAerolineaPreferida != null)
                    {
                        int iContadorAerolinea = 0;

                        OTA_AirAvailRQTravelPreferencesVendorPref[] aOTA_AirLowFareSearchRQTravelPreferencesVendorPref =
                            new OTA_AirAvailRQTravelPreferencesVendorPref[lsAerolineaPreferida.Count];

                        foreach (string sAerolineaPreferida in lsAerolineaPreferida)
                        {
                            OTA_AirAvailRQTravelPreferencesVendorPref oOTA_AirLowFareSearchRQTravelPreferencesVendorPref =
                                new OTA_AirAvailRQTravelPreferencesVendorPref();
                            oOTA_AirLowFareSearchRQTravelPreferencesVendorPref.Code = sAerolineaPreferida.Trim();
                            aOTA_AirLowFareSearchRQTravelPreferencesVendorPref[iContadorAerolinea] =
                                oOTA_AirLowFareSearchRQTravelPreferencesVendorPref;
                            iContadorAerolinea++;
                        }

                        oOTA_AirLowFareSearchRQTravelPreferences.VendorPref = aOTA_AirLowFareSearchRQTravelPreferencesVendorPref;
                    }


                    List <string> lsClases = vo_OTA_AirLowFareSearchLLSRQ.LsClase;
                    try
                    {
                        if (lsClases != null)
                        {
                            if (lsClases.Count > 0)
                            {
                                OTA_AirAvailRQTravelPreferencesCabinPref oCabinPref =
                                    new OTA_AirAvailRQTravelPreferencesCabinPref();
                                oCabinPref.Cabin = lsClases[0];
                                oOTA_AirLowFareSearchRQTravelPreferences.CabinPref =
                                    oCabinPref;
                            }
                        }
                    }
                    catch { }
                    #endregion

                    #region [ TPA_EXTENSIONS ]

                    OTA_AirAvailRQTravelPreferencesTPA_Extensions oTravelPreferencesTPA_Extensions =
                        new OTA_AirAvailRQTravelPreferencesTPA_Extensions();

                    OTA_AirAvailRQTravelPreferencesTPA_ExtensionsDirectAccess oDirectAccess =
                        new OTA_AirAvailRQTravelPreferencesTPA_ExtensionsDirectAccess();

                    oDirectAccess.Ind = false;
                    oTravelPreferencesTPA_Extensions.DirectAccess = oDirectAccess;

                    List <string> lsNoAerolineas = vo_OTA_AirLowFareSearchLLSRQ.LsExcluirAerolinea;

                    if (lsNoAerolineas != null)
                    {
                        int iContNoAerolineas = 0;
                        OTA_AirAvailRQTravelPreferencesTPA_ExtensionsExcludeVendorPref[] aOTA_AirLowFareSearchRQTravelPreferencesTPA_ExtensionsExcludeVendorPref =
                            new OTA_AirAvailRQTravelPreferencesTPA_ExtensionsExcludeVendorPref[lsNoAerolineas.Count];

                        foreach (string sAerolinea in lsNoAerolineas)
                        {
                            OTA_AirAvailRQTravelPreferencesTPA_ExtensionsExcludeVendorPref oAerolinea =
                                new OTA_AirAvailRQTravelPreferencesTPA_ExtensionsExcludeVendorPref();
                            oAerolinea.Code = sAerolinea;
                            aOTA_AirLowFareSearchRQTravelPreferencesTPA_ExtensionsExcludeVendorPref[iContNoAerolineas] = oAerolinea;
                            iContNoAerolineas++;
                        }
                        oTravelPreferencesTPA_Extensions.ExcludeVendorPref =
                            aOTA_AirLowFareSearchRQTravelPreferencesTPA_ExtensionsExcludeVendorPref;
                    }

                    /*string sViajes = vo_OTA_AirLowFareSearchLLSRQ.SVuelosARetornar;
                     * if (Validaciones.getValidarString(sViajes))
                     * {
                     *  OTA_AirLowFareSearchRQTravelPreferencesTPA_ExtensionsNumTrips oNumTrips =
                     *      new OTA_AirLowFareSearchRQTravelPreferencesTPA_ExtensionsNumTrips();
                     *  oNumTrips.Number = sViajes;
                     *  oTravelPreferencesTPA_Extensions.NumTrips = oNumTrips;
                     * }*/


                    oOTA_AirLowFareSearchRQTravelPreferences.TPA_Extensions = oTravelPreferencesTPA_Extensions;
                    oOTA_AirLowFareSearchRQ.TravelPreferences = oOTA_AirLowFareSearchRQTravelPreferences;

                    #endregion

                    #region [ TRAVELERINFORMATION ]

                    #endregion

                    #region [ PRICEREQUESTINFORMATION ]

                    #endregion

                    #region [ TPA_EXTENSIONS ]

                    #endregion

                    OTA_AirAvailService oOTA_AirLowFareSearchService = new OTA_AirAvailService();

                    oOTA_AirLowFareSearchService.MessageHeaderValue = Mensaje_;
                    oOTA_AirLowFareSearchService.SecurityValue      = Seguridad_;
                    oOTA_AirLowFareSearchService.Url = objvo_Credentials.UrlWebServices;

                    oOTA_AirLowFareSearchRS = oOTA_AirLowFareSearchService.OTA_AirAvailRQ(oOTA_AirLowFareSearchRQ);

                    // XML
                    //string pathXML = clsValidaciones.XMLDatasetCrea() + "OTA_AirAvailRQ.xml";

                    //XmlSerializer SerializerRQ = new XmlSerializer(typeof(OTA_AirAvailRQ.OTA_AirAvailRQ));
                    //StreamWriter WriterRQ = new StreamWriter(pathXML);
                    //try
                    //{
                    //    SerializerRQ.Serialize(WriterRQ, oOTA_AirLowFareSearchRQ);
                    //}
                    //catch
                    //{
                    //    WriterRQ.Flush();
                    //    WriterRQ.Close();
                    //}

                    //pathXML = clsValidaciones.XMLDatasetCrea() + "OTA_AirAvailRS.xml";

                    //XmlSerializer SerializerRS = new XmlSerializer(typeof(OTA_AirAvailRS));
                    //StreamWriter WriterRS = new StreamWriter(pathXML);
                    //try
                    //{
                    //    SerializerRS.Serialize(WriterRS, oOTA_AirLowFareSearchRS);
                    //}
                    //catch
                    //{
                    //    WriterRS.Flush();
                    //    WriterRS.Close();
                    //}
                    //termina XML


                    if (oOTA_AirLowFareSearchRS.Errors != null)
                    {
                        cParametros.Id          = 0;
                        cParametros.Code        = oOTA_AirLowFareSearchRS.Errors.Error.ErrorCode;
                        cParametros.Info        = oOTA_AirLowFareSearchRS.Errors.Error.ErrorInfo.Message;
                        cParametros.Message     = oOTA_AirLowFareSearchRS.Errors.Error.ErrorMessage;
                        cParametros.Severity    = oOTA_AirLowFareSearchRS.Errors.Error.Severity;
                        cParametros.Complemento = "HostCommand: " + oOTA_AirLowFareSearchRS.TPA_Extensions.HostCommand;
                        cParametros.Metodo      = "getBusqueda";
                        consulta.AppendLine("Credenciales: ");
                        try
                        {
                            if (objvo_Credentials != null)
                            {
                                consulta.AppendLine("User: "******"Password: "******"Ipcc: " + objvo_Credentials.Ipcc);
                                consulta.AppendLine("Pcc: " + objvo_Credentials.Pcc);
                                consulta.AppendLine("QNumber: " + objvo_Credentials.QNumber);
                                consulta.AppendLine("Dominio: " + objvo_Credentials.Dominio);
                                consulta.AppendLine("Session Sabre: " + Session_.ToString());
                                consulta.AppendLine("Url Sabre: " + objvo_Credentials.UrlWebServices);
                            }
                        }
                        catch { }
                        cParametros.Tipo = clsTipoError.WebServices;
                        ExceptionHandled.Publicar(cParametros);
                    }
                    else
                    {
                        cParametros.Id          = 1;
                        cParametros.TipoLog     = Enum_Error.Transac;
                        cParametros.Message     = oOTA_AirLowFareSearchRS.Success;
                        cParametros.Metodo      = "getBusqueda";
                        cParametros.Complemento = "HostCommand: " + oOTA_AirLowFareSearchRS.TPA_Extensions.HostCommand;
                        cParametros.Tipo        = clsTipoError.WebServices;
                        cParametros.Severity    = clsSeveridad.Moderada;
                        consulta.AppendLine("Credenciales: ");
                        try
                        {
                            if (objvo_Credentials != null)
                            {
                                consulta.AppendLine("User: "******"Password: "******"Ipcc: " + objvo_Credentials.Ipcc);
                                consulta.AppendLine("Pcc: " + objvo_Credentials.Pcc);
                                consulta.AppendLine("QNumber: " + objvo_Credentials.QNumber);
                                consulta.AppendLine("Dominio: " + objvo_Credentials.Dominio);
                                consulta.AppendLine("Session Sabre: " + Session_.ToString());
                                consulta.AppendLine("Url Sabre: " + objvo_Credentials.UrlWebServices);
                            }
                        }
                        catch { }
                        cParametros.TargetSite = consulta.ToString();
                        ExceptionHandled.Publicar(cParametros);
                        vo_OTA_AirLowFareSearchLLSRQ.Ruta++;
                        clsSesiones.setParametrosAirBargain
                        (
                            vo_OTA_AirLowFareSearchLLSRQ
                        );
                    }
                }
            }
            catch (Exception Ex)
            {
                cParametros.Id         = 0;
                cParametros.Message    = Ex.Message;
                cParametros.StackTrace = Ex.StackTrace;
                cParametros.Source     = Ex.Source;
                cParametros.TargetSite = Ex.TargetSite.ToString();
                cParametros.Severity   = clsSeveridad.Alta;
                cParametros.Metodo     = "getBusqueda";
                cParametros.Tipo       = clsTipoError.WebServices;
                ExceptionHandled.Publicar(cParametros);
            }
            return(oOTA_AirLowFareSearchRS);
        }