当前位置: 首页>>代码示例>>C#>>正文


C# IPublishedContent.GetProperty方法代码示例

本文整理汇总了C#中IPublishedContent.GetProperty方法的典型用法代码示例。如果您正苦于以下问题:C# IPublishedContent.GetProperty方法的具体用法?C# IPublishedContent.GetProperty怎么用?C# IPublishedContent.GetProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IPublishedContent的用法示例。


在下文中一共展示了IPublishedContent.GetProperty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CountryCost

        public CountryCost(IPublishedContent costCountry, string goalCurrency)
        {
            if (costCountry == null)
            {
                throw new PatentVistaMissingValueException("Het kostenland is niet ingevuld! Waarschijnlijk ben je vergeten om dit land aan een kostenland te koppelen");
            }

            if (!costCountry.DocumentTypeAlias.Equals("Landkosten"))
            {
                throw new ArgumentException("CountryCost object must receive a Landkosten node instead of a {0} node", costCountry.DocumentTypeAlias);
            }

            if (costCountry.GetProperty("valutacode").Value != null)
            {
                var umbHelper = new UmbracoHelper(UmbracoContext.Current);
                object valutaCode = costCountry.GetProperty("valutacode").Value;
                if (valutaCode == null || valutaCode == "")
                {
                    throw new PatentVistaMissingValueException(String.Format("De valutacode voor kostenland {0} is niet ingevuld", costCountry.Name));
                }
                IPublishedContent valutaItem = umbHelper.TypedContent(valutaCode.ToString());

                if (valutaItem == null)
                {
                    throw new PatentVistaMissingValueException(String.Format("Er hangt voor kostenland {0} misschien wat oude data in de Umbraco cache. Koppel {0} " +
                                                                             "(het kostenland, niet het land) opnieuw aan een valuta en save en publiceer {0} " +
                                                                             "  opnieuw", costCountry.Name));
                }

                currencyCode = valutaItem.Name;
            }

            localDollarRate = CurrencyHelper.FindDollarRate(currencyCode);
            goalDollarRate = CurrencyHelper.FindDollarRate(goalCurrency);

            onlineIndienen = UmbracoFieldHelper.GetIntField(costCountry, "onlineIndienen");
            eersteIndiening = UmbracoFieldHelper.GetIntField(costCountry, "eersteIndiening");
            extraClaimkostenVanafClaim10 = UmbracoFieldHelper.GetIntField(costCountry, "extraClaimkostenVanafClaim10");
            nieuwheidsonderzoekNationaalType = UmbracoFieldHelper.GetIntField(costCountry, "nieuwheidsonderzoekNationaalType");
            nieuwheidsonderzoekInternationaalType = UmbracoFieldHelper.GetIntField(costCountry, "nieuwheidsonderzoekInternationaalType");
            examination = UmbracoFieldHelper.GetIntField(costCountry, "examination");
            kostenVerlening = UmbracoFieldHelper.GetIntField(costCountry, "kostenVerlening");
            publicatiekostenVerlening = UmbracoFieldHelper.GetIntField(costCountry, "publicatiekostenVerlening");

            for (int i = 1; i <= 20; i++)
            {
                jaren.Add(i, UmbracoFieldHelper.GetIntField(costCountry, String.Format("jaar{0}", i)));
            }
        }
开发者ID:rubenski,项目名称:pvista,代码行数:49,代码来源:CountryCost.cs

示例2: AddCountry

        // private readonly IContentService _contentService = ApplicationContext.Current.Services.ContentService;
        public void AddCountry(IPublishedContent country)
        {
            var continentProperty = country.GetProperty("continent");

            if (continentProperty != null)
            {
                var continentId = continentProperty.Value.ToString();

                Continent continent = null;
                foreach (var existingContinents in _continents)
                {
                    if (existingContinents.Id.Equals(continentId))
                    {
                        continent = existingContinents;
                    }
                }
                if (continent == null)
                {
                    string continentName = library.GetPreValueAsString((Convert.ToInt32(continentId)));
                    continent = new Continent(continentName, continentId);
                    _continents.Add(continent);
                }

                continent.AddCountryLink(new LinkModel(country.Name, country.Url));

            }
        }
开发者ID:rubenski,项目名称:pvista,代码行数:28,代码来源:CountryListingModel.cs

示例3: MapProjectToSimpleDataIndexItem

        public SimpleDataSet MapProjectToSimpleDataIndexItem(IPublishedContent project, SimpleDataSet simpleDataSet, string indexType,
            int karma, IEnumerable<WikiFile> files, int downloads, IEnumerable<string> compatVersions)
        {
            simpleDataSet.NodeDefinition.NodeId = project.Id;
            simpleDataSet.NodeDefinition.Type = indexType;

            var desciption = project.GetPropertyValue<string>("description");
            if (!string.IsNullOrEmpty(desciption))
            {
                simpleDataSet.RowData.Add("body", umbraco.library.StripHtml(desciption));
            }
            simpleDataSet.RowData.Add("nodeName", project.Name);
            simpleDataSet.RowData.Add("updateDate", project.UpdateDate.ToString("yyyy-MM-dd HH:mm:ss"));
            simpleDataSet.RowData.Add("createDate", project.CreateDate.ToString("yyyy-MM-dd HH:mm:ss"));
            simpleDataSet.RowData.Add("nodeTypeAlias", "project");
            simpleDataSet.RowData.Add("url", project.Url );
            simpleDataSet.RowData.Add("uniqueId", project.GetPropertyValue<string>("packageGuid"));
            simpleDataSet.RowData.Add("worksOnUaaS", project.GetPropertyValue<string>("worksOnUaaS"));

            var imageFile = string.Empty;
            if (project.HasValue("defaultScreenshotPath"))
            {
                imageFile = project.GetPropertyValue<string>("defaultScreenshotPath");
            }
            if(string.IsNullOrWhiteSpace(imageFile))
            {
                var image = files.FirstOrDefault(x => x.FileType == "screenshot");
                if (image != null)
                    imageFile = image.Path;
            }
            //Clean up version data before its included in the index
            int o;
            var version = project.GetProperty("compatibleVersions").Value;
            var versions = version.ToString().ToLower()
                            .Replace("nan", "")
                            .Replace("saved", "")
                            .Replace("v", "")
                            .Trim(',').Split(',')
                            .Where(x => int.TryParse(x, out o))
                            .Select(x => (decimal.Parse(x.PadRight(3, '0') ) / 100));

            //popularity for sorting number = downloads + karma * 100;
            var pop = downloads + (karma * 100);

            simpleDataSet.RowData.Add("popularity", pop.ToString());
            simpleDataSet.RowData.Add("karma", karma.ToString());
            simpleDataSet.RowData.Add("downloads", downloads.ToString());
            simpleDataSet.RowData.Add("image", imageFile);

            //now we need to add the versions and compat versions
            // first, this is the versions that the project has files tagged against
            simpleDataSet.RowData.Add("versions", string.Join(",", versions));

            //then we index the versions that the project has actually been flagged as compatible against
            simpleDataSet.RowData.Add("compatVersions", string.Join(",", compatVersions));

            return simpleDataSet;
        }
开发者ID:larrynPL,项目名称:OurUmbraco,代码行数:58,代码来源:ProjectNodeIndexDataService.cs

示例4: Map

        public static IntranetMaster Map(IPublishedContent content, IntranetMaster model)
        {
            // Reference to the root (frontpage) node
            IPublishedContent rootNode = content.AncestorOrSelf(1);

            //Reference to the level 2 node
            IPublishedContent level2Node = content.AncestorOrSelf(2);

            // Get main navigation
            //model.MainNavigation = NavigationMapper.GetMainNavigation(rootNode, content);

            // Get top navigation
            //model.TopNavigation = NavigationMapper.GetTopNavigation(rootNode, content);

            model.LeftNavigation = NavigationMapper.GetIntranetMainNavigation(level2Node, content);

            model.MetaDescription = content.GetProperty("metaDescription") != null
                                        ? content.GetPropertyValue<string>("metaDescription")
                                        : string.Empty;

            model.MetaKeywords = content.GetProperty("metaKeywords") != null
                                     ? content.GetPropertyValue<string>("metaKeywords")
                                     : string.Empty;

            model.RedirectUrl = content.GetProperty("redirectURL") != null
                                    ? content.GetPropertyValue<string>("redirectURL")
                                    : string.Empty;

            model.BodyCssClass = level2Node != null
                                     ? level2Node.GetPropertyValue<string>("cssClassName")
                                     : string.Empty;

            model.SiteName = rootNode.GetProperty("siteName") != null
                                 ? rootNode.GetPropertyValue<string>("siteName")
                                 : string.Empty;

            model.SiteDescription = rootNode.GetProperty("siteDescription") != null
                                 ? rootNode.GetPropertyValue<string>("siteDescription")
                                 : string.Empty;

            model.Name = content.Name;

            return model;
        }
开发者ID:pjengaard,项目名称:lilleGrundetDk,代码行数:44,代码来源:IntranetMasterMapper.cs

示例5: Map

        public static WebsiteHouse Map(IPublishedContent content)
        {
            var model = new WebsiteHouse
                {
                    HouseNumber = content.GetProperty("husnummer") != null
                            ? content.GetPropertyValue<int>("husnummer")
                            : -1,

                    Residents = WebsiteResidentMapper.MapResidents(content),

                    ResidentsString = content.HasValue("antalPersonerIHusstanden") ? content.GetPropertyValue<string>("antalPersonerIHusstanden") : "",

                    MoveInDate = content.GetProperty("indflytningsdato") != null
                            ? content.GetPropertyValue<DateTime>("indflytningsdato")
                            : DateTime.MinValue
                };

            return model;
        }
开发者ID:pjengaard,项目名称:lilleGrundetDk,代码行数:19,代码来源:WebsiteHouseMapper.cs

示例6: Map

        public static WebsiteFrontpage Map(IPublishedContent content)
        {
            var andelTilSalgNodeId = content.GetProperty("andelTilSalg") != null
                                         ? content.GetPropertyValue<int>("andelTilSalg")
                                         : -1;

            //throw new Exception("FEJL: " + content.GetPropertyValue("andelTilSalg"));

            var model = new WebsiteFrontpage
                {
                    MainContent = content.GetProperty("bodyText") != null
                                      ? content.GetPropertyValue<string>("bodyText")
                                      : string.Empty,
                    AndelTilSalg = andelTilSalgNodeId > 0
                                        ? UmbracoContext.Current.ContentCache.GetById(andelTilSalgNodeId).Url
                                        : "",
                    Billeder = MediaMapper.GetImagesUrls(content, "billeder", 181, 184)
                };

            return model;
        }
开发者ID:pjengaard,项目名称:lilleGrundetDk,代码行数:21,代码来源:FrontpageMapper.cs

示例7: Map

        public static WebsitePage Map(IPublishedContent content)
        {
            var model = new WebsitePage
                {
                    GalleryShortcut = content.TypedContent("galleryLink"),
                    BodyText = content.GetProperty("bodyText") != null
                                   ? content.GetPropertyValue<string>("bodyText")
                                   : string.Empty,
                    Billeder = MediaMapper.GetImagesUrls(content, "billeder", 324, 142),
                    Content = content
                };

            return model;
        }
开发者ID:pjengaard,项目名称:lilleGrundetDk,代码行数:14,代码来源:WebsitePageMapper.cs

示例8: SetValues

        /// <summary>
        /// Gets all properties with PropertyAttribute and sets their value
        /// </summary>
        /// <param name="content"></param>
        private void SetValues(IPublishedContent content)
        {
            foreach (var property in GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(prop => Attribute.IsDefined(prop, typeof(PropertyAttribute), false)))
            {
                var alias = property.GetCustomAttribute<PropertyAttribute>(false).Alias;
                var publishedProperty = content.GetProperty(alias);

                //Local links cause stack overflow when accessing value during publish.
                //Use @Html.Raw(TemplateUtilities.ParseInternalLinks(value)) to resolve these URLs on the template.
                if (publishedProperty.DataValue is String && (publishedProperty.DataValue as String).Contains("localLink"))
                {
                    SetValue(property, publishedProperty.DataValue);
                }
                else
                {
                    SetValue(property, publishedProperty.Value);
                }
            }
        }
开发者ID:richieallen,项目名称:ucreate,代码行数:23,代码来源:BaseDocType.cs

示例9: SetValues

        /// <summary>
        /// Gets all properties with PropertyAttribute and sets their value
        /// </summary>
        /// <param name="content"></param>
        private void SetValues(IPublishedContent content)
        {
            var properties = ReflectionHelper.GetPropertiesWithAttribute<PropertyAttribute>(GetType(), bindingFlags: BindingFlags.Public | BindingFlags.Instance);

            foreach (var property in properties)
            {
                var alias = property.GetCustomAttribute<PropertyAttribute>(false).Alias;
                var publishedProperty = content.GetProperty(alias);

                //Local links cause stack overflow when accessing value during publish.
                //Use @Html.Raw(TemplateUtilities.ParseInternalLinks(value)) to resolve these URLs on the template.
                if (publishedProperty.DataValue is string && (publishedProperty.DataValue as string).Contains("localLink"))
                {
                    SetValue(property, publishedProperty.DataValue);
                }
                else
                {
                    SetValue(property, publishedProperty.Value);
                }
            }
        }
开发者ID:nicbell,项目名称:ucreate,代码行数:25,代码来源:BaseDocType.cs

示例10: GetStringValue

    public static string GetStringValue(IPublishedContent node, string propertyName)
    {
        if (node.HasValue(propertyName))
        {
            var property = node.GetProperty(propertyName);
            if (property == null) return "";

            return property.Value.ToString();
        }

        return "";
    }
开发者ID:Wolframart,项目名称:wolframart,代码行数:12,代码来源:Tapas.cs

示例11: GetPropertyInternal

		private PropertyResult GetPropertyInternal(string alias, IPublishedContent content, bool checkUserProperty = true)
		{
			if (alias.IsNullOrWhiteSpace()) throw new ArgumentNullException("alias");
			if (content == null) throw new ArgumentNullException("content");

			//if we're looking for a user defined property
			if (checkUserProperty)
			{
				var prop = content.GetProperty(alias);

				return prop == null
						? null
						: new PropertyResult(prop, PropertyResultType.UserProperty)
						{
							DocumentTypeAlias = content.DocumentTypeAlias,
							DocumentId = content.Id
						};
			}

			//reflect

			Func<string, Attempt<object>> getMember =
				memberAlias =>
				{
					try
					{
						return new Attempt<object>(true,
												   content.GetType().InvokeMember(memberAlias,
																				  System.Reflection.BindingFlags.GetProperty |
																				  System.Reflection.BindingFlags.Instance |
																				  System.Reflection.BindingFlags.Public,
																				  null,
																				  content,
																				  null));
					}
					catch (MissingMethodException ex)
					{
						return new Attempt<object>(ex);
					}
				};

			//try with the current casing
			var attempt = getMember(alias);
			if (!attempt.Success)
			{
				//if we cannot get with the current alias, try changing it's case
				attempt = alias[0].IsUpperCase()
					? getMember(alias.ConvertCase(StringAliasCaseType.CamelCase))
					: getMember(alias.ConvertCase(StringAliasCaseType.PascalCase));
			}

			return !attempt.Success
					? null
					: new PropertyResult(alias, attempt.Result, Guid.Empty, PropertyResultType.ReflectedProperty)
					{
						DocumentTypeAlias = content.DocumentTypeAlias,
						DocumentId = content.Id
					};
		}
开发者ID:elrute,项目名称:Triphulcas,代码行数:59,代码来源:DynamicPublishedContent.cs

示例12: GetStringValueRecursive

 public static string GetStringValueRecursive(IPublishedContent node, string propertyName)
 {
     var property = node.GetProperty(propertyName, true);
     if (property == null) return "";
     return property.Value.ToString();
 }
开发者ID:Wolframart,项目名称:wolframart,代码行数:6,代码来源:Tapas.cs

示例13: GetTypedGridHtml

        /// <summary>
        /// Gets the HTML for the Grid model.
        /// </summary>
        /// <param name="html">The instance of <code>HtmlHelper</code>.</param>
        /// <param name="content">The parent content item.</param>
        /// <param name="propertyAlias">The alias of the property.</param>
        /// <param name="framework">The framework used to render the Grid.</param>
        public static HtmlString GetTypedGridHtml(this HtmlHelper html, IPublishedContent content, string propertyAlias, string framework) {

            // Get the property with the specifeid alias
            IPublishedProperty property = content.GetProperty(propertyAlias);
            if (property == null) throw new NullReferenceException("No property type found with alias " + propertyAlias);

            // Get the property value
            GridDataModel value = property.Value as GridDataModel;
            if (value == null) return new HtmlString(String.Empty);
            
            // Load the partial view based on the specified framework
            return html.Partial("TypedGrid/" + framework, property.Value);
        
        }
开发者ID:skybrud,项目名称:Skybrud.Umbraco.GridData,代码行数:21,代码来源:TypedGridExtensionMethods.cs

示例14: GetUrlPickerUrl

    public static string GetUrlPickerUrl(IPublishedContent node, string value)
    {
        if (node.GetProperty(value) != null)
        {
            return new RazorLibraryCore(null).ToDynamicXml((string)node.GetProperty(value).Value).url;
        }

        return "";
    }
开发者ID:Wolframart,项目名称:wolframart,代码行数:9,代码来源:Tapas.cs

示例15: GetUrlPickerTitle

    public static string GetUrlPickerTitle(IPublishedContent node, string value)
    {
        if (node.GetProperty(value) != null)
        {
            return new RazorLibraryCore(null).ToDynamicXml((string)node.GetProperty(value).Value).XPath("//link-title").InnerText;
        }

        return "";
    }
开发者ID:Wolframart,项目名称:wolframart,代码行数:9,代码来源:Tapas.cs


注:本文中的IPublishedContent.GetProperty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。