/// <summary> /// Removes any questions that are exactly the same in both English and Translation. /// </summary> private void ProcessExactMatches() { // for every refVarName shared by the 2 surveys, compare wordings Intersection = OtherSurvey.Questions.Intersect(PrimarySurvey.Questions, new SurveyQuestionComparer()).ToList(); SurveyQuestion found; // the same question in the primary survey foreach (SurveyQuestion sq in Intersection) { found = PrimarySurvey.Questions.Single(x => x.VarName.RefVarName.ToLower().Equals(sq.VarName.RefVarName.ToLower())); // find the question in the primary survey if (AreIdenticalQuestions(sq, found)) { OtherSurvey.RemoveQuestion(sq); PrimarySurvey.RemoveQuestion(found); } } }
/// <summary> /// For any row that only appears in the primary survey, we need to either move it to the end of the survey, or re-insert it into its original position. /// </summary> private void ProcessPrimaryOnlyQuestions() { // for every refVarName in primary only, add to Qnum survey and highlight blue PrimeOnly = PrimarySurvey.Questions.Except(OtherSurvey.Questions, new SurveyQuestionComparer()).ToList(); SurveyQuestion toAdd; string highlightStart; string highlightEnd; if (HighlightStyle == HStyle.Classic) { highlightStart = "[s][t]"; highlightEnd = "[/t][/s]"; } else { highlightStart = "[pinkfill]<Font Color=Red>"; highlightEnd = "</Font>"; } // if the primary survey is not the qnum survey, then the primary only questions need to be added to the Qnum survey and highlighted/struckout if (!PrimarySurvey.Qnum) { foreach (SurveyQuestion sq in PrimeOnly) { toAdd = sq.Copy(); // highlight based on scheme if (HighlightScheme == HScheme.Sequential) { // toAdd.Qnum = "[s][t]" + toAdd.Qnum + "[/t][/s]"; toAdd.VarName.FullVarName = highlightStart + toAdd.VarName.FullVarName + highlightEnd; } else if (HighlightScheme == HScheme.AcrossCountry) { toAdd.VarName.FullVarName = highlightStart + toAdd.VarName.FullVarName + highlightEnd; //toAdd.Qnum = "[s][t]" + toAdd.Qnum + "[/t][/s]"; } // re-inserted questions are highlighted/struckout and renumbered, otherwise they are put at the bottom (Qnum starts with z) if (ReInsertDeletions) { if (!string.IsNullOrEmpty(toAdd.PreP)) { toAdd.PreP = highlightStart + toAdd.PreP + highlightEnd; } if (!string.IsNullOrEmpty(toAdd.PreI)) { toAdd.PreI = highlightStart + toAdd.PreI + highlightEnd; } if (!string.IsNullOrEmpty(toAdd.PreA)) { toAdd.PreA = highlightStart + toAdd.PreA + highlightEnd; } if (!string.IsNullOrEmpty(toAdd.LitQ)) { toAdd.LitQ = highlightStart + toAdd.LitQ + highlightEnd; } if (!string.IsNullOrEmpty(toAdd.PstI)) { toAdd.PstI = highlightStart + toAdd.PstI + highlightEnd; } if (!string.IsNullOrEmpty(toAdd.PstP)) { toAdd.PstP = highlightStart + toAdd.PstP + highlightEnd; } if (!string.IsNullOrEmpty(toAdd.RespOptions)) { toAdd.RespOptions = highlightStart + toAdd.RespOptions + highlightEnd; } if (!string.IsNullOrEmpty(toAdd.NRCodes)) { toAdd.NRCodes = highlightStart + toAdd.NRCodes + highlightEnd; } RenumberDeletion(toAdd, PrimarySurvey, OtherSurvey); OtherSurvey.AddQuestion(toAdd); } else { //toAdd.Qnum = "z" + toAdd.Qnum; sq.Qnum = "z" + sq.Qnum; } } } else { } }