private void btnSalvar_Click(object sender, EventArgs e) { if (!ValidarCampos()) { MessageBox.Show("Existem campos não preenchidos"); return; } DialogResult dialogResult = MessageBox.Show("Deseja salvar?", "Salvando...", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.No) { return; } List <TipoGastosTO> tipoGastoListaTO = new List <TipoGastosTO>(); if (tipoGastoTO != null) { PreencherValoresSalvar(); tipoGastoListaTO.Add(tipoGastoTO); } try { TipoGastosBLL tipoGastosBLL = new TipoGastosBLL(); tipoGastosBLL.Save(tipoGastoListaTO); VerificarProcessoDepoisSalvar(); } catch (Exception ex) { LoggerUtil.ErrorLog(ex.Message, ex); MessageBox.Show("Erro ao salvar os dados."); } }
private void carregarCombos() { //Impede que o comboBox seja editável cbxTipoGasto.DropDownStyle = ComboBoxStyle.DropDownList; TipoGastosBLL tipoGastoBLL = new TipoGastosBLL(); var listaTipoGastos = tipoGastoBLL.SelectAll(new FiltroTelaTO()); cbxTipoGasto.DisplayMember = "TIPO"; cbxTipoGasto.ValueMember = "ID_TIPO_GASTOS"; cbxTipoGasto.DataSource = listaTipoGastos.OrderBy(x => x.TIPO).ToList(); }
/* * Alteração de gastos */ public void Alterar(TipoGastosTO objTipoGastosTO) { TipoGastosBLL gastoBLL = new TipoGastosBLL(); this.tipoGastoTO = gastoBLL.SelectScalar(objTipoGastosTO.ID_TIPO_GASTOS); if (tipoGastoTO != null) { PreencherValoresTela(tipoGastoTO); tipoGastoTO.StatusBD = StatusTransacao.Update; } this.ShowDialog(); }
public void Excluir(TipoGastosTO objTipoGastoTO) { TipoGastosBLL gastoBLL = new TipoGastosBLL(); this.tipoGastoTO = gastoBLL.SelectScalar(objTipoGastoTO.ID_TIPO_GASTOS); if (tipoGastoTO != null) { PreencherValoresTela(tipoGastoTO); tipoGastoTO.StatusBD = StatusTransacao.Delete; } DesabilitarComponentes(); this.ShowDialog(); }
private void BuscarDados() { TipoGastosBLL tipoGastosBLL = new TipoGastosBLL(); var filtro = Filtro(); try { var listaTipoGastos = tipoGastosBLL.SelectAll(filtro); if (listaTipoGastos.Count == 0) { MessageBox.Show("Nenhum tipo encontrado!"); return; } preencherGrid(listaTipoGastos); } catch (Exception ex) { LoggerUtil.ErrorLog(ex.Message, ex); MessageBox.Show("Erro ao buscar os dados."); } }