Exemplo n.º 1
0
 private void btnSearch_Click(object sender, EventArgs e)
 {
     if (txtSearch.Text.Equals("") || txtSearch.Text.Length < 3)
     {
         MessageBox.Show("Invalid Search", "Invalid Search", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     else
     {
         publishersTable.DefaultView.Sort = "Name";
         var foundRows  = publishersTable.Select($"Name LIKE '*{txtSearch.Text}*'");
         var searchForm = new frmSearch(foundRows, "Publishers");
         searchForm.ShowDialog();
         var index = searchForm.Index;
         if (foundRows.Length == 0)
         {
             MessageBox.Show("No record found", "Search", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         else
         {
             publishersManager.Position = publishersTable.DefaultView.Find(foundRows[index]["Name"]);
         }
     }
 }
Exemplo n.º 2
0
 private void btnSearch_Click(object sender, EventArgs e)
 {
     if (txtSearch.Text.Equals("") || txtSearch.Text.Length < 3)
     {
         MessageBox.Show("Invalid Search", "Invalid Search", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     else
     {
         authorsTable.DefaultView.Sort = "Author";
         var foundRows = authorsTable.Select($"Author LIKE '*{txtSearch.Text}*'");
         if (foundRows.Length == 0)
         {
             MessageBox.Show("Couldn't find any record", "Search", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         else
         {
             var searchForm = new frmSearch(foundRows, "Authors");
             searchForm.ShowDialog();
             var index = searchForm.Index;
             authorsManager.Position = authorsTable.DefaultView.Find(foundRows[index]["Author"]);
         }
     }
 }
Exemplo n.º 3
0
 private void btnFind_Click(object sender, EventArgs e)
 {
     if (txtFind.Text.Equals("") || txtFind.Text.Length < 3)
     {
         MessageBox.Show("Invalid Input", "Invalid Input", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     else
     {
         titlesTable.DefaultView.Sort = "Title";
         var foundRows = titlesTable.Select($"Title Like '*{txtFind.Text}*'");
         if (foundRows.Length == 0)
         {
             MessageBox.Show("Record not found", "Search", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         else
         {
             var searchForm = new frmSearch(foundRows, "Titles");
             searchForm.ShowDialog();
             var index = searchForm.Index;
             titlesManager.Position = titlesTable.DefaultView.Find(foundRows[index]["Title"]);
             GetAuthors();
         }
     }
 }