public JsonResult GetImportStatus() { DezineCorpImportService importservice = new DezineCorpImportService(string.Empty); var model = importservice.GetImportStatus(); return Json(model, JsonRequestBehavior.AllowGet); }
public ActionResult DezineCorpImport(FormCollection formCollection) { if (Request != null) { HttpPostedFileBase file = Request.Files["UploadedFile"]; var allowedExtensions = new[] { ".xls" }; var ext = Path.GetExtension(file.FileName); if (allowedExtensions.Contains(ext)) if ((file != null) && (file.ContentLength > 0) && !string.IsNullOrEmpty(file.FileName)) { string name = Path.GetFileNameWithoutExtension(file.FileName); string myfile = name + "_" + Guid.NewGuid() + ".xls"; string fileName = file.FileName; string fileContentType = file.ContentType; byte[] fileBytes = new byte[file.ContentLength]; var data = file.InputStream.Read(fileBytes, 0, Convert.ToInt32(file.ContentLength)); var path = Path.Combine(Server.MapPath("~/Administration/DezineCorpImport"), myfile); file.SaveAs(path); DezineCorpImportService importservice = new DezineCorpImportService(path); Thread thread = new Thread(importservice.READExcel); thread.Start(); } } return View(); }