Exemplo n.º 1
0
        public static TomarListaPrecio tomarListaPrecios()
        {
            var httpWebRequest = (HttpWebRequest)WebRequest.Create(pagina + "tomarListaPrecio.php");

            httpWebRequest.ContentType = "application/json";
            httpWebRequest.Method      = "POST";
            using (var streamWriter = new

                                      StreamWriter(httpWebRequest.GetRequestStream()))
            {
                string json = new JavaScriptSerializer().Serialize(new Producto()
                {
                });
                streamWriter.Write(json);
            }
            var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();

            using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
            {
                var result = streamReader.ReadToEnd();
                //MessageBox.Show(result,"Resultado");
                TomarListaPrecio tlp = JsonConvert.DeserializeObject <TomarListaPrecio>(result);
                //MessageBox.Show(rj.estado + "", rj.msg);
                return(tlp);
            }
        }
Exemplo n.º 2
0
        private void reiniciarGridView()
        {
            prs = new List <Producto>();
            var list = new BindingList <GVProductoVenta>(mandarProductosGV(prs));

            dataGridView1.DataSource = list;
            textBox4.Text            = "0";
            textBox7.Text            = "";
            textBox8.Text            = "";
            cl = null;
            ag = null;
            panel3.Controls.Clear();
            tp = StaticsFunctions.tomarServicios();
            comboBox1.SelectedIndex = 1;
            tlp = null;
            agregarProductos();
        }
Exemplo n.º 3
0
        private void modificarProductosListaPrecio(TomarProductos tomarP)
        {
            TomarListaPrecio tomarListaPrecio = StaticsFunctions.tomarListaPrecios(ag);

            if (tomarListaPrecio.listaPrecio != null)
            {
                for (int i = 0; i < tomarListaPrecio.listaPrecio.Count; i++)
                {
                    for (int j = 0; j < tomarP.productos.Count; j++)
                    {
                        if (tomarP.productos.ElementAt(j).id == tomarListaPrecio.listaPrecio.ElementAt(i).idProducto)
                        {
                            tomarP.productos.ElementAt(j).precio = (float)tomarListaPrecio.listaPrecio.ElementAt(i).precio;
                        }
                    }
                }
            }
        }
Exemplo n.º 4
0
 private void modificarProductos()
 {
     if (ag != null)
     {
         tlp = StaticsFunctions.tomarListaPrecios(ag);
         if (tlp.listaPrecio != null)
         {
             for (int i = 0; i < tlp.listaPrecio.Count; i++)
             {
                 for (int j = 0; j < tp.productos.Count; j++)
                 {
                     if (tp.productos.ElementAt(j).id == tlp.listaPrecio.ElementAt(i).idProducto)
                     {
                         tp.productos.ElementAt(j).precio = (float)tlp.listaPrecio.ElementAt(i).precio;
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 5
0
 private void reiniciar()
 {
     pr = null;
     //MessageBox.Show("Menssage", "Producto correcto");
     tlp = StaticsFunctions.tomarListaPrecios();
 }