public static void uploadImportDefinition(ICswResources CswResources, CswWebSvcReturn ret, CswNbtImportWcf.ImportFileParams parms) { CswNbtResources CswNbtResources = (CswNbtResources)CswResources; CswNbtImporter Importer = new CswNbtImporter(CswNbtResources.AccessId, CswEnumSetupMode.NbtWeb); // Write uploaded file to temp dir CswTempFile myTempFile = new CswTempFile(CswResources); string path = myTempFile.saveToTempFile(parms.PostedFile.InputStream, DateTime.Now.Ticks + "_" + parms.PostedFile.FileName); Importer.storeDefinition(path, parms.ImportDefName); Importer.Finish(); }
public static void uploadImportData(ICswResources CswResources, CswNbtImportWcf.ImportDataReturn ret, CswNbtImportWcf.ImportFileParams parms) { CswNbtResources CswNbtResources = (CswNbtResources)CswResources; // Write uploaded file to temp dir CswFilePath FilePathMgr = new CswFilePath(CswResources); string FullFilePath = System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath + "\\import\\" + FilePathMgr.getFileNameForSchema(parms.PostedFile.FileName); FileStream ImportDataFile = File.Create(FullFilePath); parms.PostedFile.InputStream.CopyTo(ImportDataFile); ImportDataFile.Close(); parms.PostedFile.InputStream.Close(); ret.JobId = CswNbtImportTools.storeData(CswNbtResources, parms.PostedFile.FileName, FullFilePath, parms.ImportDefName, parms.Overwrite); }