public ListaEvento()
        {
            InitializeComponent();
            EventoBo bo = new EventoBo();
            IList <Festival.or.Evento> lista = bo.Listar();

            gridControl.RefreshDataSource();

            this.fonteDadosBinding.Clear();
            fonteDadosBinding.DataSource = lista;
            this.fonteDadosBinding.ResetBindings(true);
            gridControl.Refresh();
        }
Exemple #2
0
        private void btnInserir_Click(object sender, EventArgs e)
        {
            try
            {
                // Montar objeto
                Festival.or.Evento evento = new Festival.or.Evento();
                EventoBo           bo     = new EventoBo();
                evento = (Festival.or.Evento)eventoBindingSource.Current;

                // Gravar no banco
                eventoBindingSource.EndEdit();
                bo.Inserir(evento);
                MessageBox.Show("Inserido com sucesso");

                // Limpar campos
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erro ao inserir ");
                throw new Exception("Erro ao inserir Frm  " + ex);
            }
        }