Ejemplo n.º 1
0
        public void UpdateAnswers(KnowledgeAnswer answer)
        {
            if (Session["CorrectTracker"] != null)
            {
                List <KnowledgeAnswer> answers = (List <KnowledgeAnswer>)Session["CorrectTracker"];

                if (answers.Where(i => i.ID == answer.ID).Count() == 0)
                {
                    answers.Add(answer);
                    Session["CorrectTracker"] = answers;
                    if (answer.Result)
                    {
                        UpdateScore(1);
                    }
                }
            }
            else
            {
                List <KnowledgeAnswer> answers = new List <KnowledgeAnswer>();
                answers.Add(answer);
                Session["CorrectTracker"] = answers;
                if (answer.Result)
                {
                    UpdateScore(1);
                }
            }
        }
Ejemplo n.º 2
0
        protected void rptCorrectAnswers_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.IsItem())
            {
                HtmlGenericControl spanResult = e.FindControlAs <HtmlGenericControl>("spanResult");

                KnowledgeAnswer answer = (KnowledgeAnswer)e.Item.DataItem;

                if (spanResult != null)
                {
                    if (answer.Result)
                    {
                        spanResult.Attributes.Add("class", "results-indicator correct");
                    }
                    else
                    {
                        spanResult.Attributes.Add("class", "results-indicator incorrect");
                    }
                }
            }
        }
        public void UpdateAnswers(KnowledgeAnswer answer)
        {
            if (Session["CorrectTracker"] != null)
            {
                List<KnowledgeAnswer> answers = (List<KnowledgeAnswer>)Session["CorrectTracker"];

                if (answers.Where(i => i.ID == answer.ID).Count() == 0)
                {
                    answers.Add(answer);
                    Session["CorrectTracker"] = answers;
                    if (answer.Result)
                        UpdateScore(1);
                }
            }
            else
            {
                List<KnowledgeAnswer> answers = new List<KnowledgeAnswer>();
                answers.Add(answer);
                Session["CorrectTracker"] = answers;
                if (answer.Result)
                    UpdateScore(1);
            }
        }