/// <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");
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        CheckUIElementAccessHierarchical(ModuleName.CONTACTMANAGEMENT, "ContactMembership.Users");
        ci = (ContactInfo)EditedObject;
        if (ci == null)
        {
            RedirectToAccessDenied(GetString("general.invalidparameters"));
        }

        modifyAllowed = AuthorizationHelper.AuthorizedModifyContact(false);

        contactId = QueryHelper.GetInteger("contactid", 0);

        string where = null;

        gridElem.ObjectType = ContactMembershipUserListInfo.OBJECT_TYPE;

        // Query parameters
        QueryDataParameters parameters = new QueryDataParameters();

        parameters.Add("@ContactId", contactId);

        gridElem.WhereCondition       = where;
        gridElem.QueryParameters      = parameters;
        gridElem.OnAction            += gridElem_OnAction;
        gridElem.OnExternalDataBound += gridElem_OnExternalDataBound;

        CurrentMaster.HeaderActionsPlaceHolder.Visible = modifyAllowed;
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        ci = (ContactInfo)EditedObject;
        if (ci == null)
        {
            RedirectToAccessDenied(GetString("general.invalidparameters"));
        }

        modifyAllowed = AuthorizationHelper.AuthorizedModifyContact(false);

        contactId = QueryHelper.GetInteger("contactid", 0);

        gridElem.ObjectType = ContactMembershipCustomerListInfo.OBJECT_TYPE;

        // Query parameters
        QueryDataParameters parameters = new QueryDataParameters();

        parameters.Add("@ContactId", contactId);

        gridElem.QueryParameters      = parameters;
        gridElem.OnAction            += gridElem_OnAction;
        gridElem.OnExternalDataBound += gridElem_OnExternalDataBound;

        // Hide header actions for global contact or merged contact.
        CurrentMaster.HeaderActionsPlaceHolder.Visible = modifyAllowed;
    }
    protected override void OnPreRender(EventArgs e)
    {
        base.OnPreRender(e);

        // Disable actions for unauthorized users
        hdrActions.Enabled = AuthorizationHelper.AuthorizedModifyContact(false);
    }
Exemplo n.º 5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        gridElem.IsLiveSite = IsLiveSite;

        // Get score ID from query string
        scoreId = QueryHelper.GetInteger("ScoreID", 0);

        // Initialize score filter
        FormFieldInfo ffi = new FormFieldInfo();

        ffi.Name                           = "SUM(Value)";
        ffi.DataType                       = FieldDataType.Integer;
        ucScoreFilter.FieldInfo            = ffi;
        ucScoreFilter.DefaultOperator      = ">=";
        ucScoreFilter.WhereConditionFormat = "{0} {2} {1}";

        // Get modify permission of current user
        modifyPermission = AuthorizationHelper.AuthorizedModifyContact(false);

        var sourceData = GetContactsWithScore();

        if (DataHelper.GetItemsCount(sourceData) >= MAX_RECORDS)
        {
            ShowInformation(GetString("om.contact.notallrecords"));
        }
        gridElem.DataSource = sourceData;


        // Register OnExternalDataBound
        gridElem.OnExternalDataBound += gridElem_OnExternalDataBound;
        gridElem.OnBeforeFiltering   += gridElem_OnBeforeFiltering;

        // Initialize dropdown lists
        if (!RequestHelper.IsPostBack())
        {
            drpAction.Items.Add(new ListItem(GetString("general." + Action.SelectAction), Convert.ToInt32(Action.SelectAction).ToString()));
            if (modifyPermission)
            {
                if (AuthorizationHelper.AuthorizedReadContact(false))
                {
                    drpAction.Items.Add(new ListItem(GetString("om.account." + Action.AddToGroup), Convert.ToInt32(Action.AddToGroup).ToString()));
                }
                drpAction.Items.Add(new ListItem(GetString("om.account." + Action.ChangeStatus), Convert.ToInt32(Action.ChangeStatus).ToString()));
            }
            drpWhat.Items.Add(new ListItem(GetString("om.contact." + What.Selected), Convert.ToInt32(What.Selected).ToString()));
            drpWhat.Items.Add(new ListItem(GetString("om.contact." + What.All), Convert.ToInt32(What.All).ToString()));
        }
        else
        {
            if (ControlsHelper.CausedPostBack(btnOk))
            {
                // Set delayed reload for unigrid if mass action is performed
                gridElem.DelayedReload = true;
            }
        }

        // Register JS scripts
        RegisterScripts();
    }
Exemplo n.º 6
0
    protected void btnOK_Click(object sender, EventArgs e)
    {
        // Check permissions
        AuthorizationHelper.AuthorizedModifyContact(true);

        EnsureAsyncLog();
        RunAsyncDelete();
    }
Exemplo n.º 7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Get modify permission of current user
        modifyPermission = AuthorizationHelper.AuthorizedModifyContact(false);

        var editUrl = UIContextHelper.GetElementUrl(ModuleName.CONTACTMANAGEMENT, "EditContact");

        editUrl = URLHelper.AddParameterToUrl(editUrl, "objectid", "{0}");
        editUrl = URLHelper.AddParameterToUrl(editUrl, "displaytitle", "0");

        gridElem.OnExternalDataBound += gridElem_OnExternalDataBound;
        gridElem.WhereCondition       = SqlHelper.AddWhereCondition(gridElem.WhereCondition, WhereCondition);
        gridElem.EditActionUrl        = editUrl;
        gridElem.ZeroRowsText         = GetString("om.contact.nocontacts");
        gridElem.FilteredZeroRowsText = GetString("om.contact.nocontacts.filtered");

        if (QueryHelper.GetBoolean("deleteasync", false))
        {
            ShowConfirmation(GetString("om.contact.massdeletestarted"));
        }

        // Initialize dropdown lists
        if (!RequestHelper.IsPostBack())
        {
            drpAction.Items.Add(new ListItem(GetString("general." + Action.SelectAction), Convert.ToInt32(Action.SelectAction).ToString()));
            if (modifyPermission)
            {
                if (AuthorizationHelper.AuthorizedReadContact(false))
                {
                    drpAction.Items.Add(new ListItem(GetString("om.account." + Action.AddToGroup), Convert.ToInt32(Action.AddToGroup).ToString()));
                }

                drpAction.Items.Add(new ListItem(GetString("general.delete"), Convert.ToInt32(Action.Delete).ToString()));
                if (LicenseKeyInfoProvider.IsFeatureAvailable(RequestContext.CurrentDomain, FeatureEnum.FullContactManagement))
                {
                    drpAction.Items.Add(new ListItem(GetString("om.account." + Action.ChangeStatus), Convert.ToInt32(Action.ChangeStatus).ToString()));
                }
            }
            drpWhat.Items.Add(new ListItem(GetString("om.contact." + What.Selected), Convert.ToInt32(What.Selected).ToString()));
            drpWhat.Items.Add(new ListItem(GetString("om.contact." + What.All), Convert.ToInt32(What.All).ToString()));
        }
        else
        {
            if (ControlsHelper.CausedPostBack(btnOk))
            {
                // Set delayed reload for unigrid if mass action is performed
                gridElem.DelayedReload = true;
            }
        }

        // Register JS scripts
        RegisterScripts();
    }
    /// <summary>
    /// Actions handler.
    /// </summary>
    protected void HeaderActions_ActionPerformed(object sender, CommandEventArgs e)
    {
        // Check permission
        AuthorizationHelper.AuthorizedModifyContact(true);

        switch (e.CommandName.ToLowerCSafe())
        {
        // Save contact
        case "save":
            EditForm.SaveData(null);
            break;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        // Ensure, that it is going to be rendered
        pnlRole.Visible = true;

        ScriptHelper.RegisterWOpenerScript(Page);
        ScriptHelper.RegisterJQuery(Page);

        // Try to get parameters
        string    identifier = QueryHelper.GetString("params", null);
        Hashtable parameters = (Hashtable)WindowHelper.GetItem(identifier);

        // Validate hash
        if ((QueryHelper.ValidateHash("hash", "selectedvalue")) && (parameters != null))
        {
            // Check permissions
            AuthorizationHelper.AuthorizedReadContact(true);
            if (AuthorizationHelper.AuthorizedModifyContact(false))
            {
                contactRoleSelector.IsLiveSite = false;
                contactRoleSelector.UniSelector.DialogWindowName = "SelectContactRole";

                selectionDialog.LocalizeItems = QueryHelper.GetBoolean("localize", true);

                // Load resource prefix
                string resourcePrefix = ValidationHelper.GetString(parameters["ResourcePrefix"], "general");

                // Set the page title
                string titleText = GetString(resourcePrefix + ".selectitem|general.selectitem");

                // Validity group text
                lblAddAccounts.ResourceString = resourcePrefix + ".contactsrole";
                pnlRoleHeading.Visible        = true;

                PageTitle.TitleText = titleText;
                Page.Title          = titleText;
            }
            // No permission modify
            else
            {
                RedirectToAccessDenied(ModuleName.CONTACTMANAGEMENT, "ModifyAccount");
            }
        }
        else
        {
            // Redirect to error page
            URLHelper.Redirect(AdministrationUrlHelper.GetErrorPageUrl("dialogs.badhashtitle", "dialogs.badhashtext"));
        }

        CurrentMaster.PanelContent.RemoveCssClass("dialog-content");
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        // Get edited object
        if (UIContext.EditedObject != null)
        {
            ai = (AccountInfo)UIContext.EditedObject;

            // Setup unigrid
            gridElem.GridOptions.ShowSelection = true;
            gridElem.WhereCondition            = SqlHelper.AddWhereCondition(gridElem.WhereCondition, "AccountID = " + ai.AccountID);
            gridElem.OnAction            += gridElem_OnAction;
            gridElem.OnExternalDataBound += gridElem_OnExternalDataBound;
            gridElem.ZeroRowsText         = GetString("om.account.nocontacts");

            // Initialize dropdown lists
            if (!RequestHelper.IsPostBack())
            {
                drpAction.Items.Add(new ListItem(GetString("general." + Action.SelectAction), Convert.ToInt32(Action.SelectAction).ToString()));
                drpAction.Items.Add(new ListItem(GetString("general.remove"), Convert.ToInt32(Action.Remove).ToString()));
                drpAction.Items.Add(new ListItem(GetString("om.contactrole.selectitem"), Convert.ToInt32(Action.SelectRole).ToString()));
                drpWhat.Items.Add(new ListItem(GetString("om.contact." + What.Selected), Convert.ToInt32(What.Selected).ToString()));
                drpWhat.Items.Add(new ListItem(GetString("om.contact." + What.All), Convert.ToInt32(What.All).ToString()));
            }
            else
            {
                if (ControlsHelper.CausedPostBack(btnOk))
                {
                    // Set delayed reload for unigrid if mass action is performed
                    gridElem.DelayedReload = true;
                }
            }

            // Initialize contact selector
            contactSelector.UniSelector.OnItemsSelected  += UniSelector_OnItemsSelected;
            contactSelector.UniSelector.SelectionMode     = SelectionModeEnum.MultipleButton;
            contactSelector.UniSelector.SelectItemPageUrl = "~/CMSModules/ContactManagement/Pages/Tools/Account/Add_Contact_Dialog.aspx";
            contactSelector.UniSelector.SetValue("IsLiveSite", false);
            contactSelector.UniSelector.FilterControl        = "~/CMSModules/ContactManagement/Filters/ContactFilter.ascx";
            contactSelector.UniSelector.UseDefaultNameFilter = false;

            modifyAccountContact = AuthorizationHelper.AuthorizedModifyContact(false);

            // Register JS scripts
            RegisterScripts();
        }
        else
        {
            RedirectToAccessDenied(GetString("general.invalidparameters"));
        }
    }
Exemplo n.º 11
0
    /// <summary>
    /// Unigrid button clicked.
    /// </summary>
    protected void gridElem_OnAction(string actionName, object actionArgument)
    {
        if (actionName == "delete")
        {
            int groupId          = ValidationHelper.GetInteger(actionArgument, 0);
            ContactGroupInfo cgi = ContactGroupInfo.Provider.Get(groupId);

            // Check permission
            if ((cgi != null) && AuthorizationHelper.AuthorizedModifyContact(true))
            {
                // Delete contact group
                ContactGroupInfo.Provider.Delete(ContactGroupInfo.Provider.Get(groupId));
            }
        }
    }
Exemplo n.º 12
0
 /// <summary>
 /// UniGrid button clicked.
 /// </summary>
 private void gridElem_OnAction(string actionName, object actionArgument)
 {
     if (actionName == "remove")
     {
         if (AuthorizationHelper.AuthorizedModifyContact(true))
         {
             int         relationId   = ValidationHelper.GetInteger(actionArgument, 0);
             AccountInfo editedObject = AccountInfoProvider.GetAccountInfo(relationId);
             if (editedObject != null)
             {
                 editedObject.AccountSubsidiaryOfID = 0;
                 AccountInfoProvider.SetAccountInfo(editedObject);
             }
         }
     }
 }
    protected void Page_Init(object sender, EventArgs e)
    {
        // Get edited object (contact group)
        if (UIContext.EditedObject != null)
        {
            cgi = (ContactGroupInfo)UIContext.EditedObject;

            // Setup unigrid
            gridElem.WhereCondition       = GetWhereCondition();
            gridElem.OnAction            += gridElem_OnAction;
            gridElem.ZeroRowsText         = GetString("om.account.noaccountsfound");
            gridElem.OnExternalDataBound += gridElem_OnExternalDataBound;
            gridElem.OnDataReload        += gridElem_OnDataReload;

            mModifyPermission = AuthorizationHelper.AuthorizedModifyContact(false);

            // Initialize dropdown lists
            if (!RequestHelper.IsPostBack())
            {
                // Display mass actions
                if (mModifyPermission)
                {
                    drpAction.Items.Add(new ListItem(GetString("general." + Action.SelectAction), Convert.ToInt32(Action.SelectAction).ToString()));
                    drpAction.Items.Add(new ListItem(GetString("general.remove"), Convert.ToInt32(Action.Remove).ToString()));
                    drpWhat.Items.Add(new ListItem(GetString("om.account." + What.Selected), Convert.ToInt32(What.Selected).ToString()));
                    drpWhat.Items.Add(new ListItem(GetString("om.account." + What.All), Convert.ToInt32(What.All).ToString()));
                }
            }
            else
            {
                if (ControlsHelper.CausedPostBack(btnOk))
                {
                    // Set delayed reload for unigrid if mass action is performed
                    gridElem.DelayedReload = true;
                }
            }

            // Initialize account selector
            accountSelector.UniSelector.OnItemsSelected            += UniSelector_OnItemsSelected;
            accountSelector.UniSelector.SelectionMode               = SelectionModeEnum.MultipleButton;
            accountSelector.UniSelector.DialogButton.ResourceString = "om.account.addaccount";
        }
        else
        {
            StopProcessing = true;
        }
    }
 protected void gridElem_OnAction(string actionName, object actionArgument)
 {
     switch (actionName)
     {
     case "delete":
         int membershipId = ValidationHelper.GetInteger(actionArgument, 0);
         if (membershipId > 0)
         {
             // Check permissions
             if (AuthorizationHelper.AuthorizedModifyContact(true))
             {
                 ContactMembershipInfoProvider.DeleteMembershipInfo(membershipId);
             }
         }
         break;
     }
 }
Exemplo n.º 15
0
    protected void Page_Load(object sender, EventArgs e)
    {
        modifyPermission = AuthorizationHelper.AuthorizedModifyContact(false);

        // Edit action URL
        string url = UIContextHelper.GetElementUrl(ModuleName.CONTACTMANAGEMENT, "EditAccount", false);

        url = URLHelper.AddParameterToUrl(url, "objectid", "{0}");

        // Setup UniGrid
        gridElem.OnExternalDataBound += gridElem_OnExternalDataBound;
        gridElem.WhereCondition       = SqlHelper.AddWhereCondition(gridElem.WhereCondition, WhereCondition);
        gridElem.EditActionUrl        = url;
        gridElem.ZeroRowsText         = GetString("om.account.noaccountsfound");
        gridElem.FilteredZeroRowsText = GetString("om.account.noaccountsfound.filtered");

        // Initialize dropdown lists
        if (!RequestHelper.IsPostBack())
        {
            drpAction.Items.Add(new ListItem(GetString("general." + Action.SelectAction), Convert.ToInt32(Action.SelectAction).ToString()));
            if (modifyPermission)
            {
                if (AuthorizationHelper.AuthorizedReadContact(false))
                {
                    drpAction.Items.Add(new ListItem(GetString("om.account." + Action.AddToGroup), Convert.ToInt32(Action.AddToGroup).ToString()));
                }

                drpAction.Items.Add(new ListItem(GetString("general.delete"), Convert.ToInt32(Action.Delete).ToString()));
                drpAction.Items.Add(new ListItem(GetString("om.account." + Action.ChangeStatus), Convert.ToInt32(Action.ChangeStatus).ToString()));
            }
            drpWhat.Items.Add(new ListItem(GetString("om.account." + What.Selected), Convert.ToInt32(What.Selected).ToString()));
            drpWhat.Items.Add(new ListItem(GetString("om.account." + What.All), Convert.ToInt32(What.All).ToString()));
        }
        else
        {
            if (ControlsHelper.CausedPostBack(btnOk))
            {
                // Set delayed reload for UniGrid if mass action is performed
                gridElem.DelayedReload = true;
            }
        }

        // Register JS scripts
        RegisterScripts();
    }
Exemplo n.º 16
0
    protected void btnOk_Click(object sender, EventArgs e)
    {
        if (AuthorizationHelper.AuthorizedModifyContact(true))
        {
            Action action = (Action)ValidationHelper.GetInteger(drpAction.SelectedItem.Value, 0);
            What   what   = (What)ValidationHelper.GetInteger(drpWhat.SelectedItem.Value, 0);

            string where;

            switch (what)
            {
            // All items
            case What.All:
                where = MacroResolver.Resolve(gridElem.WhereCondition);
                break;

            // Selected items
            case What.Selected:
                where = SqlHelper.GetWhereCondition <int>("AccountID", gridElem.SelectedItems, false);
                break;

            default:
                return;
            }

            switch (action)
            {
            // Action 'Remove'
            case Action.Remove:
                // Clear HQ ID of selected accounts
                AccountInfoProvider.UpdateAccountHQ(0, where);
                ShowConfirmation(GetString("om.account.massaction.removed"));
                break;

            default:
                return;
            }

            // Reload UniGrid
            gridElem.ResetSelection();
            gridElem.ReloadData();
            pnlUpdate.Update();
        }
    }
    protected void Page_Init(object sender, EventArgs e)
    {
        mContactInfo = (ContactInfo)UIContext.EditedObject;

        if (mContactInfo == null)
        {
            RedirectToAccessDenied(GetString("general.invalidparameters"));
        }

        // Setup unigrid
        gridElem.GridOptions.ShowSelection = true;
        gridElem.WhereCondition            = SqlHelper.AddWhereCondition(gridElem.WhereCondition, "(ContactID = " + mContactInfo.ContactID + ")");
        gridElem.OnAction            += gridElem_OnAction;
        gridElem.OnExternalDataBound += gridElem_OnExternalDataBound;
        gridElem.ZeroRowsText         = GetString("om.contact.noaccounts");

        // Initialize dropdown lists
        if (!RequestHelper.IsPostBack())
        {
            drpAction.Items.Add(new ListItem(GetString("general." + Action.SelectAction), Convert.ToInt32(Action.SelectAction).ToString()));
            drpAction.Items.Add(new ListItem(GetString("general.remove"), Convert.ToInt32(Action.Remove).ToString()));
            drpAction.Items.Add(new ListItem(GetString("om.contactrole.selectitem"), Convert.ToInt32(Action.SelectRole).ToString()));
            drpWhat.Items.Add(new ListItem(GetString("om.account." + What.Selected), Convert.ToInt32(What.Selected).ToString()));
            drpWhat.Items.Add(new ListItem(GetString("om.account." + What.All), Convert.ToInt32(What.All).ToString()));
        }
        else
        {
            if (ControlsHelper.CausedPostBack(btnOk))
            {
                // Set delayed reload for unigrid if mass action is performed
                gridElem.DelayedReload = true;
            }
        }

        // Initialize contact selector
        accountSelector.UniSelector.OnItemsSelected  += UniSelector_OnItemsSelected;
        accountSelector.UniSelector.SelectionMode     = SelectionModeEnum.MultipleButton;
        accountSelector.UniSelector.SelectItemPageUrl = "~/CMSModules/ContactManagement/Pages/Tools/Contact/Add_Account_Dialog.aspx";
        accountSelector.UniSelector.SetValue("IsLiveSite", false);
        accountSelector.UniSelector.DialogButton.ResourceString = "om.account.addaccount";

        mModifyAccountContact = AuthorizationHelper.AuthorizedModifyContact(false);
    }
Exemplo n.º 18
0
    /// <summary>
    /// Items changed event handler.
    /// </summary>
    private void UniSelector_OnItemsSelected(object sender, EventArgs e)
    {
        if (AuthorizationHelper.AuthorizedModifyContact(true))
        {
            // Get new items from selector
            var newValues = ValidationHelper.GetString(accountSelector.Value, null);
            if (newValues == null)
            {
                return;
            }

            var newItems = newValues.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
            // Set HQ ID of selected accounts to edited account ID
            string where = SqlHelper.GetWhereCondition <int>("AccountID", newItems, false);
            AccountInfoProvider.UpdateAccountHQ(accountInfo.AccountID, @where);

            gridElem.ReloadData();
            pnlUpdate.Update();
            accountSelector.Value = null;
        }
    }
Exemplo n.º 19
0
    protected void Page_Init(object sender, EventArgs e)
    {
        if (UIContext.EditedObject != null)
        {
            accountInfo = (AccountInfo)UIContext.EditedObject;

            // Initialize account selector
            accountSelector.UniSelector.Enabled                     = AuthorizationHelper.AuthorizedModifyContact(false);
            accountSelector.UniSelector.OnItemsSelected            += UniSelector_OnItemsSelected;
            accountSelector.UniSelector.SelectionMode               = SelectionModeEnum.MultipleButton;
            accountSelector.UniSelector.DialogButton.ResourceString = "om.account.addaccount";

            // Setup UniGrid
            gridElem.OnExternalDataBound += gridElem_OnExternalDataBound;
            gridElem.OnAction            += gridElem_OnAction;
            gridElem.ZeroRowsText         = GetString("om.account.noaccountsfound");

            // Initialize dropdown lists
            if (!RequestHelper.IsPostBack())
            {
                drpAction.Items.Add(new ListItem(GetString("general." + Action.SelectAction), Convert.ToInt32(Action.SelectAction).ToString()));
                drpAction.Items.Add(new ListItem(GetString("general.remove"), Convert.ToInt32(Action.Remove).ToString()));
                drpWhat.Items.Add(new ListItem(GetString("om.account." + What.Selected), Convert.ToInt32(What.Selected).ToString()));
                drpWhat.Items.Add(new ListItem(GetString("om.account." + What.All), Convert.ToInt32(What.All).ToString()));
            }

            // Isn't child of someone else
            accountSelector.WhereCondition = "AccountSubsidiaryOfID IS NULL";
            // And isn't recursive parent of edited account
            accountSelector.WhereCondition = SqlHelper.AddWhereCondition(accountSelector.WhereCondition, "AccountID NOT IN (SELECT * FROM Func_OM_Account_GetSubsidiaryOf(" + accountInfo.AccountID + ", 1))");
        }
        else
        {
            StopProcessing = true;
        }
    }
 /// <summary>
 /// Checks modify contact permission for current contact group.
 /// If global, current site permission is also checked.
 /// </summary>
 private void CheckModifyContactPermission()
 {
     AuthorizationHelper.AuthorizedModifyContact(true);
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        // Get edited object (contact group)
        if (UIContext.EditedObject != null)
        {
            cgi = (ContactGroupInfo)UIContext.EditedObject;

            // Check permissions
            AuthorizationHelper.AuthorizedReadContact(true);
            mAuthorizedToModifyContactGroups = AuthorizationHelper.AuthorizedModifyContact(false);

            // Setup unigrid
            string where                  = "(ContactGroupMemberContactGroupID = " + cgi.ContactGroupID + ")";
            gridElem.WhereCondition       = where;
            gridElem.OnAction            += gridElem_OnAction;
            gridElem.ZeroRowsText         = GetString("om.contact.nocontacts");
            gridElem.OnExternalDataBound += gridElem_OnExternalDataBound;

            if (!string.IsNullOrEmpty(cgi.ContactGroupDynamicCondition))
            {
                // Set specific confirmation to remove grid action
                var removeAction = (CMS.UIControls.UniGridConfig.Action)gridElem.GridActions.Actions[1];
                removeAction.Confirmation = "$om.contactgroupmember.confirmremove$";
            }

            // Initialize dropdown lists
            if (!RequestHelper.IsPostBack())
            {
                drpAction.Items.Add(new ListItem(GetString("general." + Action.SelectAction), Convert.ToInt32(Action.SelectAction).ToString()));
                drpWhat.Items.Add(new ListItem(GetString("om.contact." + What.Selected), Convert.ToInt32(What.Selected).ToString()));
                drpWhat.Items.Add(new ListItem(GetString("om.contact." + What.All), Convert.ToInt32(What.All).ToString()));

                if (mAuthorizedToModifyContactGroups)
                {
                    drpAction.Items.Add(new ListItem(GetString("general.remove"), Convert.ToInt32(Action.Remove).ToString()));
                }

                if (AuthorizationHelper.AuthorizedModifyContact(false) && IsFullContactManagementAvailable())
                {
                    drpAction.Items.Add(new ListItem(GetString("om.account." + Action.ChangeStatus), Convert.ToInt32(Action.ChangeStatus).ToString()));
                }

                if (MembershipContext.AuthenticatedUser.IsAuthorizedPerResource(ModuleName.ONLINEMARKETING, "StartProcess") &&
                    IsFullContactManagementAvailable())
                {
                    drpAction.Items.Add(new ListItem(GetString("ma.automationprocess.select"), Convert.ToInt32(Action.StartNewProcess).ToString()));
                }
            }
            else
            {
                if (ControlsHelper.CausedPostBack(btnOk))
                {
                    // Set delayed reload for unigrid if mass action is performed
                    gridElem.DelayedReload = true;
                }
            }

            // Initialize contact selector
            contactSelector.UniSelector.OnItemsSelected += UniSelector_OnItemsSelected;
            contactSelector.UniSelector.SelectionMode    = SelectionModeEnum.MultipleButton;

            // Register JS scripts
            RegisterScripts();
        }
        else
        {
            StopProcessing = true;
        }
    }
 protected void formCustomFields_OnCheckPermissions(object sender, EventArgs e)
 {
     AuthorizationHelper.AuthorizedModifyContact(true);
 }
 protected void formCustomFields_OnBeforeSave(object sender, EventArgs e)
 {
     // Check modify permissions
     AuthorizationHelper.AuthorizedModifyContact(true);
 }