public MainForm() { InitializeComponent(); _dataSet = new ADAWorkSystemDataSet(); monthCalendarStart.SelectionStart = DateTime.Now.AddMonths(-2).Date; monthCalendarStart.SelectionEnd = monthCalendarStart.SelectionStart; monthCalendarEnd.SelectionStart = DateTime.Now.Date; monthCalendarEnd.SelectionEnd = monthCalendarEnd.SelectionStart; }
private void LoadDataSet(ADAWorkSystemDataSet dataSet, bool loadSymbol) { try { dataSet.EnforceConstraints = false; ScheduleTableAdapter scheduleAdapter = new ScheduleTableAdapter(); scheduleAdapter.Fill(dataSet.Schedule); if (loadSymbol) { SymbolTableAdapter symbolAdapter = new SymbolTableAdapter(); symbolAdapter.Fill(dataSet.Symbol); } ActivityTableAdapter activityAdapter = new ActivityTableAdapter(); activityAdapter.Fill(dataSet.Activity); if (loadSymbol) { dataSet.EnforceConstraints = true; foreach (ADAWorkSystemDataSet.ActivityRow activityRow in dataSet.Activity.Rows) { if (!activityRow.IsSymbolIdNull() && !activityRow.SymbolRow.IsImageNull()) { activityRow.Image = activityRow.SymbolRow.Image; } } } dataSet.AcceptChanges(); } catch (Exception ex) { ReportError(ex); } }