Exemplo n.º 1
0
        public ICabecalhoRodape ObterEnderecoSetor(ICabecalhoRodape cabecalhoRodape, int setorId)
        {
            CabecalhoRodapeDa da  = new CabecalhoRodapeDa();
            SetorEndereco     end = da.ObterEndSetor(setorId);

            if (end != null)
            {
                cabecalhoRodape = FormatarEndereco(cabecalhoRodape, end);
            }
            cabecalhoRodape.SetorNome = _configFunc.Obter <List <Setor> >(ConfiguracaoFuncionario.KeySetores).Single(x => x.Id == setorId).Nome;

            ObterNomes(cabecalhoRodape);

            return(cabecalhoRodape);
        }
Exemplo n.º 2
0
        public ICabecalhoRodape ObterEnderecoFuncLogado(ICabecalhoRodape cabecalhoRodape)
        {
            CabecalhoRodapeDa da = new CabecalhoRodapeDa();

            int setorId = da.ObterFuncSetor((HttpContext.Current.User.Identity as EtramiteIdentity).FuncionarioId);

            SetorEndereco end = da.ObterEndSetor(setorId);

            cabecalhoRodape = FormatarEndereco(cabecalhoRodape, end);

            cabecalhoRodape.SetorNome = _configFunc.Obter <List <Setor> >(ConfiguracaoFuncionario.KeySetores).Single(x => x.Id == setorId).Nome;

            ObterNomes(cabecalhoRodape);

            return(cabecalhoRodape);
        }
Exemplo n.º 3
0
        private ICabecalhoRodape FormatarEndereco(ICabecalhoRodape cabecalhoRodape, SetorEndereco end)
        {
            if (!String.IsNullOrEmpty(end.Logradouro) || !String.IsNullOrEmpty(end.Numero) || !String.IsNullOrEmpty(end.Bairro))
            {
                cabecalhoRodape.OrgaoEndereco = String.Empty;
                if (!String.IsNullOrEmpty(end.Logradouro))
                {
                    cabecalhoRodape.OrgaoEndereco = end.Logradouro;
                }

                if (!String.IsNullOrEmpty(end.Numero))
                {
                    cabecalhoRodape.OrgaoEndereco = String.Format("{0}, Nº {1}", cabecalhoRodape.OrgaoEndereco, end.Numero);
                }

                if (!String.IsNullOrEmpty(end.Bairro))
                {
                    cabecalhoRodape.OrgaoEndereco = String.Format("{0} - {1}", cabecalhoRodape.OrgaoEndereco, end.Bairro);
                }

                if (!String.IsNullOrEmpty(cabecalhoRodape.OrgaoEndereco))
                {
                    cabecalhoRodape.OrgaoEndereco += ", ";
                }
            }
            else
            {
                cabecalhoRodape.OrgaoEndereco = AsposeData.Empty;
            }

            if (!String.IsNullOrEmpty(end.MunicipioTexto) && !String.IsNullOrEmpty(end.EstadoTexto))
            {
                cabecalhoRodape.OrgaoMunicipio = String.Format("{0}/", end.MunicipioTexto);
                cabecalhoRodape.OrgaoUF        = String.Format("{0}, ", end.EstadoTexto);
            }
            else
            {
                cabecalhoRodape.OrgaoMunicipio = AsposeData.Empty;
                cabecalhoRodape.OrgaoUF        = AsposeData.Empty;
            }

            if (!String.IsNullOrEmpty(end.CEP))
            {
                cabecalhoRodape.OrgaoCep = String.Format("CEP: {0}.", end.CEP);
            }
            else
            {
                cabecalhoRodape.OrgaoCep = AsposeData.Empty;
            }

            if (!String.IsNullOrEmpty(end.Fone) || !String.IsNullOrEmpty(end.FoneFax))
            {
                if (!String.IsNullOrEmpty(end.Fone))
                {
                    cabecalhoRodape.OrgaoContato = String.Format("Fone: {0}", end.Fone);
                }

                if (!String.IsNullOrEmpty(end.FoneFax))
                {
                    cabecalhoRodape.OrgaoContato  = String.Format("{0}{1}", cabecalhoRodape.OrgaoContato, (!String.IsNullOrEmpty(end.Fone) ? " - " : string.Empty));
                    cabecalhoRodape.OrgaoContato += String.Format("Fax: {0}", end.FoneFax);
                }
            }
            else
            {
                cabecalhoRodape.OrgaoContato = AsposeData.Empty;
            }

            return(cabecalhoRodape);
        }
        public SetorEndereco ObterEndSetor(int setorId, BancoDeDados banco = null)
        {
            SetorEndereco end = null;

            using (BancoDeDados bancoDeDados = BancoDeDados.ObterInstancia(banco))
            {
                Comando comando = bancoDeDados.CriarComando(@"select e.id, e.setor, e.cep, e.logradouro, e.bairro, e.estado estadoid, 
					le.sigla estadotexto, e.municipio municipioid, lm.texto municipiotexto, e.numero, e.distrito, e.complemento, e.fone, 
					e.fone_fax, e.tid from {0}tab_setor_endereco e, {0}lov_estado le, {0}lov_municipio lm  where e.setor = :setor 
					and e.estado = le.id(+) and e.municipio = lm.id(+)"                    , EsquemaBanco);

                comando.AdicionarParametroEntrada("setor", setorId, DbType.Int32);

                IDataReader reader = bancoDeDados.ExecutarReader(comando);

                if (reader.Read())
                {
                    end = new SetorEndereco();

                    if (reader["cep"] != null && !Convert.IsDBNull(reader["cep"]))
                    {
                        end.CEP = reader["cep"].ToString();
                    }

                    if (reader["logradouro"] != null && !Convert.IsDBNull(reader["logradouro"]))
                    {
                        end.Logradouro = reader["logradouro"].ToString();
                    }

                    if (reader["bairro"] != null && !Convert.IsDBNull(reader["bairro"]))
                    {
                        end.Bairro = reader["bairro"].ToString();
                    }

                    if (reader["estadoid"] != null && !Convert.IsDBNull(reader["estadoid"]))
                    {
                        end.EstadoId = Convert.ToInt32(reader["estadoid"]);
                    }

                    if (reader["estadotexto"] != null && !Convert.IsDBNull(reader["estadotexto"]))
                    {
                        end.EstadoTexto = reader["estadotexto"].ToString();
                    }

                    if (reader["municipioid"] != null && !Convert.IsDBNull(reader["municipioid"]))
                    {
                        end.MunicipioId = Convert.ToInt32(reader["municipioid"]);
                    }

                    if (reader["municipiotexto"] != null && !Convert.IsDBNull(reader["municipiotexto"]))
                    {
                        end.MunicipioTexto = reader["municipiotexto"].ToString();
                    }

                    if (reader["numero"] != null && !Convert.IsDBNull(reader["numero"]))
                    {
                        end.Numero = reader["numero"].ToString();
                    }

                    if (reader["distrito"] != null && !Convert.IsDBNull(reader["distrito"]))
                    {
                        end.Distrito = reader["distrito"].ToString();
                    }

                    if (reader["complemento"] != null && !Convert.IsDBNull(reader["complemento"]))
                    {
                        end.Complemento = reader["complemento"].ToString();
                    }

                    if (reader["fone"] != null && !Convert.IsDBNull(reader["fone"]))
                    {
                        end.Fone = reader["fone"].ToString();
                    }

                    if (reader["fone_fax"] != null && !Convert.IsDBNull(reader["fone_fax"]))
                    {
                        end.FoneFax = reader["fone_fax"].ToString();
                    }

                    if (reader["tid"] != null && !Convert.IsDBNull(reader["tid"]))
                    {
                        end.Tid = reader["tid"].ToString();
                    }
                }

                reader.Close();
            }

            return(end);
        }