public void When执行AnalysisExcelToDormInfoSimple函数()
 {
     var context = new DormManageMvcContext();
     var analysisExcel = new AnalysisExcel(context);
     var scope = new TransactionScope();
     _results = analysisExcel.AnalysisExcelToDormInfoSimple(_filePath, ref _errorInfo);
     scope.Dispose();
 }
 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);
 }