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 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.º 4
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.º 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();
     }
 }
Exemplo n.º 6
0
 private void ExecuteMovieScore(String searchString, Object[] items)
 {
     SearchParam score = null;
     Boolean isInsert = true;
     try
     {
         String command = "select FilmePont from pontuaFilme where Filme = " +
             items[0].ToString() + " and Sócio = " + searchString;
         Object res = ConnectionProvider.Instance.ExecuteScalarCommand(command);
         if(res != null)
         {
             DialogResult question = MessageBox.Show(this, "O cliente já votou nesse filme com o valor " + ((Int32) res) + ". Deseja alterar a votação?", "Questão",
                 MessageBoxButtons.YesNo, MessageBoxIcon.Question);
             if(question != DialogResult.Yes)
             {
                 return;
             }
             isInsert = false;
         }
         score = new SearchParam("Pontuação", "Indique a pontuação.");
         if(score.ShowDialog(this) != DialogResult.OK)
         {
             return;
         }
         String commandString = (isInsert ? "insert into pontuaFilme values(" + items[0] +
             ", " + searchString + ", " + score.SearchString + ")":
             "update pontuaFilme set FilmePont = " + score.SearchString + " where Filme = " +
             items[0] + " and Sócio = " + searchString);
         ConnectionProvider.Instance.ExecuteNonQueryCommand(commandString);
         MessageBox.Show(this, "Votação com o valor " + score.SearchString, "Votação",
             MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     finally
     {
         if(score != null) score.Dispose();
     }
 }