Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var bll = new BLL.UserComponents();
            var user = bll.GetUser(Session["UserLogin"].ToString());
            var blls = new BLL.StatisticComponents();
            var bllt = new BLL.TestComponents();
            var stats =  blls.GetTestStatistic(user);

            foreach (var stat in stats)
            {
                var test = bllt.FindTest(stat.TestName).First();
                TestNames.Add(new Tuple<string, int, int>(stat.TestName, stat.CorrectQuestions.Count, test.Questions.Count));
            }

            RepeaterStats.DataSource = TestNames;
            if (TestNames.Count == 0)
                NullText.Visible = true;
            else NullText.Visible = false;
            DataBind();
        }
Пример #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     TestName = Request["name"];
     if (TestName != "")
     {
         if (!IsPostBack)
         {
             stat = new Entities.Statistic();
             if (Session["UserLogin"] != null)
                 stat.UserId = new BLL.UserComponents().GetUser(Session["UserLogin"].ToString()).ID;
             var bll = new BLL.TestComponents();
             test = bll.FindTest(TestName).First();
             if (test == null)
             {
                 Response.Redirect("Default.aspx");
             }
             stat.TestName = test.Name;
             Session["qNumber"] = test.Questions.Count - 1;
             if (test.Questions.Count == 0)
                 Response.Redirect("Default.aspx");
             CurrQuestion = test.Questions[(int)Session["qNumber"]].Text;
             List<string> answers = new List<string>();
             TrueCount = 0;
             foreach (var ans in test.Questions[(int)Session["qNumber"]].Answers)
             {
                 answers.Add(ans.Text);
                 if (ans.IsTrue == true)
                 {
                     TrueCount++;
                 }
             }
             if (TrueCount > 1)
                 CheckAnswerList.DataSource = answers;
             else RadioAnswerList.DataSource = answers;
             DataBind();
             Session["TestStartTime"] = DateTime.Now;
         }
     }
 }