Esempio n. 1
0
        public string obtenerAlmacen(string usuario, string password)
        {
            string resultado = "";

            try
            {
                using (ServicioAlmacenCentralPiagui.wsAlmacenCentral servicioWeb = new ServicioAlmacenCentralPiagui.wsAlmacenCentral())
                {
                    System.Net.CookieContainer cookie = new System.Net.CookieContainer();
                    servicioWeb.CookieContainer = cookie;

                    //Conectamos con el servicio web
                    if (servicioWeb.Login(usuario, password) == true)
                    {
                        //Obtenemos el almacén
                        XmlNode xml = servicioWeb.getInventario("");
                        xml       = xml.ChildNodes[0].ChildNodes[0];
                        resultado = xml["Almacen"].InnerText;
                    }
                    else
                    {
                        resultado = "";
                    }
                }
            }
            catch (Exception ex)
            {
                resultado = "";
            }
            return(resultado);
        }
Esempio n. 2
0
        public List <string> obtenerExistencias(string usuario, string password, string material)
        {
            List <string> resultado = new List <string>();

            try
            {
                using (ServicioAlmacenCentralPiagui.wsAlmacenCentral servicioWeb = new ServicioAlmacenCentralPiagui.wsAlmacenCentral())
                {
                    System.Net.CookieContainer cookie = new System.Net.CookieContainer();
                    servicioWeb.CookieContainer = cookie;

                    //Conectamos con el servicio web
                    if (servicioWeb.Login(usuario, password) == true)
                    {
                        if (!string.IsNullOrEmpty(material))
                        {
                            //Obtenemos el inventario del artículo recibido
                            XmlNode xml = servicioWeb.getInventario(material);

                            //Obtenemos las tallas
                            xml = xml.ChildNodes[0].ChildNodes[0].ChildNodes[3];
                            //Recorremos las tallas
                            int i = 0;
                            foreach (XmlNode xmlTalla in xml.ChildNodes)
                            {
                                //Aumentamos el tamaño del array
                                //Array.Resize(ref resultado, resultado.Length + 2);
                                //Guardamos la talla y la cantidad
                                resultado.Add(xmlTalla["Codigo"].InnerText + "#" + xmlTalla["Cantidad"].InnerText);
                                i++;
                            }
                        }
                        else
                        {
                            resultado = null;
                        }
                    }
                    else
                    {
                        resultado = null;
                    }
                }
            }
            catch (Exception ex)
            {
                resultado = null;
            }

            return(resultado);
        }