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"));
        }
Ejemplo n.º 2
0
 protected void btnPreProcessExport_Click(object sender, EventArgs e)
 {
     if (!fImport.HasFile)
     {
         lblError.Text = "Please select a Synapse Schema Export file to process";
     }
     else
     {
         lblError.Text = string.Empty;
         showSelectObjects();
         Session.Remove("export");
         Export ex;
         try
         {
             ex = createObjectFromExport(fImport.PostedFile.InputStream);
             Session["Export"] = ex;
             SynapseHelpers.CompareSchema(ex, SynapseHelpers.DataSetSerializerType.Json);
             ConsentTreeView(ex);
         }
         catch (Exception ex1)
         {
             Session.Remove("export");
             lblError.Text  = ex1.Message;
             lblError.Text += "Please try a different export";
             showFileUpload();
         }
     }
 }