/// <summary>
    /// Reload data.
    /// </summary>
    public void ReloadData()
    {
        if (RelatedUserId > 0)
        {
            btnAddToIgnoreList.OnClientClick = "return confirm(" + ScriptHelper.GetString(GetString("Messsaging.AddToIgnoreListConfirmation")) + ");";

            btnAddToContactList.ToolTip       = GetString("Messsaging.AddToContactList");
            btnAddToIgnoreList.ToolTip        = GetString("Messsaging.AddToIgnoreList");
            imgAddToContactList.AlternateText = GetString("Messsaging.AddToContactList");
            imgAddToIgnoreList.AlternateText  = GetString("Messsaging.AddToIgnoreList");

            imgAddToContactList.ImageUrl = GetImageUrl("/CMSModules/CMS_Messaging/addtocontactlist.png");
            imgAddToIgnoreList.ImageUrl  = GetImageUrl("/CMSModules/CMS_Messaging/addtoignorelist.png");

            pnlButtons.Visible          = true;
            btnAddToContactList.Visible = true;
            btnAddToIgnoreList.Visible  = true;

            // Hide btnAddToContactList if sender is already in contact list
            if (ContactListInfoProvider.IsInContactList(CMSContext.CurrentUser.UserID, RelatedUserId))
            {
                btnAddToContactList.Visible = false;
            }
            // Hide btnAddToIgnoreList if sender is already in ignore list
            if (IgnoreListInfoProvider.IsInIgnoreList(CMSContext.CurrentUser.UserID, RelatedUserId))
            {
                btnAddToIgnoreList.Visible = false;
            }
        }
        else
        {
            pnlButtons.Visible = false;
        }
    }
Exemplo n.º 2
0
    /// <summary>
    /// Reload data.
    /// </summary>
    public void ReloadData()
    {
        if (RelatedUserId > 0)
        {
            btnAddToIgnoreList.OnClientClick = "return confirm(" + ScriptHelper.GetString(GetString("Messsaging.AddToIgnoreListConfirmation")) + ");";

            btnAddToContactList.ToolTip = GetString("Messsaging.AddToContactList");
            btnAddToIgnoreList.ToolTip  = GetString("Messsaging.AddToIgnoreList");

            pnlButtons.Visible          = true;
            btnAddToContactList.Visible = true;
            btnAddToIgnoreList.Visible  = true;

            // Hide btnAddToContactList if sender is already in contact list
            if (ContactListInfoProvider.IsInContactList(MembershipContext.AuthenticatedUser.UserID, RelatedUserId))
            {
                btnAddToContactList.Visible = false;
            }
            // Hide btnAddToIgnoreList if sender is already in ignore list
            if (IgnoreListInfoProvider.IsInIgnoreList(MembershipContext.AuthenticatedUser.UserID, RelatedUserId))
            {
                btnAddToIgnoreList.Visible = false;
            }
        }
        else
        {
            pnlButtons.Visible = false;
        }
    }
Exemplo n.º 3
0
    /// <summary>
    /// Removes the sample "cmseditor" user from the current user's contact list. Called when the "Remove user from contact list" button is pressed.
    /// Expects the AddUserToContactList method to be run first.
    /// </summary>
    private bool RemoveUserFromContactList()
    {
        // Gets "cmseditor" UserInfo object
        UserInfo user = UserInfoProvider.GetUserInfo("cmseditor");

        if (ContactListInfoProvider.IsInContactList(CMSContext.CurrentUser.UserID, user.UserID))
        {
            // Removes "cmseditor" from the current user's contact list
            ContactListInfoProvider.RemoveFromContactList(CMSContext.CurrentUser.UserID, user.UserID);

            return(true);
        }

        return(false);
    }
Exemplo n.º 4
0
    /// <summary>
    /// Adds the sample "cmseditor" user to the current user's contact list. Called when the "Add user to contact list" button is pressed.
    /// </summary>
    private bool AddUserToContactList()
    {
        // Gets "cmseditor" UserInfo object
        UserInfo user = UserInfoProvider.GetUserInfo("cmseditor");

        if (!ContactListInfoProvider.IsInContactList(CMSContext.CurrentUser.UserID, user.UserID))
        {
            // Adds "cmseditor" to the current user's contact list
            ContactListInfoProvider.AddToContactList(CMSContext.CurrentUser.UserID, user.UserID);

            return(true);
        }

        return(false);
    }
Exemplo n.º 5
0
    /// <summary>
    /// Removes the sample "Andy" user from the current user's contact list. Called when the "Remove user from contact list" button is pressed.
    /// Expects the AddUserToContactList method to be run first.
    /// </summary>
    private bool RemoveUserFromContactList()
    {
        // Gets "Andy" UserInfo object
        UserInfo user = UserInfoProvider.GetUserInfo("MyNewContact");

        if (ContactListInfoProvider.IsInContactList(MembershipContext.AuthenticatedUser.UserID, user.UserID))
        {
            // Removes "Andy" from the current user's contact list
            ContactListInfoProvider.RemoveFromContactList(MembershipContext.AuthenticatedUser.UserID, user.UserID);

            user.Delete();

            return(true);
        }

        user.Delete();

        return(false);
    }
Exemplo n.º 6
0
    /// <summary>
    /// Adds the sample user to the current user's contact list. Called when the "Add user to contact list" button is pressed.
    /// </summary>
    private bool AddUserToContactList()
    {
        // First create a new user which will be added to the contact list
        UserInfo user = new UserInfo();

        user.UserName = "******";
        user.FullName = "My new contact";
        user.UserGUID = Guid.NewGuid();

        UserInfoProvider.SetUserInfo(user);

        if (!ContactListInfoProvider.IsInContactList(MembershipContext.AuthenticatedUser.UserID, user.UserID))
        {
            // Adds "Andy" to the current user's contact list
            ContactListInfoProvider.AddToContactList(MembershipContext.AuthenticatedUser.UserID, user.UserID);

            return(true);
        }

        return(false);
    }