Exemplo n.º 1
0
 private void btnGuardar_Click(object sender, EventArgs e)
 {
     try
     {
         this.txtMensajeError.Visible = false;
         List <Error> Errores = this.ValidarDatos();
         if (Errores.Count == 0)
         {
             DiasFestivos     Datos = this.ObtenerDatos();
             Catalogo_Negocio cn    = new Catalogo_Negocio();
             cn.ABCDiasFestivos(Datos);
             if (Datos.Completado == true)
             {
                 MessageBox.Show("Datos guardados correctamente.", Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Information);
                 this._DatosDiasFestivos = Datos;
                 this.DialogResult       = DialogResult.OK;
             }
             else
             {
                 if (Datos.Resultado == 51000)
                 {
                     MessageBox.Show("La fecha ya esta registrada", Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
                 else
                 {
                     MessageBox.Show(Comun.MensajeError, Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
             }
         }
         else
         {
             this.MostrarMensajeError(Errores);
         }
     }
     catch (Exception ex)
     {
         LogError.AddExcFileTxt(ex, "frmNuevoNominaDiasFestivos ~ btnGuardar_Click");
         MessageBox.Show(Comun.MensajeError, Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }