public void DisplayAction(SurveyModel.Question q, Poll poll, Control container, List <QuestionWebControl> ctls)
 {
     if (poll.Meetings.Count == 0)
     {
         return;
     }
     container.Controls.Add(new LiteralControl(QuestionTypeActionFactory.QuestionMarkup(q)));
     foreach (var m in poll.Meetings)
     {
         container.Controls.Add(new LiteralControl($@"<span class=""sub-block-title"">
             Meeting from {m.date_start} to {m.date_end} 
             </span>"));
         foreach (var sq in q.SubQuestions)
         {
             var csq     = (SubQuestion)sq.Clone();
             var manager = new Manager();
             csq.Answer = manager.getAnswer(poll.Id, poll.TableMeetingName, csq.Category,
                                            QuestionTypeActionFactory.getActionByName(csq.Category).getAnswerComlunName(csq),
                                            poll.PersonId, m.id_meeting);
             csq.Activity = m;
             var qc = new QuestionWebControl(csq);
             ctls.Add(qc);
             container.Controls.Add(qc);
         }
     }
     container.Controls.Add(new LiteralControl("<br/>"));
 }
 public void DisplayAction(Question q, Poll poll, Control container, List <QuestionWebControl> ctls)
 {
     if (poll.Workshops.Count == 0)
     {
         return;
     }
     container.Controls.Add(new LiteralControl(QuestionTypeActionFactory.QuestionMarkup(q)));
     foreach (var m in poll.Workshops)
     {
         container.Controls.Add(new LiteralControl(QuestionTypeActionFactory.SubBlockTitleMarkup(m.theme)));
         foreach (var sq in q.SubQuestions)
         {
             var csq     = (SubQuestion)sq.Clone();
             var manager = new Manager();
             csq.Answer = manager.getAnswer(poll.Id, poll.TableWsName, csq.Category,
                                            QuestionTypeActionFactory.getActionByName(csq.Category).getAnswerComlunName(csq),
                                            poll.PersonId, m.id_atelier);
             csq.Activity = m;
             var qc = new QuestionWebControl(csq);
             ctls.Add(qc);
             container.Controls.Add(qc);
         }
     }
     container.Controls.Add(new LiteralControl("<br/>"));
 }
        public void DisplayAction(SurveyModel.Question q, Poll poll, Control container, List <QuestionWebControl> ctls)
        {
            var manager = new Manager();

            q.Answer = manager.getAnswer(poll.Id, poll.TableName, q.Category,
                                         QuestionTypeActionFactory.getActionByName(q.Category).getAnswerComlunName(q), poll.PersonId);
            var qc = new QuestionWebControl(q);

            ctls.Add(qc);
            container.Controls.Add(qc);
        }
예제 #4
0
        public static List <QuestionWebControl> RenderForm(Poll poll, Control questions, FormGenerationSettings settings)
        {
            var questionsList = new List <QuestionWebControl>();
            var blocks        = new Dictionary <int, BlockWebControl>();

            foreach (var blocksKey in poll.Blocks.Keys)
            {
                var block = new BlockWebControl(poll.Blocks[blocksKey]);
                questions.Controls.Add(block);
                blocks.Add(blocksKey, block);
            }
            foreach (var q in poll.Questions)
            {
                QuestionTypeActionFactory.getActionByName(q.Category)
                .DisplayAction(q, poll, blocks[q.BlockNumber], questionsList);
            }
            return(questionsList);
        }