當前位置: 首頁>>代碼示例>>C#>>正文


C# SiteUser.GetProperty方法代碼示例

本文整理匯總了C#中mojoPortal.Business.SiteUser.GetProperty方法的典型用法代碼示例。如果您正苦於以下問題:C# SiteUser.GetProperty方法的具體用法?C# SiteUser.GetProperty怎麽用?C# SiteUser.GetProperty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在mojoPortal.Business.SiteUser的用法示例。


在下文中一共展示了SiteUser.GetProperty方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ShowAuthenticatedProperties

        private void ShowAuthenticatedProperties(SiteUser siteUser)
        {
            mojoProfileConfiguration profileConfig = mojoProfileConfiguration.GetConfig();
            if (profileConfig != null)
            {
                foreach (mojoProfilePropertyDefinition propertyDefinition in profileConfig.PropertyDefinitions)
                {
            #if!MONO
                    // we are using the new TimeZoneInfo list but it doesn't work under Mono
                    // this makes us skip the TimeOffsetHours setting from mojoProfile.config which is not used under windows
                    if (propertyDefinition.Name == mojoProfilePropertyDefinition.TimeOffsetHoursKey) { continue; }
            #endif

                    // we allow this to be configured as a profile property so it can be required for registration
                    // but we don't need to load it here because we have a dedicated control for the property already
                    if (propertyDefinition.Name == mojoProfilePropertyDefinition.TimeZoneIdKey) { continue; }

                    if (
                         (propertyDefinition.VisibleToAuthenticated)
                            && (
                                    (propertyDefinition.OnlyAvailableForRoles.Length == 0)
                                    || (siteUser.IsInRoles(propertyDefinition.OnlyAvailableForRoles))
                                )
                                &&(
                                    (propertyDefinition.OnlyVisibleForRoles.Length == 0)
                                        || (WebUser.IsInRoles(propertyDefinition.OnlyVisibleForRoles))
                                  )

                        )
                    {
                        object propValue = siteUser.GetProperty(propertyDefinition.Name, propertyDefinition.SerializeAs, propertyDefinition.LazyLoad);
                        if (propValue != null)
                        {
                            mojoProfilePropertyDefinition.SetupReadOnlyPropertyControl(
                                pnlProfileProperties,
                                propertyDefinition,
                                propValue.ToString(),
                                timeOffset,
                                timeZone);
                        }
                        else
                        {
                            mojoProfilePropertyDefinition.SetupReadOnlyPropertyControl(
                                pnlProfileProperties,
                                propertyDefinition,
                               propertyDefinition.DefaultValue,
                                timeOffset,
                                timeZone);

                        }
                    }

                }
            }
        }
開發者ID:saiesh86,項目名稱:TravelBlog,代碼行數:55,代碼來源:ProfileView.aspx.cs

示例2: ShowAnonymousProperties

        private void ShowAnonymousProperties(SiteUser siteUser)
        {
            bool wouldSeeMoreIfAuthenticated = false;

            mojoProfileConfiguration profileConfig = mojoProfileConfiguration.GetConfig();
            if (profileConfig != null)
            {
                foreach (mojoProfilePropertyDefinition propertyDefinition in profileConfig.PropertyDefinitions)
                {
                    if (
                        (propertyDefinition.VisibleToAnonymous)
                        && (propertyDefinition.OnlyVisibleForRoles.Length == 0)
                        &&(
                        (propertyDefinition.OnlyAvailableForRoles.Length == 0)
                            || (siteUser.IsInRoles(propertyDefinition.OnlyAvailableForRoles))
                            )
                        )
                    {
                        object propValue = siteUser.GetProperty(propertyDefinition.Name, propertyDefinition.SerializeAs, propertyDefinition.LazyLoad);
                        if (propValue != null)
                        {
                            mojoProfilePropertyDefinition.SetupReadOnlyPropertyControl(
                                pnlProfileProperties,
                                propertyDefinition,
                                propValue.ToString(),
                                timeOffset,
                                timeZone);
                        }
                        else
                        {
                            mojoProfilePropertyDefinition.SetupReadOnlyPropertyControl(
                                pnlProfileProperties,
                                propertyDefinition,
                                propertyDefinition.DefaultValue,
                                timeOffset,
                                timeZone);
                        }
                    }
                    else
                    {
                        if (
                            (propertyDefinition.VisibleToAuthenticated)
                            && (propertyDefinition.OnlyVisibleForRoles.Length == 0)
                            &&(
                            (propertyDefinition.OnlyAvailableForRoles.Length == 0)
                                || (siteUser.IsInRoles(propertyDefinition.OnlyAvailableForRoles))
                                )
                            )
                        {
                            wouldSeeMoreIfAuthenticated = true;
                        }

                    }

                }
            }

            if (wouldSeeMoreIfAuthenticated)
            {
                lblMessage.Text = ProfileResource.WouldSeeMoreIfAuthenticatedMessage;
            }
        }
開發者ID:saiesh86,項目名稱:TravelBlog,代碼行數:62,代碼來源:ProfileView.aspx.cs


注:本文中的mojoPortal.Business.SiteUser.GetProperty方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。