public void SingleVarNameSingleTranslation() { SurveyReport SR = new SurveyReport(); ReportSurvey s = new ReportSurvey("TT1"); SurveyQuestion q = new SurveyQuestion("AA000", "001"); q.Translations.Add(new Translation() { Language = "TestLang", TranslationText = "Translation Text" }); s.AddQuestion(q); s.TransFields.Add("TestLang"); SR.AddSurvey(s); SR.GenerateReport(); DataTable dt = SR.ReportTable; bool hasQnumCol = dt.Columns[0].ColumnName.Equals("Qnum"); bool hasVarNameCol = dt.Columns[1].ColumnName.Equals("VarName"); bool hasQuestionCol = dt.Columns[2].ColumnName.Equals(s.SurveyCode); bool hasTranslationCol = dt.Columns[3].ColumnName.Equals(s.SurveyCode + " " + s.TransFields[0]); bool hasRows = dt.Rows.Count == s.Questions.Count; bool hasAllColumns = hasQnumCol && hasVarNameCol && hasQuestionCol && hasTranslationCol; Assert.IsTrue(hasAllColumns && hasRows); }
/// <summary> /// Remove a survey from the report. /// </summary> /// <param name="s">ReportSurvey object being removed from the report.</param> private void RemoveSurvey(ReportSurvey s) { // remove survey from the SurveyReport object SR.RemoveSurvey((ReportSurvey)lstSelectedSurveys.SelectedItem); GC.Collect(); UpdateReportColumns(null, null); UpdateGrids(); // hide the options tabs no surveys are chosen if (lstSelectedSurveys.Items.Count < 1) { lblStatus.Visible = false; cmdGenerate.Visible = false; tabControlOptions.Visible = false; } // update report defaults ShowTranslationSubsetTableOption(); UpdateDefaultOptions(); UpdateFileNameTab(); UpdateReportDetails(); // set current survey UpdateCurrentSurvey(); // load survey specific options LoadSurveyOptions(); }
private void UpdateFileNameTab() { if (SR.Surveys.Count == 0) { return; } ReportSurvey primary = SR.PrimarySurvey(); string mainSource = primary.SurveyCode; string secondSources = ""; if (primary.Backend != DateTime.Today) { mainSource += " on " + primary.Backend; } foreach (ReportSurvey o in SR.NonPrimarySurveys()) { secondSources += o.SurveyCode; if (o.Backend != DateTime.Today) { secondSources += " on " + o.Backend; } secondSources += ", "; } secondSources = Utilities.TrimString(secondSources, ", "); txtMainSource.Text = mainSource; txtSecondSources.Text = secondSources; }
public void SingleSurveyMultiQuestionReportTable() { SurveyReport SR = new SurveyReport(); ReportSurvey s = new ReportSurvey("Test"); SR.AddSurvey(s); for (int i = 0; i < 10; i++) { SurveyQuestion sq = new SurveyQuestion(); sq.VarName.FullVarName = "AA" + i.ToString("000"); sq.Qnum = i.ToString("000"); sq.PreP = "Test PreP" + i; sq.LitQ = "Test LitQ" + i; for (int j = 1; j <= i; j++) { sq.RespOptions += j + " Response Option " + j; } s.AddQuestion(sq); } int result = SR.GenerateReport(); Assert.IsTrue(result == 0); Assert.IsTrue(SR.ReportTable.Rows.Count == 10); }
public void SingleVarNameVarLabel() { SurveyReport SR = new SurveyReport(); ReportSurvey s = new ReportSurvey("TT1"); SurveyQuestion q = new SurveyQuestion("AA000", "001"); s.AddQuestion(q); s.VarLabelCol = true; SR.AddSurvey(s); SR.GenerateReport(); DataTable dt = SR.ReportTable; bool hasQnumCol = dt.Columns[0].ColumnName.Equals("Qnum"); bool hasVarNameCol = dt.Columns[1].ColumnName.Equals("VarName"); bool hasQuestionCol = dt.Columns[2].ColumnName.Equals(s.SurveyCode); bool hasVarLabelCol = dt.Columns[3].ColumnName.Equals(s.SurveyCode + " VarLabel"); bool hasRows = dt.Rows.Count == s.Questions.Count; bool hasAllColumns = hasQnumCol && hasVarNameCol && hasQuestionCol && hasVarLabelCol; Assert.IsTrue(hasAllColumns && hasRows); }
private void chklstPrimarySurvey_SelectedIndexChanged(object sender, EventArgs e) { var checkedItems = chklstPrimarySurvey.CheckedItems; ReportSurvey r = (ReportSurvey)checkedItems[0]; SR.SetPrimary(r.ID); }
private void UpdateCurrentSurvey() { CurrentSurvey = (ReportSurvey)lstSelectedSurveys.SelectedItem; if (CurrentSurvey == null) { return; } lblCurrentSurveyFields.Text = CurrentSurvey.SurveyCode + " (" + CurrentSurvey.Backend.ToString("d") + ") selections."; }
public void SurveyReportAddCurrentSurvey() { SurveyReport SR = new SurveyReport(); ReportSurvey RS = new ReportSurvey("6E2"); SR.AddSurvey(RS); Assert.IsTrue(SR.Surveys[0].ID == 1); Assert.IsTrue(SR.Surveys[0].Primary); Assert.IsTrue(SR.Surveys[0].Qnum); }
/// <summary> /// /// </summary> public SurveyReportForm() { InitializeComponent(); // add arrow symbol to add/remove buttons cmdAddSurvey.Text = char.ConvertFromUtf32(0x2192); cmdRemoveSurvey.Text = char.ConvertFromUtf32(0x2190); // start with blank constructor, default settings SR = new SurveyBasedReport(); UP = new UserPrefs(); questionFilters = new ReportSurvey(); }
private void DoCompareReport(ReportSurvey s1, ReportSurvey s2, string filename, bool hideIdentical) { SurveyReport SR = new SurveyReport(); SR.FileName = "\\\\psychfile\\psych$\\psych-lab-gfong\\SMG\\Access\\Reports\\ISR\\"; string customFileName = filename; SR.AddSurvey(s1); SR.AddSurvey(s2); SR.ShowQuestion = false; SR.SurveyCompare.HideIdenticalQuestions = hideIdentical; SR.SurveyCompare.ReInsertDeletions = true; SR.GenerateReport(); SR.OutputReportTableXML(customFileName); }
public ComparisonTests() { primary = new ReportSurvey("TT1"); SurveyQuestion sq1 = new SurveyQuestion("BI100", "001"); SurveyQuestion sq2 = new SurveyQuestion("BI101", "002"); primary.AddQuestion(sq1); primary.AddQuestion(sq2); other = new ReportSurvey("TT2"); other.AddQuestion(sq1); other.AddQuestion(sq2); comparer = new Comparison(primary, other); }
// add 3 surveys, then remove the first added survey. The 2nd of the remaining surveys should be primary public void SurveyReportAdd3CurrentSurveysRemove2() { SurveyReport SR = new SurveyReport(); ReportSurvey RS = new ReportSurvey("6E2"); ReportSurvey RS2 = new ReportSurvey("6E1"); ReportSurvey RS3 = new ReportSurvey("6E2.5-ES"); SR.AddSurvey(RS); SR.AddSurvey(RS2); SR.AddSurvey(RS3); SR.RemoveSurvey(RS); Assert.IsTrue(SR.Surveys[0].ID == 1); Assert.IsFalse(SR.Surveys[0].Primary); Assert.IsTrue(SR.Surveys[1].Primary); Assert.IsTrue(SR.Surveys[0].Qnum); }
private void Generate_Click(object sender, EventArgs e) { if (lstSurveys.SelectedItems.Count == 0) { MessageBox.Show("Select at least one survey."); return; } // check field info is complete for (int i = 0; i < lstSurveys.SelectedItems.Count; i++) { ReportSurvey s = (ReportSurvey)DBAction.GetSurveyInfo(lstSurveys.GetItemText(lstSurveys.SelectedItems[i])); DBAction.FillQuestions(s); SR.CreateSyntax(s, SyntaxFormat.EpiData); } }
private void cmdGenerate_Click(object sender, EventArgs e) { SurveyReport SO = new SurveyReport(); ReportSurvey source = new ReportSurvey(DBAction.GetSurveyInfo(cboSurvey.GetItemText(cboSurvey.SelectedItem))); SO.Surveys.Add(source); SO.Surveys[0].Qnum = true; foreach (ReportSurvey rs in SO.Surveys) { rs.VarLabelCol = true; rs.TopicLabelCol = true; rs.ContentLabelCol = true; } SO.ShowAllQnums = true; SO.ShowAllVarNames = true; SO.ShowQuestion = false; SO.GenerateReport(); }
private void UpdatePrimarySurveyGrid() { // populate the primary survey list chklstPrimarySurvey.Items.Clear(); chklstPrimarySurvey.Items.AddRange(SR.Surveys.ToArray()); // check off the primary survey for (int i = 0; i < chklstPrimarySurvey.Items.Count; i++) { ReportSurvey r = (ReportSurvey)chklstPrimarySurvey.Items[i]; if (r.Primary) { chklstPrimarySurvey.SetItemChecked(i, true); chklstPrimarySurvey.SelectedItem = chklstPrimarySurvey.Items[i]; } else { chklstPrimarySurvey.SetItemChecked(i, false); } } }
private void AddSurvey_Click(object sender, EventArgs e) { // add survey to the SurveyReport object ReportSurvey s; try { s = new ReportSurvey(DBAction.GetSurveyInfo(cboSurveys.SelectedItem.ToString())); } catch (Exception) { MessageBox.Show("Survey not found."); return; } if (cboSurveys.SelectedIndex < cboSurveys.Items.Count - 1) { cboSurveys.SelectedIndex++; } AddSurvey(s); }
/// <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(); }
public void SingleSurveySingleQuestionReportTable() { SurveyReport SR = new SurveyReport(); ReportSurvey s = new ReportSurvey("Test"); SR.AddSurvey(s); SurveyQuestion sq = new SurveyQuestion(); sq.VarName.FullVarName = "AA000"; sq.Qnum = "000"; sq.PreP = "Test PreP"; sq.LitQ = "Test LitQ"; sq.RespOptions = "1 Yes"; s.AddQuestion(sq); int result = SR.GenerateReport(); Assert.IsTrue(result == 0); Assert.IsTrue(SR.ReportTable.Rows.Count == 1); }
private void SelfCompare_Click(object sender, EventArgs e) { // add another survey with the already selected survey code ReportSurvey s; Survey item = lstSelectedSurveys.SelectedItem as Survey; try { s = new ReportSurvey(DBAction.GetSurveyInfo(item.SurveyCode)); s.Backend = DateTime.Today.AddDays(-1); } catch (Exception) { MessageBox.Show("Survey not found."); return; } AddSurvey(s); // select the added survey and set focus to calendar lstSelectedSurveys.SelectedIndex = lstSelectedSurveys.Items.Count - 1; dateBackend.Focus(); }
public TranslationOptionsForm(ReportSurvey s) { CurrentSurvey = s; InitializeComponent(); }
public ReportSurveyTests_RemoveRepeats() { survey = new ReportSurvey("TS1"); wording = "test"; wording2 = "testing"; }
public WordingOptionsForm(ReportSurvey s) { CurrentSurvey = s; InitializeComponent(); }
public LabelOptionsForm(ReportSurvey s) { CurrentSurvey = s; InitializeComponent(); }