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); } }
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(); }
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; } } } } }
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; } } } } } }
private void reiniciar() { pr = null; //MessageBox.Show("Menssage", "Producto correcto"); tlp = StaticsFunctions.tomarListaPrecios(); }