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();
 }
Example #2
0
 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/Student/" + vsnewname + "." + str[str.Length - 1];
     file.SaveAs(Server.MapPath(path));
     var studentList = import.AnalysisExcelToStudent(Server.MapPath(path), ref tips);
     var studentDao = new StudentDao(Db);
     return View("Import", null, studentDao.ImportInfo(studentList) ? "导入成功" : tips);
 }