private void SaveScore()
        {
            string examineeAnswer = string.Empty;

            foreach (var item in Article)
            {
                examineeAnswer += item.StrInput + "|";
                if (item.StrOri.Equals(item.StrInput))
                {
                    item.IsAllRight = true;
                }
            }
            int rightAmount = Article.Where(x => x.IsAllRight == true).Count();
            int totalAmount = Article.Count;

            if (totalAmount == 0)
            {
                Messenger.Default.Send("所选文本为空!");
                return;
            }
            // 权重
            float weight = Convert.ToSingle(ExamHandle.TryGetSingleData(@"SELECT F_WEIGHT_CR FROM TY_SKILLEXAM WHERE F_KEY =? ", Exam.SE_F_KEY)) / 100;
            //分条录入成绩=正确条数/总条数*100*权重*总分
            float score = Convert.ToSingle(rightAmount) / totalAmount * Exam.SE_F_TOTALSCORE * weight;

            timer.Stop();
            if (App.Model == TestModel.Exam)
            {
                string   sql   = @"UPDATE
                        TY_SKILLEXAMGRADE
                    SET                        
                        F_ANSWER_CR = ?,
                        F_SCORE_CR = ?,
                        F_CORRECT_CR=?
                    WHERE
                        F_KEY = ?";
                string[] parms = new string[] { examineeAnswer, score.ToString("F2"), rightAmount.ToString(), Exam.SCORE_F_KEY };
                if (ExamHandle.TryExecute(sql, parms))
                {
                    Messenger.Default.Send("保存打字成绩成功!");
                }
                else
                {
                    Messenger.Default.Send("保存打字成绩失败!");
                }
                string openwindowName = string.Empty;
                if (ChildrenInfo != null)
                {
                    Control ct = new Control();
                    if (ChildrenInfo.Count > 0)
                    {
                        switch (ChildrenInfo[0])
                        {
                        case "单字录入": //单字录入
                            openwindowName = "TypeWritingMainPage";
                            ct             = new ExamSys.Client.View.TypeWritingMainPage(Exam, ChildrenInfo);
                            break;

                        case "行文本录入": //行文本录入
                            openwindowName = "TypeSlitWritingPage";
                            ct             = new ExamSys.Client.View.TypeSlitWritingPage(Exam, ChildrenInfo);
                            break;

                        case "数字录入": //数字录入
                            openwindowName = "TypeDigitalWritingPage";
                            ct             = new ExamSys.Client.View.TypeDigitalWritingPage(Exam, ChildrenInfo);
                            break;

                        case "多券别点钞"://多券别点钞
                            openwindowName = "TypeCountCashPage";
                            ct             = new ExamSys.Client.View.TypeCountCashPage(Exam, ChildrenInfo);
                            break;

                        case "单券别点钞"://单券别点钞
                            openwindowName = "TypeCountCashSinglePage";
                            ct             = new ExamSys.Client.View.TypeCountCashSinglePage(Exam, ChildrenInfo);
                            break;
                        }
                        ChildrenInfo.RemoveAt(0);
                    }
                    else if (ChildrenInfo.Count == 0)
                    {
                        ct = new ExamSys.Client.View.SkillExamReport(Exam);
                    }
                    (App.MainWindow.DataContext as ExamMainWindowViewModel).Content = ct;
                }
            }
            else
            {
                Messenger.Default.Send("您汉字分条录入得分为: " + score.ToString("F2"));

                Messenger.Default.Send(
                    new WindowMessage
                {
                    WindowName = "SkillTestSelection",
                    Operation  = WindowOperation.Show,
                });
            }


            Close();
        }
        private void SaveScore()
        {
            float score = 0;

            timer.Stop();
            if (App.Model == TestModel.Test)
            {
                if (ExerciseCriteria == 0)
                {
                    Messenger.Default.Send("达标标准不能为0");
                    return;
                }
                score = Convert.ToSingle((Convert.ToInt32(RightFontCount) - (Convert.ToInt32(ErrorFontCount) * ExerciseAbatementCount))) / (ExerciseCriteria) * 60;

                Messenger.Default.Send("您汉字全文录入得分为: " + score.ToString("F2"));
                //Loaded();
                //Messenger.Default.Send(
                //            new WindowMessage
                //            {
                //                WindowName = "SkillTestSelection",
                //                Operation = WindowOperation.Show,
                //            });
            }
            else
            {
                string sql        = @"UPDATE
                        TY_SKILLEXAMGRADE
                    SET                        
                        F_ANSWER_CS = ?,
                        F_SCORE_CS = ?,
                        F_CORRECT_CS=?
                    WHERE
                        F_KEY = ?";
                string f_h_answer = new TextRange(InputDoc.ContentStart, InputDoc.ContentEnd).Text.Replace("\r\n", "").Trim();

                //权重
                float weight = Convert.ToSingle(ExamHandle.TryGetSingleData(@"SELECT F_WEIGHT_CS FROM TY_SKILLEXAM WHERE F_KEY =? ", Exam.SE_F_KEY)) / 100;
                //全文本录入汉字录入成绩=(录入正确字数/达标标准)*100*权重*总分;
                score = Convert.ToSingle((Convert.ToInt32(RightFontCount) - (Convert.ToInt32(ErrorFontCount) * Exam.CS_F_ABATEMENTCOUNT))) / (Exam.CS_F_CRITERIA) * weight * Exam.SE_F_TOTALSCORE;

                string[] parms = new string[] { f_h_answer, score.ToString("F2"), RightFontCount.ToString(), Exam.SCORE_F_KEY };
                if (ExamHandle.TryExecute(sql, parms))
                {
                    Messenger.Default.Send("保存打字成绩成功!");
                }
                else
                {
                    Messenger.Default.Send("保存打字成绩失败!");
                }
                string openwindowName = string.Empty;
                if (ChildrenInfo != null)
                {
                    Control ct = new Control();
                    if (ChildrenInfo.Count > 0)
                    {
                        switch (ChildrenInfo[0])
                        {
                        case "单字录入":     //单字录入
                            openwindowName = "TypeWritingMainPage";
                            ct             = new ExamSys.Client.View.TypeWritingMainPage(Exam, ChildrenInfo);
                            break;

                        case "行文本录入":     //行文本录入
                            openwindowName = "TypeSlitWritingPage";
                            ct             = new ExamSys.Client.View.TypeSlitWritingPage(Exam, ChildrenInfo);
                            break;

                        case "数字录入":     //数字录入
                            openwindowName = "TypeDigitalWritingPage";
                            ct             = new ExamSys.Client.View.TypeDigitalWritingPage(Exam, ChildrenInfo);
                            break;

                        case "多券别点钞":    //多券别点钞
                            openwindowName = "TypeCountCashPage";
                            ct             = new ExamSys.Client.View.TypeCountCashPage(Exam, ChildrenInfo);
                            break;

                        case "单券别点钞":    //单券别点钞
                            openwindowName = "TypeCountCashSinglePage";
                            ct             = new ExamSys.Client.View.TypeCountCashSinglePage(Exam, ChildrenInfo);
                            break;
                        }

                        ChildrenInfo.RemoveAt(0);
                    }
                    else if (ChildrenInfo.Count == 0)
                    {
                        ct = new ExamSys.Client.View.SkillExamReport(Exam);
                    }
                    (App.MainWindow.DataContext as ExamMainWindowViewModel).Content = ct;
                    //Messenger.Default.Send(new WindowMessage
                    //{
                    //    WindowName = openwindowName,
                    //    Operation = WindowOperation.Show,
                    //    Param = new object[] { Exam, ChildrenInfo }
                    //});
                }
            }
            Close();
        }
예제 #3
0
        private void SubmitTest()
        {
            //张数正确的数量
            int PageAmountRight_FaceNum = 0;
            //金额正确的数量
            int TotalAmountRight_FaceNum = 0;
            //标准答案
            List <string> listDStandaranser = Exam.CCR_F_STANDARDANSWER.Split(new string[] { "#" }, StringSplitOptions.RemoveEmptyEntries).ToList <string>();
            //标准答案(转为特定字典格式方便使用)
            Dictionary <string, KeyValuePair <string, string> > dic = new Dictionary <string, KeyValuePair <string, string> >();

            foreach (var item in listDStandaranser)
            {
                dic.Add(item.Split('|')[0], new KeyValuePair <string, string>(item.Split('|')[1], item.Split('|')[2]));
            }
            //累加张数正确的点钞券数量
            if (OneStandardAnswer1.ZS.ToString() == dic["100"].Key)
            {
                PageAmountRight_FaceNum += OneStandardAnswer1.ZS;
            }
            if (OneStandardAnswer2.ZS.ToString() == dic["50"].Key)
            {
                PageAmountRight_FaceNum += OneStandardAnswer2.ZS;
            }
            if (OneStandardAnswer3.ZS.ToString() == dic["20"].Key)
            {
                PageAmountRight_FaceNum += OneStandardAnswer3.ZS;
            }
            if (OneStandardAnswer4.ZS.ToString() == dic["10"].Key)
            {
                PageAmountRight_FaceNum += OneStandardAnswer4.ZS;
            }
            if (OneStandardAnswer5.ZS.ToString() == dic["5"].Key)
            {
                PageAmountRight_FaceNum += OneStandardAnswer5.ZS;
            }
            if (OneStandardAnswer6.ZS.ToString() == dic["1"].Key)
            {
                PageAmountRight_FaceNum += OneStandardAnswer6.ZS;
            }
            //累加金额正确的点钞券数量
            if (OneStandardAnswer1.JE.ToString() == dic["100"].Value)
            {
                TotalAmountRight_FaceNum += OneStandardAnswer1.ZS;
            }
            if (OneStandardAnswer2.JE.ToString() == dic["50"].Value)
            {
                TotalAmountRight_FaceNum += OneStandardAnswer2.ZS;
            }
            if (OneStandardAnswer3.JE.ToString() == dic["20"].Value)
            {
                TotalAmountRight_FaceNum += OneStandardAnswer3.ZS;
            }
            if (OneStandardAnswer4.JE.ToString() == dic["10"].Value)
            {
                TotalAmountRight_FaceNum += OneStandardAnswer4.ZS;
            }
            if (OneStandardAnswer5.JE.ToString() == dic["5"].Value)
            {
                TotalAmountRight_FaceNum += OneStandardAnswer5.ZS;
            }
            if (OneStandardAnswer6.JE.ToString() == dic["1"].Value)
            {
                TotalAmountRight_FaceNum += OneStandardAnswer6.ZS;
            }
            //考生答案
            var tempStr = "100" + "|" + OneStandardAnswer1.ZS.ToString() + "|" + OneStandardAnswer1.JE.ToString() + "#"
                          + "50" + "|" + OneStandardAnswer2.ZS.ToString() + "|" + OneStandardAnswer2.JE.ToString() + "#"
                          + "20" + "|" + OneStandardAnswer3.ZS.ToString() + "|" + OneStandardAnswer3.JE.ToString() + "#"
                          + "10" + "|" + OneStandardAnswer4.ZS.ToString() + "|" + OneStandardAnswer4.JE.ToString() + "#"
                          + "5" + "|" + OneStandardAnswer5.ZS.ToString() + "|" + OneStandardAnswer5.JE.ToString() + "#"
                          + "1" + "|" + OneStandardAnswer6.ZS.ToString() + "|" + OneStandardAnswer6.JE.ToString();
            //for (int i = 0; i < StantardAnswerInfos.Count; i++)
            //{
            //    tempStr += StantardAnswerInfos[i].PM + "|" + StantardAnswerInfos[i].ZS.ToString() + "|" + StantardAnswerInfos[i].JE.ToString() + "#";
            //    if (listDStandaranser.Any(x => x.Split('|')[0] == StantardAnswerInfos[i].PM.ToString() && x.Split('|')[1] == StantardAnswerInfos[i].ZS.ToString()))
            //    {
            //        PageAmountRight_FaceNum += StantardAnswerInfos[i].ZS;
            //    }
            //    if (listDStandaranser.Any(x => x.Split('|')[0] == StantardAnswerInfos[i].PM.ToString() && x.Split('|')[2] == StantardAnswerInfos[i].JE.ToString()))
            //    {
            //        TotalAmountRight_FaceNum += StantardAnswerInfos[i].ZS;
            //    }
            //}

            //总票面
            int totalAmout = 0;

            foreach (var item in listDStandaranser.ToList <string>())
            {
                totalAmout += Convert.ToInt32(item.Split('|')[1]);
            }
            // 权重
            float weight = Convert.ToSingle(ExamHandle.TryGetSingleData(@"SELECT F_WEIGHT_CCR FROM TY_SKILLEXAM WHERE F_KEY =? ", Exam.SE_F_KEY)) / 100;
            //得分成绩=(正确张数的票面/总票面*张数得分比例+正确金额的票面/总票面*金额得分比例)*权重*总分;
            var score = ((Convert.ToSingle(PageAmountRight_FaceNum) / totalAmout) * Exam.CCR_F_PAGEWEIGHT / 100 + (Convert.ToSingle(TotalAmountRight_FaceNum) / totalAmout) * Exam.CCR_F_MONEYWEIGHT / 100) * weight * Exam.SE_F_TOTALSCORE;

            if (App.Model == TestModel.Exam)
            {
                string   sql   = @"UPDATE
                                TY_SKILLEXAMGRADE
                            SET 
                                F_SCORE_CCR = ?,
                                F_ANSWER_CCR = ?
                            WHERE
                                F_KEY = ?";
                string[] parms = new string[] { score.ToString("F2"), tempStr, Exam.SCORE_F_KEY };
                if (ExamHandle.TryExecute(sql, parms))
                {
                    Messenger.Default.Send("保存点钞成绩成功!");
                }
                else
                {
                    Messenger.Default.Send("保存点钞成绩失败!");
                }
                string openwindowName = string.Empty;
                if (ChildrenInfo != null)
                {
                    Control ct = new Control();
                    if (ChildrenInfo.Count > 0)
                    {
                        switch (ChildrenInfo[0])
                        {
                        case "单字录入":     //单字录入
                            openwindowName = "TypeWritingMainPage";
                            ct             = new ExamSys.Client.View.TypeWritingMainPage(Exam, ChildrenInfo);
                            break;

                        case "行文本录入":     //行文本录入
                            openwindowName = "TypeSlitWritingPage";
                            ct             = new ExamSys.Client.View.TypeSlitWritingPage(Exam, ChildrenInfo);
                            break;

                        case "数字录入":     //数字录入
                            openwindowName = "TypeDigitalWritingPage";
                            ct             = new ExamSys.Client.View.TypeDigitalWritingPage(Exam, ChildrenInfo);
                            break;

                        case "多券别点钞":    //多券别点钞
                            openwindowName = "TypeCountCashPage";
                            ct             = new ExamSys.Client.View.TypeCountCashPage(Exam, ChildrenInfo);
                            break;

                        case "单券别点钞":    //单券别点钞
                            openwindowName = "TypeCountCashSinglePage";
                            ct             = new ExamSys.Client.View.TypeCountCashSinglePage(Exam, ChildrenInfo);
                            break;
                        }
                        ChildrenInfo.RemoveAt(0);
                    }
                    else if (ChildrenInfo.Count == 0)
                    {
                        ct = new ExamSys.Client.View.SkillExamReport(Exam);
                    }
                    (App.MainWindow.DataContext as ExamMainWindowViewModel).Content = ct;
                }
            }
            else
            {
            }
            Close();
        }