protected void Page_Load(object sender, EventArgs e) { if (Session["Id"] != null) { List<Puja> lv = new List<Puja>(); var javaScriptSerializer = new JavaScriptSerializer(); string jsonVentas = ""; int idVenta = Int32.Parse(Request["id"]); Ventas serv = new Ventas(); serv.Url = new Juddi().getServiceUrl("Ventas"); jsonVentas = serv.getPujasVenta(idVenta); lv = javaScriptSerializer.Deserialize<List<Puja>>(jsonVentas); DataTable dt = new DataTable(); dt.Columns.AddRange(new DataColumn[4] { new DataColumn("idventa", typeof(int)), new DataColumn("idpujador",typeof(int)), new DataColumn("cantidad", typeof(string)), new DataColumn("Vender",typeof(string)) }); for (int i = 0; i < lv.Count; i++) { dt.Rows.Add(lv[i].ventaId, lv[i].pujadorId, lv[i].cantidad, "Vender"); } GridView1.DataSource = dt; GridView1.DataBind(); } else { Response.Redirect("/"); } }
public void obtenerPujas(ItemPuja p) { List<Puja> lv = new List<Puja>(); var javaScriptSerializer = new JavaScriptSerializer(); string jsonPujas = ""; Ventas serv = new Ventas(); serv.Url = new Juddi().getServiceUrl("Ventas"); jsonPujas = serv.getPujasVenta(p.id); lv = javaScriptSerializer.Deserialize<List<Puja>>(jsonPujas); for (int i = 0; i < lv.Count; i++) { lvPujas.Items.Add(new Puja { ventaId = lv[i].ventaId, pujadorId = lv[i].pujadorId, cantidad = lv[i].cantidad}); } }