private async void TransactionsButton_Click(object sender, EventArgs e) { ClearError(); TransactionsButton.Enabled = false; ResultsDataGridView.DataSource = null; ResultsDataGridView.Rows.Clear(); ResultsDataGridView.Columns.Clear(); bool success = Int32.TryParse(OPTextBox.Text.TrimEnd(), out int result); if (success) { var transactions = await service.GetCCTransactionsByOPAsync(result, (int)LimitNumeric.Value); if (transactions.Count > 0) { ResultsDataGridView.DataSource = transactions; ResultsDataGridView.Columns["Amount"].DefaultCellStyle.Format = "c"; ResultsDataGridView.Columns["Key"].Visible = false; ResultsDataGridView.Columns["OPKey"].Visible = false; } CountLabel.Text = transactions.Count.ToString(); } else { ErrorOccured("Error - Cannot convert input into number"); OPTextBox.Focus(); OPTextBox.Select(0, OPTextBox.TextLength); CountLabel.Text = "0"; } TransactionsButton.Enabled = true; }
private void OPTextBox_KeyUp(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { TransactionsButton.PerformClick(); OPTextBox.Focus(); OPTextBox.Select(0, OPTextBox.TextLength); } }
private async void CreditCardButton_Click(object sender, EventArgs e) { ClearError(); ResultsDataGridView.DataSource = null; ResultsDataGridView.Rows.Clear(); ResultsDataGridView.Columns.Clear(); CreditCardButton.Enabled = false; bool success = Int32.TryParse(OPTextBox.Text.TrimEnd(), out int result); if (success) { var creditcard = await service.GetCreditCardByOP(result); if (creditcard != null) { ResultsDataGridView.Columns.Add("CrCardTypeName", "Card Type"); ResultsDataGridView.Columns.Add("CrCardNo", "Card No"); ResultsDataGridView.Columns.Add("CrCardExp", "Expire Date"); ResultsDataGridView.Columns.Add("CardHolderName", "Card Holder"); ResultsDataGridView.Columns.Add("CrCardStreetNbrZip", "Street"); ResultsDataGridView.Columns.Add("CrCardZipCode", "Zip"); var index = ResultsDataGridView.Rows.Add(); var row = ResultsDataGridView.Rows[index]; row.Cells["CrCardTypeName"].Value = creditcard.CrCardTypeName; row.Cells["CrCardNo"].Value = creditcard.CrCardNo; row.Cells["CrCardExp"].Value = creditcard.CrCardExp; row.Cells["CardHolderName"].Value = creditcard.CardHolderName; row.Cells["CrCardStreetNbrZip"].Value = creditcard.CrCardStreetNbrZip; row.Cells["CrCardZipCode"].Value = creditcard.CrCardZipCode; CountLabel.Text = "1"; } CountLabel.Text = "0"; } else { OPTextBox.Text += " Error can't convert to number"; OPTextBox.Select(0, OPTextBox.TextLength); CountLabel.Text = "0"; } CreditCardButton.Enabled = true; }