private static void InsertPage(string title) { using ( Composite.Data.DataConnection connection = new Composite.Data.DataConnection() ) { ////// *** PAGE *** ////// // PageType Id find Guid pageTypeId; pageTypeId = connection.Get<Composite.Data.Types.IPageType>().First().Id; // Template Page ID find //Guid templateId; //templateId = connection.Get<IPageTemplate>().First().Id; // // make new website Guid parentId = Guid.Empty; // Culture = Danish System.Globalization.CultureInfo pageCulture; pageCulture = new System.Globalization.CultureInfo("en-US"); // test markup string pageContentXhtml = "<h1>This is content</h1><p>Hello world!</p>"; Composite.Data.Types.IPage page; page = Composite.Data.DataConnection.New<Composite.Data.Types.IPage>(); page.Id = Guid.NewGuid(); page.PageTypeId = Guid.NewGuid(); page.TemplateId = Guid.NewGuid(); page.Title = title; page.CultureName = pageCulture.Name; page.UrlTitle = "Title"; page.MenuTitle = "Menu"; page.Description = "Description"; //page = page.AddPageAtBottom(parentId); ////// *** PLACEHOLDER *** ////// Composite.Data.Types.IPagePlaceholderContent placeholder_content; placeholder_content = Composite.Data.DataConnection .New<Composite.Data.Types.IPagePlaceholderContent>(); placeholder_content.Content = pageContentXhtml; placeholder_content.PlaceHolderId = "contentplaceholder"; placeholder_content.PageId = page.Id; using ( Composite.Data.DataScope dataScope = new Composite.Data.DataScope ( Composite.Data.DataScopeIdentifier.Administrated ) ) { page = connection.Add<Composite.Data.Types.IPage>(page); placeholder_content = connection.Add<Composite.Data.Types.IPagePlaceholderContent> ( placeholder_content ); page.PublicationStatus = "published"; placeholder_content.PublicationStatus = "published"; connection.Update<Composite.Data.Types.IPage>(page); connection.Update<Composite.Data.Types.IPagePlaceholderContent>(placeholder_content); } } }
public string Push( string datetime , string title , string article ) { string msg = //"OK" "Date=" + datetime + Environment.NewLine + "Title=" + title + Environment.NewLine + "Article=" + article ; //context.Response.Write(functionResult.ToString()); using ( Composite.Data.DataConnection connection = new Composite.Data.DataConnection() ) { ////// *** PAGE *** ////// // PageType Id find Guid pageTypeId; pageTypeId = connection.Get<Composite.Data.Types.IPageType>().First().Id; // Template Page ID find //Guid templateId; // templateId = connection.Get<Composite.Core.PageTemplates.IPageTemplate>().First().Id; // // make new website Guid parentId = Guid.Empty; // Culture = Danish System.Globalization.CultureInfo pageCulture; pageCulture = new System.Globalization.CultureInfo("en-US"); // test markup string pageContentXhtml = "<h1>This is content</h1><p>Hello world!</p>"; Composite.Data.Types.IPage page; page = Composite.Data.DataConnection.New<Composite.Data.Types.IPage>(); page.Id = Guid.NewGuid(); page.PageTypeId = Guid.NewGuid(); page.TemplateId = Guid.NewGuid(); page.Title = title; page.CultureName = pageCulture.Name; page.UrlTitle = "Title"; page.MenuTitle = "Menu"; page.Description = "Description"; //page = page.AddPageAtBottom(parentId); ////// *** PLACEHOLDER *** ////// Composite.Data.Types.IPagePlaceholderContent placeholder_content; placeholder_content = Composite.Data.DataConnection .New<Composite.Data.Types.IPagePlaceholderContent>(); placeholder_content.Content = pageContentXhtml; placeholder_content.PlaceHolderId = "contentplaceholder"; placeholder_content.PageId = page.Id; using ( Composite.Data.DataScope dataScope = new Composite.Data.DataScope ( Composite.Data.DataScopeIdentifier.Administrated ) ) { page = connection.Add<Composite.Data.Types.IPage>(page); placeholder_content = connection.Add<Composite.Data.Types.IPagePlaceholderContent> ( placeholder_content ); page.PublicationStatus = "published"; placeholder_content.PublicationStatus = "published"; connection.Update<Composite.Data.Types.IPage>(page); connection.Update<Composite.Data.Types.IPagePlaceholderContent>(placeholder_content); } } return msg; }