예제 #1
0
        public static void Main(string[] args)
        {
            Console.WriteLine("输入创建用户名,例如:FREEstrikerABbo");
            //string userName = Console.ReadLine();
            string userName = "******";

            Console.WriteLine("输入创建密码,例如:1236zccg99326TEST");
            //string password = Console.ReadLine();
            string password = "******";

            Console.WriteLine(UserLogic.CreateUser(userName, password).Prompt);
            var userOR = UserLogic.LogInUser(userName, password);

            Console.WriteLine(userOR.Prompt);
            var userInfoOR = UserInfoLogic.GetUserInfo(userOR.Result);

            Console.WriteLine(userInfoOR.Prompt);
            var judgeInfoOR = JudgeInfoLogic.GetJudgeInfo(userOR.Result);

            Console.WriteLine(judgeInfoOR.Prompt);
            ExerciseOption exerciseOption = new ExerciseOption(IntervalType.LE10,
                                                               //OperationType.Plus |
                                                               //OperationType.Sub |
                                                               //OperationType.Mul |
                                                               //OperationType.Div |
                                                               OperationType.DivWithRemainder, QuantityType.E10);
            var exerciseOR = ExerciseLogic.GetExercise(exerciseOption);

            Console.WriteLine(exerciseOR.Prompt);
            for (int i = 0; i < exerciseOR.Result.ExerciseUnits.Length; i++)
            {
                Console.WriteLine(exerciseOR.Result.ExerciseUnits[i].Topic);
            }
            Console.WriteLine("输入答案:");
            ExerciseResult exerciseResult = new ExerciseResult()
            {
                ExerciseResultUnit = new ExerciseResultUnit[exerciseOR.Result.ExerciseUnits.Length]
            };

            for (int i = 0; i < exerciseOR.Result.ExerciseUnits.Length; i++)
            {
                exerciseResult.ExerciseResultUnit[i].Remainder = 0;
                exerciseResult.ExerciseResultUnit[i].Result    = Convert.ToInt32(Console.ReadLine());
            }
            var judgeResultOR = ExerciseLogic.JudgeExercise(exerciseOR.Result, exerciseResult, userOR.Result);

            Console.WriteLine(judgeResultOR.Prompt);
            userInfoOR = UserInfoLogic.GetUserInfo(userOR.Result);
            Console.WriteLine(userInfoOR.Prompt);
            judgeInfoOR = JudgeInfoLogic.GetJudgeInfo(userOR.Result);
            Console.WriteLine(judgeInfoOR.Prompt);
            Console.WriteLine(UserLogic.DeleteUser(userOR.Result).Prompt);
            Console.ReadKey();
        }
        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();
        }