public IActionResult ImportFile(IFormFile formFile)
        {
            //lblError.Text = string.Empty;
            //showSelectObjects();
            //Session.Remove("export");
            Export ex;

            try
            {
                Stream       memoryStream = formFile.OpenReadStream();
                StreamReader sr           = new StreamReader(memoryStream);
                ex = SynapseHelpers.DeserialiseExport(sr.ReadToEnd());
                sr.Close(); sr.Dispose();
                SynapseHelpers.CompareSchema(ex, SynapseHelpers.DataSetSerializerType.Json);
                HttpContext.Session.SetString("ExportSchema", JsonConvert.SerializeObject(ex));
                ViewBag.Json = JsonConvert.SerializeObject(ConsentTreeView(ex));
            }
            catch (Exception ex1)
            {
                //Session.Remove("export");
                //lblError.Text = ex1.Message;
                // lblError.Text += "Please try a different export";
                //showFileUpload();
            }
            return(View("SchemaImport"));
        }
Пример #2
0
        public Export createObjectFromExport(Stream stream)
        {
            StreamReader sr = new StreamReader(stream);
            Export       ex = SynapseHelpers.DeserialiseExport(sr.ReadToEnd());

            sr.Close(); sr.Dispose();
            return(ex);
        }
Пример #3
0
        public Export createObjectFromExport(string filename)
        {
            StreamReader sr = new StreamReader("c:\\export\\" + filename);
            Export       ex = SynapseHelpers.DeserialiseExport(sr.ReadToEnd());

            sr.Close(); sr.Dispose();

            return(ex);
        }