/// <summary>
    /// Items changed event handler.
    /// </summary>
    private void UniSelector_OnItemsSelected(object sender, EventArgs e)
    {
        if (AuthorizationHelper.AuthorizedModifyContact(false) || AuthorizationHelper.AuthorizedReadContact(false))
        {
            // Get new items from selector
            string newValues = ValidationHelper.GetString(contactSelector.Value, null);

            if (!String.IsNullOrEmpty(newValues))
            {
                string[] newItems = newValues.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);

                int previousStop = 0;
                string where = FetchNextContacts(ref previousStop, newItems, 1000);

                while (!String.IsNullOrEmpty(where))
                {
                    AccountContactInfoProvider.SetContactsIntoAccount(ai.AccountID, "ContactID IN (" + where + ")", ValidationHelper.GetInteger(hdnRoleID.Value, 0));

                    where = FetchNextContacts(ref previousStop, newItems, 1000);
                }

                gridElem.ReloadData();
                pnlUpdate.Update();
                contactSelector.Value = null;
            }
        }
        // No permission modify
        else
        {
            CMSPage.RedirectToAccessDenied(ModuleName.CONTACTMANAGEMENT, "Modify");
        }
    }
Example #2
0
    /// <summary>
    /// Items changed event handler.
    /// </summary>
    void UniSelector_OnItemsSelected(object sender, EventArgs e)
    {
        if (AccountHelper.AuthorizedModifyAccount(this.SiteID, false) || ContactHelper.AuthorizedReadContact(this.SiteID, false))
        {
            // Get new items from selector
            string newValues = ValidationHelper.GetString(contactSelector.Value, null);

            if (!String.IsNullOrEmpty(newValues))
            {
                string[] newItems = newValues.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);

                if (newItems != null)
                {
                    int previousStop = 0;
                    string where = FetchNextContacts(ref previousStop, newItems, 1000);

                    while (!String.IsNullOrEmpty(where))
                    {
                        AccountContactInfoProvider.SetContactsIntoAccount(ai.AccountID, "ContactID IN (" + where + ")", ValidationHelper.GetInteger(hdnRoleID.Value, 0));

                        where = FetchNextContacts(ref previousStop, newItems, 1000);
                    }
                }

                gridElem.ReloadData();
                pnlUpdate.Update();
                contactSelector.Value = null;
            }
        }
        // No permission modify
        else
        {
            if (this.SiteID > 0)
            {
                CMSPage.RedirectToCMSDeskAccessDenied("CMS.ContactManagement", "ModifyAccounts");
            }
            else
            {
                CMSPage.RedirectToCMSDeskAccessDenied("CMS.ContactManagement", "ModifyGlobalAccounts");
            }
        }
    }