Beispiel #1
0
 public OfertasForm()
 {
     InitializeComponent();
     try
     {
         ofertasDAO = new OfertasDAO();
     }
     catch (Exception ex)
     {
         Mensajes.Error(ex.Message);
     }
 }
        private void btnRegistrar_Click(object sender, EventArgs e)
        {
            if (validarOferta())
            {
                var  resultado      = new OfertasDAO().Registrar(oferta);
                Type resultado_tipo = resultado.GetType();

                if (resultado_tipo.Equals(typeof(string)))
                {
                    Mensajes.Error(resultado.ToString());
                }
                else
                {
                    Mensajes.Info("Registro exitoso.");
                    Close();
                }
            }
        }
        private void modificarBtn_Click(object sender, EventArgs e)
        {
            if (validarOferta())
            {
                var  resultado      = new OfertasDAO().Editar(oferta);
                Type resultado_tipo = resultado.GetType();

                if (resultado_tipo.Equals(typeof(string)))
                {
                    Mensajes.Error(resultado.ToString());
                }
                else
                {
                    Mensajes.Info("Actualización exitosa.");
                    Close();
                }
            }
        }