protected void btnguardar_Click(object sender, EventArgs e) { if (lote.Text != "" && dlcodigo.SelectedValue != "" && pventa.Text != "" && pcompra.Text != "") { entcrearlote obj = new entcrearlote(); obj.idlote = lote.Text; obj.codprod = dlcodigo.SelectedValue; obj.saldo = float.Parse(saldo.Text = ("0")); obj.preciomed = float.Parse(pventa.Text); obj.preciocompra = float.Parse(pcompra.Text); if (negcrearlote.crearlote(obj) != 0) { Response.Redirect("../libreria/registrooperacionconproveedor.aspx"); } else { lblerror.Text = "NO SE PUEDE INGRESAR"; lblerror.Visible = true; } } else { lblerror.Text = "FALTAN CAMPOS POR INGRESAR"; lblerror.Visible = true; } }
public static int crearlote(entcrearlote obj) { int indicador = 1; SqlCommand cmd = null; try { Conexion cn = new Conexion(); SqlConnection cnx = cn.conectar(); cmd = new SqlCommand("ingresolotesuper3", cnx); cmd.Parameters.AddWithValue("@idlote", obj.idlote); cmd.Parameters.AddWithValue("@codprod", obj.codprod); cmd.Parameters.AddWithValue("@saldo", obj.saldo); cmd.Parameters.AddWithValue("@precioprod", obj.preciomed); cmd.Parameters.AddWithValue("@preciocompra", obj.preciocompra); cmd.CommandType = CommandType.StoredProcedure; cnx.Open(); cmd.ExecuteNonQuery(); indicador = 1; } catch (Exception e) { indicador = 0; } finally { cmd.Connection.Close(); } return(indicador); }
public static int crearlote(entcrearlote obj) { return(daocrearlote.crearlote(obj)); }