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

        if (!IgnoreListInfoProvider.IsInIgnoreList(CMSContext.CurrentUser.UserID, user.UserID))
        {
            // Adds "cmseditor" to the current user's ignore list
            IgnoreListInfoProvider.AddToIgnoreList(CMSContext.CurrentUser.UserID, user.UserID);

            return(true);
        }

        return(false);
    }
    protected void btnAddToIgnoreList_Click(object sender, EventArgs e)
    {
        try
        {
            // Current user ID
            int currentUserId = CMSContext.CurrentUser.UserID;

            // Add user to ignore list
            IgnoreListInfoProvider.AddToIgnoreList(currentUserId, RelatedUserId);

            InformationText = GetString("MessageUserButtons.IgnoreAdded");
        }
        catch (Exception ex)
        {
            ErrorText = ex.Message;
        }
    }
Exemplo n.º 3
0
    protected void PerformAction(string actionName, object actionArgument)
    {
        int currentid = ValidationHelper.GetInteger(actionArgument, 0);

        switch (actionName)
        {
        case CONTACT_ACTION:
            // Add user to contact list
            ContactListInfoProvider.AddToContactList(MembershipContext.AuthenticatedUser.UserID, currentid);
            ShowConfirmation(GetString("messaging.search.addedsuccessfulytocontactlist"));
            break;

        case IGNORE_ACTION:
            // Add user to ignore list
            IgnoreListInfoProvider.AddToIgnoreList(MembershipContext.AuthenticatedUser.UserID, currentid);
            ShowConfirmation(GetString("messaging.search.addedsuccessfulytoignorelist"));
            break;
        }
    }
Exemplo n.º 4
0
    protected void PerformAction(string actionName, object actionArgument)
    {
        int currentid = ValidationHelper.GetInteger(actionArgument, 0);

        switch (actionName)
        {
        case "contact":
            // Add user to contact list
            ContactListInfoProvider.AddToContactList(CMSContext.CurrentUser.UserID, currentid);
            ShowConfirmation(GetString("messaging.search.addedsuccessfulytocontactlist"));
            break;

        case "ignore":
            // Add user to ignore list
            IgnoreListInfoProvider.AddToIgnoreList(CMSContext.CurrentUser.UserID, currentid);
            ShowConfirmation(GetString("messaging.search.addedsuccessfulytoignorelist"));
            break;
        }
    }
Exemplo n.º 5
0
    /// <summary>
    /// Adds the sample user to the current user's ignore list. Called when the "Add user to ignore list" button is pressed.
    /// </summary>
    private bool AddUserToIgnoreList()
    {
        // First create a new user which will be added to the ignore list
        UserInfo user = new UserInfo();

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

        UserInfoProvider.SetUserInfo(user);

        if (!IgnoreListInfoProvider.IsInIgnoreList(MembershipContext.AuthenticatedUser.UserID, user.UserID))
        {
            // Adds "Andy" to the current user's ignore list
            IgnoreListInfoProvider.AddToIgnoreList(MembershipContext.AuthenticatedUser.UserID, user.UserID);

            return(true);
        }

        return(false);
    }
Exemplo n.º 6
0
    private void SaveUsers()
    {
        bool falseValues = false;

        // Remove old items
        string newValues = ValidationHelper.GetString(usUsers.Value, null);
        string items     = DataHelper.GetNewItemsInList(newValues, currentValues);

        if (!String.IsNullOrEmpty(items))
        {
            string[] newItems = items.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
            // Add all new items to user
            foreach (string item in newItems)
            {
                int userId = ValidationHelper.GetInteger(item, 0);
                IgnoreListInfoProvider.RemoveFromIgnoreList(MembershipContext.AuthenticatedUser.UserID, userId);
            }
        }

        // Add new items
        items = DataHelper.GetNewItemsInList(currentValues, newValues);
        if (!String.IsNullOrEmpty(items))
        {
            string[] newItems = items.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
            // Add all new items to user
            foreach (string item in newItems)
            {
                int userId = ValidationHelper.GetInteger(item, 0);
                IgnoreListInfoProvider.AddToIgnoreList(MembershipContext.AuthenticatedUser.UserID, userId);
            }
        }

        if (falseValues)
        {
            currentValues = GetContactListValues();
            usUsers.Value = currentValues;
        }

        ShowChangesSaved();
    }
Exemplo n.º 7
0
    private void SaveUsers()
    {
        bool falseValues = false;

        // Remove old items
        string newValues = ValidationHelper.GetString(usUsers.Value, null);
        string items     = DataHelper.GetNewItemsInList(newValues, currentValues);

        if (!String.IsNullOrEmpty(items))
        {
            string[] newItems = items.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
            // Add all new items to user
            foreach (string item in newItems)
            {
                int userId = ValidationHelper.GetInteger(item, 0);

                // Check permissions
                string result = string.Empty;
                if (result != String.Empty)
                {
                    lblError.Visible = true;
                    lblError.Text   += result;
                    falseValues      = true;
                    continue;
                }
                else
                {
                    IgnoreListInfoProvider.RemoveFromIgnoreList(CMSContext.CurrentUser.UserID, userId);
                }
            }
        }

        // Add new items
        items = DataHelper.GetNewItemsInList(currentValues, newValues);
        if (!String.IsNullOrEmpty(items))
        {
            string[] newItems = items.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
            // Add all new items to user
            foreach (string item in newItems)
            {
                int userId = ValidationHelper.GetInteger(item, 0);

                // Check permissions
                string result = string.Empty;
                if (result != String.Empty)
                {
                    lblError.Visible = true;
                    lblError.Text   += result;
                    falseValues      = true;
                    continue;
                }
                else
                {
                    IgnoreListInfoProvider.AddToIgnoreList(CMSContext.CurrentUser.UserID, userId);
                }
            }
        }

        if (falseValues)
        {
            currentValues = GetContactListValues();
            usUsers.Value = currentValues;
        }

        lblInfo.Visible = true;
        lblInfo.Text    = GetString("General.ChangesSaved");
    }