Beispiel #1
0
 protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     foreach (GridViewRow row in GridView1.Rows)
     {
         ComponenteNegocio.ProductosCN oMatriculaCN = new ComponenteNegocio.ProductosCN();
         ComponenteEntidad.Productos   oMatriculaCE = new ComponenteEntidad.Productos();
         oMatriculaCE.Codproducto = Convert.ToString(row.Cells[0].Text);
         oMatriculaCN.EliminarProductos(oMatriculaCE);
     }
 }
Beispiel #2
0
 protected void btnGuardar_Click(object sender, EventArgs e)
 {
     ComponenteNegocio.ProductosCN oMatriculaCN = new ComponenteNegocio.ProductosCN();
     ComponenteEntidad.Productos   oMatriculaCE = new ComponenteEntidad.Productos();
     oMatriculaCE.Codproducto  = txtCodigo.Text;
     oMatriculaCE.Desproducto  = txtNombre.Text;
     oMatriculaCE.Codcategoria = cbCategoria.SelectedValue.ToString();
     oMatriculaCE.Preproducto  = decimal.Parse(txtPrecio.Text);
     if (!string.IsNullOrEmpty(FileUpload1.FileName))
     {
         FileUpload1.SaveAs(Server.MapPath("/Imagenes/") + FileUpload1.FileName);
     }
     oMatriculaCE.Canproducto = int.Parse(txtCantidad.Text);
     oMatriculaCE.Imagen      = FileUpload1.FileName;
     oMatriculaCN.InsertarProductos(oMatriculaCE);
     limpiar();
 }