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; }
private void btnPesquisa_Click(object sender, EventArgs e) { resultado = Referencia.ConverteObject(c.SelecionarTabela(tabelasBd.REFERENCIAS, Referencia.ToListTabela(true), "Cod='" + txtCodPSQ.Text + "'")); if (resultado.Count < 1) { InformaDiag.Informa("Nenhum resultado encontrado."); return; } referencia = resultado.First(); MostraModel(); if (resultado.Count > 1) { btnAnt.Visible = true; btnProx.Visible = true; } p = 0; txtCod.ReadOnly = true; }
private void timerRef_Tick(object sender, EventArgs e) { string pesquisa; pesquisa = comboRef.Text; if (comboRef.Items.Count > 0) { comboRef.Items.Clear(); } if (pesquisa.Length >= 5) { resRef = Referencia.ConverteObject(crud.SelecionarTabela(tabelasBd.REFERENCIAS, Referencia.ToListTabela(true), "Descricao LIKE '%" + pesquisa + "%'", "LIMIT 10")); foreach (Referencia re in resRef) { comboRef.Items.Add(re.descricao); } } timerRef.Enabled = false; //prevenindo de floodar a combo }
private List <string> SanitizaValores(string tabela, List <string> valores) { //função para trocar possíveis valores em string por suas respectivas FK string saida; for (int i = 0; i < valores.Count; i++) { if (SanitizaString(valores.ElementAt(i), out saida)) { valores.RemoveAt(i); valores.Insert(i, saida); } } if (tabela == tabelasBd.CONJUGACAO) { List <string> FKs = new List <string>(); int idx, c = 0; bool[] fila = { false, false }; ///TODO: Ah, enumeradores... /////faço issoi para evitar que seja lançada uma exceção e os valores perdidos no cast logo abaixo //rubrica idx = Palavra.ToListTabela().FindIndex(bs => bs == "Rubrica"); if (!int.TryParse(valores.ElementAt(idx), out int conv) && (valores.ElementAt(idx) != "")) { FKs.Add(valores.ElementAt(idx)); valores.RemoveAt(idx); valores.Insert(idx, "0"); fila[c] = true; } c++; //referencia idx = Palavra.ToListTabela().FindIndex(bs => bs == "referencia_verbete"); if (!int.TryParse(valores.ElementAt(idx), out conv) && (valores.ElementAt(idx) != "")) { FKs.Add(valores.ElementAt(idx)); valores.RemoveAt(idx); valores.Insert(idx, "0"); fila[c++] = true; } c++; Palavra teste = new Palavra(); try { teste = (Palavra)valores; } catch (InvalidCastException) { LoggerErros(EnumErros.Erro_dados); return(null); } catch (FormatException) { LoggerErros(EnumErros.Erro_dados); return(null); } List <MarcaUso> lrub = new List <MarcaUso>(); List <Referencia> lref = new List <Referencia>(); IEnumerator <string> ff = FKs.GetEnumerator(); c = 0; if (fila[c++]) { saida = ff.Current; lrub = MarcaUso.ConverteObject(operacoes.SelecionarTabela(tabelasBd.MARCAS_USO, MarcaUso.ToListTabela(true), "sigla='" + saida + "'")); if (lrub.Count() > 0) { // teste.rubrica = lrub.First().id; } else { return(null); } ff.MoveNext(); } if (fila[c]) { saida = ff.Current; lref = Referencia.ConverteObject(operacoes.SelecionarTabela(tabelasBd.REFERENCIAS, Referencia.ToListTabela(true), "Cod='" + saida + "'")); if (lref.Count > 0) { // teste.referencia_verbete = lref.First().id; } else { return(null); } } valores.Clear(); valores.AddRange(teste.ToListValores()); } return(valores); }