123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using EMIS.CommonLogic.MinorManage.MinorSetting;
- using EMIS.ViewModel;
- using EMIS.Web.Controls;
- using Bowin.Web.Controls.Mvc;
- using EMIS.ViewModel.MinorManage.MinorSetting;
- using Bowin.Common.Utility;
- using Bowin.Common.Data;
- namespace EMIS.Web.Controllers.MinorManage.MinorSetting
- {
- [Authorization]
- public class MinorConditionController : Controller
- {
- //
- // GET: /MinorCondition/
- public IMinorConditionServices minorConditionServices { get; set; }
- [HttpGet]
- public ActionResult List()
- {
- return View();
- }
- [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(minorConditionServices.MinorConditionViewGrid(configuretView, isCurrent, (int)pararms.page, (int)pararms.rows));
- }
- /// <summary>
- /// 编辑
- /// </summary>
- /// <param name="minorConditionID"></param>
- /// <returns></returns>
- [HttpGet]
- public ActionResult Edit(Guid? minorConditionID)
- {
- MinorConditionView minorConditionView = new MinorConditionView();
- if (minorConditionID.HasValue && minorConditionID != Guid.Empty)
- {
- minorConditionView = minorConditionServices.GetMinorConditionView(minorConditionID);
- }
- else
- {
- minorConditionView.RecordStatus = 1;
- }
- return View(minorConditionView);
- }
- /// <summary>
- /// 编辑
- /// </summary>
- /// <param name="graduationConditionView"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Edit(MinorConditionView minorConditionView)
- {
- try
- {
- minorConditionServices.MinorConditionEdit(minorConditionView);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "保存失败,原因:" + ex.Message + "。"
- });
- }
- }
- [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 minorConditionIDString = Request.Form["SelectedID"];
- var minorConditionIDList = minorConditionIDString.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
- var dt = minorConditionServices.GetMinorConditionViewList(configuretView, isCurrent, minorConditionIDList)
- .Select(x => new
- {
- x.Title,
- x.RecordStatusStr
- }).ToTable();
- string[] liststring = { "条件名称", "启用状态" };
- neh.Export(dt, liststring, "辅修条件信息" + DateTime.Now.ToString("yyyyMMdd"));
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "导出成功。"
- });
- }
- }
- }
|