protected void Button1_Click(object sender, EventArgs e) { if (listaDeImpuesto.SelectedIndex == -1) { string message = "alert('" + "Escoga un porcentaje de impuesto" + "');"; ClientScript.RegisterStartupScript(this.GetType(), "Error_message", message, true); return; } TresAmigosWebService ws = new TresAmigosWebService(); int codigo = Int32.Parse(codigoDeProducto.Text); int cantidad = Int32.Parse(cantidadDisponible.Text); float precio = float.Parse(precioUnidad.Text); float impuesto = float.Parse(listaDeImpuesto.Text); float ganancia = float.Parse(porcentajeDeGanancia.Text); ws.AgregarProducto(codigo, nombreDeProducto.Text, cantidad, precio, impuesto, 5, ganancia); }
}//botonUpload protected void btnInsert_Click(object sender, EventArgs e) { TresAmigosWebService ws = new TresAmigosWebService(); if (GridView1.Rows.Count == 0) { //is empty } else { foreach (GridViewRow row in GridView1.Rows) { //Cod_producto Name_Product Qty_Stock Unit_Price Tax Pre_Total Gain Total_Sale int cod_producto = Int32.Parse(row.Cells[0].Text); string nombre = row.Cells[1].Text; int cantidad = Int32.Parse(row.Cells[2].Text); float precio = float.Parse(row.Cells[3].Text); float impuesto = float.Parse(row.Cells[4].Text); float pre_total = float.Parse(row.Cells[5].Text); float ganancia = float.Parse(row.Cells[6].Text); ws.AgregarProducto(cod_producto, nombre, cantidad, precio, impuesto, pre_total, ganancia); } } }