123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using EMIS.CommonLogic.RetakeManage;
- using EMIS.ViewModel.RetakeManage;
- using EMIS.ViewModel;
- using EMIS.Web.Controls;
- using Bowin.Common.Utility;
- using Bowin.Common.Data;
- namespace EMIS.Web.Controllers.RetakeManage
- {
- [Authorization]
- public class RetakeOpenControlController : Controller
- {
- public IRetakeOpenControlServices RetakeOpenControlServices { get; set; }
- /// <summary>
- /// 重修控制页面
- /// </summary>
- /// <returns></returns>
- public ActionResult List()
- {
- return View();
- }
- /// <summary>
- /// 重修控制列表查询
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult List(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- Guid? schoolyearID = pararms.getExtraGuid("ddlSchoolYear");
- return base.Json(RetakeOpenControlServices.GetRetakeOpenControlViewList(configuretView, schoolyearID, (int)pararms.page, (int)pararms.rows));
- }
- /// <summary>
- /// 编辑
- /// </summary>
- /// <param name="RetakeOpenControlID"></param>
- /// <returns></returns>
- public ActionResult Edit(Guid? RetakeOpenControlID)
- {
- RetakeOpenControlView retakeOpenControlView = new RetakeOpenControlView();
- if (RetakeOpenControlID.HasValue)
- {
- retakeOpenControlView = RetakeOpenControlServices.GetRetakeOpenControlView(RetakeOpenControlID);
- }
- else
- {
- retakeOpenControlView.StartDate = DateTime.Now;
- retakeOpenControlView.EndDate = DateTime.Now.AddDays(+1);
- }
- return View(retakeOpenControlView);
- }
- /// <summary>
- /// 编辑(新增、修改)
- /// </summary>
- /// <param name="retakeOpenControlView"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Edit(RetakeOpenControlView retakeOpenControlView)
- {
- try
- {
- RetakeOpenControlServices.RetakeOpenControlEdit(retakeOpenControlView);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "保存失败,原因:" + ex.Message
- });
- }
- }
- /// <summary>
- /// 删除
- /// </summary>
- /// <param name="retakeOpenControlIDs"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Delete(string retakeOpenControlIDs)
- {
- try
- {
- List<Guid?> list = retakeOpenControlIDs.Split(',').Where(x => !string.IsNullOrEmpty(x))
- .Select(x => (Guid?)new Guid(x)).ToList();
- RetakeOpenControlServices.RetakeOpenControlDelete(list);
- return base.Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "删除成功。"
- });
- }
- catch (Exception ex)
- {
- return base.Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "删除失败,原因:" + ex.Message
- });
- }
- }
- /// <summary>
- /// Excel导出
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Excel()
- {
- NpoiExcelHelper neh = new NpoiExcelHelper();
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
- var schoolyearID = Request.Form["ddlSchoolYear"].ParseStrTo<Guid>();
- var dt = RetakeOpenControlServices.GetRetakeOpenControlViewList(configuretView, schoolyearID)
- .Select(x => new
- {
- x.SchoolyearCode,
- x.StartDate,
- x.EndDate
- }).ToTable();
- string[] liststring = {
- "重修学年学期", "开始时间", "结束时间"
- };
- neh.Export(dt, liststring, "重修控制信息" + DateTime.Now.ToString("yyyyMMdd"));
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "导出成功。"
- });
- }
- }
- }
|