예제 #1
0
        public string Processar(Entity entidade)
        {
            if (entidade is Profile)
            {
                var dao           = new ProfileDAO();
                var Profile       = (Profile)entidade;
                var SearchProfile = new Profile();

                //Passando um  perfil soh com o rg
                SearchProfile.Rg = Profile.Rg;
                List <Entity> resultProfile = (List <Entity>)dao.VerificarRg(SearchProfile);
                if (resultProfile.Count > 0)
                {
                    return("Esse RG já está cadastrado!");
                }

                //Passando um  perfil soh com o cpf
                SearchProfile.Rg  = "";
                SearchProfile.Cpf = Profile.Cpf;
                resultProfile     = (List <Entity>)dao.VerificarCpf(SearchProfile);
                if (resultProfile.Count > 0)
                {
                    return("Esse CPF já está cadastrado!");
                }

                return(null);
            }
            return("Essa entidade não é do tipo usuário!");
        }