private void AtualizaHistorico() { ttbCodigo.Clear(); btnRegistrar.Text = "Registrar"; rbtTrans.Enabled = true; if (cbbDestino.SelectedIndex != -1) { ggbHistorico.Enabled = true; MovContas mov = new MovContas(new BancoM()); if (rbtUltimosLan.Checked) { dgvHistorico.DataSource = mov.UltimosLancamentos(int.Parse(cbbDestino.SelectedValue.ToString())); } else if (rbtPeriodo.Checked) { dgvHistorico.DataSource = mov.porPeriodo(int.Parse(cbbDestino.SelectedValue.ToString()), dtpIni.Value.AddDays(-1), dtpFim.Value); } else { char mov_tipo = 'X'; if(cbbTipo.SelectedIndex != -1) char.TryParse(cbbTipo.SelectedValue.ToString(),out mov_tipo); dgvHistorico.DataSource = mov.porTipo(int.Parse(cbbDestino.SelectedValue.ToString()),mov_tipo); } } else { ggbHistorico.Enabled = false; MovContas mov = new MovContas(new BancoM()); dgvHistorico.DataSource = mov.UltimosLancamentos(0); } }
private void btnLocalizar_Click(object sender, EventArgs e) { MovContas mov = new MovContas(new BancoM()); if (rbtExibirTodos.Checked) { dgvHistorico.DataSource = mov.exibirTodos(); } else if (rbtCredito.Checked) { dgvHistorico.DataSource = mov.porTipo('C'); } else if (rbtDebito.Checked) { dgvHistorico.DataSource = mov.porTipo('D'); } else if (rbtPeriodo.Checked) { dgvHistorico.DataSource = mov.porPeriodo(dtpIni.Value.AddDays(-1), dtpFim.Value); } }