12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using Bowin.Web.Controls.Mvc;
- using Bowin.Common.Data;
- using Bowin.Common.Utility;
- using EMIS.CommonLogic.TerminatePrinter;
- using EMIS.ViewModel;
- using EMIS.Web.Controls;
- using EMIS.Utility;
- namespace EMIS.Web.Controllers.TerminatePrinter
- {
- [Authorization]
- public class StudentPrintTimesController : Controller
- {
- public IStudentPrintTimesServices StudentPrintTimesServices { get; set; }
- public ActionResult List()
- {
- return View();
- }
- [HttpPost]
- public ActionResult List(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var collegeID = pararms.getExtraGuid("cgbCollege");
- var yearID = pararms.getExtraInt("ddlYear") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlYear");
- var standardID = pararms.getExtraInt("cbgStandard") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("cbgStandard");
- var classmajorID = pararms.getExtraGuid("cbgClassmajor");
- return base.Json(StudentPrintTimesServices.GetStudentPrintTimesViewGrid(configuretView, collegeID, yearID, standardID, classmajorID, pararms.page, pararms.rows));
- }
- [HttpPost]
- public ActionResult Excel()
- {
- NpoiExcelHelper neh = new NpoiExcelHelper();
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
- var collegeID = Request.Form["cgbCollege"].ParseStrTo<Guid>();
- var yearID = Request.Form["ddlYear"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlYear"].ParseStrTo<int>();
- var standardID = Request.Form["cbgStandard"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["cbgStandard"].ParseStrTo<int>();
- var classmajorID = Request.Form["cbgClassmajor"].ParseStrTo<Guid>();
- var dt = StudentPrintTimesServices.GetStudentPrintTimesViewGrid(configuretView, collegeID, yearID, standardID, classmajorID)
- .Select(x => new
- {
- x.CollegeName,
- x.YearID,
- x.StandardDesc,
- x.ClassmajorName,
- x.LoginID,
- x.Name,
- x.IsInSchoolDesc,
- x.Times
- }).ToTable();
- string[] liststring = {
- RSL.Get("College"), "年级", "专业", "班级", "学号", "姓名",
- "在校状态", "已打印次数"
- };
- neh.Export(dt, liststring, "学生打印次数表" + DateTime.Now.ToString("yyyyMMdd"));
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "导出成功。"
- });
- }
- [HttpPost]
- public ActionResult BatchUpdate(string userIDs, int times)
- {
- try
- {
- var userIDList = userIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => new Guid(x)).ToList();
- StudentPrintTimesServices.BatchUpdate(userIDList, times);
- return base.Json(new ReturnMessage { IsSuccess = true, Message = "批量修改成功。" });
- }
- catch (Exception ex)
- {
- return base.Json(new ReturnMessage { IsSuccess = false, Message = "批量修改失败,原因:" + ex.Message + "。" });
- }
- }
- }
- }
|