Example #1
0
        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.");
            }
        }
Example #2
0
        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();
        }
Example #3
0
        /*
         * 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();
        }
Example #4
0
        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();
        }
Example #5
0
        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.");
            }
        }