public void SummaryDataSearch() { ClearGridViewData(gridDetailData); ShowQueryResultToGridView(gridSummaryData, Mapper.GetGridViewSummaryCommand(this.Name), null); // If there`s no query result for selected year if (gridSummaryData.Rows.Count == 0) { ClearGridViewData(gridSummaryData); SetSelectionLabelText(new List <string> { "" }); MessageBox.Show($"{dateTimePicker.Value.ToString("yyyy-MM")} is not closed yet."); return; } // There should not be automatic row selection when data is populated onto GridView DataGridViewFormat.UndoAutomaticRowSelection(gridSummaryData); DataGridViewFormat.ChangeGridViewFormat(gridSummaryData); ShowUpTypeSelectionLabel(); // Showing up detail data is only allowed after summary data is showed up IsDetailDataShowUpAllowed = true; }
public void SummaryDataSearch() { List <List <int> > closedMonths = new List <List <int> >(); List <string> commands = new List <string>() { DB_Configuration.FUNC_GET_CLOSED_MONTHS_tqtInOut, DB_Configuration.FUNC_GET_CLOSED_MONTHS_tqtInOutCKD, DB_Configuration.FUNC_GET_CLOSED_MONTHS_tmtInOutProd, DB_Configuration.FUNC_GET_CLOSED_MONTHS_tmtInOutSemi }; using (SqlConnection sqlConnection = new SqlConnection(DB_Configuration.ConnectionString)) { foreach (string command in commands) { using (SqlCommand sqlCommand = new SqlCommand(command, sqlConnection)) { sqlConnection.Open(); using (SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(sqlCommand)) { DataTable dataTable = new DataTable(); sqlDataAdapter.Fill(dataTable); closedMonths.Add(ConvertToList(dataTable)); } sqlConnection.Close(); } } gridClosedMonths.DataSource = GetCommonValue(closedMonths); } DataGridViewFormat.ChangeGridViewFormat(gridClosedMonths); DataGridViewFormat.UndoAutomaticRowSelection(gridClosedMonths); }