Esempio n. 1
0
        private bool validaObjeto()
        {
            Ajudas ajudas = new Ajudas();

            string nome = txtNomeProjeto.Text.Trim();

            if (nome == string.Empty)
            {
                DialogHelper.Alerta("Informe um nome para o projeto.");
                txtNomeProjeto.Focus();
                return(false);
            }

            if (editar == false)
            {
                if (projetoRepository.ProcurarPorNome(txtNomeProjeto.Text))
                {
                    DialogHelper.Informacao("Já existe projeto cadastrado com este nome.");
                    txtNomeProjeto.Focus();
                    return(false);
                }
            }


            if (txtNomeProjeto.Text.Length > 149 || txtNomeProjeto.Text.Length < 2)
            {
                DialogHelper.Alerta("O nome do projeto deve ter entre 150 e ser menor que 2 caracteres");
                txtNomeProjeto.Focus();
                return(false);
            }

            if (CbbUf.SelectedItem == null)
            {
                DialogHelper.Alerta("Selecione o estado.");
                CbbUf.Focus();
                return(false);
            }

            if (CbbCidade.SelectedItem == null)
            {
                DialogHelper.Alerta("Selecione a cidade.");
                CbbCidade.Focus();
                return(false);
            }

            string endereco = txtLogradouro.Text.Trim();

            if (endereco == string.Empty)
            {
                DialogHelper.Alerta("Informe um endereço para o projeto.");
                txtLogradouro.Focus();
                return(false);
            }

            string bairro = txtBairro.Text.Trim();

            if (bairro == string.Empty)
            {
                DialogHelper.Alerta("Informe um bairro para o projeto.");
                txtBairro.Focus();
                return(false);
            }

            return(true);
        }