Esempio n. 1
0
        protected void dtgProductos_Delete(Object sender, DataGridCommandEventArgs e)
        {
            IProducto oProducto = ProductoFactory.GetProducto();

            oProducto.ProductoID = Convert.ToInt32(dtgProductos.DataKeys[(int)e.Item.ItemIndex]);

            try
            {
                if (oProducto.Eliminar())
                {
                    BindGrid();
                }
            }
            catch (Exception ex)
            {
                string mensaje = ex.Message;
                try
                {
                    mensaje = this.TraducirTexto(ex.Message);
                    if (mensaje == "" || mensaje == null)
                    {
                        mensaje = ex.Message;
                    }
                }
                catch (Exception)
                {
                    mensaje = ex.Message;
                }
                ((ErrorWeb)this.phErrores.Controls[0]).setMensaje(mensaje);
            }
        }
Esempio n. 2
0
 public bool Eliminar(int idProducto)
 {
     try
     {
         using (var scope = new TransactionScope())
         {
             var result = iProducto.Eliminar(idProducto);
             scope.Complete();
             return(result);
         }
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
 public void Eliminar(Int32 codigo)
 {
     MPro.Eliminar(codigo);
 }