public ActionResult AllTaskImport(AllTaskImportModel model, int pageIndex = 1) { if (Request.IsAjaxRequest()) { const int pageSize = 3; AllTaskImportModel = new AllTaskImportModel(); PagedList<TaskImportModel> infoPagerList = AllTaskImportModel.GetTaskImportPagedList(pageIndex, pageSize); ViewData["Task"] = _listService.GetTaskNameExceptAddPigList(); AllTaskImportModel.TaskImportModels = infoPagerList; return PartialView("UCJqAllTaskImport", AllTaskImportModel); } //根据所选择的任务类型导入到不同的表中 try { string returnstring = _allTaskImportModelService.ImportByCertainTask(model); if (returnstring != "") Response.Write("<script language='JavaScript'>alert('" + returnstring + ".');history.go(0);</script>"); } catch (Exception e) { Response.Write("<script language='JavaScript'>alert('" + e + ".');history.go(0);</script>"); } ViewData["Task"] = _listService.GetTaskNameList(); return View(model); }
public ActionResult AllTaskImport(int pageIndex = 1) { if (Session["CheckFeed"] == null || !(bool) Session["CheckDataImport"]) { Response.Write("<script>history.go(0);</script>"); return View("Error"); } //删除0字节的文件 var strFiles = new DirectoryInfo(@"c:\pigrecorder"); if (strFiles.Exists) { foreach (FileInfo strFile in strFiles.GetFiles()) { if (strFile.Length == 0) { System.IO.File.Delete(strFile.FullName); } } } const int pageSize = 25; AllTaskImportModel = new AllTaskImportModel(); PagedList<TaskImportModel> infoPagerList = AllTaskImportModel.GetTaskImportPagedList(pageIndex, pageSize); ViewData["Task"] = _listService.GetTaskNameExceptAddPigList(); AllTaskImportModel.TaskImportModels = infoPagerList; if (Request.IsAjaxRequest()) { return PartialView("UCJqAllTaskImport", AllTaskImportModel); } return View(AllTaskImportModel); }