public void When执行ImportInfo函数() { var dormInfoSimpleDao = new DormInfoSimpleDao(_context); _result = dormInfoSimpleDao.ImportInfo(_data).ToString(); }
public ActionResult ReceiveFile(HttpPostedFileBase file) { //return View("Import"); var tips = ""; var import = new AnalysisExcel(Db); var vsnewname = System.DateTime.Now.ToString("yyyyMMddHHmmssffff"); var str = file.FileName.Split('.'); var path = "~/Upload/DormInfo/" + vsnewname + "." + str[str.Length - 1]; file.SaveAs(Server.MapPath(path)); var dormInfoSimpleList = import.AnalysisExcelToDormInfoSimple(Server.MapPath(path), ref tips); var dormInfoSimpleDao = new DormInfoSimpleDao(Db); return View("Import", null, dormInfoSimpleDao.ImportInfo(dormInfoSimpleList) ? "导入成功" : tips); }