protected void Page_Init(object sender, EventArgs e)
    {
        if (Contact == null)
        {
            RedirectToAccessDenied(GetString("general.invalidparameters"));
        }

        AuthorizationHelper.AuthorizedReadContact(true);

        // Initialize process selector
        ucSelector.UniSelector.SelectionMode = SelectionModeEnum.SingleButton;

        // Check permissions
        if (WorkflowStepInfoProvider.CanUserStartAutomationProcess(CurrentUser, CurrentSiteName))
        {
            ucSelector.UniSelector.OnItemsSelected += UniSelector_OnItemsSelected;
            ucSelector.UniSelector.SetValue("IsLiveSite", false);
            ucSelector.Enabled = true;
        }
        else
        {
            ucSelector.Enabled = false;
        }


        listElem.ObjectID      = Contact.ContactID;
        listElem.ObjectType    = ContactInfo.OBJECT_TYPE;
        listElem.EditActionUrl = "Process_Detail.aspx?stateid={0}";
    }
    /// <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)
    {
        if (!QueryHelper.ValidateHash("hash") || Parameters == null)
        {
            StopProcessing = true;
            return;
        }

        CurrentMaster.PanelContent.RemoveCssClass("dialog-content");

        where = ValidationHelper.GetString(Parameters["where"], null);

        // Check read permission
        if (AuthorizationHelper.AuthorizedReadContact(true))
        {
            PageTitle.TitleText = GetString("om.account.select");
            Page.Title          = PageTitle.TitleText;

            // Load header actions
            InitHeaderActions();

            gridElem.WhereCondition       = "AccountID NOT IN (SELECT AccountID FROM OM_Account WHERE " + where + ")";
            gridElem.OnExternalDataBound += gridElem_OnExternalDataBound;
            gridElem.ShowActionsMenu      = false;
            if (!RequestHelper.IsPostBack())
            {
                gridElem.Pager.DefaultPageSize = 10;
            }
        }
    }
Exemplo n.º 4
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();
    }
    /// <summary>
    /// Returns WHERE condition
    /// </summary>
    private string GetWhereCondition()
    {
        if (!AuthorizationHelper.AuthorizedReadContact(true))
        {
            return(new WhereCondition().NoResults().ToString());
        }

        return(new WhereCondition().WhereEquals("ContactGroupMemberContactGroupID", cgi.ContactGroupID).ToString(true));
    }
    /// <summary>
    /// Reloads the data in the selector.
    /// </summary>
    public void ReloadData()
    {
        uniSelector.WhereCondition = WhereCondition;

        if (!AuthorizationHelper.AuthorizedReadContact(false))
        {
            uniSelector.WhereCondition = SqlHelper.AddWhereCondition(WhereCondition, "(1=0)");
        }

        uniSelector.Reload(true);
    }
    /// <summary>
    /// Reloads the data in the selector.
    /// </summary>
    public void ReloadData()
    {
        if (!AuthorizationHelper.AuthorizedReadContact(false))
        {
            uniSelector.WhereCondition = "(1=0)";
        }

        // Initialize selector
        uniSelector.IsLiveSite = false;
        uniSelector.Reload(true);
    }
Exemplo n.º 8
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();
    }
    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");
    }
Exemplo n.º 10
0
    /// <summary>
    /// Reloads the data in the selector.
    /// </summary>
    public void ReloadData()
    {
        if (string.IsNullOrEmpty(uniSelector.AdditionalSearchColumns))
        {
            uniSelector.FilterControl        = "~/CMSModules/ContactManagement/FormControls/SearchContactFullName.ascx";
            uniSelector.UseDefaultNameFilter = false;
        }


        var isAuthorized = AuthorizationHelper.AuthorizedReadContact(false);

        uniSelector.WhereCondition = SqlHelper.AddWhereCondition(uniSelector.WhereCondition, isAuthorized ? WhereCondition : "(1=0)");
        uniSelector.Reload(true);
    }
Exemplo n.º 11
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.º 12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        CurrentMaster.PanelContent.RemoveCssClass("dialog-content");
        PageTitle.TitleText = GetString("om.contactgroup.selecttitle");
        Page.Title          = PageTitle.TitleText;

        if (!QueryHelper.ValidateHash("hash") || Parameters == null)
        {
            StopProcessing = true;
            return;
        }

        // Check permission
        if (AuthorizationHelper.AuthorizedReadContact(true))
        {
            gridElem.OnExternalDataBound += gridElem_OnExternalDataBound;
        }
    }
    protected void SetupControl()
    {
        // Check permissions
        var currentUser = MembershipContext.AuthenticatedUser;

        if (!AuthorizationHelper.AuthorizedReadContact(false))
        {
            lblInfo.Visible = true;
            lblInfo.Text    = GetString("om.myaccounts.notallowedtoreadaccounts");
            return;
        }

        gridElem.Visible               = true;
        gridElem.WhereCondition        = "AccountOwnerUserID=" + currentUser.UserID;
        gridElem.OnExternalDataBound  += gridElem_OnExternalDataBound;
        gridElem.Pager.DefaultPageSize = PageSize;

        ScriptHelper.RegisterDialogScript(Page);

        SetVisibleColumns();
    }
    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;
        }
    }