private async void Consultar_Reporte() { string filtroInicial = Txt_Comprobante_Inicial.Text.Trim() == "" ? "NULL" : Txt_Comprobante_Inicial.Text.Trim(); string filtroFinal = Txt_Comprobante_Final.Text.Trim() == "" ? "NULL" : Txt_Comprobante_Final.Text.Trim(); string cliente = Txt_Cliente.Text.Trim() == "" ? "NULL" : Txt_Cliente.Text.Trim(); this.Cursor = Cursors.WaitCursor; using (var client = new HttpClient()) { using (var response = await client.GetAsync(Globales.Url_API + "facturacion/consultaventas/" + filtroInicial + "/" + filtroFinal + "/" + cliente)) { if (response.IsSuccessStatusCode) { var jsonString = await response.Content.ReadAsStringAsync(); Grid_Ventas.AutoGenerateColumns = false; Grid_Ventas.DataSource = JsonConvert.DeserializeObject <typeReporteVentas[]>(jsonString).ToList(); Grid_Ventas.ClearSelection(); } else { this.Cursor = Cursors.Default; var contents = await response.Content.ReadAsStringAsync(); MessageBox.Show(contents); } } } this.Cursor = Cursors.Default; }
protected void botonAñadir(object sender, EventArgs e) { DataTable dt = new DataTable(); DataTable aux = (DataTable)Session["dtAuxventas"]; bool sw = Convert.ToBoolean(Session["switchVentas"]); string codigoProducto = txtProducto.Text; dt = DALC.AccessDB.getProducto(codigoProducto); if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { if (sw) { foreach (GridViewRow gridr in Grid_Ventas.Rows) { if (gridr.Cells[0].Text.Equals(row["CODIGO"].ToString())) { Label label = (Label)gridr.Cells[1].FindControl("labelCantidad"); decimal cantidadLabel; cantidadLabel = Convert.ToDecimal(label.Text); label.Text = (cantidadLabel + 1).ToString(); foreach (DataRow r in aux.Rows) { if (r[0].ToString().Equals(gridr.Cells[0].Text)) { r["CANTIDAD_MOV"] = (cantidadLabel + 1).ToString(); } } ajustarSumatorios(); Session["dtAuxVentas"] = aux; setUpGrid(); return; } } } if (row["CANTIDAD_MOV"].ToString() == "") { row["CANTIDAD_MOV"] = "1"; } row["TOTAL"] = (Convert.ToDecimal(row["CANTIDAD_MOV"]) * Convert.ToDecimal(row["PRECIO"])); aux.Rows.Add(row.ItemArray); } Session["dtAuxVentas"] = aux; Grid_Ventas.DataSource = aux; Grid_Ventas.DataBind(); setUpGrid(); if (!sw) { Session["switchVentas"] = true; } ajustarSumatorios(); Grid_Ventas.Visible = true; } else { Response.Write("<script language=javascript>alert('Producto no encontrado');</script>"); } }