Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Solomon Closson 22 posts 42 karma points
    Oct 28, 2014 @ 15:23
    Solomon Closson
    0

    deprecated umbraco.cms.businesslogic.web.Document

    Hello what is the new way in Umbraco 7 to write out this method in a .cs file for a website that is being rendered in WebForms, that is attaching to a Document Type, called AccordionGroup in Umbraco -> Settings -> Document Types:

    public static AccordionGroup ParseDocument(Document aDocument)
    {
        AccordionGroup theAccordionGroup = new AccordionGroup();
    
        theAccordionGroup.ID = aDocument.Id; 
    
        if(aDocument.getProperty("headline") != null)
        {
            theAccordionGroup.Headline = aDocument.getProperty("headline").Value.ToString();
        }
    
        return theAccordionGroup;
    }
    
    public static Document ToDocument(XmlNode aXmlNode)
    {
        int theID = 0;
    
        XmlNode theIDNode = aXmlNode.SelectSingleNode("ID");
        XmlNode theHeadlineNode = aXmlNode.SelectSingleNode("Headline");
    
        if (theIDNode != null) int.TryParse(theIDNode.InnerText, out theID);
    
        if (theID > 0)
        {
            Document theDocument = new Document(theID);
    
            theDocument.getProperty("headline").Value = theHeadlineNode == null ? "" : theHeadlineNode.InnerText;
    
            return theDocument;
        }
        return null;
    }
    

    Or is this no longer being used? Thanks!

    Using the following namespaces:

    using umbraco.NodeFactory;
    using umbraco.cms.businesslogic.media;
    using umbraco.cms.businesslogic.web;
    

    Also, should I be using different namespaces? If so, which one?

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Oct 28, 2014 @ 17:21
    Jan Skovgaard
    0

    Hi Solomon

    Have you tried searching the documentation for the new API's here? http://our.umbraco.org/documentation/Reference/

    /Jan

  • Solomon Closson 22 posts 42 karma points
    Oct 28, 2014 @ 20:00
    Solomon Closson
    0

    Yes, but the Document object doesn't exist in the New API's. Should I be using the Content object? Basically, I am only using these .cs files to collect the information on nodes and output them inside User Controls. The documentation I read on Document, says that it is used to update, create, or add properties... So, not even sure that I need it. Perhaps someone can help me understand why it would be needed in this case? All I want to do is get the information and have it outputted in a class file's properties. I have a Parse method already for doing this, which seems to work fine... Ofcourse, uses Node, which is loading fine, but not entirely sure that that should be used in the new Umbraco 7 version.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Oct 29, 2014 @ 08:04
    Jan Skovgaard
    0

    Sounds like you're looking for the Model stuff? http://our.umbraco.org/documentation/Reference/Management-v6/Models/Content or do I misunderstood you? :)

    /Jan

Please Sign in or register to post replies

Write your reply to:

Draft