/// <summary> /// 问题编辑页面呈现 /// 在编辑试卷时调用 /// </summary> /// <param name="id"></param> /// <param name="sortID"></param> /// <param name="flag"></param> /// <returns></returns> public ActionResult AddQuestionToExampaper(int id = 0, int sortID = 0, int flag = 0) { Response.Expires = 0; tbQuestion qu; if (id > 0) { qu = EQuestionBL.GetSingleByID(id); ViewBag.fatherModel = ESortBL.GetAllQuestionSortDictionary(CurrentTenant.TenantId)[qu.QuestionSortID].Title; } else { qu = new tbQuestion(); ViewBag.fatherModel = sortID == 0 ? CurrentTenant.TenantName : ESortBL.GetAllQuestionSortDictionary(CurrentTenant.TenantId)[sortID].Title; } ViewBag.id = id; ViewBag.baseInfor = qu; ViewBag.sortID = sortID == 0 ? qu.QuestionSortID : sortID; ViewBag.backSortID = sortID; ViewBag.backUrl = Url.RetechAction("QuestionList", "Question"); if (flag == 1) { ViewBag.backUrl = Url.RetechAction("QuestionManage", "Question"); } else if (flag == 2) { ViewBag.backUrl = Url.RetechAction("ExampaperList", "Exampaper"); } ViewBag.flag = flag; return(View()); }
/// <summary> /// 问题编辑页面呈现 /// </summary> public ActionResult QuestionEdit() { Response.Expires = 0; int id = Convert.ToInt32(Request.QueryString["id"]); if (id > 0) { tbQuestion qu = EQuestionBL.GetSingleByID(id); ViewData["BaseInfor"] = qu; ViewData["fatherModel"] = ESortBL.GetAllQuestionSortDictionary()[qu.QuestionSortID].Title; } else { ViewData["BaseInfor"] = new tbQuestion(); if (Request.QueryString["sortID"] != null) { ViewData["fatherModel"] = Request.QueryString["sortID"] == "0" ? "无" : ESortBL.GetAllQuestionSortDictionary()[ Convert.ToInt32(Request.QueryString["sortID"])].Title; } else { ViewData["fatherModel"] = "无"; } } return(View()); }
/// <summary> /// 问答题编辑页面呈现 /// </summary> public ActionResult QuestionSubjectEdit() { Response.Expires = 0; int id = Convert.ToInt32(Request.QueryString["id"]); if (id > 0) { tbQuestion qu = EQuestionBL.GetSingleByID(id); ViewData["BaseInfor"] = qu; ViewData["QuestionInfor"] = qu.QuestionAnswer.OrderBy(p => p.Order).ToList(); } else { ViewData["BaseInfor"] = new tbQuestion(); ViewData["QuestionInfor"] = new List <QuestionAnswer>(); } return(View()); }
public JsonResult SubmitQuestion() { string content = Request.Form["hiddenQuestionContent"].NoHtml(); if (content.Replace(" ", "").Trim() == "") { return(Json(new { result = 0, content = RetechWing.LanguageResources.Exam.Question.message16, }, "text/html", JsonRequestBehavior.AllowGet)); //return Json(new //{ // result = 0, // content = RetechWing.LanguageResources.Exam.Question.message16, //}, JsonRequestBehavior.AllowGet); } //ID int id = Convert.ToInt32(Request.Params["id"]); //类型 int qType = Convert.ToInt32(Request.Form["hiddenSelQuestionType"]); int newid = 0; bool flag = true; int fileType = Convert.ToInt32(Request.Params["type"]); //0:图片,1:音频,2:视频 if (qType == 6) { HttpFileCollectionBase files = Request.Files; for (int i = 0; i < files.Count; i++) { if (((fileType != 0 && files[i].ContentLength > 8388608) || (fileType == 0 && files[i].ContentLength > 512000)) && flag) { flag = false; break; } } } int questionType = Convert.ToInt32(Request.Form["hiddenSelQuestionType"]); if (flag) { List <FileUpload> listfileUpload = qType == 6 ? FileUpload(fileType) : new List <FileUpload>(); tbQuestion question = id > 0 ? EQuestionBL.GetSingleByID(id) : new tbQuestion { Status = 0, LastUpdateTime = DateTime.Now, _id = id, UserID = CurrentUser.UserId, FileUpload = listfileUpload, CreateTime = DateTime.Now, TenantId = CurrentTenant.TenantId }; if (question.TenantId != CurrentTenant.TenantId) { return(Json(new { result = -1, content = RetechWing.LanguageResources.Exam.Question.message17, }, "text/html", JsonRequestBehavior.AllowGet)); } question.QuestionAnswerKeys = Request.Form["txtQuestionAnswerKeys"] ?? ""; question.QuestionLevel = Convert.ToInt32(Request.Form["hiddenSelQuestionLevel"]); question.QuestionSortID = Convert.ToInt32(Request.Form["hiddenSelQuestionSort"]); question.QuestionOpen = Convert.ToInt32(Request.Form["hiddenQuestionOpen"]); question.QuestionAvailable = Convert.ToInt32(Request.Form["hiddenQuestionAvailable"]); question.QuestionType = questionType; question.QuestionAnalysis = Request.Form["txtQuestionAnalysis"] ?? ""; question.QuestionKey = Request.Form["hiddenSelQuestionKey"].GetInt32(); question.QuestionAnswer = new List <QuestionAnswer>(); question.LastUpdateTime = DateTime.Now; if (qType == 6) { question = UpdateQuestionFiles(question, listfileUpload); } switch (qType) { case 1: //主观题 newid = SubmitSubjectQuestion(id, question); break; case 2: //单选题 newid = SubmitSingleQuestion(id, question); break; case 3: //多选题 newid = SubmitMultipeQuestion(id, question); break; case 4: //判断题 newid = SubmitJudgeQuestion(id, question); break; case 5: //填空题 newid = SubmitFillblankQuestion(id, question); break; case 6: //多媒体 newid = SubmitMultimediaQuestion(id, question); break; } if (newid > 0) { return(Json(new { result = 1, questionID = newid, content = RetechWing.LanguageResources.Common.SaveSuccess, }, "text/html", JsonRequestBehavior.AllowGet)); } return(Json(new { result = 0, content = RetechWing.LanguageResources.Common.SaveFailed, url = "" }, "text/html", JsonRequestBehavior.AllowGet)); } return(Json(new { result = -1, content = RetechWing.LanguageResources.Exam.Question.message18, }, "text/html", JsonRequestBehavior.AllowGet)); }
public JsonResult SubmitQuestion() { string content = Request.Form["hiddenQuestionContent"].NoHtml(); if (content.Replace(" ", "").Trim() == "") { return(Json(new { result = 0, content = "请输入试题题干", }, "text/html", JsonRequestBehavior.AllowGet)); } //ID int id = Convert.ToInt32(Request.QueryString["id"]); //类型 int qType = Convert.ToInt32(Request.Form["hiddenSelQuestionType"]); int newid = 0; bool flag = true; int fileType = Convert.ToInt32(Request.QueryString["type"]); //0:图片,1:音频,2:视频 if (qType == 6) { HttpFileCollectionBase files = Request.Files; for (int i = 0; i < files.Count; i++) { if (((fileType != 0 && files[i].ContentLength > 8388608) || (fileType == 0 && files[i].ContentLength > 512000)) && flag) { flag = false; break; } } } int questionType = Convert.ToInt32(Request.Form["hiddenSelQuestionType"]); if (flag) { List <FileUpload> listfileUpload = qType == 6 ? FileUpload(fileType) : new List <FileUpload>(); tbQuestion question = id > 0 ? EQuestionBL.GetSingleByID(id) : new tbQuestion { Status = 0, LastUpdateTime = DateTime.Now, _id = id, UserID = Session["userID"] == null ? 0 : CurrentUser.UserId, FileUpload = listfileUpload, CreateTime = DateTime.Now }; question.QuestionAnswerKeys = Request.Form["txtQuestionAnswerKeys"] ?? ""; question.QuestionLevel = Convert.ToInt32(Request.Form["hiddenSelQuestionLevel"]); question.QuestionSortID = Convert.ToInt32(Request.Form["hiddenSelQuestionSort"]); question.QuestionType = questionType; question.QuestionAnalysis = Request.Form["txtQuestionAnalysis"] ?? ""; question.QuestionKey = Request.Form["hiddenSelQuestionKey"].StringToInt32(); question.QuestionAnswer = new List <QuestionAnswer>(); if (qType == 6 && listfileUpload.Count > 0) { question = UpdateQuestionFiles(question, listfileUpload); } switch (qType) { case 1: //主观题 newid = SubmitSubjectQuestion(id, question); break; case 2: //单选题 newid = SubmitSingleQuestion(id, question); break; case 3: //多选题 newid = SubmitMultipeQuestion(id, question); break; case 4: //判断题 newid = SubmitJudgeQuestion(id, question); break; case 5: //填空题 newid = SubmitFillblankQuestion(id, question); break; case 6: //情景题 newid = SubmitMultimediaQuestion(id, question); break; } if (newid > 0) { return(Json(new { result = 1, questionID = newid, content = CommonLanguage.Common_AddSuccess, }, "text/html", JsonRequestBehavior.AllowGet)); } return(Json(new { result = 0, content = CommonLanguage.Common_AddFailed, url = "" }, "text/html", JsonRequestBehavior.AllowGet)); } return(Json(new { result = -1, content = CommonLanguage.Common_Tip_UpLoadFileLimit, }, "text/html", JsonRequestBehavior.AllowGet)); }