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.");
            }
        }