/// <summary> /// /// </summary> /// <param name="primaryWording"></param> /// <param name="otherWording"></param> /// <returns></returns> public string CompareWordings(string primaryWording, string otherWording) { if (IsWordingEqual(primaryWording, otherWording, true, IgnoreSimilarWords)) { if (HideIdenticalWordings) { otherWording = ""; } } else { if (otherWording.Equals("") && ShowDeletedFields) { otherWording = "[s][t]" + primaryWording + "[/t][/s]"; } else if (primaryWording.Equals("")) { otherWording = "[yellow]" + otherWording + "[/yellow]"; } else { if (HybridHighlight) { otherWording = "[brightgreen]" + ChangeHighlighter.HighlightChanges(primaryWording, otherWording, CompareType.ByWords) + "[/brightgreen]"; } else { otherWording = "[brightgreen]" + otherWording + "[/brightgreen]"; } } } return(otherWording); }
/// <summary> /// For any common rows, compare the wordings and color them if they are different or missing. /// </summary> private void ProcessCommonQuestions() { Intersection = OtherSurvey.Questions.Intersect(PrimarySurvey.Questions, new SurveyQuestionComparer()).ToList(); SurveyQuestion found; 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 (HighlightStyle == HStyle.Classic) { sq.PreP = CompareWordings(found.PreP, sq.PreP); sq.PreI = CompareWordings(found.PreI, sq.PreI); sq.PreA = CompareWordings(found.PreA, sq.PreA); sq.LitQ = CompareWordings(found.LitQ, sq.LitQ); sq.PstI = CompareWordings(found.PstI, sq.PstI); sq.PstP = CompareWordings(found.PstP, sq.PstP); sq.RespOptions = CompareWordings(found.RespOptions, sq.RespOptions); if (HighlightNR) { sq.NRCodes = CompareWordings(found.NRCodes, sq.NRCodes); } } else { sq.PreP = ChangeHighlighter.HighlightChanges(found.PreP, sq.PreP, CompareType.ByWords); sq.PreI = ChangeHighlighter.HighlightChanges(found.PreI, sq.PreI, CompareType.ByWords); sq.PreA = ChangeHighlighter.HighlightChanges(found.PreA, sq.PreA, CompareType.ByWords); sq.LitQ = ChangeHighlighter.HighlightChanges(found.LitQ, sq.LitQ, CompareType.ByWords); sq.PstI = ChangeHighlighter.HighlightChanges(found.PstI, sq.PstI, CompareType.ByWords); sq.PstP = ChangeHighlighter.HighlightChanges(found.PstP, sq.PstP, CompareType.ByWords); sq.RespOptions = ChangeHighlighter.HighlightChanges(found.RespOptions, sq.RespOptions, CompareType.ByWords); if (HighlightNR) { sq.NRCodes = ChangeHighlighter.HighlightChanges(found.NRCodes, sq.NRCodes, CompareType.ByWords); } } } }