// // Event marked to show the transaction details of each transaction when clicked on the list box which gets poppulated with the list of transactions based on email id search private void TransactionsListBox1_MouseClick(object sender, MouseEventArgs e) { try { SearchByTransactionNumber(SearchTransactionsListBox1.SelectedItem.ToString()); } catch { // Print message to show no transaction found MessageBox.Show("There is no transaction as per your search", "No Transaction", MessageBoxButtons.OK, MessageBoxIcon.Error); // // Bringing the focus back to Search button which is blank and needs user input SearchButton1.Focus(); } }
// // Event coded for the click of Search button private void SearchButton1_Click(object sender, EventArgs e) { bool IsSearchButtonChecked = false; string SearchTranNum = SearchTextBox1.Text; // // To check if any radio button (Transaction number or Email ID) is selected for the search foreach (RadioButton rdbutton in SearchGroupBox1.Controls.OfType <RadioButton>()) { if (rdbutton.Checked) { IsSearchButtonChecked = true; break; } } if (!IsSearchButtonChecked) { // Print message no button is selected MessageBox.Show("Please select one search type", "Search type selection error", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error); // // Bringing the focus back to SEARCH button which is blank and needs user input SearchButton1.Focus(); } else { SearchResultEmailIdAnsLabel1.Text = ""; SearchResultInvestedAmountAnswerLabel1.Text = ""; SearchResultClientNameAnswerLabel1.Text = ""; SearchResultBalanceAmountAnswerLabel1.Text = ""; SearchResultTelephoneAnswerLabel1.Text = ""; SearchResultTermPlanAnswerLabel1.Text = ""; SearchTransactionsListBox1.Items.Clear(); // // Calling the method based on user radio button selection and passing the search string if (SearchTransNumRadioButton1.Checked == true) { SearchByTransactionNumber(SearchTranNum); } else { SearchByEmailId(SearchTranNum); } } }
public void SearchGQ(string keyWord) { Thread.Sleep(2000); KeywordTextBox.SendKeys(keyWord); SearchButton1.Click(); }