/// <summary> /// After a date is chosen, check that a backup exists for that date. If the date chosen is today, do nothing. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dateBackend_ValueChanged(object sender, EventArgs e) { if (dateBackend.Value == DateTime.Today) { return; } string filePath = dateBackend.Value.ToString("yyyy-MM-dd"); BackupConnection bkp = new BackupConnection(dateBackend.Value); if (!bkp.IsValidBackup()) { MessageBox.Show("No backup found for this date."); dateBackend.Value = bkp.GetNearestBackup(); } UpdateReportColumns(null, null); }
/// <summary> /// Add a survey to the report. /// </summary> /// <param name="s">ReportSurvey object being added to the report.</param> private void AddSurvey(ReportSurvey s) { if (SR.HasSurvey(s)) { BackupConnection bkp = new BackupConnection(s.Backend); s.Backend = bkp.GetNearestBackup(); } SR.AddSurvey(s); UpdateReportColumns(null, null); UpdateGrids(); // show the options tabs if at least one survey is chosen if (lstSelectedSurveys.Items.Count > 0) { lblStatus.Visible = true; cmdGenerate.Visible = true; //tabControlOptions.Enabled = CurrentTemplate == ReportTemplate.Custom; foreach (TabPage p in tabControlOptions.TabPages) { p.Enabled = CurrentTemplate == ReportTemplate.Custom; } tabControlOptions.Visible = true; } // update report defaults ShowTranslationSubsetTableOption(); UpdateDefaultOptions(); UpdateFileNameTab(); UpdateReportDetails(); // set current survey UpdateCurrentSurvey(); // load survey specific options LoadSurveyOptions(); }