public Ent_ConfigConexion listar_config_conexion()
        {
            Ent_ConfigConexion config_conexion = dat_storeTda.XSTORE_GET_CONEXION_GLOBAL(Session["PAIS"].ToString());

            Session[_session_cc_central_xst] = config_conexion.list_central_xst;
            Session[_session_cc_caja_xst]    = config_conexion.list_cajas_xst;
            return(config_conexion);
        }
Exemple #2
0
        public Ent_ConfigConexion XSTORE_GET_CONEXION_GLOBAL(string pais)
        {
            string                 sql            = "USP_XSTORE_GET_CONEXION_GLOBAL";
            DataSet                dsResponse     = null;
            Ent_ConfigConexion     configConexion = null;
            List <Ent_Central_Xst> listCentralXst = null;
            List <Ent_Cajas_Xst>   listCajasXst   = null;

            try
            {
                using (SqlConnection cn = new SqlConnection(Ent_Conexion.conexionPosPeru))
                {
                    dsResponse = new DataSet();
                    SqlCommand cmd = new SqlCommand(sql, cn);
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@pais", pais);
                    SqlDataAdapter da = new SqlDataAdapter(cmd);
                    da.Fill(dsResponse);
                    listCentralXst = new List <Ent_Central_Xst>();
                    listCentralXst = (from DataRow dr in dsResponse.Tables[0].Rows
                                      select new Ent_Central_Xst()
                    {
                        IP_CENTRAL = dr["IP_CENTRAL"].ToString(),
                        DES_CENTRAL = dr["DES_CENTRAL"].ToString(),
                        ESTADO_CONEXION_CENTRAL_XST = PingHost(dr["IP_CENTRAL"].ToString())
                    }).ToList();
                    listCajasXst = new List <Ent_Cajas_Xst>();
                    listCajasXst = (from DataRow dr in dsResponse.Tables[1].Rows
                                    select new Ent_Cajas_Xst()
                    {
                        COD_ENTID = dr["COD_ENTID"].ToString(),
                        TIENDA = dr["TIENDA"].ToString(),
                        NCAJA = dr["NCAJA"].ToString(),
                        IP = dr["IP"].ToString(),
                        VERSION_XST = dr["VERSION_XST"].ToString(),
                        ESTADO_CONEXION_CAJA_XST = PingHost(dr["IP"].ToString())
                    }).ToList();
                    configConexion = new Ent_ConfigConexion();
                    configConexion.list_cajas_xst   = listCajasXst;
                    configConexion.list_central_xst = listCentralXst;
                }
            }
            catch (Exception ex)
            {
                configConexion = null;
            }
            return(configConexion);
        }