示例#1
0
 private void Aceptar_Click(object sender, EventArgs e)
 {
     try
     {
         retencioneBindingSource.EndEdit();
         Calcular();
         if (string.IsNullOrEmpty(registro.NumeroComprobante))
         {
             throw new Exception("Error el numero de comprobante no puede estar vacio");
         }
         if (string.IsNullOrEmpty(registro.NumeroControlDocumento))
         {
             throw new Exception("Error el numero de control no puede estar vacio");
         }
         if (string.IsNullOrEmpty(registro.NumeroDocumento))
         {
             throw new Exception("Error el numero de documento no puede estar vacio");
         }
         if (string.IsNullOrEmpty(registro.NumeroExpediente))
         {
             registro.NumeroExpediente = "0";
         }
         registro          = (Retencione)retencioneBindingSource.Current;
         this.DialogResult = DialogResult.OK;
         try
         {
             string num    = registro.NumeroComprobante.Substring(6, 8);
             int    numero = Convert.ToInt32(num);
             FactoryContadores.SetMaxComprobante(Mes, Año, numero);
         }
         catch
         {
         }
         this.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error al guardar los datos \n" + ex.Source + "\n" + ex.Message, "Atencion", MessageBoxButtons.OK);
     }
 }