using Ninject; using System; using System.Web.Mvc; using WX.CRM.Common; using WX.CRM.IBLL.Quality; using WX.CRM.WebHelper; namespace WX.CRM.WEB.Controllers.Quality { public class UserCheckController : BaseController { // // GET: /UserCheck/ [Inject] public IQC_USERCHECK_Q usercheck { get; set; } [AuthorizeRedirect(Roles = InitRights.CONST_员工质检)] public ActionResult UserIndex() { ToolBar tool = new ToolBar(); //tool.AllowButton("Other1"); string[] toolbtn = new ToolButtonView().ToolButtonRight(InitRights.员工质检, userRightId); tool.AllowButton(toolbtn); tool.AddOtherButton("Other1", "导出", "icon-export", "Export", true); ViewBag.ToolBar = tool; var pager = new Pager() { page = 1, rows = 10 }; var tableId = "tablist"; var tab = new Table(tableId); tab.AddHeadCol("NAME", "10%", "姓名"); tab.AddHeadCol("GROUPNAME", "10%", "所属组别"); tab.AddHeadCol("ENTRYDATE", "", "入职时间"); tab.AddHeadCol("POSITIVETIME", "", "转正时间"); tab.AddHeadCol("DISMISSTIME", "", "离职时间"); tab.AddHeadCol("QUALITYTIME", "", "质检时间"); tab.AddHeadCol("QUALITYSTATUS", "", "质检审核状态"); tab.AddHeadCol("QUALITYMEMO", "", "质检说明"); tab.AddHeadCol("QUALITYADVISE", "", "质检建议"); tab.AddHeadRow(); ViewBag.List = tab.GetTable() + Pagination.GetPage(pager, tableId, "10,20,30"); ViewBag.inneruserid = UserId; ViewBag.userGroupId = userGroupId; ViewBag.saleDeptId = saleDeptId; ViewBag.roleCodes = DataCacheHelper.GetCache().Get_RoleCodes(userRoleId); return View(); } [AuthorizeRedirect(Roles = InitRights.CONST_员工质检)] public ActionResult GetUserList(Pager pager, string columns) { DateTime? dismissctime = Request.Form["dismissctime"].GetDateTime(); DateTime? dismissetime = Request.Form["dismissetime"].GetDateTimeAdd(1); DateTime? entryctime = Request.Form["entryctime"].GetDateTime(); DateTime? entryetime = Request.Form["entryetime"].GetDateTimeAdd(1); DateTime? positvectime = Request.Form["positvectime"].GetDateTime(); DateTime? positveetime = Request.Form["positveetime"].GetDateTimeAdd(1); DateTime? qualityctime = Request.Form["qualityctime"].GetDateTime(); DateTime? qualityetime = Request.Form["qualityetime"].GetDateTimeAdd(1); decimal? dismiss = Request.Form["dismiss"].GetDecimal(); decimal? qualitystatus = Request.Form["qualitystatus"].GetDecimal(); string groupId = Request.Form["groupId"]; decimal userId = Request.Form["userId"].GetDecimal(0); var list = usercheck.GetUserCheck(ref pager, dismiss, dismissctime, dismissetime, entryctime, entryetime, positvectime, positveetime, qualityctime, qualityetime, qualitystatus, groupId, userId); var table = new Table(columns, true); table.gridPager = pager; foreach (var model in list) { table.AddCol(model.EID + "-" + model.USERNAME); table.AddCol(model.GROUPNAME); table.AddCol(model.ENTRYDATE); table.AddCol(model.POSITIVETIME); table.AddCol(model.DISMISSTIME); table.AddCol(model.QUALITYTIME); table.AddCol(model.QUALITYSTATUS.HasValue ? (model.QUALITYSTATUS == 60 ? "审核未通过" : "审核已通过") : ""); table.AddCol(model.QUALITYMEMO); table.AddCol(model.QUALITYADVISE); table.AddRow(); } var json = new { totalPages = pager.totalPages, totalRows = pager.totalRows, rowsList = table.GetRows() }; return Json(json, JsonRequestBehavior.AllowGet); } [AuthorizeToolBar(InitRights.CONST_员工质检, InitToolBar.CONST_Other1)] public FileResult UserExport(string checkedFilds, string checkedTitle) { Pager pager = new Pager(); pager.page = 1; pager.rows = int.MaxValue; DateTime? dismissctime = Request.QueryString["dismissctime"].GetDateTime(); DateTime? dismissetime = Request.QueryString["dismissetime"].GetDateTimeAdd(1); DateTime? entryctime = Request.QueryString["entryctime"].GetDateTime(); DateTime? entryetime = Request.QueryString["entryetime"].GetDateTimeAdd(1); DateTime? positvectime = Request.QueryString["positvectime"].GetDateTime(); DateTime? positveetime = Request.QueryString["positveetime"].GetDateTimeAdd(1); DateTime? qualityctime = Request.QueryString["qualityctime"].GetDateTime(); DateTime? qualityetime = Request.QueryString["qualityetime"].GetDateTimeAdd(1); decimal? dismiss = Request.QueryString["dismiss"].GetDecimal(); decimal? qualitystatus = Request.QueryString["qualitystatus"].GetDecimal(); string groupId = Request.QueryString["groupId"]; decimal userId = Request.QueryString["userId"].GetDecimal(0); var list = usercheck.GetUserCheck(ref pager, dismiss, dismissctime, dismissetime, entryctime, entryetime, positvectime, positveetime, qualityctime, qualityetime, qualitystatus, groupId, userId); return File(ExcelHelper.ExportListModelToExcel(list, "视频审核", int.MaxValue, checkedFilds, checkedTitle, DataFormart), "application/ms-excel", PageRequest.GetDlownLoadName("视频审核" + DateTime.Now.ToString("yyyy-MM-dd hh:ss:mm") + ".xls")); } public string DataFormart(string key, object value) { string formartValue = string.Empty; switch (key) { case "QUALITYSTATUS": formartValue = value == null ? "" : ((decimal)value == 60 ? "审核未通过" : "审核已通过"); break; default: formartValue = string.Format("{0}", value); break; } return formartValue; } } }