/// <summary> /// /// </summary> /// <param name="connection"></param> private async void GetApplications() { SqlCommand command = new SqlCommand(SqlHelpers.GetDetailedApplicationsTable(), connection.con); await connection.con.OpenAsync(); using (var reader = await command.ExecuteReaderAsync()) { dataTable.Load(reader); reader.Close(); } connection.con.Close(); applicationsDataGridView.DataSource = dataTable; applicationsDataGridView.Rows[0].Selected = true; applicationsDataGridView.Columns["ApplicationID"].Visible = false; applicationsDataGridView.Columns.Cast <DataGridViewColumn>().ToList().ForEach(f => f.SortMode = DataGridViewColumnSortMode.NotSortable); var count = applicationsDataGridView.Rows.Count; ApplicationsDataGridView_CellClick(null, null); }
/// <summary> /// /// </summary> /// <param name="id"></param> private async void GetReviewsForSelectedID(int?id) { SqlCommand command = new SqlCommand(SqlHelpers.GetReviewsTable(id), connection.con); await connection.con.OpenAsync(); DataTable dataTable = new DataTable(); using (var reader = await command.ExecuteReaderAsync()) { dataTable.Load(reader); reader.Close(); } connection.con.Close(); reviewsDataGridView.DataSource = dataTable; reviewsDataGridView.Columns["MainID"].Visible = false; reviewsDataGridView.Columns["ApplicationID"].Visible = false; SetReviewsGridViewProperties(reviewsDataGridView); if (reviewsDataGridView.Rows.Count > 0) { reviewsDataGridView.Rows[0].Selected = true; reviewsDataGridView_CellClick(null, null); } }