private void AddDetailContext(TemplateContext context, SurveyDetail detail, SurveyComponent component)
 {
     context.SetValue(new ScriptVariableGlobal(detail.GetType().Name), detail);
     context.SetValue(new ScriptVariableGlobal(component.GetType().Name), component);
     if (detail.IsQuestion == true)
     {
         var question = GetQuestion(detail.AttributeID);
         context.SetValue(new ScriptVariableGlobal(question.GetType().Name), question);
     }
 }
        private void FillPageInfo(TemplateContext context, IEnumerable <SurveyDetail> details, SurveyDetail selectedPage)
        {
            var nbPages = details.Select(det => det.PageNbr).Distinct().Count();
            var min     = details.Min(det => det.PageNbr);
            var max     = details.Max(det => det.PageNbr);
            var current = selectedPage.PageNbr;

            context.SetValue(new ScriptVariableGlobal(CURRENT_PAGE_NBR), current);
            context.SetValue(new ScriptVariableGlobal(FIRST_PAGE_NBR), min);
            context.SetValue(new ScriptVariableGlobal(LAST_PAGE_NBR), max);
            context.SetValue(new ScriptVariableGlobal(NB_PAGES), nbPages);
            context.SetValue(new ScriptVariableGlobal(IS_FIRST_PAGE), current == min);
            context.SetValue(new ScriptVariableGlobal(IS_LAST_PAGE), current == max);
        }