123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using Bowin.Web.Controls.Mvc;
- using Bowin.Common.Utility;
- using Bowin.Common.Data;
- using EMIS.ViewModel;
- using EMIS.Web.Controls;
- using EMIS.CommonLogic.DegreeManage.DegreeSetting;
- using EMIS.ViewModel.DegreeManage.DegreeSetting;
- namespace EMIS.Web.Controllers.DegreeManage.DegreeSetting
- {
- [Authorization]
- public class DegreeConditionController : Controller
- {
- public IDegreeConditionServices DegreeConditionServices { 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);
- var isCurrent = pararms.getExtraInt("IsCurrentDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("IsCurrentDropDown");
- return base.Json(DegreeConditionServices.GetDegreeConditionViewGrid(configuretView, isCurrent,
- (int)pararms.page, (int)pararms.rows));
- }
- /// <summary>
- /// 编辑
- /// </summary>
- /// <param name="DegreeConditionID"></param>
- /// <returns></returns>
- [HttpGet]
- public ActionResult Edit(Guid? DegreeConditionID)
- {
- DegreeConditionView degreeConditionView = new DegreeConditionView();
- if (DegreeConditionID.HasValue && DegreeConditionID != Guid.Empty)
- {
- degreeConditionView = DegreeConditionServices.GetDegreeConditionView(DegreeConditionID);
- }
- else
- {
- degreeConditionView.IsEnable = true;
- }
- return View(degreeConditionView);
- }
- /// <summary>
- /// 编辑
- /// </summary>
- /// <param name="degreeConditionView"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Edit(DegreeConditionView degreeConditionView)
- {
- try
- {
- DegreeConditionServices.DegreeConditionEdit(degreeConditionView);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存成功。"
- });
- }
- catch (Exception ex)
- {
- return 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);
- int? isCurrent = Request["IsCurrentDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request["IsCurrentDropDown"].ParseStrTo<int>();
- var dt = DegreeConditionServices.GetDegreeConditionViewList(configuretView, isCurrent)
- .Select(x => new
- {
- x.OrderNo,
- x.Title,
- x.IsEnableName
- }).ToTable();
- string[] liststring = {
- "序号", "条件名称", "启用状态"
- };
- neh.Export(dt, liststring, "学位条件信息" + DateTime.Now.ToString("yyyyMMdd"));
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "导出成功。"
- });
- }
- }
- }
|