/// <summary> /// Create a report object depending on selections made in the form, set it's surveys/varnames, then execute the report. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cmdGenerateReport_Click(object sender, EventArgs e) { // TODO fill surveys, then assign the list to the report object switch (preset) { case ReportPreset.Harmony: HarmonyReport HR = new HarmonyReport(); HR.matchFields = new List <string> { "PreA", "LitQ", "RespOptions", "Topic" }; foreach (VariableName v in VarNames) { HR.questions.AddRange(DBAction.GetQuestionsByRefVarName(v.refVarName)); } HR.VarNames = VarNames; HR.CreateHarmonyReport(); break; case ReportPreset.VarList: VarNameBasedReport VL = new VarNameBasedReport(); break; case ReportPreset.SurveyList: VarNameReport SR = new VarNameReport(); Surveys[0].Qnum = true; SR.Surveys = Surveys; if (SR.GenerateReport() == 1) { MessageBox.Show("One or more surveys has no records!"); } break; case ReportPreset.Overview: VarNameReport SO = new VarNameReport(); Surveys[0].Qnum = true; foreach (ReportSurvey rs in Surveys) { rs.VarLabelCol = true; rs.TopicLabelCol = true; rs.ContentLabelCol = true; } SO.ShowAllQnums = true; SO.ShowAllVarNames = true; SO.ShowQuestion = false; SO.Surveys = Surveys; SO.GenerateReport(); break; case ReportPreset.Sections: VarNameReport SS = new VarNameReport(); Surveys[0].Qnum = true; foreach (ReportSurvey rs in Surveys) { var headingVars = rs.questions.FindAll(x => x.VarName.StartsWith("Z")); foreach (SurveyQuestion sq in headingVars) { rs.Varnames.Add(sq.VarName); } } SS.Surveys = Surveys; SS.ShowAllQnums = true; SS.ShowAllVarNames = true; SS.ShowSectionBounds = true; SS.GenerateReport(); break; case ReportPreset.Syntax: SyntaxReport SY = new SyntaxReport(); SY.OutputPath = @"D:\users\Dev"; foreach (ReportSurvey s in Surveys) { SY.CreateSyntax(s, SyntaxFormat.EpiData); } break; case ReportPreset.TopicContent: TopicContentReport TCR = new TopicContentReport(); TCR.Surveys = Surveys; TCR.GenerateLabelReport(); break; case ReportPreset.OrderCompare: return; case ReportPreset.ProductCrosstab: LabelBasedReport LR = new LabelBasedReport(); break; default: MessageBox.Show("Please select a report type."); return; } }
public Form1() { SR = new SyntaxReport(); InitializeComponent(); }