Esempio n. 1
0
        public bool Validar(out string Alertas)
        {
            StringBuilder msg = new StringBuilder();

            if (string.IsNullOrEmpty(Nome.Trim()))
            {
                msg.Append("Insira o Nome do Cliente.");
                msg.AppendLine();
            }
            else if (string.IsNullOrEmpty(Sobrenome.Trim()))
            {
                msg.Append("Insira o Sobrenome do Cliente.");
                msg.AppendLine();
            }
            else if (string.IsNullOrEmpty(Cpf.Trim()))
            {
                msg.Append("Insira o CPF do Cliente.");
                msg.AppendLine();
            }
            else if (string.IsNullOrEmpty(Telefone.Trim()))
            {
                msg.Append("Insira o Numero de Telefone do Cliente.");
                msg.AppendLine();
            }
            else if (string.IsNullOrEmpty(Rua.Trim()))
            {
                msg.Append("Insira o Logradouro do Cliente.");
                msg.AppendLine();
            }
            else if (string.IsNullOrEmpty(Numero.Trim()))
            {
                msg.Append("Insira o Numero do Cliente.");
                msg.AppendLine();
            }
            else if (string.IsNullOrEmpty(Bairro.Trim()))
            {
                msg.Append("Insira o Bairro do Cliente.");
                msg.AppendLine();
            }
            else if (string.IsNullOrEmpty(UF.Trim()))
            {
                msg.Append("Insira a UF do Cliente.");
                msg.AppendLine();
            }
            else if (string.IsNullOrEmpty(CEP.Trim()))
            {
                msg.Append("Insira o Cep do Cliente.");
                msg.AppendLine();
            }
            Alertas = msg.ToString();
            return(msg.Length == 0);
        }
Esempio n. 2
0
        private bool ValidaCampos()
        {
            if (string.IsNullOrWhiteSpace(Nome))
            {
                MessagingCenter.Send <string>("Nome deve ser preenchido.", "Mensagem");
                return(false);
            }
            if (Telefone.Trim().Replace(" ", "").Length < 10)
            {
                MessagingCenter.Send <string>("O numero precisa conter DDD+Numero", "Mensagem");
                return(false);
            }

            return(true);
        }
Esempio n. 3
0
        public bool Validar(out string Alertas)
        {
            StringBuilder msg = new StringBuilder();

            if (string.IsNullOrEmpty(Nome.Trim()))
            {
                msg.Append("É necessário informar o nome do Funcionario.");
                msg.AppendLine();
            }
            else if (string.IsNullOrEmpty(Sobrenome.Trim()))
            {
                msg.Append("É necessário informar o sobrenome do Funcionario.");
                msg.AppendLine();
            }
            else if (string.IsNullOrEmpty(Rua.Trim()))
            {
                msg.Append("É necessário informar a rua do Funcionario.");
                msg.AppendLine();
            }
            else if (string.IsNullOrEmpty(Cidade.Trim()))
            {
                msg.Append("É necessário informar a cidade do Funcionario.");
                msg.AppendLine();
            }
            else if (string.IsNullOrEmpty(Bairro.Trim()))
            {
                msg.Append("É necessário informar o Bairro do Funcionario.");
                msg.AppendLine();
            }
            else if (string.IsNullOrEmpty(CEP.Trim()))
            {
                msg.Append("É necessário informar o CEP do Funcionario.");
                msg.AppendLine();
            }
            else if (string.IsNullOrEmpty(UF.Trim()))
            {
                msg.Append("É necessário informar o UF do Funcionario.");
                msg.AppendLine();
            }
            else if (string.IsNullOrEmpty(Telefone.Trim()))
            {
                msg.Append("É necessário informar o Telefone do Funcionario.");
                msg.AppendLine();
            }

            Alertas = msg.ToString();
            return(msg.Length == 0);
        }
Esempio n. 4
0
        public IList <string> IsValid()
        {
            var erros = new List <string>();

            if (Nome.Trim() == string.Empty)
            {
                erros.Add("O campo nome é obrigatório!");
            }
            if (Telefone.Trim() == string.Empty)
            {
                erros.Add("O campo telefone é obrigatório!");
            }
            if (Email.Trim() == string.Empty)
            {
                erros.Add("O campo e-mail é obrigatório!");
            }

            return(erros);
        }
        /// <summary>
        /// Converte de model para DTO
        /// </summary>
        /// <param name="requisicaoDto"></param>
        /// <param name="mensagemErro"></param>
        /// <returns></returns>
        public bool ConverterModelParaDto(ref RequisicaoObterListagemClienteDto requisicaoDto, ref string mensagemErro)
        {
            if (!base.ConverterModelParaDto(requisicaoDto, ref mensagemErro))
            {
                return(false);
            }

            try
            {
                requisicaoDto.Cpf      = string.IsNullOrWhiteSpace(Cpf) ? "" : Cpf.Trim().Replace("-", "").Replace(".", "");
                requisicaoDto.Telefone = string.IsNullOrWhiteSpace(Telefone) ? "" : Telefone.Trim().Replace("-", "").Replace("(", "").Replace(")", "");
                requisicaoDto.Nome     = string.IsNullOrWhiteSpace(Nome) ? "" : Nome.Trim();

                return(true);
            }
            catch (Exception ex)
            {
                mensagemErro = ex.Message;
                return(false);
            }
        }
Esempio n. 6
0
        /// <summary>
        /// Converte um produto de Model para Dto
        /// </summary>
        /// <param name="clienteDto"></param>
        /// <param name="mensagemErro"></param>
        /// <returns></returns>
        public bool ConverterModelParaDto(ref ClienteDto clienteDto, ref string mensagemErro)
        {
            try
            {
                clienteDto.Nome          = string.IsNullOrWhiteSpace(Nome) ? "" : Nome.Trim();
                clienteDto.Telefone      = string.IsNullOrWhiteSpace(Telefone) ? "" : Telefone.Trim().Replace("(", "").Replace(")", "").Replace("-", "");
                clienteDto.Cpf           = string.IsNullOrWhiteSpace(Cpf) ? "" : Cpf.Trim().Replace(".", "").Replace("-", "");
                clienteDto.DataAlteracao = this.DataAlteracao;
                clienteDto.DataInclusao  = this.DataInclusao;
                clienteDto.Id            = this.Id;
                clienteDto.Inativo       = this.Inativo;

                return(true);
            }
            catch (Exception ex)
            {
                mensagemErro = ex.Message;
                return(false);
            }
        }
Esempio n. 7
0
        /// <summary>
        /// Converte um fornecedor de Model para Dto
        /// </summary>
        /// <param name="fornecedorDto"></param>
        /// <param name="mensagemErro"></param>
        /// <returns></returns>
        public bool ConverterModelParaDto(ref FornecedorDto fornecedorDto, ref string mensagemErro)
        {
            try
            {
                fornecedorDto.Cnpj = string.IsNullOrWhiteSpace(Cnpj) ? "" : Cnpj.Trim().Replace(".", "").Replace("-", "").Replace("-", "");
                fornecedorDto.ComplementoEndereco = string.IsNullOrWhiteSpace(ComplementoEndereco) ? "" : ComplementoEndereco.Trim();
                fornecedorDto.NomeFantasia        = string.IsNullOrWhiteSpace(NomeFantasia) ? "" : NomeFantasia.Trim();
                fornecedorDto.NumeroEndereco      = string.IsNullOrWhiteSpace(NumeroEndereco) ? "" : NumeroEndereco.Trim();
                fornecedorDto.Obs           = string.IsNullOrWhiteSpace(Obs) ? "" : Obs.Trim();
                fornecedorDto.RazaoSocial   = string.IsNullOrWhiteSpace(RazaoSocial) ? "" : RazaoSocial.Trim();
                fornecedorDto.Telefone      = string.IsNullOrWhiteSpace(Telefone) ? "" : Telefone.Trim();
                fornecedorDto.DataAlteracao = this.DataAlteracao;
                fornecedorDto.DataInclusao  = this.DataInclusao;
                fornecedorDto.Id            = this.Id;
                fornecedorDto.Inativo       = this.Inativo;

                fornecedorDto.Endereco.Bairro     = string.IsNullOrWhiteSpace(Endereco.Bairro) ? "" : Endereco.Bairro.Trim();
                fornecedorDto.Endereco.Cep        = string.IsNullOrWhiteSpace(Endereco.Cep) ? "" : Endereco.Cep.Trim().Replace("-", "");
                fornecedorDto.Endereco.Cidade     = string.IsNullOrWhiteSpace(Endereco.Cidade) ? "" : Endereco.Cidade.Trim();
                fornecedorDto.Endereco.Logradouro = string.IsNullOrWhiteSpace(Endereco.Logradouro) ? "" : Endereco.Logradouro.Trim();
                fornecedorDto.Endereco.Id         = Endereco.Id;

                return(true);
            }
            catch (Exception ex)
            {
                mensagemErro = ex.Message;
                return(false);
            }
        }
Esempio n. 8
0
        /// <summary>
        /// Converte de model para DTO
        /// </summary>
        /// <param name="requisicaoDto"></param>
        /// <param name="mensagemErro"></param>
        /// <returns></returns>
        public bool ConverterModelParaDto(ref RequisicaoObterListagemFornecedoresDto requisicaoDto, ref string mensagemErro)
        {
            if (!base.ConverterModelParaDto(requisicaoDto, ref mensagemErro))
            {
                return(false);
            }

            try
            {
                requisicaoDto.Cnpj         = string.IsNullOrWhiteSpace(Cnpj) ? "" : Cnpj.Trim().Replace("-", "").Replace(".", "").Replace("/", "");
                requisicaoDto.Telefone     = string.IsNullOrWhiteSpace(Telefone) ? "" : Telefone.Trim().Replace("-", "").Replace("(", "").Replace(")", "");
                requisicaoDto.NomeFantasia = string.IsNullOrWhiteSpace(NomeFantasia) ? "" : NomeFantasia.Trim();
                requisicaoDto.RazaoSocial  = string.IsNullOrWhiteSpace(RazaoSocial) ? "" : RazaoSocial.Trim();

                return(true);
            }
            catch (Exception ex)
            {
                mensagemErro = ex.Message;
                return(false);
            }
        }