示例#1
0
        /// <summary>
        ///     创建分类的页面呈现
        /// </summary>
        /// <returns></returns>
        public ActionResult SortEdit()
        {
            int            id   = Convert.ToInt32(Request.QueryString["id"]);
            tbQuestionSort sort = id > 0 ? ESortBL.GetSingleByID(id) : new tbQuestionSort();

            ViewData["model"] = sort;

            if (Request.QueryString["fatherID"] != null)
            {
                ViewData["fatherModel"] = Request.QueryString["fatherID"] == "0"
                                              ? CommonLanguage.Common_TreeFootName
                                              : ESortBL.GetAllQuestionSortDictionary()[
                    Request.QueryString["fatherID"].StringToInt32()].Title;
                ViewData["fatherID"] = Request.QueryString["fatherID"];
            }
            else
            {
                if (id > 0)
                {
                    ViewData["fatherModel"] = sort.FatherID == 0
                                                  ? CommonLanguage.Common_TreeFootName
                                                  : ESortBL.GetAllQuestionSortDictionary()[sort.FatherID].Title;
                    ViewData["fatherID"] = sort.FatherID;
                }
                else
                {
                    ViewData["fatherModel"] = CommonLanguage.Common_TreeFootName;
                    ViewData["fatherID"]    = 0;
                }
            }
            return(View());
        }
示例#2
0
        /// <summary>
        ///     查看试卷呈现
        /// </summary>
        public ViewResult ExampaperDetail(int flag = 0)
        {
            int         id     = Convert.ToInt32(Request.QueryString["id"]);
            tbExampaper expape = EBL.GetExampaper(id);
            List <ReExampaperQuestion> questionList = expape.QuestionList;
            List <ReRuleQuestion>      ruleList     = expape.QuestionRule;

            var itemArray = new List <tbQuestion>();

            if (questionList.Count > 0)
            {
                //遍历试卷问题ID,获取题目
                foreach (ReExampaperQuestion Pquestion in questionList)
                {
                    tbQuestion baseInfor = qBL.GetSingleByID(Pquestion.Qid);
                    baseInfor.QuestionAnswer = baseInfor.QuestionAnswer.OrderByDescending(p => p.AnswerFlag).ToList();
                    itemArray.Add(baseInfor);
                }
            }

            var itemArray1 = new List <MExamRuleShow>();

            if (ruleList.Count > 0)
            {
                foreach (ReRuleQuestion qRule in ruleList)
                {
                    var eq = new MExamRuleShow();
                    eq.QuestingScore = qRule.QScore;
                    switch (qRule.Qtype)
                    {
                    case 1:     //问答题
                        eq.QuestionType = "问答题";
                        break;

                    case 2:     //单选题
                        eq.QuestionType = "单选题";
                        break;

                    case 3:     //多选题
                        eq.QuestionType = "多选题";
                        break;

                    case 4:     //判断题
                        eq.QuestionType = "判断题";
                        break;

                    case 5:     //填空题
                        eq.QuestionType = "填空题";
                        break;

                    case 6:     //情景题
                        eq.QuestionType = "情景题";
                        break;
                    }

                    tbQuestionSort qSort = qSortBL.GetSingleByID(qRule.QSort);
                    eq.QuestionSort = qSort.Title;
                    string[] questionLevel = qRule.QLevelStr.Split(';');
                    string[] Easy          = questionLevel[0].Split(':');
                    string[] Common        = questionLevel[1].Split(':');
                    string[] Hard          = questionLevel[2].Split(':');
                    eq.Leveleasy   = Convert.ToInt32(Easy[1]);
                    eq.Levelcommon = Convert.ToInt32(Common[1]);
                    eq.Levelhard   = Convert.ToInt32(Hard[1]);
                    string qit1 = qRule.Qtype + "|" + qRule.QSort;
                    string qit  = qRule.Qtype + "|" + qRule.QSort + "|" + qRule.QScore + "|" + Easy[1] + "|" + Common[1] +
                                  "|" + Hard[1];
                    eq.qita    = qit;
                    eq.qitaone = qit1;

                    itemArray1.Add(eq);
                }
            }

            if (Request.QueryString["sortID"] != null)
            {
                if (flag == 1)
                {
                    ViewData["fatherModel"] = eSortBL.GetAllExampaperSortDictionary().Keys.Contains(expape.ExamSortID)
                                                  ? eSortBL.GetAllExampaperSortDictionary()[expape.ExamSortID].Title
                                                  : "无";
                }
                else
                {
                    ViewData["fatherModel"] = Request.QueryString["SortID"] == "0"
                                                  ? Exampaper.NO
                                                  : eSortBL.GetAllExampaperSortDictionary()[
                        Convert.ToInt32(Request.QueryString["sortID"])].Title;
                }
            }
            else
            {
                ViewData["fatherModel"] = Exampaper.NO;
            }
            ViewData["expape"]         = expape;
            ViewData["expapeQuestion"] = itemArray;
            ViewData["expapeRule"]     = itemArray1;
            return(View());
        }