protected void btnModificar_Click(object sender, EventArgs e)
 {
     try
     {
         CapaNegocio.Producto a = new Producto();
         a.Id_producto = Convert.ToInt32(txtID.Text);
         if (a.buscarProducto())
         {
             a.Id_producto     = Convert.ToInt32(txtID.Text);
             a.Nombre_producto = txtNombre.Text;
             a.Marca_producto  = txtMarca.Text;
             a.Precio_producto = Convert.ToInt32(txtPrecio.Text);
             a.Stock_producto  = Convert.ToInt32(txtStock.Text);
             a.Id_min          = Convert.ToInt32(DDLMini.SelectedValue.ToString());
             a.modificarProducto();
             lblMensaje.Text = "Producto Modificado";
             limpiar();
             cargarDDL();
         }
         else
         {
             lblMensaje.Text = "Producto No existe";
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine("Error :" + ex.Message);
         lblMensaje.Text = "Error al modificar";
         limpiar();
         cargarDDL();
     }
 }
예제 #2
0
        protected void btnModificar_Click(object sender, EventArgs e)
        {
            try
            {
                CapaNegocio.Producto a = new Producto();
                a.Id_producto = Convert.ToInt32(txtID.Text);
                if (a.buscarProducto())
                {
                    a.Id_producto     = Convert.ToInt32(txtID.Text);
                    a.Nombre_producto = txtNombre.Text;
                    a.Marca_producto  = txtMarca.Text;
                    a.Precio_producto = Convert.ToInt32(txtPrecio.Text);
                    a.Stock_producto  = Convert.ToInt32(txtStock.Text);
                    a.Id_min          = Convert.ToInt32(DDLMini.SelectedValue.ToString());
                    a.modificarProducto();

                    Response.Redirect("Administracion.aspx");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error :" + ex.Message);
            }
        }