示例#1
0
        private documentCarrier createCarrier(Document doc)
        {
            documentCarrier carrier = new documentCarrier();

            carrier.ExpireDate  = doc.ExpireDate;
            carrier.ReleaseDate = doc.ReleaseDate;
            carrier.Id          = doc.Id;
            carrier.Name        = doc.Text;

            try
            {
                carrier.ParentID = doc.Parent.Id;
            }
            catch
            {
            }

            carrier.Published   = doc.Published;
            carrier.HasChildren = doc.HasChildren;
            var props = doc.getProperties;

            foreach (umbraco.cms.businesslogic.property.Property prop in props)
            {
                documentProperty carrierprop = new documentProperty();

                if (prop.Value == System.DBNull.Value)
                {
                    carrierprop.PropertyValue = null;
                }
                else
                {
                    carrierprop.PropertyValue = prop.Value;
                }

                carrierprop.Key = prop.PropertyType.Alias;
                carrier.DocumentProperties.Add(carrierprop);
            }
            return(carrier);
        }
        private documentCarrier createCarrier(Document doc)
        {
            documentCarrier carrier = new documentCarrier();
            carrier.ExpireDate = doc.ExpireDate;
            carrier.ReleaseDate = doc.ReleaseDate;
            carrier.Id = doc.Id;
            carrier.Name = doc.Text;

            try
            {
                carrier.ParentID = doc.Parent.Id;
            }
            catch
            {
            }

            carrier.Published = doc.Published;
            carrier.HasChildren = doc.HasChildren;
            var props = doc.GenericProperties;
            foreach (umbraco.cms.businesslogic.property.Property prop in props)
            {
                documentProperty carrierprop = new documentProperty();

                if (prop.Value == System.DBNull.Value)
                {
                    carrierprop.PropertyValue = null;
                }
                else
                {
                    carrierprop.PropertyValue = prop.Value;
                }

                carrierprop.Key = prop.PropertyType.Alias;
                carrier.DocumentProperties.Add(carrierprop);
            }
            return carrier;

        }