private void MostraRegistroAtivo()
        {
            chkHtonico.Checked    = ativo.heterotonico;
            chkHsemantico.Checked = ativo.heterossemantico;
            chkHgenerico.Checked  = ativo.heterogenerico;

            resP = Palavra.ConverteObject(crud.SelecionarTabela(tabelasBd.PALAVRA, Palavra.ToListTabela(true), "id=" + ativo.equivalente.ToString()));
            comboDestino.Text = resP.First().lema;

            txtApresentacao.Value    = ativo.nOrdem;
            txtExemplo.Text          = ativo.exemplo;
            txtExemploTraduzido.Text = ativo.exemplo_traduzido;

            resRef = Referencia.ConverteObject(crud.SelecionarTabela(tabelasBd.REFERENCIAS, Referencia.ToListTabela(true), "Id=" + ativo.Referencia.ToString()));
            if (resRef.Count > 0)
            {
                comboRef.Text = resRef.First().descricao;
            }

            resRubrica = MarcaUso.ConverteObject(crud.SelecionarTabela(tabelasBd.MARCAS_USO, MarcaUso.ToListTabela(true), "Id=" + ativo.MarcaUso.ToString()));
            if (resRubrica.Count > 0)
            {
                ComboRubrica.Text = resRubrica.First().descricao;
            }
            oldEqAt           = ativo;
            txtCultura.Text   = ativo.notasCulturais;
            txtGramatica.Text = ativo.notasGramaticais;
        }
Exemplo n.º 2
0
        private void MostraDados()
        {
            txtpalavra.Text = p.lema;
            if (p.idioma == "PT")
            {
                ComboIdioma.SelectedIndex = 0;
            }
            else
            {
                if (p.idioma == "ES")
                {
                    ComboIdioma.SelectedIndex = 1;
                }
                else
                {
                    ComboIdioma.SelectedIndex = 2;
                }
            }
            switch (p.Genero)
            {
            case "M":
                ComboGenero.SelectedIndex = 0;
                break;

            case "N":
                ComboGenero.SelectedIndex = 2;
                break;

            case "F":
                ComboGenero.SelectedIndex = 1;
                break;

            case "S":
                ComboGenero.SelectedIndex = 3;
                break;

            case "SM":
                ComboGenero.SelectedIndex = 4;
                break;
            }
            ComboClasseGram.Text = p.ClasseGram;
            btnEquiv.Enabled     = true;
            btnConjuga.Enabled   = true;
            txtSubLema.Text      = p.Sublema;
            if (p.Sinonimo1 > 0)
            {
                string filtro = "id=" + p.Sinonimo1.ToString();
                if (p.Sinonimo2 > 0)
                {
                    filtro += (" OR id=" + p.Sinonimo2.ToString());
                }
                resSin = Palavra.ConverteObject(crud.SelecionarTabela(tabelasBd.PALAVRA, Palavra.ToListTabela(true), filtro));
                comboSinonimo1.Text = resSin.First().lema;
                if (resSin.Count > 1)
                {
                    comboSinonimo2.Text = resSin.ElementAt(1).lema;
                }
            }
        }
        private void timerDestino_Tick(object sender, EventArgs e)
        {
            string pesquisa = comboDestino.Text;

            comboDestino.Items.Clear();
            if (pesquisa.Length > 0)
            {
                resP = Palavra.ConverteObject(crud.SelecionarTabela(tabelasBd.PALAVRA, Palavra.ToListTabela(true), "lema='" + pesquisa + "'", "LIMIT 25"));
                foreach (Palavra p in resP)
                {
                    comboDestino.Items.Add(p.lema + " Idioma " + p.idioma + ", " + p.ClasseGram + " " + p.Genero);
                }
            }
            timerDestino.Enabled = false;
        }
Exemplo n.º 4
0
        private void searchButton_Click(object sender, EventArgs e)
        {
            List <Palavra> lista = new List <Palavra>();
            string         chavePesquisa = searchBox.Text, pesquisa;

            if (chavePesquisa == "")
            {
                InformaDiag.Erro("A caixa de busca não pode estar vazia!");
                return;
            }
            if (chavePesquisa.Contains(" "))
            {
            }
            else
            {
                if (chavePesquisa.EndsWith("ing") || chavePesquisa.EndsWith("ed") || chavePesquisa.EndsWith("ies") || chavePesquisa.EndsWith("es"))
                {
                    InformaDiag.Erro("Entradas em inglês não acessíveis no momento.");
                    return;
                }
                if (chavePesquisa.EndsWith("ar") || chavePesquisa.EndsWith("ir"))
                {
                    //caso suspeitarmos que seja um infinitivo em portugues...
                    pesquisa = "Lema = '" + chavePesquisa + "' AND Idioma = 'PT'";
                    lista    = Palavra.ConverteObject(cRUD.SelecionarTabela(tabelasBd.PALAVRA, Palavra.ToListTabela(true), pesquisa));

                    if (lista.Count >= 1) //Existe somente aquele resultado?
                    {
                        if (lista.Count == 1)
                        {
                            txtResultado.Text = MontaApresentaçãoInfinitivoPt(lista.First());
                        }
                        else
                        {
                        }
                    }
                    else
                    {
                        InformaDiag.Erro("Busca não encontrada!");
                    }
                }
                else
                {
                    //caso suspeitarmos que é um verbo flexionado em português
                }
            }
        }
Exemplo n.º 5
0
        private void timerSinonimo_Tick(object sender, EventArgs e)
        {
            string pesquisa;

            if (Sin1Ativo)
            {
                pesquisa = comboSinonimo1.Text;
                comboSinonimo1.Items.Clear();
            }
            else
            {
                pesquisa = comboSinonimo2.Text;
                comboSinonimo2.Items.Clear();
            }
            if (pesquisa.Length > 0)
            {
                string idioma = p.idioma;
                if (idioma == "" || idioma == null)
                {
                    idioma = PegaSiglaIdioma();
                }
                if (idioma != "")
                {
                    resSin = Palavra.ConverteObject(crud.SelecionarTabela(tabelasBd.PALAVRA, Palavra.ToListTabela(true), "lema LIKE '%" + pesquisa + "%' AND Idioma='" + idioma + "'", "LIMIT 10"));
                }
                if (Sin1Ativo)
                {
                    foreach (Palavra p in resSin)
                    {
                        comboSinonimo1.Items.Add(p.lema);
                    }
                }
                else
                {
                    foreach (Palavra p in resSin)
                    {
                        comboSinonimo2.Items.Add(p.lema);
                    }
                }
            }
            timerSinonimo.Enabled = false;
        }
Exemplo n.º 6
0
        private void btnSalva_Click(object sender, EventArgs e)
        {
            if (txtpalavra.Text == String.Empty)
            {
                InformaDiag.Erro("Palavra não pode ser vazio!");
                return;
            }
            if (ComboClasseGram.SelectedItem == null)
            {
                InformaDiag.Erro("Selecione um valor válido de Classe gramatical!");
                return;
            }
            if (ComboGenero.SelectedItem == null)
            {
                InformaDiag.Erro("Selecione um gênero válido!");
                return;
            }
            if (ComboIdioma.SelectedItem == null)
            {
                InformaDiag.Erro("É obrigatório selecionar um idioma!");
                return;
            }
            string lng;

            p.lema = txtpalavra.Text;

            switch (ComboIdioma.SelectedIndex)
            {
            case 0:
                lng = "PT";
                break;

            case 2:
                lng = "EN";
                break;

            case 1:
                lng = "ES";
                break;

            default:
                lng = "";
                break;
            }
            p.idioma          = lng;
            p.notas_gramatica = txtGramatica.Text;
            p.nota_cultura    = textCultura.Text;
            p.Definicao       = txtDefinicao.Text;
            switch (ComboGenero.SelectedIndex)
            {
            case 0:
                p.Genero = "M";
                break;

            case 1:
                p.Genero = "F";
                break;

            case 2:
                p.Genero = "N";
                break;

            default:
                p.Genero = "S";
                break;
            }
            p.ClasseGram = ComboClasseGram.Text;
            if (p.id <= 0)
            {
                if (crud.InsereLinha(tabelasBd.PALAVRA, Palavra.ToListTabela(), p.ToListValores()) > 0)
                {
                    InformaDiag.Informa("Salvo!");
                    LimpaCampos();
                    LimpaModel();
                }
                else
                {
                    ///CASO HOUVER UMA DUPLICATA, ENTÃO O REGISTRO EXISTENTE NO BANCO DEVE SER CARREGADO NO LUGAR DAS INFORMAÇÕES QUE O USUÁRIO PREENCHEU
                    InformaDiag.Erro("Não foi possível salvar.\nO item caracterizado já existe.");
                    if (InformaDiag.ConfirmaSN("Deseja carregar o registro existente?") == DialogResult.Yes)
                    {
                        p = Palavra.ConverteObject(crud.SelecionarTabela(tabelasBd.PALAVRA, Palavra.ToListTabela(true), "lema='" + p.lema + "' AND ClasseGram='" + p.ClasseGram + "' AND idioma='" + p.idioma + "' AND Genero='" + p.Genero + "'")).First();
                        MostraDados();
                    }
                }
            }
            else
            {
                crud.UpdateLine(tabelasBd.PALAVRA, Palavra.ToListTabela(), p.ToListValores(), "id=" + p.id.ToString());
                InformaDiag.Informa("Salvo!");
                LimpaCampos();
            }
            //Uma excessão pode ser lançda aqui quando os valores das chaves estrangerias forem <1, pois estão refernciando um valor que não existe. Como o int no c# não cabe um NULL, seria melhor não enviar o tal valor que evitamos o problema
        }
Exemplo n.º 7
0
        private void searchButton_Click(object sender, EventArgs e)
        {
            if (searchBox.Text != "")
            {
                string filtroquery;
                int    temp;
                switch (filterComboBox.SelectedIndex)
                {
                case 1:
                    filtroquery = "Cod";
                    break;

                default:
                    filtroquery = "lema";
                    break;
                }
                switch (ComboFiltroPrecisao.SelectedIndex)
                {
                case 1:
                    filtroquery += " LIKE '" + searchBox.Text + "%'";
                    break;

                default:
                    filtroquery += "=";
                    if (int.TryParse(searchBox.Text, out temp))
                    {
                        filtroquery += searchBox.Text;
                    }
                    else
                    {
                        filtroquery += "'" + searchBox.Text + "'";
                    }
                    break;
                }
                switch (comboFiltroIdiomas.SelectedIndex)
                {
                case 1:
                    filtroquery += "AND Idioma='PT'";
                    break;

                case 2:
                    filtroquery += "AND Idioma='EN'";
                    break;

                case 3:
                    filtroquery += "AND Idioma='ES'";
                    break;

                default:
                    break;
                }
                if (ComboFiltroPrecisao.Text == "Precisamente")
                {
                    resultados = crud.SelecionarTabela(tabelasBd.PALAVRA, Palavra.ToListTabela(true), "lema='" + searchBox.Text + "'");
                }
                else
                {
                    resultados = crud.SelecionarTabela(tabelasBd.PALAVRA, Palavra.ToListTabela(true), "lema LIKE '%" + searchBox.Text + "%'");
                }
                if (resultados.Count > 0)
                {
                    resPalavra = Palavra.ConverteObject(resultados);
                    p          = resPalavra.First();
                    MostraDados();
                    if (resPalavra.Count == 1)
                    {
                        DesativaNavegadores();
                    }
                    else
                    {
                        AtivaNavegadores();
                        ipal = 0;
                    }
                }
                else
                {
                    InformaDiag.Erro("Nenhum resultado adequado encontrado.");
                }
            }
        }
Exemplo n.º 8
0
        private string MontaApresentaçãoInfinitivoPt(Palavra pReg)
        {
            string              pesquisa, textoApresentado = "Equivalências" + NOVALINHA;
            List <Equivalente>  listaEquiv     = new List <Equivalente>();
            List <Palavra>      listaPEquiv    = new List <Palavra>();
            List <ConjugacaoEn> listaConjugaEn = new List <ConjugacaoEn>();

            pesquisa   = "Origem=" + pReg.id.ToString();
            listaEquiv = Equivalente.ConverteObject(cRUD.SelecionarTabela(tabelasBd.EQUIVALENTE, Equivalente.ToListTabela(), pesquisa, "ORDER BY nApresentacao ASC"));
            pesquisa   = "";
            foreach (Equivalente itemEquiv in listaEquiv)
            {
                pesquisa += ("id=" + itemEquiv.equivalente.ToString() + " OR ");
            }
            pesquisa    = pesquisa.Remove(pesquisa.Count() - 4);
            listaPEquiv = Palavra.ConverteObject(cRUD.SelecionarTabela(tabelasBd.PALAVRA, Palavra.ToListTabela(true), pesquisa));
            pesquisa    = "";
            foreach (Palavra p in listaPEquiv)
            {
                pesquisa += ("idconjugacao=" + p.id.ToString() + " OR ");
            }
            pesquisa       = pesquisa.Remove(pesquisa.Count() - 4);
            listaConjugaEn = ConjugacaoEn.ConverteObject(cRUD.SelecionarTabela(tabelasBd.CONJUGACAOEN, ConjugacaoEn.ToListTabela(true), pesquisa));

            int elementos = listaEquiv.Count;

            //monta Indice
            for (int i = 0; i < elementos; i++)
            {
                textoApresentado += ((i + 1).ToString() + ". " + (listaPEquiv.ElementAt(i).lema) + " (" + listaEquiv.ElementAt(i).PalavraGuia + ")" + NOVALINHA);
            }
            ConjugacaoEn conjugacao = new ConjugacaoEn();

            for (int i = 0; i < elementos; i++)
            {
                pReg       = listaPEquiv.ElementAt(i);
                conjugacao = listaConjugaEn.ElementAt(i);

                textoApresentado += ((i + 1).ToString() + ". " + (pReg.lema) + NOVALINHA);

                textoApresentado += (listaEquiv.ElementAt(i).PalavraGuia + NOVALINHA);

                textoApresentado += (pReg.Definicao + NOVALINHA);

                textoApresentado += (conjugacao.ConstrPresente + NOVALINHA);
                textoApresentado += (conjugacao.ConstrPassado + NOVALINHA);
                textoApresentado += (conjugacao.ConstrWill + NOVALINHA);
                textoApresentado += (conjugacao.ConstrGoingTo + NOVALINHA);
                textoApresentado += (conjugacao.ConstrPresPer + NOVALINHA);
                textoApresentado += (conjugacao.ConstrPasPer + NOVALINHA);
                textoApresentado += (conjugacao.ConstrPresCon + NOVALINHA);
                textoApresentado += (conjugacao.ConstrPasCon + NOVALINHA);

                textoApresentado += (conjugacao.ExPresente + NOVALINHA);
                textoApresentado += (conjugacao.ExPassado + NOVALINHA);
                textoApresentado += (conjugacao.ExWill + NOVALINHA);
                textoApresentado += (conjugacao.ExGoingTo + NOVALINHA);
                textoApresentado += (conjugacao.ExPresPer + NOVALINHA);
                textoApresentado += (conjugacao.ExPasPer + NOVALINHA);
                textoApresentado += (conjugacao.ExPresCon + NOVALINHA);
                textoApresentado += (conjugacao.ExPasCon + NOVALINHA);

                textoApresentado += (pReg.notas_gramatica + NOVALINHA);

                textoApresentado += (pReg.nota_cultura + NOVALINHA);
            }

            textoApresentado += ("Fraseologia" + NOVALINHA + NOVALINHA);

            return(textoApresentado);
        }
Exemplo n.º 9
0
        private void searchButton_Click(object sender, EventArgs e)
        {
            List <object[]> lista = new List <object[]>();

            if (searchBox.Text == "")
            {
                InformaDiag.Erro("A caixa de busca não pode estar vazia!");
                return;
            }
            string filtro = "";

            switch (filterComboBox.SelectedIndex)
            {
            case 1:
                filtro += "lema LIKE'" + searchBox.Text + "'";
                break;

            case 2:
                //anagrama
                break;

            case 3:
                //filtro += "definicao LIKE '" + searchBox.Text + "'";
                break;

            case 4:
                //exemplo
                break;

            case 5:
                //Heterogenérico
                break;

            case 6:
                //Heterotônico
                break;

            default:
                filtro += "lema='" + searchBox.Text + "'";
                break;
            }
            lista = cRUD.SelecionarTabela("palavra", Palavra.ToListTabela(true), filtro, "ORDER BY lema ASC");
            searchResultsListBox.Items.Clear();
            if (lista.Count > 0)
            {
                try
                {
                    resultadosPalavra.Clear();
                }
                catch (NullReferenceException) {
                    resultadosPalavra = new List <Palavra>();
                }
                List <string> cabecalhos = new List <string>();
                Palavra       temPal     = new Palavra();
                resultadosPalavra = AgrupaResultados(Palavra.ConverteObject(lista), out cabecalhos, out int[] divisores);
                int c = 0, i;
                foreach (string conjunto in cabecalhos)
                {
                    searchResultsListBox.Items.Add(conjunto);
                    for (i = 0; i < divisores[c]; i++)
                    {
                        temPal = resultadosPalavra.ElementAt(i);
                        filtro = temPal.lema + " Acep." + " " + " \"";  //+ temPal.referencia_exemplo + "\"" + "\"" + temPal.ref_ex_tr + "\"" + temPal.referencia_verbete;
                        searchResultsListBox.Items.Add(filtro);
                    }
                    c++;
                }
                searchResultsListBox.Enabled = true;

                similares = Palavra.ConverteObject(cRUD.SelecionarTabela(tabelasBd.PALAVRA, Palavra.ToListTabela(true), "referencia_exemplo LIKE '" + searchBox.Text + "'"));
                if (similares.Count > 0)
                {
                    foreach (Palavra p in similares)
                    {
                        similarListBox.Items.Add(p.lema);
                    }
                }
                else
                {
                    similarListBox.Items.Clear();
                    similarListBox.Items.Add("Não há entradas similares além das pesquisadas.");
                    similarListBox.Enabled = false;
                }
                similarListBox.Enabled = true;
            }
            else
            {
                similarListBox.Items.Clear();
                searchResultsListBox.Items.Add("Nenhum resultado encontrado. Verifique seus critérios de pesquisa!");
                searchResultsListBox.Enabled = false;
                similarListBox.Enabled       = false;
            }
            this.searchResultsListBox.Show();
        }