コード例 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        performancereport.NavigateUrl = "PerformanceReport.aspx";
        if (PreviousPage != null && IsPostBack == false)
        {
            ArithmeticHelper.Evaluator ev = PreviousPage.evaluator;
            numberOfQuestions.Text  = ev.numberOfQuestions.ToString();
            attemptedQuestions.Text = ev.attemptedQuestions.ToString();
            correctQuestions.Text   = ev.correctAnswers.ToString();
            averageTime.Text        = ev.averageTime.ToString() + " sec ";
            percentage.Text         = (ev.percentageCorrect).ToString();

            if (Request.Cookies["StudentMode"] != null)
            {
                if (Request.Cookies["StudentMode"].Value == "Preview" || Request.Cookies["StudentMode"].Value == "Study")
                {
                    performancereport.Visible = false;
                }
                else
                {
                    subscribe.Visible      = false;
                    subscribelabel.Visible = false;
                }
                if (ev.attemptedQuestions != 0)
                {
                    try
                    {
                        new ArithmeticHelper.TableUpdater(ev).insertResult();
                    }
                    catch (SystemException)
                    {
                        Response.Redirect("Error.aspx");
                    }
                }
                else
                {
                    reportTitle.Text = " Quiz Cancelled ";
                }
            }
            else
            {
                Response.Redirect("EnableCookie.aspx");
            }
        }
        else
        {
            Response.Redirect("MainPage.aspx");
        }
    }
コード例 #2
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        if ((ArithmeticHelper.QuizPaper)Cache[userID] != null)
        {
            evaluatorProperty = new ArithmeticHelper.Evaluator((ArithmeticHelper.QuizPaper)Cache[userID]);
        }
        else
        {
            Cache.Remove(userID);
            Response.Redirect("Error.aspx");
        }

        if (Request.Cookies["StudentMode"] != null)
        {
            if (Request.Cookies["StudentMode"].Value == "Preview")
            {
                evaluatorProperty.userID = System.Configuration.ConfigurationManager.AppSettings["AnonymousUser"];
            }
            else
            {
                if (Request.Cookies["StudentId"] != null)
                {
                    evaluatorProperty.userID = Request.Cookies["StudentId"].Value;
                }
                else
                {
                    Response.Redirect("EnableCookie.aspx");
                }
            }
        }
        else
        {
            Response.Redirect("EnableCookie.aspx");
        }
        Cache.Remove(userID);
        Server.Transfer("Report.aspx");
    }