Ejemplo n.º 1
0
        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);
                }

            }
        }
Ejemplo n.º 2
0
    public string GetIcon(string productLine)
    {
        var    iconBase     = "/Frontend/Images/icons/";
        string icon         = string.Empty;
        string mini         = string.Empty;
        string conventional = string.Empty;
        string demo         = string.Empty;
        string parts        = string.Empty;
        string midi         = string.Empty;

        if (!string.IsNullOrEmpty(productLine))
        {
            using (var c = new Composite.Data.DataConnection())
            {
                var dataProductLines = c.Get <Kobelco.ProductLine>().ToList();
                foreach (var pl in dataProductLines)
                {
                    switch (pl.Name)
                    {
                    case "MHEX":
                        mini = pl.Id.ToString();
                        break;

                    case "CHEX":
                        conventional = pl.Id.ToString();
                        break;

                    case "PARTS":
                        parts = pl.Id.ToString();
                        break;

                    case "DEMO":
                        demo = pl.Id.ToString();
                        break;

                    case "MIDI":
                        midi = pl.Id.ToString();
                        break;

                    default:
                        break;
                    }
                }
            }
            if ((productLine.Contains(mini) || productLine.Contains(midi)) && !productLine.Contains(conventional))
            {
                icon = "mini.png";
            }
            else if (productLine.Contains(conventional) || productLine.Contains(demo))
            {
                icon = "fullline.png";
            }
            else if (productLine.Contains(parts) && !productLine.Contains(midi) && !productLine.Contains(mini) && !productLine.Contains(demo))
            {
                icon = "parts.png";
            }
        }
        else
        {
            icon = "latinamerica.png";
        }

        return(iconBase + icon);


        //
        // TODO: Add constructor logic here
        //
    }
Ejemplo n.º 3
0
        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;
        }