Beispiel #1
0
        protected void btnSalvar_Click(object sender, EventArgs e)
        {
            Taxa taxa = new Taxa();

            taxa.BancoTAX  = Convert.ToInt32(txtBanco.Text);
            taxa.TipoTAX   = txtTipo.Text;
            taxa.StatusTAX = txtStatus.Text;
            taxa.JurosTAX  = txtJuros.Text;

            TaxaBD bd = new TaxaBD();

            if (bd.Insert(taxa))
            {
                lblMensagem.Text = "Taxa cadastrada com sucesso";

                txtBanco.Text  = "";
                txtTipo.Text   = "";
                txtStatus.Text = "";
                txtJuros.Text  = "";

                txtBanco.Focus();
            }
            else
            {
                lblMensagem.Text = "Ops, algo deu errado, tente novamente";
            }
        }
        private void Carrega()
        {
            //Carrega Cliente
            ClienteBD clientebd = new ClienteBD();
            DataSet   clienteds = clientebd.SelectAll();

            //vincula usuario ao dropdownlist
            dpdCliente.DataSource     = clienteds.Tables[0].DefaultView;
            dpdCliente.DataTextField  = "cli_cpf";
            dpdCliente.DataValueField = "cli_codigo";
            dpdCliente.DataBind();
            dpdCliente.Items.Insert(0, new ListItem("Selecione", ""));

            //Carrega Taxa
            TaxaBD  taxabd = new TaxaBD();
            DataSet taxads = taxabd.SelectAll();

            //Vincula taxas ao checkboxlist
            cblTaxa.DataSource     = taxads.Tables[0].DefaultView;
            cblTaxa.DataTextField  = "tax_taxaJuros";
            cblTaxa.DataValueField = "tax_codigo";
            cblTaxa.DataBind();


            //Carrega Usuario
            UsuarioBD usuariobd = new UsuarioBD();
            DataSet   usuariods = usuariobd.SelectAll();

            //vincula usuario ao dropdownlist
            dpdUsuario.DataSource     = usuariods.Tables[0].DefaultView;
            dpdUsuario.DataTextField  = "usu_nome";
            dpdUsuario.DataValueField = "usu_codigo";
            dpdUsuario.DataBind();
            dpdUsuario.Items.Insert(0, new ListItem("Selecione", ""));

            //Carrega Loja
            LojaBD  lojabd = new LojaBD();
            DataSet lojads = lojabd.SelectAll();

            //vincula loja ao dropdownlist
            dpdLoja.DataSource     = lojads.Tables[0].DefaultView;
            dpdLoja.DataTextField  = "loj_id";
            dpdLoja.DataValueField = "loj_codigo";
            dpdLoja.DataBind();
            dpdLoja.Items.Insert(0, new ListItem("Selecione", ""));

            //Carrega Venda
            EmprestimoBD emprestimobd = new EmprestimoBD();
            DataSet      emprestimods = emprestimobd.SelectAll();

            //vincula emprestimo ao dropdownlist
            dpdEmprestimo.DataSource     = emprestimods.Tables[0].DefaultView;
            dpdEmprestimo.DataTextField  = "emp_id";
            dpdEmprestimo.DataValueField = "emp_codigo";
            dpdEmprestimo.DataBind();
            dpdEmprestimo.Items.Insert(0, new ListItem("Selecione", ""));
        }