Esempio n. 1
0
        internal static List <QuestionPage> GenerateQuestionPages(List <Question> questions, Inspection inspection, ISectionPage sectionPage)
        {
            List <QuestionPage> pages                 = new List <QuestionPage>();
            string           MasterQuestionText       = string.Empty;
            List <Reference> MasterQuestionReferences = new List <Reference>();
            int MasterQuestionNumber = -2;

            foreach (Question question in questions)
            {
                QuestionPage page = null;
                if (question.HasSubItems)
                {
                    MasterQuestionNumber     = question.Number;
                    MasterQuestionText       = question.Text.Trim();
                    MasterQuestionReferences = question.References;
                }
                else if (question.Number == MasterQuestionNumber)
                {
                    page = new QuestionPage(question, inspection, MasterQuestionText + "\n" + question.Text.Trim(), MasterQuestionReferences);
                }
                else
                {
                    page = new QuestionPage(question, inspection);
                }
                if (page != null)
                {
                    page.sectionPage = sectionPage;
                    pages.Add(page);
                }
            }
            return(pages);
        }
Esempio n. 2
0
 public Template1(QuestionPage questionOwner)
 {
     InitializeComponent();
     QuestionOwner           = questionOwner;
     Question                = new Question();
     AnswerList.SizeChanged += AnswerList_SizeChanged;
 }
Esempio n. 3
0
        public void AddQuestion(CreateQuestionBindingModel model)
        {
            var questionPage = this.GetQuestionPage(model.QuestionSlug);

            if (questionPage == null)
            {
                questionPage = new QuestionPage
                {
                    QuestionSlug = model.QuestionSlug,
                    Questions    = new List <Question>()
                };

                this.questions.InsertOne(questionPage);
                questionPage = this.GetQuestionPage(model.QuestionSlug);
            }

            var oldQuestions = questionPage.Questions;

            oldQuestions.Add(this.mapper.Map <Question>(model));

            this.questions.UpdateOne(
                p => p.QuestionSlug == questionPage.QuestionSlug,
                Builders <QuestionPage> .Update.Set(p => p.Questions, oldQuestions));

            var newQuestions = this.questions
                               .FindSync(p => p.QuestionSlug == model.QuestionSlug)
                               .First();
        }
        public void NewQuestion(IQuestion question, IModerator moderator)
        {
            var viewModel = _questionViewModelFactory.Create(moderator, question);

            var page = new QuestionPage {
                BindingContext = viewModel
            };

            _app.MainPage = page;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            LandingPage = Model.GetDecisionToolLandingPage();
            var questionPageId = Request.QueryString[Constants.QueryStrings.DecisionTool.QuestionId];

            if (!string.IsNullOrEmpty(questionPageId) && (QuestionPage = Sitecore.Context.Database.GetItem(questionPageId)) != null)
            {
                Answers = QuestionPage.GetAnswers().ToList();
                var rawIndAnswerHistory = Request.QueryString[Constants.QueryStrings.DecisionTool.IndicationAnswerHistory];
                var indAnswerHistory    = rawIndAnswerHistory != null?rawIndAnswerHistory.Split(',') : new string[]
                {
                };

                var answerModels = Answers
                                   .Select((a, i) => new
                {
                    IndicatorCount = indAnswerHistory.Count(iah => iah == i.ToString()),
                    AnswerText     = a.DisplayText.Rendered,
                    Abstract       = a.Abstract.Rendered
                })
                                   .OrderByDescending(am => am.IndicatorCount);
                rptrAnswers.DataSource = answerModels;
                rptrAnswers.DataBind();

                IndicatedAnswerAbstract = string.Empty;
                var maximumIndications = answerModels != null?answerModels.First().IndicatorCount : 0;

                if (maximumIndications > 0)
                {
                    IndicatedAnswerAbstract = string.Join(
                        @"<br/>",
                        answerModels
                        .TakeWhile(am => am.IndicatorCount == maximumIndications)
                        .Select(am => am.Abstract));
                }

                var questions = LandingPage.GetDecisionQuestionCategories()
                                .SelectMany(category => category.GetDecisionQuestions())
                                .OrderBy(question => Guid.NewGuid())
                                .Take(3);

                rptrQuestions.DataSource = questions;
                rptrQuestions.DataBind();
            }
            else
            {
                Response.Redirect(LandingPage.GetUrl());
            }
        }
Esempio n. 6
0
        public void SurveyQuestion1Test()
        {
            HomePage            homePage            = new HomePage(Driver);
            BaseApplicationPage baseApplicationPage = new BaseApplicationPage(Driver);
            SurveyPage          surveyPage          = new SurveyPage(Driver);
            QuestionPage        questionPage        = new QuestionPage(Driver);

            baseApplicationPage.GoFrankly();

            homePage.LoginWithDemoUser();

            surveyPage.VerifySuccesfulLogin();
            surveyPage.ClickOnFirstQuestion();
            questionPage.SlideGrowingSliderUp();
            questionPage.SubmitAnswer();
            surveyPage.VerifyThatQuestion1IsAnswered();
        }
Esempio n. 7
0
        internal static List <QuestionPage> GenerateQuestionPages(List <Question> questions, Inspection inspection, ISectionPage sectionPage)
        {
            List <QuestionPage> pages                 = new List <QuestionPage>();
            string           MasterQuestionText       = string.Empty;
            List <Reference> MasterQuestionReferences = new List <Reference>();
            int    MasterQuestionNumber               = -2;
            double bottomSpace;

            if (sectionPage.GetType() == typeof(SectionNoPartsPage))
            {
                bottomSpace = 30;
            }
            else
            {
                bottomSpace = 60;
            }
            foreach (Question question in questions)
            {
                QuestionPage page = null;
                if (question.HasSubItems)
                {
                    MasterQuestionNumber     = question.Number;
                    MasterQuestionText       = question.Text.Trim();
                    MasterQuestionReferences = question.References;
                }
                else if (question.Number == MasterQuestionNumber)
                {
                    page = new QuestionPage(question, inspection, bottomSpace, MasterQuestionText + "\n" + question.Text.Trim(), MasterQuestionReferences);
                }
                else
                {
                    page = new QuestionPage(question, inspection, bottomSpace);
                }
                if (page != null)
                {
                    page.sectionPage = sectionPage;
                    pages.Add(page);
                }
            }
            return(pages);
        }
Esempio n. 8
0
        private QuestionPage InitQuestionPage(Competition competition, int questionIdx)
        {
            var page        = new QuestionPage(competition, questionIdx);
            var isCompleted = false;

            page.Answered += answer =>
            {
                if (page.Answers.All(t => t.QuestionChoice != null))
                {
                    lock (page)
                    {
                        if (!isCompleted)
                        {
                            isCompleted = true;
                            OnCompetitionQuestionCompleted(competition, questionIdx, page.Answers.OrderBy(t => t.CompetitionParticipant.No).ToList());
                        }
                    }
                }
            };
            if (_settings.QuestionCountDown > 0)
            {
                page.TimeUp += () =>
                {
                    lock (page)
                    {
                        if (!isCompleted)
                        {
                            isCompleted = true;
                            OnCompetitionQuestionCompleted(competition, questionIdx, page.Answers.OrderBy(t => t.CompetitionParticipant.No).ToList());
                        }
                    }
                };
                page.StartCountDown(_settings.QuestionCountDown);
            }

            return(page);
        }
 protected void StartOver_Click(object sender, EventArgs e)
 {
     Response.Redirect(QuestionPage.GetStartUrl());
 }
Esempio n. 10
0
    public void Redaktor(object sender, RoutedEventArgs e)
    {
        QuestionPage quest = new QuestionPage(MW, StartWindow);

        StartWindow.Content = quest;
    }