Esempio n. 1
0
        public ActionResult SetProblematics(string testletsId, string testletsStructId)
        {
            //string teacherId = _teacherService.GetTeacherId(testletsStructId, OriTeacherId);
            //var command = new SetProblematics(testletsId, teacherId);
            //var result = await ExecuteCommandAsync(command);
            //if (result.IsSuccess())
            //{
            //    return Json(ActionHandleResult.FromSuccess(message: "设置成功"), JsonRequestBehavior.AllowGet);
            //}
            //return Json(ActionHandleResult.FromFail(message: result.GetErrorMessage()), JsonRequestBehavior.AllowGet);


            TeacherCheck teacherCheck = new TeacherCheck()
            {
                TeacherId   = TeacherId,
                CheckType   = CheckTypes.Doubt,
                TeacherInfo = TeacherInfo,
                Score       = new Dictionary <string, double>()
            };



            AnswerCheck answerCheck = OnlineCheckManager.Instance.AnswerSheets.SelectMany(s => s.AnswerChecks)
                                      .SingleOrDefault(s => s.AnswerCheckId == testletsId);


            answerCheck.TeacherCheckManagerx.UpdateTeacherChecks(teacherCheck);



            return(Json(ActionHandleResult.FromSuccess(message: "设置成功"), JsonRequestBehavior.AllowGet));
        }
Esempio n. 2
0
        public async Task <ActionResult> ReviewProblematics(ReviewViewModel reviewViewModel)
        {
            //string teacherId = _teacherService.GetTeacherId(model.TestletsId, Teacher.OriTeacherId);
            //var reviewScorePointList = model.ReviewScores.Select(reviewScore =>
            //    new ReviewScorePointDto(
            //        reviewScore.ScorePointStructId,
            //        reviewScore.Score)).ToList();
            //var command = new ReviewProblematics(model.TestletsId, teacherId, reviewScorePointList);
            //var result = await ExecuteCommandAsync(command);
            //if (result.IsSuccess())
            //{
            //    return Json(ActionHandleResult.FromSuccess(message: "问题卷评阅成功"));
            //}
            //return Json(ActionHandleResult.FromFail(message: result.GetErrorMessage()));



            TeacherCheck teacherCheck = new TeacherCheck()
            {
                TeacherId   = TeacherId,
                CheckType   = CheckTypes.SolveDoubt,
                TeacherInfo = TeacherInfo,
                Score       = reviewViewModel.Score
            };

            AnswerCheck answerCheck = OnlineCheckManager.Instance.AnswerSheets.SelectMany(s => s.AnswerChecks)
                                      .SingleOrDefault(s => s.AnswerCheckId == reviewViewModel.AnswerCheckId);

            answerCheck.TeacherCheckManagerx.SetFinalScoreForDoubt(teacherCheck);


            return(Json(ActionHandleResult.FromSuccess(message: "评阅成功")));
        }
Esempio n. 3
0
        /// <summary>
        /// 获取题目
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Get_Click(object sender, RoutedEventArgs e)
        {
            AnswerSheet answerSheet = OnlineCheckManager.Instance.AnswerSheets.FirstOrDefault(
                s => s.AnswerChecks.Any(a => a.QuestionGroupId == QuestionGroupId && a.TeacherCheckManagerx.IsGet(TeacherId)));

            if (answerSheet == null)
            {
                MessageBox.Show("木有了"); return;
            }

            AnswerCheck answerCheck = answerSheet.AnswerChecks.SingleOrDefault(s => s.QuestionGroupId == QuestionGroupId);

            answerCheck.TeacherCheckManagerx.AddTeacherChecks(new TeacherCheck()
            {
                TeacherId = TeacherId,
            });

            AnswerCheckLabel.Content = answerCheck.AnswerCheckId;

            FirstContentLabel.Content = answerCheck.Answers[0].AnswerId;

            SecondContentLabel.Content = answerCheck.Answers[1].AnswerId;

            FirstScoreText.Text  = "";
            SecondScoreText.Text = "";
        }
Esempio n. 4
0
        public ActionResult CallBackReview(ReviewViewModel reviewViewModel)
        {
            TeacherCheck teacherCheck = new TeacherCheck()
            {
                TeacherId = TeacherId,
                Score     = reviewViewModel.Score
            };


            AnswerCheck answerCheck = OnlineCheckManager.Instance.AnswerSheets.SelectMany(s => s.AnswerChecks)
                                      .SingleOrDefault(s => s.AnswerCheckId == reviewViewModel.AnswerCheckId);

            answerCheck.TeacherCheckManagerx.UpdateTeacherChecks(teacherCheck);


            OnlineCheckManager.Instance.QuestionGroups.SingleOrDefault(s => s.QuestionGroupId == reviewViewModel.QuestionGroupId).PressReviewManager.Press(teacherCheck.TeacherId, answerCheck.AnswerCheckId, teacherCheck.Score);



            return(Json(ActionHandleResult.FromSuccess(message: "回评成功")));

            //string teacherId = _teacherService.GetTeacherId(model.TestletsStructId, Teacher.OriTeacherId);
            //var reviewScorePointList = model.ReviewScores.Select(reviewScore =>
            //    new ReviewScorePointDto(
            //        reviewScore.ScorePointStructId,
            //        reviewScore.Score) {Id = reviewScore.Id}).ToList();
            //var command = new ReviewBackTestlets(model.TestletsId, model.ReviewId, teacherId, reviewScorePointList);
            //var result = await ExecuteCommandAsync(command);
            //if (result.IsSuccess())
            //{
            //    return Json(ActionHandleResult.FromSuccess(message: "回评成功"));
            //}
            //return Json(ActionHandleResult.FromFail(message: result.GetErrorMessage()), JsonRequestBehavior.AllowGet);
        }
Esempio n. 5
0
        private void Submit_Click(object sender, RoutedEventArgs e)
        {
            var score = new Dictionary <String, Double>();

            score.Add(AnswerId, Score);
            score.Add(AnswerId2, Score2);

            TeacherCheck teacherCheck = new TeacherCheck()
            {
                TeacherId = TeacherId,
                CheckType = CheckTypes.Arbitration,
                Score     = score
            };

            AnswerCheck answerCheck = OnlineCheckManager.Instance.AnswerSheets.SelectMany(s => s.AnswerChecks)
                                      .SingleOrDefault(s => s.AnswerCheckId == AnswerCheckId);

            answerCheck.TeacherCheckManagerx.UpdateTeacherChecks(teacherCheck, CheckTypes.Arbitration);
            answerCheck.TeacherCheckManagerx.PressReturn();

            //    QuestionGroup questionGroup =
            //OnlineCheckManager.Instance.QuestionGroups.SingleOrDefault(s => s.QuestionGroupId.ToString() == QuestionGroupId);

            //    Question question = questionGroup.Questions.SingleOrDefault(s => s.QuestionCheckId == QuestionCheckId);
            //    question.TeacherCheckManagerx.UpdateTeacherChecks(teacherCheck, CheckTypes.Arbitration);
            //    question.TeacherCheckManagerx.PressReturn();
        }
Esempio n. 6
0
        private void Submit_Click(object sender, RoutedEventArgs e)
        {
            //    TeacherCheck teacherCheck = new TeacherCheck()
            //    {
            //        TeacherId = TeacherId,
            //        CheckType = CheckTypes.Doubt,
            //        AnswerId = QuestionCheckId,
            //        Score = Score
            //    };


            //    QuestionGroup questionGroup =
            //OnlineCheckManager.Instance.QuestionGroups.SingleOrDefault(s => s.QuestionGroupId.ToString() == QuestionGroupId);

            //    Question question = questionGroup.Questions.SingleOrDefault(s => s.QuestionCheckId == QuestionCheckId);
            //    question.TeacherCheckManagerx.SetFinalScoreForDoubt(teacherCheck);
            var score = new Dictionary <String, Double>();

            score.Add(AnswerId, Score);
            score.Add(AnswerId2, Score2);

            TeacherCheck teacherCheck = new TeacherCheck()
            {
                TeacherId = TeacherId,
                CheckType = CheckTypes.SolveDoubt,
                Score     = score
            };

            AnswerCheck answerCheck = OnlineCheckManager.Instance.AnswerSheets.SelectMany(s => s.AnswerChecks)
                                      .SingleOrDefault(s => s.AnswerCheckId == AnswerCheckId);

            answerCheck.TeacherCheckManagerx.SetFinalScoreForDoubt(teacherCheck);
        }
Esempio n. 7
0
        public frmQuestion6i()
        {
            InitializeComponent();

            // Tell the system that this form has been used
            Globalvariables.CompletedQuestionsI [5] = true;
            Globalvariables.form += 1;

            // start timer
            UserTimer.Start();
            AnswerCheck.Start();
            lblTime.Text = "Timer  :  " + Convert.ToString(Globalvariables.timer); // This will make a smoother transition between forms.

            // This will check to see which character image the user has selected, and then display it within this form.
            switch (Globalvariables.Character)
            {
            case 1:
            {
                pictureCharacter.Image    = Properties.Resources.CharacterPlaceholder;      // Displays 1st image
                pictureCharacter.SizeMode = PictureBoxSizeMode.Zoom;
            }
            break;

            case 2:
            {
                pictureCharacter.Image    = Properties.Resources.CharacterPlaceholder2;      // 2nd image
                pictureCharacter.SizeMode = PictureBoxSizeMode.Zoom;
            }
            break;

            case 3:
            {
                pictureCharacter.Image    = Properties.Resources.NeilArmstrong;      // 3rd image
                pictureCharacter.SizeMode = PictureBoxSizeMode.Zoom;
            }
            break;

            case 4:
            {
                pictureCharacter.Image    = Properties.Resources.Predator2;      // 4th image
                pictureCharacter.SizeMode = PictureBoxSizeMode.Zoom;
            }
            break;
            }


            // Display player name
            lblPlayerName.Text = Globalvariables.username;

            // Display player score
            lblScore.Text = Convert.ToString(Globalvariables.points);
        }
Esempio n. 8
0
        public ActionResult PullTestlets(string id)
        {
            //string teacherId = _teacherService.GetTeacherId(id, OriTeacherId);
            //var result = Send(new GetTestlets()
            //{
            //    TeacherId = teacherId,
            //    TestletsStructId = id
            //});
            //if (result.GetHandleStatus()==HandleStatus.Success)
            //{
            //    var testlets = _sender.DecodeResponseMessage<TestletsInfo>(result.HandleResult.Body);
            //    if (testlets != null)
            //    {
            //        return Json(ActionHandleResult.FromSuccess(data: new
            //        {
            //            TestletsId = testlets.TestletsId,
            //            ImageUrl = testlets.ImageUrl
            //        }), JsonRequestBehavior.AllowGet);
            //    }
            //}
            //return Json(ActionHandleResult.FromFail(success: 1, message: "目前题组评阅状态已经完成,请等待继续"),
            //    JsonRequestBehavior.AllowGet);


            AnswerSheet answerSheet = OnlineCheckManager.Instance.AnswerSheets.FirstOrDefault(
                s =>
                s.AnswerChecks.Any(
                    a => a.QuestionGroupId == id && a.TeacherCheckManagerx.IsGet(TeacherId)));

            if (answerSheet == null)
            {
                return(Json(ActionHandleResult.FromFail(success: 1, message: "目前题组评阅状态已经完成,请等待继续"),
                            JsonRequestBehavior.AllowGet));
            }

            AnswerCheck answerCheck = answerSheet.AnswerChecks.SingleOrDefault(s => s.QuestionGroupId == id);

            answerCheck.TeacherCheckManagerx.AddTeacherChecks(new TeacherCheck()
            {
                TeacherId = TeacherId,
            });



            return(Json(ActionHandleResult.FromSuccess(data: new
            {
                TestletsId = answerCheck.AnswerCheckId,
                ImageUrl = answerCheck.CombinationedPicUrl
            }), JsonRequestBehavior.AllowGet));
        }
Esempio n. 9
0
        private void Get_Click(object sender, RoutedEventArgs e)
        {
            AnswerSheet answerSheet = OnlineCheckManager.Instance.AnswerSheets.FirstOrDefault(
                s => s.AnswerChecks.Any(a => a.QuestionGroupId == QuestionGroupId && a.TeacherCheckManagerx.IsArbitration && !a.TeacherCheckManagerx.IsAllFinish));

            if (answerSheet == null)
            {
                MessageBox.Show("木有了"); return;
            }

            AnswerCheck answerCheck = answerSheet.AnswerChecks.SingleOrDefault(s => s.QuestionGroupId == QuestionGroupId);

            answerCheck.TeacherCheckManagerx.AddTeacherChecks(new TeacherCheck()
            {
                TeacherId = TeacherId,
                CheckType = CheckTypes.Arbitration,
                Score     = new Dictionary <string, double>()
            });

            AnswerCheckLabel.Content = answerCheck.AnswerCheckId;

            FirstContentLabel.Content  = answerCheck.Answers[0].AnswerId;
            SecondContentLabel.Content = answerCheck.Answers[1].AnswerId;



            //Question question =
            //    OnlineCheckManager.Instance.QuestionGroups.SingleOrDefault(s => s.QuestionGroupId == QuestionGroupId)
            //        .SeleteArbitrationQuestion();

            //if (question == null)
            //{
            //    MessageBox.Show("this is over");
            //    return;
            //}

            //question.TeacherCheckManagerx.AddTeacherChecks(new TeacherCheck()
            //{
            //    TeacherId = TeacherId,
            //    AnswerId = question.QuestionCheckId,
            //    IsOver = false,
            //    CheckType = CheckTypes.Arbitration
            //});



            //QuestionCheckIdLabel.Content = question.QuestionCheckId;
        }
Esempio n. 10
0
        /// <summary>
        /// 设置问题卷
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SetQuestion_Click(object sender, RoutedEventArgs e)
        {
            TeacherCheck teacherCheck = new TeacherCheck()
            {
                TeacherId = TeacherId,
                CheckType = CheckTypes.Doubt,
                Score     = new Dictionary <string, double>()
            };



            AnswerCheck answerCheck = OnlineCheckManager.Instance.AnswerSheets.SelectMany(s => s.AnswerChecks)
                                      .SingleOrDefault(s => s.AnswerCheckId == AnswerCheckId);


            answerCheck.TeacherCheckManagerx.UpdateTeacherChecks(teacherCheck);
        }
Esempio n. 11
0
        public ActionResult Review(ReviewViewModel reviewViewModel)
        {
            //string teacherId = _teacherService.GetTeacherId(model.TestletsStructId, OriTeacherId);
            //var reviewScorePointList = model.ReviewScores.Select(reviewScore =>
            //    new ReviewScorePointDto(
            //        reviewScore.ScorePointStructId,
            //        reviewScore.Score)).ToList();
            //var command = new ReviewTestlets(model.TestletsId, teacherId, reviewScorePointList);
            //var result = await ExecuteCommandAsync(command);
            //if (result.IsSuccess())
            //{
            //    return Json(ActionHandleResult.FromSuccess(message: "评阅成功"));
            //}
            //if (result.GetErrorCode() == 1)
            //{
            //    return Json(ActionHandleResult.FromFail(success: 1, message: result.GetErrorMessage()));
            //}
            //return Json(ActionHandleResult.FromFail(message: result.GetErrorMessage()));



            TeacherCheck teacherCheck = new TeacherCheck()
            {
                TeacherId   = TeacherId,
                TeacherInfo = TeacherInfo,
                Score       = reviewViewModel.Score
            };



            AnswerCheck answerCheck = OnlineCheckManager.Instance.AnswerSheets.SelectMany(s => s.AnswerChecks)
                                      .SingleOrDefault(s => s.AnswerCheckId == reviewViewModel.AnswerCheckId);

            answerCheck.TeacherCheckManagerx.UpdateTeacherChecks(teacherCheck);


            OnlineCheckManager.Instance.QuestionGroups.SingleOrDefault(s => s.QuestionGroupId == reviewViewModel.QuestionGroupId).PressReviewManager.Enqueue(teacherCheck.TeacherId, new PressCheck()
            {
                Score         = teacherCheck.Score,
                AnswerCheckId = answerCheck.AnswerCheckId
            });


            return(Json(ActionHandleResult.FromSuccess(message: "评阅成功")));
        }
Esempio n. 12
0
        /// <summary>
        /// 打分
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Submit_Click(object sender, RoutedEventArgs e)
        {
            Boolean over = IsOver.IsChecked == true;

            var score = new Dictionary <String, Double>();

            score.Add(AnswerId, Score);
            score.Add(AnswerId2, Score2);


            TeacherCheck teacherCheck = new TeacherCheck()
            {
                TeacherId = TeacherId,
                Score     = score
            };



            AnswerCheck answerCheck = OnlineCheckManager.Instance.AnswerSheets.SelectMany(s => s.AnswerChecks)
                                      .SingleOrDefault(s => s.AnswerCheckId == AnswerCheckId);

            answerCheck.TeacherCheckManagerx.UpdateTeacherChecks(teacherCheck);


            Log.Items.Add(String.Format("{0} , {1}", TeacherId, answerCheck.AnswerCheckId));

            if (!over)
            {
                OnlineCheckManager.Instance.Enqueue(teacherCheck.TeacherId, new PressCheck()
                {
                    Score         = teacherCheck.Score,
                    AnswerCheckId = answerCheck.AnswerCheckId
                });
            }
            else
            {
                OnlineCheckManager.Instance.Press(teacherCheck.TeacherId, answerCheck.AnswerCheckId, teacherCheck.Score);
            }



            IsOver.IsChecked = false;
        }
Esempio n. 13
0
        public ActionResult QueryOnlyCallBack(string testletsStructId, string reviewId)
        {
            PressCheck pressCheck =
                OnlineCheckManager.Instance.QuestionGroups.SingleOrDefault(s => s.QuestionGroupId == testletsStructId)
                .PressReviewManager.PressReview[TeacherId].SingleOrDefault(s => s.Id == reviewId.ToString());

            AnswerCheck answerCheck = OnlineCheckManager.Instance.AnswerSheets.SelectMany(s => s.AnswerChecks)
                                      .SingleOrDefault(s => s.AnswerCheckId == pressCheck.AnswerCheckId);


            if (pressCheck != null)
            {
                var data = new
                {
                    TestletsId  = answerCheck.AnswerCheckId,
                    ReviewId    = pressCheck.Id,
                    ReviewDate  = pressCheck.CreateDateTime.ToString("hh:mm:ss"),
                    ReviewItems = pressCheck.Score,
                    ImageUrl    = answerCheck.CombinationedPicUrl
                };
                return(Json(ActionHandleResult.FromSuccess(message: "", data: data), JsonRequestBehavior.AllowGet));
            }


            //string teacherId = _teacherService.GetTeacherId(testletsStructId, OriTeacherId);
            //var review = _testletsReviewQueryService.QueryTestletsReviewDtos(new TestletsReviewQueryDto(teacherId)
            //{
            //    ReviewId = reviewId
            //}).FirstOrDefault();


            //if (review != null)
            //{
            //    //查询出题组下所有的评分点结构Id
            //    var scorePoints = _scorePointQueryService.QueryScorePointDtos(review.TestletsId).ToList();
            //    var testletsInfo =
            //        _testletsQueryService.QueryTestletsDtos(new TestletsQueryDto(testletsStructId, review.TestletsId))
            //            .FirstOrDefault();
            //    if (testletsInfo != null && scorePoints.Any())
            //    {
            //        var data = new
            //        {
            //            TestletsId = review.TestletsId,
            //            ReviewId = review.ReviewId,
            //            ReviewDate = review.ReviewDate.ToString("hh:mm:ss "),
            //            ReviewTeacherId = review.ReviewTeacherId,
            //            ReviewItems = review.Items.Select(x => new
            //            {
            //                Id=x.Id,
            //                ScorePointId=x.ScorePointId,
            //                Score=x.Score,
            //                ScorePointStructId=scorePoints.FirstOrDefault(y=>y.ScorePointId==x.ScorePointId).ScorePointStructId
            //            }),
            //            ImageUrl = testletsInfo.ImageUrl
            //        };
            //        return Json(ActionHandleResult.FromSuccess(message: "", data: data), JsonRequestBehavior.AllowGet);
            //    }
            //}
            //return Json(ActionHandleResult.FromSuccess(message: "题组或者评阅不存在"), JsonRequestBehavior.AllowGet);

            return(null);
        }
Esempio n. 14
0
 private void Search_Click(object sender, RoutedEventArgs e)
 {
     AnswerCheck answerCheck = OnlineCheckManager.Instance.AnswerSheets.SelectMany(s => s.AnswerChecks)
                               .SingleOrDefault(s => s.AnswerCheckId == AnswerChckIdText.Text);
 }
        static void Main(string[] args)
        {
            GetStudentsHelper.GetAllStudents();
            GetTeachersHelper.GetAllTeachers();
            bool check = true;

            while (check)
            {
                Console.WriteLine("Please log in.");

                int     teacherOrStudent = 0;
                int     timesTried       = 0;
                bool    isLogged         = false;
                Student loggedStudent    = null;
                while (isLogged == false && timesTried < 3)
                {
                    Console.Write("Username: "******"Password: "******"You are logged in as student: {student.Username}");
                                teacherOrStudent = 2;
                                loggedStudent    = student;
                                isLogged         = true;
                            }
                        }
                    }

                    foreach (var teacher in Teacher.AllTeachers)
                    {
                        if (userInput == teacher.Username)
                        {
                            if (passInput == teacher.Password)
                            {
                                Console.WriteLine($"You are logged in as teacher: {teacher.Username}");
                                teacherOrStudent = 1;
                                isLogged         = true;
                            }
                        }
                    }
                    timesTried++;

                    if (isLogged == false)
                    {
                        Console.WriteLine("Please enter valid username and password.");
                    }
                }

                switch (teacherOrStudent)
                {
                case 1:
                    foreach (var student in Student.AllStudents)
                    {
                        if (student.TookQuiz == true)
                        {
                            Console.ForegroundColor = ConsoleColor.Green;
                            Console.WriteLine(student.Username);
                            Console.ResetColor();
                        }
                        else
                        {
                            Console.ForegroundColor = ConsoleColor.Red;
                            Console.WriteLine(student.Username);
                            Console.ResetColor();
                        }
                    }
                    break;

                case 2:
                {
                    if (loggedStudent.TookQuiz)
                    {
                        Console.WriteLine("You already took the quiz!");
                        break;
                    }

                    int[] answers = new int[5];
                    Console.WriteLine("Please enter the number next to your answer after each question.");
                    Console.WriteLine("Q: What is the capital of Tasmania ?\r\n1 : Dodoma \r\n2 : Hobart\r\n3 : Launceston \r\n4 : Wellington");
                    var inputAnswer1 = Console.ReadLine();
                    int.TryParse(inputAnswer1, out answers[0]);
                    Console.WriteLine("Q: What is the tallest building in the Republic of the Congo? \r\n1 : Kinshasa Democratic Republic of the Congo Temple \r\n2 : Palais de la Nation\r\n3 : Kongo Trade Centre \r\n4 : Nabemba Tower");
                    var inputAnswer2 = Console.ReadLine();
                    int.TryParse(inputAnswer2, out answers[1]);
                    Console.WriteLine("Q: Which of these is not one of Pluto's moons?\r\n1 : Styx\r\n2 : Hydra\r\n3 : Nix\r\n4 : Lugia");
                    var inputAnswer3 = Console.ReadLine();
                    int.TryParse(inputAnswer3, out answers[2]);
                    Console.WriteLine("Q: What is the smallest lake in the world? \r\n1 : Onega Lake\r\n2 : Benxi Lake\r\n3 : Kivu Lake\r\n4 : Wakatipu Lake");
                    var inputAnswer4 = Console.ReadLine();
                    int.TryParse(inputAnswer4, out answers[3]);
                    Console.WriteLine("Q: What country has the largest population of alpacas?  \r\n1 : Chad\r\n2 : Peru\r\n3 : Australia\r\n4 : Niger");
                    var inputAnswer5 = Console.ReadLine();
                    int.TryParse(inputAnswer5, out answers[4]);

                    loggedStudent.Score = AnswerCheck.Grade(answers);
                    Console.WriteLine($"Your grade is: {loggedStudent.Score}");
                    loggedStudent.TookQuiz = true;
                }
                break;

                default:
                    Console.WriteLine("You tried to log in with incorrect username and password more than 3 times.");
                    check = false;
                    break;
                }
            }
        }