123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using EMISOnline.CommonLogic.CourseworkServices;
- using EMISOnline.ViewModel.ExamView;
- using EMISOnline.ViewModel;
- using System.Web.Script.Serialization;
- using EMISOnline.ViewModel.Coursework;
- namespace EMISOnline.Web.Controllers.Manage
- {
- [Authorization]
- public partial class CourseworkController : Controller
- {
- public ICourseworkServices ICourseworkServices { get; set; }
- //
- // GET: /Coursework/
- public ActionResult CourseworkAdd(decimal? workid)
- {
- CourseworkAddView view = new CourseworkAddView();
- if (workid.HasValue){
- view = ICourseworkServices.getCourseWork(workid.Value);
- }
- return View(view);
- }
- public ActionResult CourseworkList()
- {
- return View();
- }
- /// <summary>
- /// 列表查询
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult List(string testname, int page, int rows)
- {
- var result = ICourseworkServices.GetCourseworkList(testname, page, rows);
- return Json(result);
- }
- [HttpPost]
- public ActionResult CourseworkAdd(CourseworkAddView CourseworkAddView)
- {
- try
- {
- var user = ((EMISOnline.Utility.FormValidate.CustomPrincipal)HttpContext.User);
- ICourseworkServices.ExamSettingSave(CourseworkAddView, user.LoginID);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存成功!",
- RedictUrl = Url.Content("~/Coursework/CourseworkList")
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "保存失败:" + ex.Message
- });
- }
- }
- public ActionResult Review(decimal workid)
- {
- ViewBag.workid = workid;
- return View();
- }
- /// <summary>
- /// 列表查询
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult ReviewList(string testname,decimal workid, int page, int rows)
- {
- var result = ICourseworkServices.GetReviewList(testname,workid, page, rows);
- return Json(result);
- }
- public ActionResult ShowPaper(decimal ResultID)
- {
- var result = ICourseworkServices.GetCourseWorkResult(ResultID);
- //获取考试试卷(原动态卷)
- var testpaper = ICourseworkServices.getPaper(result.workid.Value);
- var questions = ICourseworkServices.ShowPaperQuestion(result.workid.Value, testpaper.test_paper_id);
- ViewBag.questions = questions;
- return View();
- }
-
- private Dictionary<string, string> Answers
- {
- get
- {
- if (Session["Answers"] == null)
- {
- var dic = new Dictionary<string, string>();
- Session["Answers"] = dic;
- return dic;
- }
- return Session["Answers"] as Dictionary<string, string>;
- }
- }
- private decimal[] QeustionSet
- {
- get
- {
- return Session["QeustionSet"] as decimal[];
- }
- set
- {
- Session["QeustionSet"] = value;
- }
- }
- }
- }
|