protected void OnClick_LinkButton2(object sender, EventArgs e) { GridViewRow tabla = (GridViewRow)(((LinkButton)sender).Parent.Parent); //IdProducto = ((Label)tabla.FindControl("Label1")).Text.ToString(); SqlDataSource10.SelectParameters["ID_Existencia"].DefaultValue = ((Label)tabla.FindControl("Label8")).Text.ToString(); SqlDataSource10.DataSourceMode = SqlDataSourceMode.DataReader; SqlDataReader PRECIOPROD; PRECIOPROD = (SqlDataReader)SqlDataSource10.Select(DataSourceSelectArguments.Empty); if (PRECIOPROD.Read()) { precioProducto = PRECIOPROD["PrecioUnitario"].ToString(); } SqlDataSource10.InsertParameters["Cantidad"].DefaultValue = ((Label)tabla.FindControl("Label4")).Text.ToString(); SqlDataSource10.InsertParameters["Precio"].DefaultValue = precioProducto; SqlDataSource10.InsertParameters["Total"].DefaultValue = (Convert.ToDecimal(precioProducto) * Convert.ToDecimal(((Label)tabla.FindControl("Label4")).Text.ToString())).ToString(); SqlDataSource10.InsertParameters["ID_Existencia"].DefaultValue = ((Label)tabla.FindControl("Label8")).Text.ToString(); SqlDataSource10.InsertParameters["ID_Compra"].DefaultValue = ((Label)tabla.FindControl("Label10")).Text.ToString(); SqlDataSource10.Insert(); //SqlDataSource10.UpdateParameters["Cantidad"].DefaultValue = ((Label)tabla.FindControl("Label8")).Text.ToString(); //SqlDataSource10.UpdateParameters["ID_Existencia"].DefaultValue = ((Label)tabla.FindControl("Label4")).Text.ToString(); //SqlDataSource10.Update(); SqlDataSource4.UpdateParameters["ID_DevProPro"].DefaultValue = ((Label)tabla.FindControl("Label1")).Text.ToString(); SqlDataSource4.UpdateParameters["Cantidad"].DefaultValue = ((Label)tabla.FindControl("Label4")).Text.ToString(); SqlDataSource4.UpdateParameters["idStock"].DefaultValue = ((Label)tabla.FindControl("Label8")).Text.ToString(); SqlDataSource4.Update(); Response.Redirect("DevProPro.aspx"); }
protected void Button8_Click(object sender, EventArgs e) { try { if (TextBox8.Text != "") { SqlDataSource10.InsertParameters["SubCategoria"].DefaultValue = TextBox8.Text; SqlDataSource10.InsertParameters["ID_Categoria"].DefaultValue = DropDownList3.SelectedValue; SqlDataSource10.Insert(); SqlDataSource10.SelectCommand = "SELECT SubCategoria.ID_SubCategoria, SubCategoria.SubCategoria, Categoria.Categoria FROM Categoria INNER JOIN SubCategoria ON Categoria.ID_Categoria = SubCategoria.ID_Categoria WHERE(Categoria.Estado = 1)"; SqlDataSource10.DataBind(); borrar(); } else { Response.Write("<script>alert('Error, resive los datos')</script>"); } } catch { Response.Write("<script>alert('Error, resive los datos')</script>"); } }