Exemplo n.º 1
0
        public static void _enviar_webservice_xml()
        {
            string _ruta_copy = _xml + "\\copy";

            try
            {
                if (!Directory.Exists(@_ruta_copy))
                {
                    Directory.CreateDirectory(@_ruta_copy);
                }
                string[] _archivos_xml = Directory.GetFiles(@_xml, "*.xml");

                if (!Directory.Exists(@_ruta_copy))
                {
                    Directory.CreateDirectory(@_ruta_copy);
                }

                if (_archivos_xml.Length > 0)
                {
                    for (Int32 a = 0; a < _archivos_xml.Length; ++a)
                    {
                        string _archivo           = _archivos_xml[a].ToString();
                        string _nombrearchivo_xml = System.IO.Path.GetFileNameWithoutExtension(@_archivo);

                        byte[] _archivo_bytes = File.ReadAllBytes(@_archivo);
                        ServiceBata.ws_bataSoapClient _valor = new ServiceBata.ws_bataSoapClient();
                        string _error_service = _valor.ws_envio_xml_desarrollo(_archivo_bytes, _nombrearchivo_xml);

                        if (_error_service == "1")
                        {
                            string _archivo_copy = _ruta_copy + "\\" + _nombrearchivo_xml + ".xml";
                            File.Copy(@_archivo, @_archivo_copy, true);
                            File.Delete(@_archivo);
                        }
                    }
                }
            }
            catch
            {
            }
        }
Exemplo n.º 2
0
        public static void _enviar_webservice_xml()
        {
            string _ruta_copy = _xml + "\\copy";

            try
            {
                //Boolean valida_envio = true;
                if (Ent_Global._canal_venta == "AQ")
                {
                    if (Ent_Conexion._Base_Datos != "BdAquarella")
                    {
                        return;
                    }
                }
                ;
                if (Ent_Global._canal_venta == "BA")
                {
                    if (Ent_Conexion._Base_Datos != "BD_ECOMMERCE")
                    {
                        return;
                    }
                }
                if (Ent_Global._canal_venta == "MV")
                {
                    if (Ent_Conexion._Base_Datos != "BD_MULTIVENDE")
                    {
                        return;
                    }
                }

                //return;
                if (!Directory.Exists(@_ruta_copy))
                {
                    Directory.CreateDirectory(@_ruta_copy);
                }
                string[] _archivos_xml = Directory.GetFiles(@_xml, "*.xml");

                if (!Directory.Exists(@_ruta_copy))
                {
                    Directory.CreateDirectory(@_ruta_copy);
                }

                #region <REGION PARA ENVIAR EL XML AL SERVIDOR>


                if (_archivos_xml.Length > 0)
                {
                    for (Int32 a = 0; a < _archivos_xml.Length; ++a)
                    {
                        string _archivo           = _archivos_xml[a].ToString();
                        string _nombrearchivo_xml = System.IO.Path.GetFileNameWithoutExtension(@_archivo);

                        byte[] _archivo_bytes = File.ReadAllBytes(@_archivo);
                        ServiceBata.ws_bataSoapClient _valor = new ServiceBata.ws_bataSoapClient();
                        string _error_service = _valor.ws_envio_xml(_archivo_bytes, _nombrearchivo_xml);

                        if (_error_service == "1")
                        {
                            string _archivo_copy = _ruta_copy + "\\" + _nombrearchivo_xml + ".xml";
                            File.Copy(@_archivo, @_archivo_copy, true);
                            File.Delete(@_archivo);
                        }
                        else
                        {
                            break;
                        }
                    }
                }
                #endregion
            }
            catch
            {
            }
        }