Esempio n. 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     UserName                 = Request.QueryString["name"];
     UserId                   = Request.QueryString["id"];
     user                     = new CalculateOnlineJudge.Entity.User(Convert.ToInt32(UserId), UserName);
     Label1_Menu.Text         = "当前用户: " + UserName;
     Response.Expires         = 0;
     Response.Buffer          = true;
     Response.ExpiresAbsolute = DateTime.Now.AddSeconds(-1);
     Response.AddHeader("pragma", "no-cache");
     Response.CacheControl = "no-cache";
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            username = Request.QueryString["username"];
            id       = Request.QueryString["id"];
            Debug.WriteLine(username);
            Debug.WriteLine(id);
            user = new CalculateOnlineJudge.Entity.User(Convert.ToInt32(id), username);
            OperationResult <JudgeInfo> judgeInfoOR = JudgeInfoLogic.GetJudgeInfo(user);
            JudgeInfo judgeInfo = judgeInfoOR.Result;

            Label1.Text = "总答题数" + judgeInfo.QuestionNum.ToString();
            Label2.Text = "错题数" + judgeInfo.QuestionErrorNum.ToString();
            Label3.Text = "正确率" + judgeInfo.CorrectRate.ToString();
            Label4.Text = "错误率" + judgeInfo.ErrorRate.ToString();
            Label5.Text = "最后答题时间\n" + judgeInfo.LastestCompleteTime.ToString();
        }
Esempio n. 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string username = Request.QueryString["username"];
            string id       = Request.QueryString["id"];

            Debug.WriteLine(username);
            Debug.WriteLine(id);
            user       = new CalculateOnlineJudge.Entity.User(Convert.ToInt32(id), username);
            userinfoOR = UserInfoLogic.GetUserInfo(user);
            Debug.WriteLine(userinfoOR.Prompt);
            if (!IsPostBack)
            {
                if (userinfoOR.Result.Phone != null)
                {
                    newphone.Text = userinfoOR.Result.Phone;
                }
                else
                {
                    newphone.Text = null;
                }
                if (userinfoOR.Result.Email != null)
                {
                    newemail.Text = userinfoOR.Result.Email;
                }
                else
                {
                    newemail.Text = null;
                }
                lastphone            = userinfoOR.Result.Phone;
                lastemail            = userinfoOR.Result.Email;
                Session["LastPhone"] = lastphone;
                Session["LastEmail"] = lastemail;
                Debug.WriteLine("加载页面");
                Debug.WriteLine("getphone=" + userinfoOR.Result.Phone);
                Debug.WriteLine("getemail=" + userinfoOR.Result.Email);
            }
        }
Esempio n. 4
0
        protected void Submit_Prac(object sender, EventArgs e)
        {
            //if (!IsPostBack)
            {
                Debug.WriteLine("Submit_Prac_Start");
                TextBox txt;
                //HtmlGenericControl p = new HtmlGenericControl("p");

                ExerciseResult ExerciseResult = new ExerciseResult()
                {
                    ExerciseResultUnit = new ExerciseResultUnit[num]
                };

                for (int i = 0; i < num; i++)
                {
                    txt = exercise_frame.FindControl("result" + i.ToString()) as TextBox;
                    ExerciseResult.ExerciseResultUnit[i].Remainder = 0;
                    if (Regex.IsMatch(txt.Text, @"^[_0-9]{1,20}$"))
                    {
                        ExerciseResult.ExerciseResultUnit[i].Result = Convert.ToInt32(txt.Text);
                    }
                    else
                    {
                        ExerciseResult.ExerciseResultUnit[i].Result = -1;
                    }
                }

                if (Type == "D")
                {
                    for (int i = 0; i < num; i++)
                    {
                        txt = exercise_frame.FindControl("remainder" + i.ToString()) as TextBox;
                        if (Regex.IsMatch(txt.Text, @"^[_0-9]{1,20}$"))
                        {
                            ExerciseResult.ExerciseResultUnit[i].Remainder = Convert.ToInt32(txt.Text);
                        }
                        else
                        {
                            ExerciseResult.ExerciseResultUnit[i].Remainder = -1;
                        }
                    }
                }
                CalculateOnlineJudge.Entity.User user = new CalculateOnlineJudge.Entity.User(Convert.ToInt32(UserId), Username);
                var judgeResult = ExerciseLogic.JudgeExercise(ExerciseOR.Result, ExerciseResult, user);
                if (judgeResult.IsSuccess)
                {
                    Label2.Text = judgeResult.Prompt;
                    for (int i = 0; i < num; i++)
                    {
                        Label jdglabel;
                        jdglabel      = exercise_frame.FindControl("dynalabel" + i.ToString()) as Label;
                        jdglabel.Text = "√";
                    }
                    for (int i = 0; i < judgeResult.Result.ErrorExerciseIndex.Length; i++)
                    {
                        Label jdglabel;
                        jdglabel      = exercise_frame.FindControl("dynalabel" + judgeResult.Result.ErrorExerciseIndex[i].ToString()) as Label;
                        jdglabel.Text = "×";
                    }


                    //Label3.Text = judgeResult.Result.TotalNum.ToString();
                    Label4.Text = "共答对: " + (judgeResult.Result.TotalNum - judgeResult.Result.ErrorNum).ToString() + "题";
                }
                else
                {
                    MessaegBox("结果异常异常");
                }
                Button1_Practice.Visible = false;
            }
        }