using System; using System.Collections.Generic; using System.Web.Mvc; using WX.CRM.Common; using WX.CRM.IBLL.Base; using WX.CRM.WebHelper; namespace WX.CRM.WEB.Controllers.Base { public class ExcelImportLogController : Controller { // // GET: /ExcelImportLog/ private IBAS_EXCELIMPORTLOG excelImportLog; private IBAS_EXCELIMPORTLOG_Q excelImportLog_Q; ValidationErrors errors = new ValidationErrors(); public ExcelImportLogController(IBAS_EXCELIMPORTLOG _excelImportLog, IBAS_EXCELIMPORTLOG_Q _excelImportLog_Q) { this.excelImportLog = _excelImportLog; this.excelImportLog_Q = _excelImportLog_Q; } #region 首页 [AuthorizeRedirect(Roles = InitRights.CONST_期货导入)] public ActionResult Index() { //ToolBar ToolBar tool = new ToolBar(); tool.AllowButton("Other1"); tool.AddOtherButton("Other1", "继续处理", "icon-return", "Continue_Click", true); ViewBag.ToolBar = tool; //table Pager pager = new Pager() { page = 1, rows = 10 }; string tableId = "tablist"; Table tab = new Table(tableId); tab.AddHeadCol("IMPORTID", "10%", "导入批次"); tab.AddHeadCol("FILENAME", "", "文件名"); tab.AddHeadCol("EXCELTYPE", "10%", "文件数据类型"); tab.AddHeadCol("DONESTATUS", "10%", "处理状态"); tab.AddHeadCol("DONEREMARK", "10%", "处理结果信息"); tab.AddHeadCol("CREATEUSER", "10%", "创建人"); tab.AddHeadCol("CTIME", "10%", "创建日期"); tab.AddHeadRow(); ViewBag.gridTable = tab.GetTable() + Pagination.GetPage(pager, tableId, "5,8,10,15"); return View(); } #endregion #region 列表 [HttpPost] /// /// 按照条件获取数据 /// /// /// /// [AuthorizeRedirect(Roles = InitRights.CONST_期货导入)] public JsonResult GetHtmlList(Pager pager, string columns) { string doneStatus = Request.Form["doneStatus"]; string excelType = Request.Form["excelType"]; string stime = Request.Form["stime"]; string etime = Request.Form["etime"]; var list = excelImportLog_Q.GetList(ref pager, doneStatus, excelType, stime, etime); Table table = new Table(columns, true); table.gridPager = pager; Dictionary userList = DataCacheHelper.GetCache().GetList_Inneruser(); foreach (var model in list) { table.AddCol(model.IMPORTID); table.AddCol(model.FILENAME); table.AddCol(model.EXCELTYPE); table.AddCol(GetDoneStatus(model.DONESTATUS)); table.AddCol(model.DONEREMARK); table.AddCol(userList[model.CREATEUSER]); table.AddCol(model.CTIME); table.AddRow(); } var json = new { totalPages = pager.totalPages, totalRows = pager.totalRows, rowsList = table.GetRows() }; return Json(json, JsonRequestBehavior.AllowGet); } private string GetDoneStatus(decimal status) { int _status = Convert.ToInt32(status); string statusStr = string.Empty; switch (_status) { case 200: statusStr = "数据生成成功"; break; case 110: statusStr = "已计算"; break; case 100: statusStr = "文件已导入"; break; case 70: statusStr = "无效"; break; } return statusStr; } #endregion } }