private async Task DeleteQuestion()
 {
     MultipleChoiceQuestions.Remove(SelectedQuestion);
     SelectedQuestion = null;
     await _pageService.PopAsync();
 }
Esempio n. 2
0
        /// <summary>
        /// 交卷操作
        /// </summary>
        private void SubmitPaper(bool isForce = false)
        {
            //是否强制交卷
            if (!isForce)
            {
                bool flag = false;
                Messenger.Default.Send(new DialogMessage("确定是否要交卷?", result =>
                {
                    if (result == MessageBoxResult.OK)
                    {
                        flag = true;
                    }
                })
                {
                    Button = MessageBoxButton.OKCancel, Caption = "提示", Icon = MessageBoxImage.Question
                });

                if (!flag)
                {
                    return;
                }
            }
            string sqlTemp = @"   UPDATE
                                                TBL_TH_EXST
                                            SET
                                                TBL_TH_EXST.EXST_ENDTIME = SYSDATE
                                            WHERE
                                                EXST_KEY=?";

            if (!ExamHandle.TryExecute(sqlTemp, OneStaffExam.EXST_KEY))
            {
                Messenger.Default.Send("提交试卷发生错误");
                return;
            }

            foreach (Process thisproc in System.Diagnostics.Process.GetProcesses())
            {
                if (thisproc.ProcessName == "TellerSystem.Client" || thisproc.ProcessName == "TellerSystem.Client.vshost")
                {
                    thisproc.Kill();
                }
            }
            // 停止倒计时
            this.ExamClock.StopTime();


            float         totalScore               = 0f;
            float         SingleChoicetotalScore   = 0f;
            float         MultipleChoicetotalScore = 0f;
            float         TrueFalsetotalScore      = 0f;
            StringBuilder strLog = new StringBuilder();

            strLog.AppendLine("************************理论题考试得分明细************************");
            strLog.AppendLine("----------单项选择题----------");
            int count = 0;

            foreach (var item in SingleChoiceQuestions)
            {
                float  thisQuGetScore  = 0;
                string thisStaffAnswer = string.Empty;
                count++;
                strLog.AppendLine(string.Format("第 {0} 题:{1}", count, item.QU_INFO));
                strLog.AppendLine(string.Format("分值: {0}   标准答案:{1}", item.TMQU_SCORE, item.QU_ANSWER));
                strLog.AppendLine(string.Format("选项A: {0}", item.QU_ITEM_A));
                strLog.AppendLine(string.Format("选项B: {0}", item.QU_ITEM_B));
                strLog.AppendLine(string.Format("选项C: {0}", item.QU_ITEM_C));
                strLog.AppendLine(string.Format("选项D: {0}", item.QU_ITEM_D));
                switch (item.QU_ANSWER)
                {
                case "A":
                    if (item.ISSELECTED_A == true)
                    {
                        thisQuGetScore  = item.TMQU_SCORE;
                        thisStaffAnswer = "A";
                    }
                    break;

                case "B":
                    if (item.ISSELECTED_B == true)
                    {
                        thisQuGetScore  = item.TMQU_SCORE;
                        thisStaffAnswer = "B";
                    }
                    break;

                case "C":
                    if (item.ISSELECTED_C == true)
                    {
                        thisQuGetScore  = item.TMQU_SCORE;
                        thisStaffAnswer = "C";
                    }
                    break;

                case "D":
                    if (item.ISSELECTED_D == true)
                    {
                        thisQuGetScore  = item.TMQU_SCORE;
                        thisStaffAnswer = "D";
                    }
                    break;

                default:
                    break;
                }

                if (item.ISSELECTED_A == true)
                {
                    thisStaffAnswer = "A";
                }
                if (item.ISSELECTED_B == true)
                {
                    thisStaffAnswer = "B";
                }
                if (item.ISSELECTED_C == true)
                {
                    thisStaffAnswer = "C";
                }
                if (item.ISSELECTED_D == true)
                {
                    thisStaffAnswer = "D";
                }
                SingleChoicetotalScore += thisQuGetScore;
                strLog.AppendLine(string.Format("考生得值: {0}   考生答案:{1}", thisQuGetScore, thisStaffAnswer));
                strLog.AppendLine();
            }
            strLog.AppendLine();
            strLog.AppendLine("************************************************************************");
            strLog.AppendLine("************************************************************************");
            strLog.AppendLine("************************************************************************");
            strLog.AppendLine("----------多项选择题----------");
            string MultipleStaffAnswer = string.Empty;
            float  TempTotalScore      = 0;

            foreach (var item in MultipleChoiceQuestions)
            {
                if (MultipleChoiceQuestions.IndexOf(item) != 0)
                {
                    strLog.AppendLine(string.Format("考生得值: {0}   考生答案:{1}", MultipleChoicetotalScore - TempTotalScore, MultipleStaffAnswer));
                    strLog.AppendLine();
                }
                TempTotalScore = MultipleChoicetotalScore;
                count++;
                strLog.AppendLine(string.Format("第 {0} 题:{1}", count, item.QU_INFO));
                strLog.AppendLine(string.Format("分值: {0}   标准答案:{1}", item.TMQU_SCORE, item.QU_ANSWER));
                strLog.AppendLine(string.Format("选项A: {0}", item.QU_ITEM_A));
                strLog.AppendLine(string.Format("选项B: {0}", item.QU_ITEM_B));
                strLog.AppendLine(string.Format("选项C: {0}", item.QU_ITEM_C));
                strLog.AppendLine(string.Format("选项D: {0}", item.QU_ITEM_D));
                MultipleStaffAnswer = (item.ISSELECTED_A ? "A," : string.Empty) + (item.ISSELECTED_B ? "B," : string.Empty) + (item.ISSELECTED_C ? "C," : string.Empty) + (item.ISSELECTED_D ? "D," : string.Empty) + (item.ISSELECTED_E ? "E," : string.Empty);
                if (MultipleStaffAnswer.Length > 0)
                {
                    MultipleStaffAnswer = MultipleStaffAnswer.Substring(0, MultipleStaffAnswer.Length - 1);
                }
                if (item.QU_ANSWER.Contains("A") != item.ISSELECTED_A)
                {
                    continue;
                }
                if (item.QU_ANSWER.Contains("B") != item.ISSELECTED_B)
                {
                    continue;
                }
                if (item.QU_ANSWER.Contains("C") != item.ISSELECTED_C)
                {
                    continue;
                }
                if (item.QU_ANSWER.Contains("D") != item.ISSELECTED_D)
                {
                    continue;
                }
                if (item.QU_ANSWER.Contains("E") != item.ISSELECTED_E)
                {
                    continue;
                }
                MultipleChoicetotalScore += item.TMQU_SCORE;
            }
            strLog.AppendLine(string.Format("考生得值: {0}   考生答案:{1}", MultipleChoicetotalScore - TempTotalScore, MultipleStaffAnswer));

            strLog.AppendLine();
            strLog.AppendLine("************************************************************************");
            strLog.AppendLine("************************************************************************");
            strLog.AppendLine("************************************************************************");

            strLog.AppendLine("------------判断题------------");
            foreach (var item in TrueFalseQuestions)
            {
                float thisQuGetScore = 0;
                count++;
                strLog.AppendLine(string.Format("第 {0} 题:{1}", count, item.QU_INFO));
                strLog.AppendLine(string.Format("分值: {0}   标准答案:{1}", item.TMQU_SCORE, (item.QU_ANSWER == "1" ? "正确" : "错误")));
                switch (item.QU_ANSWER)
                {
                case "1":
                    if (item.ISSELECTED_A == true)
                    {
                        thisQuGetScore = item.TMQU_SCORE;
                    }
                    break;

                case "0":
                    if (item.ISSELECTED_B == true)
                    {
                        thisQuGetScore = item.TMQU_SCORE;
                    }
                    break;

                default: break;
                }
                TrueFalsetotalScore += thisQuGetScore;
                strLog.AppendLine(string.Format("考生得值: {0}   考生答案:{1}", thisQuGetScore, (item.ISSELECTED_A == true ? "正确" : "错误")));
                strLog.AppendLine();
            }
            totalScore = SingleChoicetotalScore + MultipleChoicetotalScore + TrueFalsetotalScore;
            string totalResult = string.Format("理论知识考核成绩为:{0}.    \n单选题为:{1}.    \n多选题为:{2}.    \n判断题为:{3}.    ", totalScore, SingleChoicetotalScore, MultipleChoicetotalScore, TrueFalsetotalScore);

            //Messenger.Default.Send(totalResult);

            strLog.AppendLine();
            strLog.AppendLine("************************************************************************");
            strLog.AppendLine("************************************************************************");
            strLog.AppendLine("************************************************************************");
            strLog.AppendLine(totalResult);
            string sql1 = @"   UPDATE
                                                TBL_TH_EXST
                                            SET
                                                TBL_TH_EXST.EXST_GRADE = ?,
                                                TBL_TH_EXST.EXST_GRADE_DETAIL = ?
                                            WHERE
                                                EXST_KEY=?";

            if (!ExamHandle.TryExecute(sql1, totalScore.ToString(), strLog.ToString(), OneStaffExam.EXST_KEY))
            {
                Messenger.Default.Send("提交考试成绩及明细发生错误");
                return;
            }

            //打开理论知识考核成绩单窗口
            Messenger.Default.Send(
                new WindowMessage
            {
                WindowName = "ThExamReportCard",
                Operation  = WindowOperation.Show,
                Param      = new object[] { StaffInfo, totalScore }
            });
            Close();
        }