Esempio n. 1
0
 protected void btnAgregarProducto_Click(object sender, EventArgs e)
 {
     try
     {
         Producto prodTemporal = new Producto();
         administracionProducto admProducto = new administracionProducto();
         prodTemporal.nombreProducto = txtNombreProducto.Text;
         prodTemporal.precioProducto = Convert.ToInt32(txtPrecioProducto.Text);
         prodTemporal.marca          = ddlMarca.SelectedValue;
         prodTemporal.imagenProducto = admProducto.imageToByte(inputImagenProducto.FileName);
         prodTemporal.ventaMin       = Convert.ToInt32(txtVentaMinima.Text);
         prodTemporal.ventaMax       = Convert.ToInt32(txtVentaMaxima.Text);
         prodTemporal.idRubro        = Convert.ToInt32(ddlRubro.SelectedValue);
         prodTemporal.idLote         = Convert.ToInt32(ddLote.SelectedValue);
         prodTemporal.idSubFamilia   = Convert.ToInt32(ddlSubFamilia.SelectedValue);
         admProducto.agregarProducto(prodTemporal);
         limpiarCampos();
         lblMensaje.Text = "Producto " + txtNombreProducto.Text + " agregado con éxito.";
     }
     catch (Exception ex)
     {
         lblMensaje.Text = ex.Message;
     }
 }