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


C# UserInfo.IsPublic方法代码示例

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


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

示例1: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        userId = QueryHelper.GetInteger("objectid", 0);

        // Get user info object and check if UI should be displayed
        ui = UserInfoProvider.GetUserInfo(userId);
        CheckUserAvaibleOnSite(ui);
        EditedObject = ui;

        ucUserName.UseDefaultValidationGroup = false;
        cultureSelector.DisplayAllCultures = true;
        lblResetToken.Text = GetString("mfauthentication.token.reset");

        // Register picture delete script
        ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "PictDelConfirm",
                                               ScriptHelper.GetScript("function DeleteConfirmation(){ return confirm(" + ScriptHelper.GetString(GetString("MyProfile.PictDeleteConfirm")) + ");}"));

        // Check that only global administrator can edit global administrator's accounts
        if (!CheckGlobalAdminEdit(ui))
        {
            plcTable.Visible = false;
            ShowError(GetString("Administration-User_List.ErrorGlobalAdmin"));
        }

        if (!RequestHelper.IsPostBack())
        {
            LoadData();
        }

        // Set hide action if user extend validity of his own account
        if (ui.UserID == CurrentUser.UserID)
        {
            btnExtendValidity.OnClientClick = "window.top.HideWarning()";
        }

        // Register help variable for user is external confirmation
        ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "IsExternal", ScriptHelper.GetScript("var isExternal = " + chkIsExternal.Checked.ToString().ToLowerCSafe() + ";"));

        // Javascript code for "Is external user" confirmation
        string javascript = ScriptHelper.GetScript(
            @"function CheckExternal() {
                            var checkbox = document.getElementById('" + chkIsExternal.ClientID + @"')
                            if(checkbox.checked && !isExternal) {
                                if(!confirm('" + GetString("user.confirmexternal") + @"')) {
                                    checkbox.checked = false ;
                                }
                            }}");

        // Register script to the page
        ScriptHelper.RegisterClientScriptBlock(this, typeof(string), ClientID + "CheckExternal", javascript);

        // Assign to ok button
        if (!chkIsExternal.Checked)
        {
            btnOk.OnClientClick = "CheckExternal()";
        }

        // Display impersonation link if current user is global administrator and edited user is not global admin
        if (CurrentUser.IsGlobalAdministrator && (ui.UserID != CurrentUser.UserID) && !ui.IsPublic())
        {
            string message = GetImpersonalMessage(ui);

            HeaderAction action = new HeaderAction();
            action.Text = GetString("Membership.Impersonate");
            action.Tooltip = GetString("Membership.Impersonate");
            action.OnClientClick = "if (!confirm('" + message + "')) { return false; }";
            action.CommandName = "impersonate";
            CurrentMaster.HeaderActions.AddAction(action);

            CurrentMaster.HeaderActions.ActionPerformed += HeaderActions_ActionPerformed;
        }
    }
开发者ID:kbuck21991,项目名称:kentico-blank-project,代码行数:72,代码来源:User_Edit_General.aspx.cs


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