@using System.Data @using System.Text @using Newtonsoft.Json @using Newtonsoft.Json.Linq @using ZoomLa.Common @using ZoomLa.Model @using ZoomLa.BLL @{ Layout = "~/Areas/User/Views/Shared/_empty.cshtml"; DataTable questDt = ViewBag.questDt ?? new DataTable(); DataTable typeDt = ViewBag.typeDt ?? new DataTable(); int step = ViewBag.step ?? 0; string pname = ViewBag.pname ?? ""; int newid = ViewBag.newid ?? 0; } @functions{ private DataTable GetQuestDt(DataTable questDt, string qtype, int isbig) { string normFilter = "p_type=" + qtype + " AND IsToShare=0 AND (pid=0 OR pid IS NULL)"; string bigfilter = "pid=" + qtype + " AND IsToShare=0";//big下,qtype为其id if (isbig == 0) { questDt.DefaultView.RowFilter = normFilter; } else { questDt.DefaultView.RowFilter = bigfilter; } return questDt.DefaultView.ToTable(); } public string GetSubmit(int pid, int ptype) { string option = SafeSC.ReadFileStr(M_Exam_Sys_Questions.OptionDir + pid + ".opt"); JArray arr = JsonConvert.DeserializeObject(option); StringBuilder builder = new StringBuilder(); //单,多,填,解 switch (ptype) { case (int)M_Exam_Sys_Questions.QType.Radio: { if (arr == null || arr.Count < 1) { return "未定义选项"; } string name = "srad_" + pid; string tlp = "
  • "; foreach (JObject obj in arr) { builder.Append(string.Format(tlp, name, obj["op"], obj["val"])); } } break; case (int)M_Exam_Sys_Questions.QType.Multi: { if (arr == null || arr.Count < 1) { return "未定义选项"; } string name = "mchk_" + pid; string tlp = "
  • "; foreach (JObject obj in arr) { builder.Append(string.Format(tlp, name, obj["op"], obj["val"])); } } break; case (int)M_Exam_Sys_Questions.QType.FillBlank: { //string tlp = "
    解:
    "; //builder.Append(tlp); } break; case (int)M_Exam_Sys_Questions.QType.Answer://放置一个ueditor { string name = "answer_" + pid; string tlp = "
    解:
    "; builder.Append(tlp); } break; } return builder.ToString(); } } @section head{ 组卷中心 } @section content{ @if (step != 2) {
    标题:
    描述:
    价格:
    考试时间:0表示不限时长
    @foreach (DataRow dr in typeDt.Rows) {
    @(ZoomLa.BLL.Helper.StrHelper.ConvertIntegral(typeDt.Rows.IndexOf(dr) + 1) + "." + dr["QName"] + "(有" + dr["QNum"] + "小题,共" + dr["TotalScore"] + "分)") @{ int index = 0; } @foreach (DataRow row in GetQuestDt(questDt, dr["QType"].ToString(), DataConverter.CLng(dr["IsBig"])).Rows) { index++;
    @( index + "." + row["P_Title"])@MvcHtmlString.Create(row["p_content"].ToString())
      @MvcHtmlString.Create(GetSubmit(DataConverter.CLng(row["p_id"]), DataConverter.CLng(row["p_type"])))
    }
    }
    } else {
    【恭喜您组卷成功】
    标题:@pname
    试卷类型:练习
    考试时长:不限时
    } } @section script{ }