using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using EMIS.CommonLogic.ChargeManage.ChargeSituation; using EMIS.ViewModel; using EMIS.Web.Controls; using Bowin.Web.Controls.Mvc; using EMIS.ViewModel.ChargeManage.ChargeSituation; using Bowin.Common.Utility; using Bowin.Common.Data; using EMIS.Utility; namespace EMIS.Web.Controllers.StudentSystem.Charge { [Authorization] public class StudentChargeDelayController : Controller { public IChargeDelayServices ChargeDelayServices { get; set; } /// /// 缓交申请页面(学生平台) /// /// [HttpGet] public ActionResult List() { return View(); } /// /// 缓交申请列表查询(学生平台) /// /// /// [HttpPost] public ActionResult List(QueryParamsModel pararms) { ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms); //登录用户user var user = EMIS.Utility.FormValidate.CustomPrincipal.Current; var chargeYearID = pararms.getExtraInt("ChargeYearDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ChargeYearDropDown"); var chargeProjectID = pararms.getExtraGuid("ChargeProjectComboGrid"); //状态 var chargeDelayStatus = pararms.getExtraInt("DictionaryChargeDelayStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryChargeDelayStatus"); return base.Json(ChargeDelayServices.GetStudentChargeDelayViewGrid(configuretView, user.UserID, chargeYearID, chargeProjectID, chargeDelayStatus, (int)pararms.page, (int)pararms.rows)); } /// /// 编辑(申请、修改) /// /// /// [HttpGet] public ActionResult Edit(Guid? chargeDelayID) { ChargeDelayView chargeDelayView = new ChargeDelayView(); if (chargeDelayID.HasValue && chargeDelayID != Guid.Empty) { chargeDelayView = ChargeDelayServices.GetChargeDelayEditView(chargeDelayID); } else { //登录用户user var user = EMIS.Utility.FormValidate.CustomPrincipal.Current; chargeDelayView.UserID = user.UserID; chargeDelayView.ChargeYear = BaseExtensions.GetCurrentYearID(); } return View(chargeDelayView); } /// /// 编辑(申请、修改) /// /// /// [HttpPost] public ActionResult Edit(ChargeDelayView chargeDelayView) { try { ChargeDelayServices.ChaegeDelayEdit(chargeDelayView); return Json(new ReturnMessage() { IsSuccess = true, Message = "保存成功。" }); } catch (Exception ex) { return Json(new ReturnMessage() { IsSuccess = false, Message = "保存失败,原因:" + ex.Message + "。" }); } } /// /// 导出Excel /// /// [HttpPost] public ActionResult Excel() { NpoiExcelHelper neh = new NpoiExcelHelper(); ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null); //登录用户user var user = EMIS.Utility.FormValidate.CustomPrincipal.Current; var chargeYearID = Request.Form["ChargeYearDropDown"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["ChargeYearDropDown"].ParseStrTo(); var chargeProjectID = Request.Form["ChargeProjectComboGrid"].ParseStrTo(); //审批状态 var chargeDelayStatus = Request.Form["DictionaryChargeDelayStatus"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryChargeDelayStatus"].ParseStrTo(); var dt = ChargeDelayServices.GetStudentChargeDelayViewList(configuretView, user.UserID, chargeYearID, chargeProjectID, chargeDelayStatus) .Select(x => new { x.StudentNo, x.UserName, x.SexName, x.ClassNo, x.ClassName, x.GradeMajorCode, x.GradeMajoyStr, x.CollegeCode, x.CollegeStr, x.ChargeYear, x.ChargeProjectStr, x.ActualAmount, x.PaidAmount, x.DelayAmount, x.InSchoolStatusName, x.Reason, x.RecordStatusName }).ToTable(); string[] liststring = { "学号", "姓名", "性别", "班级编号", "班级名称", "年级专业编号", "年级专业名称", RSL.Get("CollegeCode"), RSL.Get("CollegeName"), "缴费学年", "收费项目", "实收金额", "已缴金额", "缓交金额", "在校状态", "缓交原因", "状态" }; neh.Export(dt, liststring, "缓交申请信息" + DateTime.Now.ToString("yyyyMMdd") + "(" + user.Name.ToString() + ")"); return Json(new ReturnMessage() { IsSuccess = true, Message = "导出成功。" }); } } }