public void PokazDane(DataGridView datagrid, DateTime Start, DateTime Stop) { DgvConfig dane = new DgvConfig(datagrid); dane.Samochod(); dane.dgv.DataSource = Mapowanie.SamochodGetData(SqlQuery.SamochodAll(Start, Stop)); }
private void openExcelToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog dialog = new OpenFileDialog(); dialog.Title = "Open Excel file"; dialog.ShowHelp = true; dialog.Filter = "Excel files|*.xlsx"; dialog.FilterIndex = 1; dialog.RestoreDirectory = false; dialog.InitialDirectory = CurrentPath; dialog.Multiselect = false; if (dialog.ShowDialog() == DialogResult.OK) { InputFileName = dialog.FileName; try { Ncm = new CapaSsme(InputFileName, 1, ConfigFilePath); } catch (Exception ex) { TbLog.Text += dialog.FileName + " Not Initialized!\r\n" + ex.Message.ToString() + "\r\n"; TbLog.Text += "Normally, this is caused by unmatched excel headers to the header configuration."; return; } TbLog.Text += dialog.FileName + "Inited!\r\n" + "Data is init:" + Ncm.IsInitDone.ToString() + "\r\n"; } else { return; } if (!Ncm.IsInitDone) { if (Ncm.ListofNewFoundName.Count == 0) { TbLog.Text += "Init failed, double check the excel file!\r\n"; } else { TbLog.Text += "Find new names: \r\n"; foreach (string s in Ncm.ListofNewFoundName) { TbLog.Text += s + "\r\n"; Ncm.ConfigXml.AddData(s, ""); } } } // Binding the data to show DgvConfig.DataSource = Ncm.ConfigXml.DictToDataTable(); DgvConfig.AutoResizeColumns(); // Enable Analyze button and export excel menu BtnCalculateFPY.Enabled = true; exportExcelToolStripMenuItem.Enabled = true; BtnCheckWeeklyNcm.Enabled = true; excelHeaderConfigurationToolStripMenuItem.Enabled = false; }