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


C# Business.SiteUser类代码示例

本文整理汇总了C#中mojoPortal.Business.SiteUser的典型用法代码示例。如果您正苦于以下问题:C# SiteUser类的具体用法?C# SiteUser怎么用?C# SiteUser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: LoadSettings

        private void LoadSettings()
        {
            userId = WebUtils.ParseInt32FromQueryString("userId", -1);
            pageNumber = WebUtils.ParseInt32FromQueryString("pagenumber", 1);

            forumUser = new SiteUser(siteSettings, userId);
            if (forumUser.UserId == -1) { forumUser = null; }

            threadList.SiteSettings = siteSettings;
            threadList.ForumUser = forumUser;
            threadList.PageNumber = pageNumber;
            threadList.SiteRoot = SiteRoot;
            threadList.ImageSiteRoot = ImageSiteRoot;

            threadListAlt.SiteSettings = siteSettings;
            threadListAlt.ForumUser = forumUser;
            threadListAlt.PageNumber = pageNumber;
            threadListAlt.SiteRoot = SiteRoot;
            threadListAlt.ImageSiteRoot = ImageSiteRoot;

            if (displaySettings.UseAltUserThreadList)
            {
                threadList.Visible = false;
                threadListAlt.Visible = true;
            }

            AddClassToBody("forumuserthreads");
        }
开发者ID:saiesh86,项目名称:TravelBlog,代码行数:28,代码来源:UserThreads.aspx.cs

示例2: LoadSettings

        private void LoadSettings()
        {
            //spnAdmin.Visible = WebUser.IsAdminOrContentAdmin;

            currentUser = SiteUtils.GetCurrentSiteUser();
            letterInfoGuid = WebUtils.ParseGuidFromQueryString("l", Guid.Empty);

            if (letterInfoGuid == Guid.Empty) return;

            letterInfo = new LetterInfo(letterInfoGuid);
            if (letterInfo.SiteGuid != siteSettings.SiteGuid)
            {
                letterInfo = null;
                letterInfoGuid = Guid.Empty;

            }

            pageNumber = WebUtils.ParseInt32FromQueryString("pagenumber", 1);

            lnkAdminMenu.Visible = WebUser.IsAdminOrContentAdmin;
            litLinkSeparator1.Visible = lnkAdminMenu.Visible;

            AddClassToBody("administration");
            AddClassToBody("eletterdrafts");
        }
开发者ID:joedavis01,项目名称:mojoportal,代码行数:25,代码来源:LetterDrafts.aspx.cs

示例3: HandleWindowsLiveConfirmation

        private void HandleWindowsLiveConfirmation(SiteUser siteUser)
        {
            if ((liveUser == null) || (windowsLive == null)) { return; }

            if (siteSettings.UseEmailForLogin)
            {
                FormsAuthentication.SetAuthCookie(
                    siteUser.Email, liveUser.UsePersistentCookie);
            }
            else
            {
                FormsAuthentication.SetAuthCookie(
                    siteUser.LoginName, liveUser.UsePersistentCookie);
            }

            if (WebConfigSettings.UseFoldersInsteadOfHostnamesForMultipleSites)
            {
                string cookieName = "siteguid" + siteSettings.SiteGuid;
                CookieHelper.SetCookie(cookieName, siteUser.UserGuid.ToString(), liveUser.UsePersistentCookie);
            }

            if (siteUser.UserId > -1 && siteSettings.AllowUserSkins && siteUser.Skin.Length > 0)
            {
                SiteUtils.SetSkinCookie(siteUser);
            }

            siteUser.UpdateLastLoginTime();

            //WebUtils.SetupRedirect(this, SiteRoot + "/Secure/UserProfile.aspx");
        }
开发者ID:joedavis01,项目名称:mojoportal,代码行数:30,代码来源:ConfirmRegistration.aspx.cs

示例4: LoadSettings

        private void LoadSettings()
        {
            currentUser = SiteUtils.GetCurrentSiteUser();
            letterInfoGuid = WebUtils.ParseGuidFromQueryString("l", Guid.Empty);
            //spnAdmin.Visible = WebUser.IsAdminOrContentAdmin;
            ScriptConfig.IncludeColorBox = true;

            if (letterInfoGuid == Guid.Empty) return;

            letterInfo = new LetterInfo(letterInfoGuid);
            if (letterInfo.SiteGuid != siteSettings.SiteGuid)
            {
                letterInfo = null;
                letterInfoGuid = Guid.Empty;

            }

            pageNumber = WebUtils.ParseInt32FromQueryString("pagenumber", 1);
            timeOffset = SiteUtils.GetUserTimeOffset();
            timeZone = SiteUtils.GetUserTimeZone();

            lnkAdminMenu.Visible = WebUser.IsAdminOrContentAdmin;
            litLinkSeparator1.Visible = lnkAdminMenu.Visible;

            AddClassToBody("administration");
            AddClassToBody("eletterarchive");
        }
开发者ID:joedavis01,项目名称:mojoportal,代码行数:27,代码来源:LetterArchive.aspx.cs

示例5: GetCountOfState

        public static int GetCountOfState(
            SiteSettings siteSettings,
            PersonalizationScope scope,
            PersonalizationStateQuery query)
        {
            int result = 0;

            if (siteSettings != null)
            {
                Guid userGuid = Guid.Empty;
                if ((query.UsernameToMatch != null) && (query.UsernameToMatch.Length > 0))
                {
                    SiteUser siteUser = new SiteUser(siteSettings, query.UsernameToMatch);
                    if (siteUser.UserId > 0)
                    {
                        userGuid = siteUser.UserGuid;
                    }

                }

                bool allUsersScope = (scope == PersonalizationScope.Shared);
                result = SitePersonalization.GetCountOfState(
                    siteSettings.SiteId,
                    query.PathToMatch,
                    allUsersScope,
                    userGuid,
                    query.UserInactiveSinceDate);

            }

            return result;
        }
开发者ID:joedavis01,项目名称:mojoportal,代码行数:32,代码来源:PersonalizationHelper.cs

示例6: ClaimExistingSubscriptions

        /// <summary>
        /// people can subscribe to the newsletters without registering on the site. This method is used to attach those existing subscriptions to the user upon registration
        /// </summary>
        /// <param name="siteUser"></param>
        public static void ClaimExistingSubscriptions(SiteUser siteUser)
        {
            SubscriberRepository subscriptions = new SubscriberRepository();
            List<LetterSubscriber> userSubscriptions = subscriptions.GetListByEmail(siteUser.SiteGuid, siteUser.Email);

            foreach (LetterSubscriber s in userSubscriptions)
            {

                if (s.UserGuid != siteUser.UserGuid)
                {
                    s.UserGuid = siteUser.UserGuid;
                    subscriptions.Save(s);
                }

                if (!s.IsVerified)
                {
                    subscriptions.Verify(s.SubscribeGuid, true, Guid.Empty);
                    LetterInfo.UpdateSubscriberCount(s.LetterInfoGuid);

                }

            }

            List<LetterSubscriber> memberSubscriptions = subscriptions.GetListByUser(siteUser.SiteGuid, siteUser.UserGuid);

            RemoveDuplicates(memberSubscriptions);

            // commented out 2012-11-16 since we now give the user a chance to opt in the registration
            // then we should not force him in if he chose not to opt in

            //if (memberSubscriptions.Count == 0)
            //{
            //    string ipAddress = SiteUtils.GetIP4Address();
            //    //user has no previous subscriptions and just registered
            //    // lets give him the site subscriptions that are configured for opting in new users by default
            //    List<LetterInfo> allNewsletters = LetterInfo.GetAll(siteUser.SiteGuid);
            //    foreach (LetterInfo l in allNewsletters)
            //    {
            //        if ((l.ProfileOptIn) && (l.AvailableToRoles.Contains("All Users;")))
            //        {
            //            LetterSubscriber s = new LetterSubscriber();
            //            s.SiteGuid = siteUser.SiteGuid;
            //            s.LetterInfoGuid = l.LetterInfoGuid;
            //            s.UserGuid = siteUser.UserGuid;
            //            s.EmailAddress = siteUser.Email;
            //            s.IsVerified = true;
            //            s.UseHtml = true;
            //            s.IpAddress = ipAddress;
            //            subscriptions.Save(s);

            //        }

            //    }

            //}
        }
开发者ID:joedavis01,项目名称:mojoportal,代码行数:60,代码来源:NewsletterHelper.cs

示例7: btnLockUser_Click

        protected void btnLockUser_Click(object sender, EventArgs e)
        {
            if (this.userID > -1)
            {
                SiteUser user = new SiteUser(siteSettings, this.userID);
                user.LockoutAccount();
            }

            WebUtils.SetupRedirect(this, Request.RawUrl);
            return;
        }
开发者ID:joedavis01,项目名称:mojoportal,代码行数:11,代码来源:ManageUsers.aspx.cs

示例8: LoadSettings

        private void LoadSettings()
        {
            //avatarPath = Page.ResolveUrl("~/Data/Sites/" + siteSettings.SiteId.ToInvariantString() + "/useravatars/");

            UntrustedContent2.TrustedImageUrlPattern = allowedImageUrlRegexPattern;

            allowView = WebUser.IsInRoles(siteSettings.RolesThatCanViewMemberList);
            userID = WebUtils.ParseInt32FromQueryString("userid", true, userID);
            timeOffset = SiteUtils.GetUserTimeOffset();
            timeZone = SiteUtils.GetUserTimeZone();
            userGuid = WebUtils.ParseGuidFromQueryString("u", Guid.Empty);

            if (userID > -1)
            {
                siteUser = new SiteUser(siteSettings, userID);
                if (siteUser.UserGuid == Guid.Empty) { siteUser = null; }
            }
            else if(userGuid != Guid.Empty)
            {
                siteUser = new SiteUser(siteSettings, userGuid);
                if (siteUser.UserGuid == Guid.Empty) { siteUser = null; }
            }

            switch (siteSettings.AvatarSystem)
            {
                case "gravatar":
                    allowGravatars = true;
                    disableAvatars = false;
                    break;

                case "internal":
                    allowGravatars = false;
                    disableAvatars = false;

                    break;

                case "none":
                default:
                    allowGravatars = false;
                    disableAvatars = true;
                    break;

            }

            if (displaySettings.OverrideAvatarLabel.Length > 0)
            {
                lblAvatar.ConfigKey = displaySettings.OverrideAvatarLabel;
            }

            if (displaySettings.HidePostCount) { divForumPosts.Visible = false; }

            AddClassToBody("profileview");
        }
开发者ID:saiesh86,项目名称:TravelBlog,代码行数:53,代码来源:ProfileView.aspx.cs

示例9: LoadPersonalizationBlobs

        public static void LoadPersonalizationBlobs(
            SiteSettings siteSettings,
            WebPartManager webPartManager,
            string path,
            string userName,
            ref byte[] sharedDataBlob,
            ref byte[] userDataBlob)
        {
            if (siteSettings != null)
            {
                if ((userName != null) && (userName.Length > 0))
                {
                    SiteUser siteUser = new SiteUser(siteSettings, userName);
                    Guid userID = Guid.Empty;
                    if (siteUser.UserId > 0)
                    {
                        userID = siteUser.UserGuid;
                    }

                    if (userID != Guid.Empty)
                    {
                        userDataBlob = SitePersonalization.GetPersonalizationBlob(
                            siteSettings.SiteId,
                            path,
                            userID);

                        siteUser.UpdateLastActivityTime();

                        sharedDataBlob = SitePersonalization.GetPersonalizationBlobAllUsers(
                            siteSettings.SiteId,
                            path);

                    }
                }
                else
                {
                    //TODO: tracking/personalization for unauthenticated users?

                    sharedDataBlob = SitePersonalization.GetPersonalizationBlobAllUsers(
                            siteSettings.SiteId,
                            path);

                }

            }
        }
开发者ID:joedavis01,项目名称:mojoportal,代码行数:46,代码来源:PersonalizationHelper.cs

示例10: LoadSettings

        private void LoadSettings()
        {
            IsAdmin = WebUser.IsAdmin;
            isSiteEditor = SiteUtils.UserIsSiteEditor();
            isCommerceReportViewer = WebUser.IsInRoles(siteSettings.CommerceReportViewRoles);

            userGuid = WebUtils.ParseGuidFromQueryString("u", userGuid);

            customerUser = new SiteUser(siteSettings, userGuid);

            UserCommerceHistory commerceHistory = purchaseHx as UserCommerceHistory;

            commerceHistory.UserGuid = userGuid;
            commerceHistory.ShowAdminOrderLink = true;

            AddClassToBody("administration");
            AddClassToBody("commercereports");
        }
开发者ID:joedavis01,项目名称:mojoportal,代码行数:18,代码来源:SalesCustomerDetail.aspx.cs

示例11: InstallContent

        public void InstallContent(Module module, string configInfo)
        {
            HtmlContent htmlContent = new HtmlContent();
            htmlContent.ModuleId = module.ModuleId;
            if (configInfo.StartsWith("~/"))
            {
                if (File.Exists(HostingEnvironment.MapPath(configInfo)))
                {
                    htmlContent.Body = File.ReadAllText(HostingEnvironment.MapPath(configInfo), Encoding.UTF8);
                }
            }
            else
            {
                htmlContent.Body = ResourceHelper.GetMessageTemplate(CultureInfo.CurrentUICulture, configInfo);
            }

            htmlContent.ModuleGuid = module.ModuleGuid;

            SiteSettings siteSettings = new SiteSettings(module.SiteId);
            SiteUser adminUser = null;
            if (siteSettings.UseEmailForLogin)
            {
                adminUser = new SiteUser(siteSettings, "[email protected]");
                if (adminUser.UserId == -1) { adminUser = null; }
            }
            else
            {
                adminUser = new SiteUser(siteSettings, "admin");
                if (adminUser.UserId == -1) { adminUser = null; }
            }

            if (adminUser != null)
            {
                htmlContent.UserGuid = adminUser.UserGuid;
                htmlContent.LastModUserGuid = adminUser.UserGuid;
            }

            HtmlRepository repository = new HtmlRepository();
            repository.Save(htmlContent);
        }
开发者ID:saiesh86,项目名称:TravelBlog,代码行数:40,代码来源:HtmlContentInstaller.cs

示例12: MojoPortalUser

 public MojoPortalUser()
 {
     try
     {
         if (HttpContext.Current.User.Identity.IsAuthenticated)
         {
             //UserInfo info = UserController.GetUserByName(((PortalSettings) HttpContext.Current.Items["PortalSettings"]).get_PortalId(), HttpContext.Current.User.Identity.Name, false);
             siteUser = SiteUtils.GetCurrentSiteUser();
             this.m_userID = siteUser.UserId;
             this.m_userName = siteUser.LoginName;
             this.m_email = siteUser.Email;
             this.m_firstName = siteUser.Name;
             this.m_lastName = "";
             this.m_location = siteUser.Country;
             this.m_isSuperAdmin = siteUser.IsInRoles("Administrators");
             this.m_isAuthenticated = true;
         }
     }
     catch (Exception exception)
     {
         throw new Exception("Failed to find user info from mojoPortal.", exception);
     }
 }
开发者ID:RH-Code,项目名称:YAFNET,代码行数:23,代码来源:MojoPortalUser.cs

示例13: LoadSettings

        private void LoadSettings()
        {
            currentUser = SiteUtils.GetCurrentSiteUser();
            config = new BlogConfiguration(ModuleSettings.GetModuleSettings(moduleId));

            lnkCategories.NavigateUrl = SiteRoot + "/Blog/EditCategory.aspx?pageid="
                + pageId.ToInvariantString() + "&mid=" + moduleId.ToInvariantString();

            lnkNewPost.NavigateUrl = SiteRoot + "/Blog/EditPost.aspx?pageid="
                + pageId.ToInvariantString() + "&mid=" + moduleId.ToInvariantString();

            lnkDrafts.NavigateUrl = SiteRoot + "/Blog/Drafts.aspx?pageid="
                + pageId.ToInvariantString() + "&mid=" + moduleId.ToInvariantString();

            lnkClosedPosts.NavigateUrl = SiteRoot + "/Blog/ClosedPosts.aspx?pageid="
                + pageId.ToInvariantString() + "&mid=" + moduleId.ToInvariantString();

            if (currentUser == null) { return; }

            if (BlogConfiguration.SecurePostsByUser)
            {
                if (WebUser.IsInRoles(config.ApproverRoles))
                {
                    countOfDrafts = Blog.GetCountOfDrafts(moduleId, Guid.Empty);
                }
                else
                {
                    countOfDrafts = Blog.GetCountOfDrafts(moduleId, currentUser.UserGuid);
                }
            }
            else
            {
                countOfDrafts = Blog.GetCountOfDrafts(moduleId, Guid.Empty);
            }

            countOfExpiredPosts = Blog.GetCountClosed(moduleId);
        }
开发者ID:saiesh86,项目名称:TravelBlog,代码行数:37,代码来源:Manage.aspx.cs

示例14: LoadSettings

        private void LoadSettings()
        {
            PageId = WebUtils.ParseInt32FromQueryString("pageid", -1);
            ModuleId = WebUtils.ParseInt32FromQueryString("mid", -1);
            payPalGetExpressCheckoutLogGuid = WebUtils.ParseGuidFromQueryString("plog", payPalGetExpressCheckoutLogGuid);

            if (payPalGetExpressCheckoutLogGuid == Guid.Empty)
            {
                Response.Redirect(SiteUtils.GetCurrentPageUrl());
            }

            checkoutDetailsLog = new PayPalLog(payPalGetExpressCheckoutLogGuid);

            if (checkoutDetailsLog.RowGuid == Guid.Empty)
            {
                Response.Redirect(SiteUtils.GetCurrentPageUrl());
            }

            cart = (Cart)SerializationHelper.DeserializeFromString(typeof(Cart), checkoutDetailsLog.SerializedObject);

            if (cart == null)
            {
                Response.Redirect(SiteUtils.GetCurrentPageUrl());
            }
            cart.DeSerializeCartOffers();

            cart.RefreshTotals();

            if ((cart.LastModified < DateTime.UtcNow.AddDays(-1)) && (cart.DiscountCodesCsv.Length > 0))
            {
                StoreHelper.EnsureValidDiscounts(store, cart);
            }

            siteUser = SiteUtils.GetCurrentSiteUser();
            //if (siteUser == null)
            //{
            //    Response.Redirect(SiteUtils.GetCurrentPageUrl());
            //}

            if ((siteUser != null)&&(cart.UserGuid == Guid.Empty))
            {
                // user wasn't logged in when express checkout was called
                cart.UserGuid = siteUser.UserGuid;
                cart.Save();
                //if (checkoutDetailsLog.UserGuid == Guid.Empty)
                //{
                //    // we need to make sure we have the user in the log and serialized cart
                //    checkoutDetailsLog.UserGuid = siteUser.UserGuid;
                //    cart.SerializeCartOffers();
                //    checkoutDetailsLog.SerializedObject = SerializationHelper.SerializeToSoap(cart);
                //    checkoutDetailsLog.Save();

                //}
            }

            if ((siteUser != null)&&(cart.UserGuid != siteUser.UserGuid))
            {
                Response.Redirect(SiteUtils.GetCurrentPageUrl());
            }

            if (ModuleId == -1)
            {
                ModuleId = StoreHelper.FindStoreModuleId(CurrentPage);
            }

            store = StoreHelper.GetStore();

            commerceConfig = SiteUtils.GetCommerceConfig();
            currencyCulture = ResourceHelper.GetCurrencyCulture(siteSettings.GetCurrency().Code);

            if (siteUser != null)
            {
                pnlRequireLogin.Visible = false;
            }
            else
            {
                btnMakePayment.Visible = false;
            }

            AddClassToBody("webstore webstoreexpresscheckout");
        }
开发者ID:joedavis01,项目名称:mojoportal,代码行数:81,代码来源:PayPalExpressCheckout.aspx.cs

示例15: UserRoles_ItemCommand

        private void UserRoles_ItemCommand(object sender, DataListCommandEventArgs e)
        {
            int roleID = Convert.ToInt32(userRoles.DataKeys[e.Item.ItemIndex]);
            SiteUser user = new SiteUser(siteSettings, userId);

            Role.RemoveUser(roleID, userId);
            userRoles.EditItemIndex = -1;
            if (user.UserId > -1)
            {
                user.RolesChanged = true;
                user.Save();
            }

            BindRoles();

            upRoles.Update();

            //WebUtils.SetupRedirect(this, Request.RawUrl);
            //return;
        }
开发者ID:saiesh86,项目名称:TravelBlog,代码行数:20,代码来源:UserRoles.ascx.cs


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