public void Alterar(ModeloCliente modelo)
        {
            if (modelo.CliNome.Trim().Length == 0)
            {
                throw new Exception("O nome do Cliente é obrigatório");
            }
            if (modelo.CliCidade.Trim().Length == 0)
            {
                throw new Exception("O nome da Cidade é obrigatório");
            }
            if (modelo.CliEstado.Trim().Length == 0)
            {
                throw new Exception("O nome do estado é obrigatório");
            }
            //modelo.CatNome = modelo.CatNome.ToUpper();

            DALCliente DALobj = new DALCliente(conexao);
            DALobj.Alterar(modelo);
        }
Beispiel #2
0
        public void Alterar(ModeloCliente obj)
        {
            if (obj.CliNome.Trim().Length == 0)
            {
                throw new Exception("O nome do cliente é obrigatório");
            }

            if (obj.CliCPF_CNPJ.Trim().Length == 0)
            {
                throw new Exception("O CNPJ/CPF é obrigatório");
            }

            if (obj.CliRG.Trim().Length <= 0)
            {
                throw new Exception("O RG do cliente é obrigatório");
            }

            if (obj.CliTipo.Trim().Length <= 0)
            {
                throw new Exception("O tipo de cliente é obrigatório");
            }

            if (obj.CliCep.Trim().Length <= 0)
            {
                throw new Exception("O CEP do cliente é obrigatório");
            }

            if (obj.CliEndereco.Trim().Length <= 0)
            {
                throw new Exception("O endereço do cliente é obrigatório");
            }

            if (obj.CliBairro.Trim().Length <= 0)
            {
                throw new Exception("O bairro do cliente é obrigatório");
            }
            if (obj.CliFone.Trim().Length <= 0 || obj.CliCel.Trim().Length <=0)
            {
                throw new Exception("Pelo menos um contato do cliente é obrigatório");
            }
            if (obj.CliEndNumero.Trim().Length <= 0)
            {
                throw new Exception("O Número resedencial do cliente é obrigatório");
            }
            if (obj.CliCidade.Trim().Length <= 0)
            {
                throw new Exception("A cidade do cliente é obrigatório");
            }
            if (obj.CliEstado.Trim().Length <= 0)
            {
                throw new Exception("O estado do cliente é obrigatório");
            }

            DALCliente DALobj = new DALCliente(conexao);
            DALobj.Alterar(obj);
        }
Beispiel #3
0
        public void Alterar(ModeloCliente modelo)
        {
            if (modelo.CliNome.Trim().Length == 0)
            {
                throw new Exception("O nome do cliente é obrigatório");
            }


            if (modelo.CliCpfcnpj.Trim().Length == 0)
            {
                throw new Exception("O CPF/CNPJ é obrigatorio");
            }

            //verifica CPF/CNPJ

            if (modelo.CliRgie.Trim().Length == 0)
            {
                throw new Exception("O RG/IE é obrigatorio");
            }

            if (modelo.CliFone.Trim().Length == 0)
            {
                throw new Exception("O Telefone é obrigatorio");
            }

            //cli_tipo => 0=fisica ; 1=juridica

            
            if (!Validacao.ValidaEmail(modelo.CliEmail))
            {
                throw new Exception("Digite um email válido");
            }
            // valida cep

            //if (!Validacao.ValidaCep(modelo.CliCep))
            //{
            //    throw new Exception("Digite um CEP válido");
            //}


            DALCliente DALObj = new DALCliente(conexao);
            DALObj.Alterar(modelo);
        }