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(); }
public void ContinueWithUpdate(string tempFile) { UploadedFilePath = tempFile; try { IImportRecord record = Engine.Resolve<Updater>().Read(UploadedFilePath); updatedItems.CurrentItem = record.RootItem; rptAttachments.DataSource = record.Attachments; if (Selection.SelectedItem.GetContentType().Equals(record.RootItem.GetContentType()) != true) { pnlTypeMissmatch.Visible = true; } ShowErrors(record); } catch (WrongVersionException) { using (Stream s = File.OpenRead(UploadedFilePath)) { N2XmlReader xr = new N2XmlReader(N2.Context.Current); updatedItems.CurrentItem = xr.Read(s); } } DataBind(); }
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); }
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); }
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(); }
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(); }