Exemplo n.º 1
0
 private void SearchAndFillByName(String[] searchInfo, FillDelegate fill)
 {
     SearchParam search = null;
     SearchSelect select = null;
     try
     {
         search = new SearchParam(searchInfo[0], searchInfo[1]);
         if(search.ShowDialog(this) != DialogResult.OK)
         {
             return;
         }
         select = new SearchSelect(searchInfo[2] + "'%" + search.SearchString + "%'");
         if(select.ShowDialog(this) != DialogResult.OK)
         {
             return;
         }
         fill(select.Line.ItemArray);
     }
     finally
     {
         if(search != null) search.Dispose();
         if(select != null) select.Dispose();
     }
 }
Exemplo n.º 2
0
 private void PesquisarButton_Click(object sender, System.EventArgs e)
 {
     SearchParam search = null;
     SearchSelect select = null;
     try
     {
         search = new SearchParam("Pesquisa de Vendedores Autorizados", "Indique o nome do vendedor autorizado.");
         if(search.ShowDialog(this) != DialogResult.OK)
         {
             return;
         }
         select = new SearchSelect("select * from VendedorAutorizado where VendeNome like '%" + search.SearchString + "%'");
         if(select.ShowDialog(this) != DialogResult.OK)
         {
             return;
         }
         VendedorAutorizadoTextBox.Text = select.Line.ItemArray[0].ToString();
     }
     finally
     {
         if(search != null) search.Dispose();
         if(select != null) select.Dispose();
     }
 }
Exemplo n.º 3
0
 private void PesquisarCopiaButton_Click(object sender, System.EventArgs e)
 {
     SearchParam search = null;
     SearchSelect select = null;
     try
     {
         search = new SearchParam("Pesquisa de Filmes", "Indique o nome do filme");
         if(search.ShowDialog(this) != DialogResult.OK)
         {
             return;
         }
         select = new SearchSelect("exec ListaCópiasPorFilme '" + search.SearchString + "'");
         if(select.ShowDialog(this) != DialogResult.OK)
         {
             return;
         }
         Object[] items = select.Line.ItemArray;
         SuporteEditBox.Text = items[0].ToString();
         CopiaCodigoEditBox.Text = items[1].ToString();
         ClubeEditBox.Text = items[2].ToString();
         FilmeCodEditBox.Text = items[3].ToString();
         FilmeNomeEditBox.Text = items[4].ToString();
     }
     finally
     {
         if(search != null) search.Dispose();
         if(select != null) select.Dispose();
     }
 }
Exemplo n.º 4
0
 private void PesquisarSocioButton_Click(object sender, System.EventArgs e)
 {
     SearchParam search = null;
     SearchSelect select = null;
     try
     {
         search = new SearchParam("Pesquisa de Sócios", "Indique o nome do sócio");
         if(search.ShowDialog(this) != DialogResult.OK)
         {
             return;
         }
         select = new SearchSelect("select * from ListaSócios where Nome like '%" + search.SearchString + "%'");
         if(select.ShowDialog(this) != DialogResult.OK)
         {
             return;
         }
         SocioCodTextBox.Text = select.Line.ItemArray[0].ToString();
         SocioNomeTextBox.Text = select.Line.ItemArray[1].ToString();
     }
     finally
     {
         if(search != null) search.Dispose();
         if(select != null) select.Dispose();
     }
 }
Exemplo n.º 5
0
 private void SearchSelectExecute(String[] searchParameters, String[] selectParameters, ExecuteDelegate execute)
 {
     SearchParam search = null;
     SearchSelect select = null;
     try
     {
         search = new SearchParam(searchParameters[0], searchParameters[1]);
         if(search.ShowDialog(this) != DialogResult.OK)
         {
             return;
         }
         select = new SearchSelect(selectParameters[0] + search.SearchString + selectParameters[1]);
         if(select.ShowDialog(this) != DialogResult.OK)
         {
             return;
         }
         execute(search.SearchString, select.Line.ItemArray);
     }
     catch(ConnectionProviderException exception)
     {
         MessageBox.Show(this, exception.Message, "Erro na ligação.",
             MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     finally
     {
         if(search != null) search.Dispose();
         if(select != null) select.Dispose();
     }
 }