Exemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                GastosADTO dto = new GastosADTO();
                dto.Nome      = txtNome.Text;
                dto.Descricao = txtDescricao.Text;
                dto.Data      = mktData.Text;
                dto.Valor     = nudValor.Value;

                GastosABusiness buss = new GastosABusiness();
                buss.Salvar(dto);

                string     msg  = "Gasto adicionado com sucesso.";
                frmMessage tela = new frmMessage();
                tela.LoadScreen(msg);
                tela.ShowDialog();
            }
            catch (Exception)
            {
                frmException tela = new frmException();
                tela.LoadScreen("Ocorreu um erro.\nConsulte o administrador do sistema.");
                tela.ShowDialog();
            }
        }
Exemplo n.º 2
0
        void AutoCarregar()
        {
            try
            {
                GastosABusiness   buss  = new GastosABusiness();
                List <GastosADTO> lista = buss.Listar();

                dgvGastos.AutoGenerateColumns = false;
                dgvGastos.DataSource          = lista;
            }
            catch (Exception)
            {
                frmException tela = new frmException();
                tela.LoadScreen("Ocorreu um erro.\nConsulte o administrador do sistema.");
                tela.ShowDialog();
            }
        }