Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
        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;
            }
        }
Ejemplo n.º 3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     var tc = new BLL.TestComponents();
     var Tests = tc.GetTests();
     RepeaterTests.DataSource = Tests;
     DataBind();
 }
Ejemplo n.º 4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     var tc = new BLL.TestComponents();
     Tests = tc.GetTests();
     RepeaterTests.DataSource = Tests;
     if (Tests.Count == 0)
         NullText.Visible = true;
     else NullText.Visible = false;
     DataBind();
 }
Ejemplo n.º 5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     var bll = new BLL.UserComponents();
     var user = bll.GetUser(Session["UserLogin"].ToString());
     if (user != null)
     {
         var bllt = new BLL.TestComponents();
         RepeaterTests.DataSource = bllt.GetTests(user.Login);
         DataBind();
     }
 }
Ejemplo n.º 6
0
 protected void Find_Click(object sender, EventArgs e)
 {
     var lst = new List<Entities.Test>();
     var test = new BLL.TestComponents().FindTest(SearchText.Text);
     if (test != null)
         lst.AddRange(test);
     RepeaterTests.DataSource = lst;
     if (lst.Count == 0)
         NullText.Visible = true;
     else NullText.Visible = false;
     DataBind();
 }
Ejemplo n.º 7
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();
        }
Ejemplo n.º 8
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;
         }
     }
 }