Пример #1
0
        private void btnGrabar_Click(object sender, EventArgs e)
        {
            try
            {
                ErrorIcono.Clear();

                string msgRespuesta = "";
                if (txtNombre.Text == "" || txtDescripcion.Text == "")
                {
                    MsgError("Debe ingresar los datos correctamente para continuar: ");
                }
                if (txtNombre.Text == string.Empty)
                {
                    ErrorIcono.SetError(txtNombre, "Debe ingresar un nombre");
                }
                if (txtDescripcion.Text == string.Empty)
                {
                    ErrorIcono.SetError(txtDescripcion, "Debe Ingresar una Descripcion");
                }
                else
                {
                    if (N == true)
                    {
                        msgRespuesta = NPresentacion.IngresarPresentacion(txtNombre.Text.Trim(), txtDescripcion.Text.Trim());
                    }
                    else
                    {
                        msgRespuesta = NPresentacion.ModificarPresentacion(Convert.ToInt32(txtCodigo.Text), txtNombre.Text.Trim(), txtDescripcion.Text.Trim());
                    }
                    if (msgRespuesta.Equals("Ok"))
                    {
                        if (N)
                        {
                            MsgConfirmacion("Se han guardado los datos correctamente");
                        }
                        else
                        {
                            MsgConfirmacion("Se han editado los datos correctamente");
                        }
                        N = false;
                        E = false;
                        HoB_btn();
                        limpiar();
                        MostrarDatos();
                        ErrorIcono.Clear();
                    }
                    else
                    {
                        MsgError(msgRespuesta);
                    }
                }
            }

            catch (Exception ex)
            {
                MsgError(ex.Message + ex.StackTrace);
            }
        }