Beispiel #1
0
    public string _Sabre_CrearSesion()
    {
        string Session_ = null;

        Ssoft.ValueObjects.VO_Credentials objvo_Credentials = Ssoft.Utils.clsSesiones.getCredentials();
        /*ASIGNAMOS LOS CRITERIOS BASICOS PARA CREAR LA SESSION*/
        VO_SessionCreateRQ vo_SessionCreateRQ = new VO_SessionCreateRQ(objvo_Credentials.User,
                                                                       objvo_Credentials.Password,
                                                                       objvo_Credentials.Ipcc,
                                                                       objvo_Credentials.Pcc,
                                                                       objvo_Credentials.Dominio
                                                                       );

        clsSessionCreateRQ objclsSessionCreateRQ = new clsSessionCreateRQ();

        Session_ = objclsSessionCreateRQ.getSesion(vo_SessionCreateRQ);
        VO_SabreCommandLLSRS vo = new VO_SabreCommandLLSRS();

        vo.BCDATA     = true;
        vo.StrComando = "AAA" + objvo_Credentials.Pcc;

        clsSabreCommandLLS oclsSabreCommandLLS = new clsSabreCommandLLS();

        oclsSabreCommandLLS.StrSesion = Session_;
        SabreCommandLLSRS respuesta = oclsSabreCommandLLS.getEjecutarComando(vo);

        return(Session_);
    }
    public static string _CrearSesion()
    {
        string   Session_ = null;
        clsCache cCache   = new csCache().cCache();

        StringBuilder  consulta          = new StringBuilder();
        clsParametros  cParametros       = new clsParametros();
        VO_Credentials objvo_Credentials = clsSesiones.getCredentials();
        string         sMensaje          = clsValidaciones.GetKeyOrAdd("sMensajeSesionSabre", "En este momento hay mas de 2000 personas consultado nuestras Promociones!!!");
        string         sSugerencia       = clsValidaciones.GetKeyOrAdd("sSugerenciaSesionSabre", "Por favor intente de nuevo en 5 minutos!!!");

        try
        {
            /*ASIGNAMOS LOS CRITERIOS BASICOS PARA CREAR LA SESSION*/
            VO_SessionCreateRQ vo_SessionCreateRQ = new VO_SessionCreateRQ(objvo_Credentials.User,
                                                                           objvo_Credentials.Password,
                                                                           objvo_Credentials.Ipcc,
                                                                           objvo_Credentials.Pcc,
                                                                           objvo_Credentials.Dominio
                                                                           );

            clsSessionCreateRQ objclsSessionCreateRQ = new clsSessionCreateRQ();
            try
            {
                Session_ = objclsSessionCreateRQ.getSesion(vo_SessionCreateRQ);
            }
            catch (Exception Ex)
            {
                cParametros.Id          = 0;
                cParametros.Message     = Ex.Message.ToString();
                cParametros.Tipo        = clsTipoError.Library;
                cParametros.Severity    = clsSeveridad.Moderada;
                cParametros.Metodo      = System.Reflection.MethodInfo.GetCurrentMethod().Name;
                cParametros.Complemento = "_CrearSesion";
                cParametros.Info        = cParametros.Message;
                consulta.AppendLine("Credenciales: ");
                try
                {
                    if (objvo_Credentials != null)
                    {
                        consulta.AppendLine("User: "******"Password: "******"Ipcc: " + objvo_Credentials.Ipcc);
                        consulta.AppendLine("Pcc: " + objvo_Credentials.Pcc);
                        consulta.AppendLine("Dominio: " + objvo_Credentials.Dominio);
                        consulta.AppendLine("Session Sabre: " + Session_.ToString());
                        consulta.AppendLine("Url Sabre: " + objvo_Credentials.UrlWebServices);
                    }
                }
                catch { }
                cParametros.StackTrace = consulta.ToString();
                try
                {
                    if (Session_ != null)
                    {
                        if (cCache != null)
                        {
                            cParametros.Source = "Sesion Local: " + cCache.SessionID.ToString();
                        }
                        else
                        {
                            cParametros.Source = "Sesion Local: No hay cache ";
                        }
                    }
                }
                catch
                {
                    cParametros.Source = "Sesion Local: Error ";
                }
                try
                {
                    if (cCache != null)
                    {
                        cParametros.ErrorConfigura[0] = cCache.Empresa;
                    }
                    else
                    {
                        cParametros.ErrorConfigura[0] = "0";
                    }
                }
                catch { }
                if (cParametros.Message.Contains("limit of Host TAs allocated"))
                {
                    cParametros.ViewMessage.Add(sMensaje);
                    cParametros.Sugerencia.Add(sSugerencia);
                    cParametros.Code = "109";
                }
                else
                {
                    cParametros.Code = "106";
                }
                cParametros.ValidaInfo = false;
                clsSesiones.setParametrosError(cParametros);
                ExceptionHandled.Publicar(cParametros);
                clsValidaciones.RedirectPagina("ErrorBusqueda.aspx", true);
            }

            VO_SabreCommandLLSRS vo = new VO_SabreCommandLLSRS();
            vo.BCDATA     = true;
            vo.StrComando = "AAA" + objvo_Credentials.Pcc;

            clsSabreCommandLLS oclsSabreCommandLLS = new clsSabreCommandLLS();
            oclsSabreCommandLLS.StrSesion = Session_;
            SabreCommandLLSRS respuesta = oclsSabreCommandLLS.getEjecutarComando(vo);
            //if (clsValidaciones.GetKeyOrAdd("ValidaLogTransac", "False").ToUpper().Equals("TRUE"))
            //{
            consulta.AppendLine("Credenciales: ");
            if (objvo_Credentials != null)
            {
                consulta.AppendLine("User: "******"Password: "******"Ipcc: " + objvo_Credentials.Ipcc);
                consulta.AppendLine("Pcc: " + objvo_Credentials.Pcc);
                consulta.AppendLine("Dominio: " + objvo_Credentials.Dominio);
                consulta.AppendLine("Url Sabre: " + objvo_Credentials.UrlWebServices);
            }
            cParametros.Id          = 1;
            cParametros.TipoLog     = Enum_Error.Transac;
            cParametros.Message     = "Ejecucion del comando AAA y perfil de agencia";
            cParametros.Tipo        = clsTipoError.WebServices;
            cParametros.Severity    = clsSeveridad.Baja;
            cParametros.TargetSite  = "Comando: " + vo.StrComando;
            cParametros.StackTrace  = "Respuesta" + respuesta.Response;
            cParametros.Metodo      = System.Reflection.MethodInfo.GetCurrentMethod().Name;
            cParametros.Complemento = consulta.ToString();
            try
            {
                if (Session_ != null)
                {
                    cParametros.Info = "Session Sabre: " + Session_.ToString();
                }
                if (cCache != null)
                {
                    cParametros.Source = "Sesion Local: " + cCache.SessionID.ToString();
                }
                else
                {
                    cParametros.Source = "Sesion Local: No hay cache ";
                }
            }
            catch
            {
                cParametros.Source = "Sesion Local: Error ";
            }
            ExceptionHandled.Publicar(cParametros);
            //}
        }
        catch (Exception Ex)
        {
            consulta.AppendLine("Credenciales: ");
            if (objvo_Credentials != null)
            {
                consulta.AppendLine("User: "******"Password: "******"Ipcc: " + objvo_Credentials.Ipcc);
                consulta.AppendLine("Pcc: " + objvo_Credentials.Pcc);
                consulta.AppendLine("Dominio: " + objvo_Credentials.Dominio);
                consulta.AppendLine("Url Sabre: " + objvo_Credentials.UrlWebServices);
            }
            cParametros.Id          = 0;
            cParametros.TipoLog     = Enum_Error.Log;
            cParametros.Message     = Ex.Message.ToString();
            cParametros.Source      = Ex.Source.ToString();
            cParametros.Tipo        = clsTipoError.WebServices;
            cParametros.Severity    = clsSeveridad.Alta;
            cParametros.Metodo      = System.Reflection.MethodInfo.GetCurrentMethod().Name;
            cParametros.Complemento = consulta.ToString();
            cParametros.Info        = cParametros.Message;
            try
            {
                if (cCache != null)
                {
                    cParametros.ErrorConfigura[0] = cCache.Empresa;
                }
                else
                {
                    cParametros.ErrorConfigura[0] = "0";
                }
            }
            catch { }
            if (cParametros.Message.Contains("limit of Host TAs allocated"))
            {
                cParametros.ViewMessage.Add(sMensaje);
                cParametros.Sugerencia.Add(sSugerencia);
                cParametros.Code = "109";
            }
            else
            {
                cParametros.Code = "106";
            }
            cParametros.ValidaInfo = false;
            cParametros.TipoWs     = Enum_ProveedorWebServices.Sabre;
            clsSesiones.setParametrosError(cParametros);
            ExceptionHandled.Publicar(cParametros);
            clsValidaciones.RedirectPagina("ErrorBusqueda.aspx", true);
        }
        return(Session_);
    }