private void btnSalva_Click(object sender, EventArgs e)
 {
     if (equivDestModificado || ativo.equivalente < 1)
     {
         if (novo)
         {
             InformaDiag.Erro("Selecione uma palavra equivalente dentro dos\nresultados da caixa de pesquisa Verbete Destino!");
             return;
         }
         else
         {
             if (InformaDiag.ConfirmaSN("O valor selecionado no verbete destino foi modificado para um valor inconsistente.\nDeseja continuar com o valor antigo?") == DialogResult.No)
             {
                 return;
             }
         }
     }
     ativo.exemplo           = txtExemplo.Text;
     ativo.exemplo_traduzido = txtExemploTraduzido.Text;
     ativo.DefinirOrdemApresentação((int)txtApresentacao.Value);
     ativo.heterogenerico   = chkHgenerico.Checked;
     ativo.heterotonico     = chkHtonico.Checked;
     ativo.heterossemantico = chkHsemantico.Checked;
     ativo.notasCulturais   = txtCultura.Text;
     ativo.notasGramaticais = txtGramatica.Text;
     if (!novo)
     {
         crud.UpdateLine(tabelasBd.EQUIVALENTE, Equivalente.ToListTabela(), ativo.ToListValores(), "Origem=" + oldEqAt.origem.ToString() + " AND equivalente=" + oldEqAt.equivalente.ToString() + " AND nApresentacao=" + oldEqAt.nOrdem.ToString());
         int tpos = equivO.IndexOf(ativo);
         equivO.RemoveAt(tpos);
         equivO.Insert(tpos, ativo);
     }
     else
     {
         crud.InsereLinha(tabelasBd.EQUIVALENTE, Equivalente.ToListTabela(), ativo.ToListValores());
         equivO.Add(ativo);
         if (equivO.Count > 1)
         {
             AtivaNavegadores();
         }
     }
     InformaDiag.InformaSalvo();
     novo = false;
 }
Ejemplo n.º 2
0
        private void btnSalva_Click(object sender, EventArgs e)
        {
            ativo.exemplo           = txtExemplo.Text;
            ativo.exemplo_traduzido = txtExemploTraduzido.Text;
            ativo.DefinirOrdemApresentação((int)txtApresentacao.Value);
            ativo.PalavraGuia = txtGuia.Text;
            //ativo.heterogenerico = chkHgenerico.Checked;
            //ativo.heterotonico = chkHtonico.Checked;
            //ativo.heterossemantico = chkHsemantico.Checked;
            List <string> fld = Equivalente.ToListTabela();

            fld.Remove("heterotonico");
            fld.Remove("heterogenerico");
            fld.Remove("heterossemantico");

            if (!novo)
            {
                crud.UpdateLine(tabelasBd.EQUIVALENTE, fld, ativo.ToListValores(), "Origem=" + oldEqAt.origem.ToString() + " AND equivalente=" + oldEqAt.equivalente.ToString() + " AND nApresentacao=" + oldEqAt.nOrdem.ToString());
            }
            else
            {
                if (ativo.equivalente < 1)
                {
                    InformaDiag.Erro("Selecione um equivalente na lista de pesquisa.");
                    return;
                }
                else
                {
                    crud.InsereLinha(tabelasBd.EQUIVALENTE, Equivalente.ToListTabela(), ativo.ToListValores());
                    equivO.Add(ativo);
                    AtivaNavegadores();
                }
            }
            InformaDiag.InformaSalvo();
            novo = false;
        }