Example #1
0
 private void btnAnular_Click(object sender, EventArgs e)
 {
     try
     {
         if (GrdDatos.RowCount > 0)
         {
             if (MessageBox.Show("Desea anular esta clave?", "Profit Expansion", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == System.Windows.Forms.DialogResult.Yes)
             {
                 if (GrdDatos[6, GrdDatos.CurrentCell.RowIndex].Value.ToString() != "ANU")
                 {
                     using (Profit_RGEntities context = new Profit_RGEntities())
                     {
                         context.pAnulaClave(GrdDatos[8, GrdDatos.CurrentCell.RowIndex].Value.ToString().Trim());
                         GrdDatos.AutoGenerateColumns = false;
                         GrdDatos.DataSource          = context.pSeleccionarGene_Claves().ToList();
                     }
                 }
                 else
                 {
                     MessageBox.Show("La clave ya ha sido anulada!", "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                 }
             }
         }
     }
     catch (EntityException ex0)
     {
         MessageBox.Show(ex0.InnerException.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     catch (Exception ex1)
     {
         MessageBox.Show(ex1.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }