예제 #1
0
        public void ContinueWithImport(string tempFile)
        {
            UploadedFilePath = tempFile;

            try
            {
                IImportRecord record = Engine.Resolve <Importer>().Read(UploadedFilePath);
                importedItems.CurrentItem = record.RootItem;
                rptAttachments.DataSource = record.Attachments;
                if (Selection.SelectedItem.Children.FindNamed(record.RootItem.Name) != null)
                {
                    pnlNewName.Visible = true;
                    txtNewName.Text    = record.RootItem.Name;
                }
                ShowErrors(record);
            }
            catch (WrongVersionException)
            {
                using (Stream s = File.OpenRead(UploadedFilePath))
                {
                    N2XmlReader xr = new N2XmlReader(N2.Context.Current);
                    importedItems.CurrentItem = xr.Read(s);
                }
            }

            DataBind();
        }
예제 #2
0
        protected void btnImportUploaded_Click(object sender, EventArgs e)
        {
            Importer importer = Engine.Resolve <Importer>();

            IImportRecord record;

            try
            {
                record = importer.Read(UploadedFilePath);
                ShowErrors(record);
            }
            catch (WrongVersionException)
            {
                N2XmlReader xr   = new N2XmlReader(N2.Context.Current);
                ContentItem item = xr.Read(File.OpenRead(UploadedFilePath));
                record = CreateRecord(item);
            }

            Import(importer, record);
        }
예제 #3
0
        internal void ImportNow(HttpPostedFile postedFile)
        {
            Importer importer = Engine.Resolve <Importer>();

            IImportRecord record;

            try
            {
                record = importer.Read(postedFile.InputStream, postedFile.FileName);
            }
            catch (WrongVersionException)
            {
                N2XmlReader xr   = new N2XmlReader(N2.Context.Current);
                ContentItem item = xr.Read(postedFile.InputStream);
                record = CreateRecord(item);
                ShowErrors(record);
            }

            Import(importer, record);
        }
예제 #4
0
        public void ContinueWithImport(string tempFile)
        {
            UploadedFilePath = tempFile;

            try
            {
                IImportRecord record = Engine.Resolve <Importer>().Read(UploadedFilePath);
                importedItems.CurrentItem = record.RootItem;
                rptAttachments.DataSource = record.Attachments;
                ShowErrors(record);
            }
            catch (WrongVersionException)
            {
                using (Stream s = File.OpenRead(UploadedFilePath))
                {
                    N2XmlReader xr = new N2XmlReader(N2.Context.Current);
                    importedItems.CurrentItem = xr.Read(s);
                }
            }

            DataBind();
        }
예제 #5
0
        protected void btnVerify_Click(object sender, EventArgs e)
        {
            UploadedFilePath = System.IO.Path.GetTempFileName() + System.IO.Path.GetExtension(fuImport.PostedFile.FileName);
            fuImport.PostedFile.SaveAs(UploadedFilePath);

            try
            {
                IImportRecord record = Engine.Resolve <Importer>().Read(UploadedFilePath);
                importedItems.CurrentItem = record.RootItem;
                rptAttachments.DataSource = record.Attachments;
                ShowErrors(record);
            }
            catch (WrongVersionException)
            {
                using (Stream s = File.OpenRead(UploadedFilePath))
                {
                    N2XmlReader xr = new N2XmlReader(N2.Context.Current);
                    importedItems.CurrentItem = xr.Read(s);
                }
            }
            uploadFlow.ActiveViewIndex = 1;
            uploadFlow.Views[1].DataBind();
        }