|
- using System;
- using Learun.Util;
- using System.Data;
- using System.Web.Mvc;
- using System.Collections.Generic;
- using Learun.Application.TwoDevelopment.EducationalAdministration;
- using Learun.Application.TwoDevelopment.EvaluationTeach;
- using System.Linq;
-
- namespace Learun.Application.Web.Areas.EvaluationTeach.Controllers
- {
- /// <summary>
- /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
- /// Copyright (c) 2013-2018 北京泉江科技有限公司
- /// 创 建:超级管理员
- /// 日 期:2019-04-23 15:50
- /// 描 述:问卷管理
- /// </summary>
- public class Eval_MainController : MvcControllerBase
- {
- private Eval_MainIBLL ask_MainIBLL = new Eval_MainBLL();
- private EmpInfoIBLL empInfoIbll = new EmpInfoBLL();
- private StuInfoBasicIBLL stuInfoBasicIbll = new StuInfoBasicBLL();
- private LessonInfoIBLL lessonInfoIbll = new LessonInfoBLL();
-
- #region 视图功能
-
- /// <summary>
- /// 主页面
- /// <summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult Index()
- {
- return View();
- }
- [HttpGet]
- public ActionResult AnswerIndex()
- {
- return View();
- }
-
- [HttpGet]
- public ActionResult TeacherIndex()
- {
- return View();
- }
-
- [HttpGet]
- public ActionResult TeacherIndex2()
- {
- return View();
- }
- [HttpGet]
- public ActionResult StudentIndex()
- {
- var logininfo = LoginUserInfo.Get();
- ViewBag.StuNo = logininfo.account;
- ViewBag.StuName = logininfo.realName;
- var yearsemester = Common.GetSemesterAndYear();
-
- ViewBag.AcademicYearNo = yearsemester.AcademicYearShort;
- ViewBag.Semester = yearsemester.Semester;
- 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 Eval_Main = ask_MainIBLL.GetEval_MainEntityAndQuestions(VID);
- return View(Eval_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 Eval_Main = ask_MainIBLL.GetEval_MainEntityAndQuestions(VID);
- return View(Eval_Main);
- }
- else
- {
- return View();
- }
- }
- [HttpGet]
- public ActionResult PaperView(string VID, string StuNo, string EmpNo, string LessonNo)
- {
- if (!string.IsNullOrEmpty(VID))
- {
- var Eval_Main = ask_MainIBLL.GetEval_MainEntityAndQuestionsResult(VID, StuNo, EmpNo, LessonNo);
- Eval_Main.StuName = stuInfoBasicIbll.GetStuInfoBasicEntityByStuNo(StuNo).StuName;
- Eval_Main.EmpName = empInfoIbll.GetEmpInfoEntityByEmpNo(EmpNo).EmpName;
- Eval_Main.LessonName = lessonInfoIbll.GetLessonInfoEntityByLessonNo(LessonNo).LessonName;
- return View(Eval_Main);
- }
- else
- {
- return View();
- }
- }
- /// <summary>
- /// 表单页
- /// <summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult Form()
- {
- ViewBag.VSerial = "EvaluationTeach_" + CommonHelper.CreateNo();
- return View();
- }
- #endregion
-
- #region 获取数据
- [HttpGet]
- public ActionResult GenerateNearByAcademic()
- {
- return Success(Learun.Util.WebHelper.GenerateNearByAcademic());
- }
- /// <summary>
- /// 获取页面显示列表数据
- /// <summary>
- /// <param name="queryJson">查询参数</param>
- /// <returns></returns>
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetPageList(string pagination, string queryJson)
- {
- Pagination paginationobj = pagination.ToObject<Pagination>();
- 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)
- {
- var data = ask_MainIBLL.GetStudentPageList(null, queryJson);
- return Success(data);
- }
-
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetAnswerPageList(string pagination, string queryJson)
- {
- Pagination paginationobj = pagination.ToObject<Pagination>();
- var data = ask_MainIBLL.GetAnswerPageList(paginationobj, queryJson);
- var jsonData = new
- {
- rows = data,
- total = paginationobj.total,
- page = paginationobj.page,
- records = paginationobj.records
- };
- return Success(jsonData);
- }
-
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetTeacherIndexPageList(string pagination, string queryJson)
- {
- var data = ask_MainIBLL.GetTeacherIndexPageList(null, queryJson);
- return Success(data);
- }
-
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetTeacherIndexPageList2(string pagination, string queryJson)
- {
- var data = ask_MainIBLL.GetTeacherIndexPageList(null, queryJson);
-
- var data2 = data.GroupBy(x => x.EmpNo).Select(x => new Eval_QuestionResultEntity()
- {
- EmpNo = x.Key,
- EmpName = x.Select(y => y.EmpName).FirstOrDefault(),
- LessonNo = String.Join(",", x.Select(y => y.LessonNo).ToArray()),
- StudentCount = x.Select(y => y.StudentCount).Sum(),
- EvalCount = x.Select(y => y.EvalCount).Sum(),
- AverageScore = x.Select(y => y.AverageScore).Sum()
- });
-
- return Success(data2);
- }
- /// <summary>
- /// 获取表单数据
- /// <summary>
- /// <returns></returns>
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetFormData(string keyValue)
- {
- var Eval_MainData = ask_MainIBLL.GetEval_MainEntity(keyValue);
- var jsonData = new
- {
- Eval_Main = Eval_MainData,
- };
- return Success(jsonData);
- }
- #endregion
-
- #region 提交数据
-
- /// <summary>
- /// 删除实体数据
- /// <param name="keyValue">主键</param>
- /// <summary>
- /// <returns></returns>
- [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("操作成功!");
- }
- /// <summary>
- /// 保存实体数据(新增、修改)
- /// <param name="keyValue">主键</param>
- /// <summary>
- /// <returns></returns>
- [HttpPost]
- [ValidateAntiForgeryToken]
- [AjaxOnly]
- public ActionResult SaveForm(string keyValue, string strEntity)
- {
- var userinfo = LoginUserInfo.Get();
- Eval_MainEntity entity = strEntity.ToObject<Eval_MainEntity>();
- entity.UID = userinfo.userId;
- entity.UName = userinfo.realName;
- entity.VCreateTime = DateTime.Now;
- entity.Status = false;
- ask_MainIBLL.SaveEntity(keyValue, entity);
- return Success("保存成功!");
- }
-
- [HttpPost]
- [ValidateAntiForgeryToken]
- [AjaxOnly]
- [ValidateInput(false)]
- public ActionResult StudentSubmitForm(string answerlist, string VID, string LessonNo, string EmpNo)
- {
- var userinfo = LoginUserInfo.Get();
- List<Eval_QuestionResultEntity> entity = answerlist.ToObject<List<Eval_QuestionResultEntity>>();
- ask_MainIBLL.SaveEval_QuestionResultEntity(entity, VID, LessonNo, EmpNo, userinfo.account, userinfo.realName, userinfo.iPAddress);
- return Success("保存成功!");
- }
-
-
- #endregion
-
- }
- }
|