Exemple #1
0
        private void adicionaBanco()
        {
            DTOAcrescimos dto = new DTOAcrescimos();
            DALConexao    cx  = new DALConexao(DadosDaConexao.StringDaConexao);
            BLLAcrescimos bll = new BLLAcrescimos(cx);

            //Preenche dados

            dto.Conta_acrescimo = "";
            dto.Obs_acrescimo   = "";
            dto.Tipo_acrescimo  = "";
            dto.Valor_acrescimo = 0;

            dto.Data_acrescimo  = dpData.Value;
            dto.Valor_acrescimo = Convert.ToDouble(txtValor.Text);
            dto.Id_usuario      = idUsuario;
            dto.Id_unidade      = idUnidade;

            if (txtObs.Text != "")
            {
                dto.Obs_acrescimo = txtObs.Text.Trim();
            }

            if (cbConta.SelectedValue.ToString() == "-1")
            {
                dto.Tipo_acrescimo = "p";
            }
            else if (cbConta.SelectedValue.ToString() == "-2")
            {
                dto.Tipo_acrescimo = "r";
            }
            else
            {
                dto.Tipo_acrescimo   = "c";
                dto.Valor_acrescimo *= -1;
                dto.Conta_acrescimo  = cbConta.Text.ToString().Substring(0, 10);
            }

            dto.Descricao_acrescimo = cbConta.Text;


            bll.Incluir(dto);


            txtValor.Clear();
            txtObs.Clear();
            cbConta.Text = "";
            dpData.Value = DateTime.Now;

            MessageBox.Show("Valor incluído com sucesso!");

            CarregaDGVs();
        }