コード例 #1
0
        protected void btnPesPessoa_Click(object sender, EventArgs e)
        {
            Session["tabelaPesquisa"] = null;
            DataTable dt = CriarDtPesquisa();

            PessoasBL peaBL = new PessoasBL();
            Pessoas pe = new Pessoas();
            List<Pessoas> pessoas = peaBL.PesquisarBL();

            foreach (Pessoas pes in pessoas)
            {
                DataRow linha = dt.NewRow();

                linha["ID"] = pes.Id;
                linha["CODIGO"] = pes.Codigo;
                linha["NOME"] = pes.Nome;

                dt.Rows.Add(linha);
            }

            Session["tabelaPesquisa"] = null;

            if (dt.Rows.Count > 0)
                Session["tabelaPesquisa"] = dt;

            Session["objBLPesquisa"] = peaBL;
            Session["objPesquisa"] = pe;
            ScriptManager.RegisterStartupScript(this, this.GetType(), Guid.NewGuid().ToString(), "WinOpen('/Pesquisar.aspx?caixa=" + txtPessoa.ClientID + "&id=" + hfIdPessoa.ClientID + "&lbl=" + lblDesPessoa.ClientID + "','',600,500);", true);
        }
コード例 #2
0
        private void CarregarDDLPessoa()
        {
            PessoasBL pesBL = new PessoasBL();
            List<Pessoas> pessoa = pesBL.PesquisarBL();

            ddlPessoa.Items.Add(new ListItem());
            foreach (Pessoas ltPes in pessoa)
                ddlPessoa.Items.Add(new ListItem(ltPes.Codigo.ToString() + " - " + ltPes.Nome, ltPes.Id.ToString()));

            ddlPessoa.SelectedIndex = 0;
        }
コード例 #3
0
        protected void txtCliente_TextChanged(object sender, EventArgs e)
        {
            hfIdPessoa.Value = "";
            PessoasBL pesBL = new PessoasBL();
            Pessoas pessoa = new Pessoas();
            List<Pessoas> pes = pesBL.PesquisarBL("CODIGO", txtCliente.Text);

            foreach (Pessoas ltpessoa in pes)
            {
                hfIdPessoa.Value = ltpessoa.Id.ToString();
                txtCliente.Text = ltpessoa.Codigo.ToString();
                lblDesCliente.Text = ltpessoa.Nome;
                txtItem.Focus();
            }

            if (utils.ComparaIntComZero(hfIdPessoa.Value) <= 0)
            {
                ExibirMensagem("Cliente não cadastrado !");
                txtCliente.Text = "";
                lblDesCliente.Text = "";
                txtCliente.Focus();
                hfIdPessoa.Value = "";
            }
        }
コード例 #4
0
        private void CarregarDadosPessoas(int id_pes)
        {
            PessoasBL pesBL = new PessoasBL();
            List<Pessoas> pessoas = pesBL.PesquisarBL(id_pes);

            foreach (Pessoas pes in pessoas)
            {
                hfId.Value = pes.Id.ToString();
                lblCodigo.Text = pes.Codigo.ToString();
                txtNome.Text = pes.Nome;

                if (pes.NomeFantasia.Trim() != "")
                    txtNome.Text = pes.NomeFantasia;

                txtCpfCnpj.Text = pes.CpfCnpj;
                txtRg.Text = pes.Rg;
                txtDataNascimento.Text = pes.DtNascimento != null ? Convert.ToDateTime(pes.DtNascimento).ToString("dd/MM/yyyy") : "";
                ddlEstadoCivil.SelectedValue = pes.EstadoCivil;
                txtNomeMae.Text = pes.NomeMae;
                txtNomePai.Text = pes.NomePai;
                txtCep.Text = pes.Cep;
                txtEndereco.Text = pes.Endereco;
                txtNumero.Text = pes.Numero;
                txtComplemento.Text = pes.Complemento;
                txtEmpresa.Text = pes.Empresa;
                txtEnderecoProf.Text = pes.EnderecoProf;
                txtNumeroProf.Text = pes.NumeroProf;
                txtComplementoProf.Text = pes.ComplementoProf;
                txtCepProf.Text = pes.CepProf;
                txtObservacao.Text = pes.Obs;
                txtDtCadastro.Text = pes.DtCadastro.ToString("dd/MM/yyyy");
                ddlSexo.SelectedValue = pes.Sexo;
                txtEmail.Text = pes.Email;
                rbTipoAssoc.SelectedValue = pes.TipoAssociado.ToString();
                txtRefNome.Text = pes.RefNome.ToString();
                txtRefTelefone.Text = pes.RefTelefone.ToString();
                ckEnviaEmail.Checked = pes.EnvEmail;

                if (pes.Cidade != null)
                {
                    ddlUF.SelectedValue = pes.Cidade.EstadoId.ToString();
                    CarregarDdlCidade(ddlCidades, pes.Cidade.EstadoId);
                    CarregarDdlBairro(ddlBairro, pes.CidadeId);
                    ddlCidades.SelectedValue = pes.CidadeId.ToString();
                    ddlBairro.SelectedValue = pes.BairroId.ToString();
                }

                if (pes.CidadeProf != null)
                {
                    ddlUfProf.SelectedValue = pes.CidadeProf.EstadoId.ToString();
                    CarregarDdlCidade(ddlCidadeProf, pes.CidadeProf.EstadoId);
                    CarregarDdlBairro(ddlBairroProf, utils.ComparaIntComZero(pes.CidadeProfId.ToString()));
                    ddlCidadeProf.SelectedValue = pes.CidadeProfId.ToString();
                    ddlBairroProf.SelectedValue = pes.BairroProf.ToString();
                }

                ddlCategoria.SelectedValue = pes.CategoriaId.ToString();

                if (pes.Tipo == "F")
                {
                    lblDesNome.Text = "* Nome";
                }
                else
                {
                    lblDesNome.Text = "* Nome Fantasia";
                }

                ConsisteCPFCNPJ();
            }
        }
コード例 #5
0
        public void pesquisaAssociado(string lCampoPesquisa)
        {
            Session["tabelaPesquisa"] = null;

            DataTable dt = CriarTabelaPesquisa();

            PessoasBL pesBL = new PessoasBL();
            Pessoas pe = new Pessoas();
            List<Pessoas> pessoas;
            if (this.txtAssociado.Text != string.Empty && lCampoPesquisa != string.Empty)
            {
                pessoas = pesBL.PesquisarBL(lCampoPesquisa, this.txtAssociado.Text);
            }
            else
            {
                pessoas = pesBL.PesquisarBL();
            }

            foreach (Pessoas pes in pessoas)
            {
                DataRow linha = dt.NewRow();

                linha["ID"] = pes.Id;
                linha["CODIGO"] = pes.Codigo;
                linha["DESCRICAO"] = pes.Nome;

                dt.Rows.Add(linha);
            }

            if (dt.Rows.Count > 0)
                Session["tabelaPesquisa"] = dt;
            else
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "ALERTA", "alert('Associado não encontrado.');", true);
            }

            Session["objBLPesquisa"] = pesBL;
            Session["objPesquisa"] = pe;
        }
コード例 #6
0
        private void PesquisarCliente(string cod_cliente)
        {
            hfIdPessoa.Value = "";
            string situacao = null;
            PessoasBL pesBL = new PessoasBL();
            Pessoas pessoa = new Pessoas();
            List<Pessoas> pes = pesBL.PesquisarBL("CODIGO", cod_cliente);

            foreach (Pessoas ltpessoa in pes)
            {
                hfIdPessoa.Value = ltpessoa.Id.ToString();
                txtCliente.Text = ltpessoa.Codigo.ToString();
                lblDesCliente.Text = ltpessoa.Nome;
                lblClienteItens.Text = ltpessoa.Nome;
                lblCategoria.Text = ltpessoa.Categorias.Descricao;

                situacao = pesBL.VerificaSituacaoPessoa(utils.ComparaIntComZero(hfIdPessoa.Value), true, true);

                if (situacao != null && situacao != string.Empty)
                    LblSituacao.Text = situacao;
                else
                    LblSituacao.Text = "OK";

                PesquisarEmprestimosAtivo(utils.ComparaIntComZero(hfIdPessoa.Value));
            }

            if (utils.ComparaIntComZero(hfIdPessoa.Value) <= 0)
            {
                if (cod_cliente != string.Empty)
                    ExibirMensagem("Cliente não cadastrado !");

                txtCliente.Text = "";
                lblDesCliente.Text = "";
                lblCategoria.Text = "";
                LblSituacao.Text = "";
                lblClienteItens.Text = "";
                txtCliente.Focus();
            }
        }