using System; using Learun.Util; using System.Data; using Learun.Application.TwoDevelopment.Ask; using System.Web.Mvc; using System.Collections.Generic; using Learun.Application.TwoDevelopment.EducationalAdministration; namespace Learun.Application.Web.Areas.Ask.Controllers { /// /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园 /// Copyright (c) 2013-2018 北京泉江科技有限公司 /// 创 建:超级管理员 /// 日 期:2019-04-23 15:50 /// 描 述:问卷管理 /// public class Ask_MainController : MvcControllerBase { private Ask_MainIBLL ask_MainIBLL = new Ask_MainBLL(); #region 视图功能 /// /// 主页面 /// /// [HttpGet] public ActionResult Index() { return View(); } [HttpGet] public ActionResult AnswerIndex() { return View(); } [HttpGet] public ActionResult StudentIndex() { var logininfo = LoginUserInfo.Get(); ViewBag.StuNo = logininfo.account; ViewBag.StuName = logininfo.realName; return View(); } [HttpGet] public ActionResult AnswerQuery() { return View(); } [HttpGet] public ActionResult Paper(string VID) { ViewBag.StuNo = LoginUserInfo.Get().account; ViewBag.StuName = LoginUserInfo.Get().realName; if (!string.IsNullOrEmpty(VID)) { var Ask_Main = ask_MainIBLL.GetAsk_MainEntityAndQuestions(VID); return View(Ask_Main); } else { return View(); } } [HttpGet] public ActionResult PaperAdminView(string VID) { ViewBag.StuNo = LoginUserInfo.Get().account; ViewBag.StuName = LoginUserInfo.Get().realName; if (!string.IsNullOrEmpty(VID)) { var Ask_Main = ask_MainIBLL.GetAsk_MainEntityAndQuestions(VID); return View(Ask_Main); } else { return View(); } } [HttpGet] public ActionResult PaperView(string VID,string StuNo) { if (!string.IsNullOrEmpty(VID)) { var Ask_Main = ask_MainIBLL.GetAsk_MainEntityAndQuestionsResult(VID,StuNo); return View(Ask_Main); } else { return View(); } } /// /// 表单页 /// /// [HttpGet] public ActionResult Form() { ViewBag.VSerial = "Table_" + CommonHelper.CreateNo(); var xnxq = Common.GetSemesterAndYear(); ViewBag.AcademicYearNo = xnxq.AcademicYearShort; ViewBag.Semester = xnxq.Semester; return View(); } #endregion #region 获取数据 /// /// 获取页面显示列表数据 /// /// 查询参数 /// [HttpGet] [AjaxOnly] public ActionResult GetPageList(string pagination, string queryJson) { Pagination paginationobj = pagination.ToObject(); var data = ask_MainIBLL.GetPageList(paginationobj, queryJson); var jsonData = new { rows = data, total = paginationobj.total, page = paginationobj.page, records = paginationobj.records }; return Success(jsonData); } [HttpGet] [AjaxOnly] public ActionResult GetStudentPageList(string pagination, string queryJson) { Pagination paginationobj = pagination.ToObject(); var data = ask_MainIBLL.GetStudentPageList(paginationobj, queryJson); var jsonData = new { rows = data, total = paginationobj.total, page = paginationobj.page, records = paginationobj.records }; return Success(jsonData); } [HttpGet] [AjaxOnly] public ActionResult GetAnswerPageList(string pagination, string queryJson) { Pagination paginationobj = pagination.ToObject(); var data = ask_MainIBLL.GetStudentPageList(paginationobj, queryJson); var jsonData = new { rows = data, total = paginationobj.total, page = paginationobj.page, records = paginationobj.records }; return Success(jsonData); } /// /// 获取表单数据 /// /// [HttpGet] [AjaxOnly] public ActionResult GetFormData(string keyValue) { var Ask_MainData = ask_MainIBLL.GetAsk_MainEntity(keyValue); var jsonData = new { Ask_Main = Ask_MainData, }; return Success(jsonData); } #endregion #region 提交数据 /// /// 删除实体数据 /// 主键 /// /// [HttpPost] [AjaxOnly] public ActionResult DeleteForm(string keyValue) { ask_MainIBLL.DeleteEntity(keyValue); return Success("删除成功!"); } [HttpPost] [AjaxOnly] public ActionResult SubmitForm(string keyValue) { ask_MainIBLL.ChangeFormStatus(keyValue, true); return Success("操作成功!"); } [HttpPost] [AjaxOnly] public ActionResult UnSubmitForm(string keyValue) { ask_MainIBLL.ChangeFormStatus(keyValue, false); return Success("操作成功!"); } /// /// 保存实体数据(新增、修改) /// 主键 /// /// [HttpPost] [ValidateAntiForgeryToken] [AjaxOnly] public ActionResult SaveForm(string keyValue, string strEntity) { var userinfo = LoginUserInfo.Get(); Ask_MainEntity entity = strEntity.ToObject(); entity.UID = userinfo.userId; entity.UName = userinfo.realName; entity.VCreateTime = DateTime.Now; entity.Status = false; entity.SPVNum = 0; entity.SPNum = 0; entity.SClick = 0; ask_MainIBLL.SaveEntity(keyValue, entity); return Success("保存成功!"); } [HttpPost] [ValidateAntiForgeryToken] [AjaxOnly] [ValidateInput(false)] public ActionResult StudentSubmitForm(string answerlist,string VID) { var userinfo = LoginUserInfo.Get(); List entity = answerlist.ToObject>(); ask_MainIBLL.SaveAsk_QuestionResultEntity(entity, VID,userinfo.account,userinfo.realName, userinfo.iPAddress); return Success("保存成功!"); } #endregion } }