Example #1
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            bool result = false;

            try
            {
                DialogResult res = MessageBox.Show("¿Desea eliminar el proveedor?",
                                                   "My Store Desktop", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (res == DialogResult.Yes)
                {
                    int fila = dgvDatos.CurrentRow.Index;
                    proveedor = proveedores.ElementAt(fila);
                    SuppliersDAO cDAO = new SuppliersDAO();
                    result = cDAO.Delete(proveedor.SupplierID);
                    if (result)
                    {
                        GetProveedores();
                    }
                    else
                    {
                        MessageBox.Show("Error al eliminar el proveedor",
                                        "My Store Desktop", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error al eliminar el proveedor: " + ex.Message, "My Store Desktop",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #2
0
 /// <summary>
 /// Delete registers based on class values informed. MinValues and nulls are skipped.
 /// Must have "MultipleActiveResultSets=True" on connection string.
 /// </summary>
 /// <param name="parSuppliersInfo">Item to delete</param>
 /// <param name="transaction">Transaction context</param>
 /// <param name="errorMessage">Error message</param>
 public virtual void Delete(SuppliersInfo parSuppliersInfo, DbTransaction transaction, out string errorMessage)
 {
     errorMessage = string.Empty;
     SuppliersDAO.Delete(parSuppliersInfo, transaction, out errorMessage);
     //By default, the caller of this method will do the commit.
     //motor.Commit();
     //motor.CloseConnection();
 }