Exemple #1
0
        // POST: Datasets/Create
        public string ProcessDatasetFile()
        {
            Dataset dataset = datasetService.GetDataset(Request.Files["datasetFile"]);

            if (dataset != null)
            {
                return("This dataset already exists under the name: " + dataset.DatasetName);
            }
            var    datasetFile     = Request.Files["datasetFile"];
            string dir             = "~/App_Data/uploads/" + id.ToString();
            string inputFolderPath = Server.MapPath(dir);

            Directory.CreateDirectory(Server.MapPath(dir));
            Directory.CreateDirectory(Server.MapPath(dir) + @"\Discretizations\");
            InputHandler          inputHandler          = new InputHandler(Request.Files, inputFolderPath);
            InputValidationObject inputValidationObject = inputHandler.ValidateDatasetFiles();

            if (!inputValidationObject.IsValid)
            {
                ViewBag.Errors = String.Join("<br>", inputValidationObject.Errors);
            }
            fileArr = new byte[datasetFile.InputStream.Length];
            fileArr = inputHandler.getFileToArray();
            return(String.Join("<br>", inputValidationObject.Errors));
        }