コード例 #1
0
ファイル: UserStatistic.aspx.cs プロジェクト: Lesssnik/Labs
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["UserLogin"] == null || Session["UserLogin"].ToString().CompareTo("Admin") != 0)
            {
                Response.Redirect("Default.aspx");
            }

            var user = new BLL.UserComponents().GetUser(Request["user"]);
            var tempstat = new BLL.StatisticComponents().GetTestStatistic(user);

            foreach (var st in tempstat)
            {
                var test = new BLL.TestComponents().FindTest(st.TestName).First();
                stats.Add(new Tuple<string, List<Tuple<string, string>>>(test.Name, new List<Tuple<string, string>>()));
                foreach (var q in test.Questions)
                {
                    var temp = st.CorrectQuestions.Where(s => s.Correct == q.Text);
                    if (temp.Count() > 0)
                        stats[stats.Count-1].Item2.Add(new Tuple<string, string>(q.Text, "Верно"));
                    else stats[stats.Count-1].Item2.Add(new Tuple<string, string>(q.Text, "Неверно"));
                }
            }
            RepeaterStats.DataSource = stats;
            if (stats.Count == 0)
                NullText.Visible = true;
            else NullText.Visible = false;
            DataBind();
        }
コード例 #2
0
ファイル: Result.aspx.cs プロジェクト: Lesssnik/Labs
        protected void Page_Load(object sender, EventArgs e)
        {
            var bll = new BLL.UserComponents();
            var user = new Entities.User();
            if (Session["UserLogin"] != null)
                user = bll.GetUser(Session["UserLogin"].ToString());
            var test = new BLL.TestComponents().FindTest(Guid.Parse(Request["test"]));
            var blls = new BLL.StatisticComponents();
            var guid = Guid.Parse(Request["stat"]);
            var stat = new BLL.StatisticComponents().GetTestStatistics().Where(s => s.ID.CompareTo(guid) == 0).First();

            foreach (var q in test.Questions)
            {
                var temp = stat.CorrectQuestions.Where(s => s.Correct == q.Text);
                if (temp.Count() > 0)
                    stats.Add(new Tuple<string, string>(q.Text, "Верно"));
                else stats.Add(new Tuple<string, string>(q.Text, "Неверно"));
            }

            RepeaterStats.DataSource = stats;
            DataBind();

            if (Session["IsTrue"] != null)
            {
                blls.DeleteStatistic(stat);
                Session["IsTrue"] = null;
            }
        }
コード例 #3
0
ファイル: MyStatistic.aspx.cs プロジェクト: Lesssnik/Labs
        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();
        }