Ejemplo n.º 1
0
    /// <summary>
    /// Handles the OnClick event of the SaveAsGroup control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    protected void SaveAsGroup_OnClick(object sender, EventArgs e)
    {
        TargetSelectedFilterState filterState = GetFilterState();

        DialogService.SetSpecs(200, 200, 220, 350, "CampaignTargetCreateGroup", "", true);
        DialogService.DialogParameters.Add("TargetSelectedFilterState", filterState);
        DialogService.ShowDialog();
    }
    /// <summary>
    /// Handles the OnClick event of the cmdOK control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    protected void cmdOK_OnClick(object sender, EventArgs e)
    {
        if (string.IsNullOrEmpty(txtGroupName.Text))
        {
            DialogService.ShowMessage(GetLocalResourceObject("error_NoGroupName").ToString());
            return;
        }
        if (DialogService.DialogParameters.Count > 0)
        {
            if (DialogService.DialogParameters.ContainsKey("TargetSelectedFilterState"))
            {
                string groupId = String.Empty;
                TargetSelectedFilterState filterState = DialogService.DialogParameters["TargetSelectedFilterState"] as TargetSelectedFilterState;
                TargetsViewDataSource     ds          = new TargetsViewDataSource();
                string targetIds = null;
                ds.SelectedFilterState = filterState;
                if (lbxGroupType.SelectedValue.Equals("Contact"))
                {
                    filterState.IncludeContacts = true;
                    filterState.IncludeLeads    = false;
                }
                else
                {
                    filterState.IncludeContacts = false;
                    filterState.IncludeLeads    = true;
                }

                targetIds = ConvertToString(rdgGroupMembers.SelectedIndex == 0 ? ds.GetEntityIds(false) : ds.GetEntityIds(true));
                if (!string.IsNullOrEmpty(targetIds))
                {
                    groupId = GroupInfo.CreateAdHocGroup(targetIds, lbxGroupType.SelectedValue, txtGroupName.Text);
                }
                else
                {
                    throw new ValidationException(String.Format(GetLocalResourceObject("error_NoTargetsFound").ToString(), lbxGroupType.SelectedValue));
                }

                if (!String.IsNullOrEmpty(groupId))
                {
                    Response.Redirect(lbxGroupType.SelectedValue.Equals("Contact")
                                          ? string.Format("Contact.aspx?gid={0}", groupId)
                                          : string.Format("Lead.aspx?gid={0}", groupId));
                }
            }
            else
            {
                DialogService.ShowMessage(GetLocalResourceObject("error_NoDataSourceFound").ToString());
            }
            DialogService.CloseEventHappened(sender, e);
            Refresh();
        }
    }
Ejemplo n.º 3
0
 /// <summary>
 /// Handles the OnClick event of the UpdateTargets control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
 protected void UpdateTargets_OnClick(object sender, EventArgs e)
 {
     if (DialogService != null)
     {
         _State.manageViewOpen = true;
         TargetSelectedFilterState state = GetFilterState();
         ICampaign campaign = GetParentEntity() as ICampaign;
         DialogService.SetSpecs(200, 200, 650, 900, "UpdateTargets", "", true);
         DialogService.EntityType = typeof(ICampaign);
         DialogService.EntityID   = campaign.Id.ToString();
         DialogService.DialogParameters.Add("TargetSelectedFilterState", state);
         DialogService.ShowDialog();
     }
 }
 /// <summary>
 /// Called when [form bound].
 /// </summary>
 ///
 protected override void OnFormBound()
 {
     base.OnFormBound();
     ClientBindingMgr.RegisterDialogCancelButton(cmdCancel);
     _campaign = (ICampaign)BindingSource.Current;
     if (DialogService.DialogParameters.Count > 0)
     {
         object filterStateObj;
         if (DialogService.DialogParameters.TryGetValue("TargetSelectedFilterState", out filterStateObj))
         {
             _filterState = filterStateObj as TargetSelectedFilterState;
             _filterState.IncludeSelectedOnly = true;
         }
     }
     LoadView();
 }
    /// <summary>
    /// Gets the data source.
    /// </summary>
    /// <returns>
    ///
    /// </returns>
    private TargetsViewDataSource GetDataSource()
    {
        TargetsViewDataSource ds = new TargetsViewDataSource();

        if (DialogService.DialogParameters.Count > 0)
        {
            object filterStateObj;
            if (DialogService.DialogParameters.TryGetValue("TargetSelectedFilterState", out filterStateObj))
            {
                _filterState = filterStateObj as TargetSelectedFilterState;
                _filterState.IncludeSelectedOnly = true;
            }
        }
        ds.SelectedFilterState = _filterState;
        return(ds);
    }
Ejemplo n.º 6
0
    /// <summary>
    /// Gets the seleceted target ids.
    /// </summary>
    /// <returns></returns>
    private object[] GetSelecetedTargetIds()
    {
        object[] ids             = null;
        TargetsViewDataSource ds = new TargetsViewDataSource();

        if (DialogService.DialogParameters.Count > 0)
        {
            object filterStateObj;
            if (DialogService.DialogParameters.TryGetValue("TargetSelectedFilterState", out filterStateObj))
            {
                _filterState = filterStateObj as TargetSelectedFilterState;
                _filterState.IncludeSelectedOnly = true;
            }
        }

        ds.SelectedFilterState = _filterState;
        ids = ds.GetTargetIds(true);
        return(ids);
    }
    /// <summary>
    /// Gets the state of the filter.
    /// </summary>
    /// <returns></returns>
    private TargetSelectedFilterState GetFilterState()
    {
        TargetSelectedFilterState state = new TargetSelectedFilterState();
        ICampaign campaign = GetParentEntity() as ICampaign;

        state.CampaignId      = campaign.Id.ToString();
        state.IncludeContacts = chkContacts.Checked;
        state.IncludeLeads    = chkLeads.Checked;

        state.FilterByGroup = chkGroup.Checked;
        if (lbxGroups.SelectedItem != null)
        {
            state.GroupValue = lbxGroups.SelectedItem.Text;
        }

        state.FilterByPriority = chkPriority.Checked;
        if (lbxPriority.SelectedItem != null)
        {
            state.PriorityValue = lbxPriority.SelectedItem.Text;
        }

        state.FilterByResponded = chkResponded.Checked;
        state.Responded         = (rdgResponded.SelectedIndex == 0);

        state.FilterByStatus = chkStatus.Checked;
        if (lbxStatus.SelectedItem != null)
        {
            state.StatusValue = lbxStatus.SelectedItem.Text;
        }

        state.FilterByStage = chkStage.Checked;
        if (lbxStages.SelectedItem != null)
        {
            state.StageValue = lbxStages.SelectedItem.Text;
        }

        state.SelectedALL    = IsSelectALL();
        state.SelectedStates = GetSelectState();
        return(state);
    }
Ejemplo n.º 8
0
    /// <summary>
    /// Gets the state of the filter.
    /// </summary>
    /// <returns></returns>
    private TargetSelectedFilterState GetFilterState()
    {
        TargetSelectedFilterState state = new TargetSelectedFilterState();
        ICampaign campaign = GetParentEntity() as ICampaign;
        state.CampaignId = campaign.Id.ToString();
        state.IncludeContacts = chkContacts.Checked;
        state.IncludeLeads = chkLeads.Checked;

        state.FilterByGroup = chkGroup.Checked;
        if (lbxGroups.SelectedItem != null)
            state.GroupValue = lbxGroups.SelectedItem.Text;

        state.FilterByPriority = chkPriority.Checked;
        if (lbxPriority.SelectedItem != null)
            state.PriorityValue = lbxPriority.SelectedItem.Text;

        state.FilterByResponded = chkResponded.Checked;
        state.Responded = (rdgResponded.SelectedIndex == 0);

        state.FilterByStatus = chkStatus.Checked;
        if (lbxStatus.SelectedItem != null)
            state.StatusValue = lbxStatus.SelectedItem.Text;

        state.FilterByStage = chkStage.Checked;
        if (lbxStages.SelectedItem != null)
            state.StageValue = lbxStages.SelectedItem.Text;

        state.SelectedALL = IsSelectALL();
        state.SelectedStates = GetSelectState();
        return state;
    }
Ejemplo n.º 9
0
    /// <summary>
    /// Gets the seleceted target ids.
    /// </summary>
    /// <returns></returns>
    private object[] GetSelecetedTargetIds()
    {
        object[] ids = null;
        TargetsViewDataSource ds = new TargetsViewDataSource();

        if (DialogService.DialogParameters.Count > 0)
        {
            object filterStateObj;
            if (DialogService.DialogParameters.TryGetValue("TargetSelectedFilterState", out filterStateObj))
            {
                _filterState = filterStateObj as TargetSelectedFilterState;
                _filterState.IncludeSelectedOnly = true;
            }
        }

        ds.SelectedFilterState = _filterState;
        ids = ds.GetTargetIds(true);
        return ids;
    }
Ejemplo n.º 10
0
    /// <summary>
    /// Called when [form bound].
    /// </summary>
    /// 
    protected override void OnFormBound()
    {
        base.OnFormBound();
        ClientBindingMgr.RegisterDialogCancelButton(cmdCancel);
        _campaign = (ICampaign) this.BindingSource.Current;
        if (txtInit.Value == "F")
        {

        }
        if (DialogService.DialogParameters.Count > 0)
        {
            object filterStateObj;
            if (DialogService.DialogParameters.TryGetValue("TargetSelectedFilterState", out filterStateObj))
            {
                _filterState = filterStateObj as TargetSelectedFilterState;
                _filterState.IncludeSelectedOnly = true;
            }
        }
        LoadView();
    }
 /// <summary>
 /// Gets the data source.
 /// </summary>
 /// <returns>
 /// 
 /// </returns>
 private TargetsViewDataSource GetDataSource()
 {
     TargetsViewDataSource ds = new TargetsViewDataSource();
     if (DialogService.DialogParameters.Count > 0)
     {
         object filterStateObj;
         if (DialogService.DialogParameters.TryGetValue("TargetSelectedFilterState", out filterStateObj))
         {
             _filterState = filterStateObj as TargetSelectedFilterState;
             _filterState.IncludeSelectedOnly = true;
         }
     }
     ds.SelectedFilterState = _filterState;
     return ds;
 }