using Bowin.Common.Data; using Bowin.Common.Utility; using Bowin.Web.Controls.Mvc; using EMIS.CommonLogic.ProjectShareManage; using EMIS.ViewModel; using EMIS.ViewModel.ProjectShareManage; using EMIS.Web.Controls; using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; namespace EMIS.Web.Controllers.ProjectShareManage { public class ShareRecordController : Controller { public IShareRecordServices shareRecordServices { get; set; } /// /// 项目资讯页面 /// /// public ActionResult List() { return View(); } [HttpPost] public ActionResult List(QueryParamsModel pararms) { ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms); var startTime = pararms.getExtraDateTime("StartTime"); var endTime = pararms.getExtraDateTime("EndTime"); var title = pararms.getExtraString("Title"); var userID = pararms.getExtraGuid("StudentsComboGrid"); return base.Json(shareRecordServices.GetShareRecordViewGrid(configuretView, startTime, endTime, title, userID, (int)pararms.page, (int)pararms.rows)); } /// /// Excel导出 /// /// /// [HttpPost] public ActionResult Excel() { NpoiExcelHelper neh = new NpoiExcelHelper(); ConfiguretView conditionView = ConfiguretExtensions.GetConfiguretermsView(null); var startTime = Request.Form["StartTime"].ParseStrTo(); var endTime = Request.Form["EndTime"].ParseStrTo(); var title = Request.Form["Title"].ToString(); var userID = Request.Form["StudentsComboGrid"].ParseStrTo(); var shareRecordIDs = Request.Form["selectedIDs"].Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => new Guid(x)).ToList(); var dt = shareRecordServices.GetShareRecordViewList(conditionView, startTime, endTime, title, userID, shareRecordIDs).Select(x => new { x.YearMonthDay, x.Time, x.Title, x.UserName, x.ClassmajorName, x.Count, }).ToTable(); string[] liststring = { "年月日", "时间", "文章标题", "分享人", "班级", "积分" }; neh.Export(dt, liststring, "分享信息" + DateTime.Now.ToString("yyyyMMdd")); return Json(new ReturnMessage() { IsSuccess = true, Message = "导出成功。" }); } [HttpGet] public ActionResult GetCodeBack() { var headers = HttpContext.Request; return View(); } } }