//PESQUISAR
        public static List <MVeiculo> Pesquisar(MVeiculo item)
        {
            List <MVeiculo> retorno = null;

            if (item != null && item.PessoaCPF != null && item.RENAVAM != null)
            {
                string cpf = item.PessoaCPF.Replace(".", "");
                cpf = cpf.Replace("-", "");
                cpf = cpf.Trim();

                if (cpf == "")
                {
                    item.PessoaCPF = "";
                }


                item.Placa = item.Placa.Trim();

                if (item.Placa == "-")
                {
                    item.Placa = item.Placa.Replace("-", "");
                }

                retorno = DVeiculo.Pesquisar(item);

                //RETORNO SE NÃO HOUVER NENHUM CADASTRO
                if (retorno == null)
                {
                    throw new Exception("A Pesquisa não retornou nenhum cadastro!");
                }
            }
            return(retorno);
        }
Exemple #2
0
        public static List <MVeiculo> Pesquisar(MVeiculo item)
        {
            List <MVeiculo> retorno = null;

            if (item != null && item.RENAVAM != null)
            {
                //string cpf = item.CPF.Replace(".", "");
                //cpf = cpf.Replace("-", "");
                //cpf = cpf.Trim();

                //if (item.Placa == "")
                //{
                //    item.Placa = "";
                //}

                //if (item.Modelo == "")
                //{
                //    item.Modelo = "";
                //}

                //if (item.AnoModelo == 0)
                //{
                //    item.AnoModelo = 0;
                //}

                //if (item.AnoFabricacao == 0)
                //{
                //    item.AnoFabricacao = 0;
                //}
            }
            retorno = DVeiculo.Pesquisar(item);

            return(retorno);
        }