Пример #1
0
    /// <summary>
    /// Called when [set filters] event is fired on the TargetViewDataSource object.
    /// </summary>
    /// <param name="criteria">The criteria.</param>
    /// <param name="expressions">The expressions.</param>
    protected void OnSetFilters(Sage.Platform.Repository.ICriteria criteria, IExpressionFactory expressions)
    {
        ICampaign campaign = GetParentEntity() as ICampaign;
        criteria.Add(expressions.Eq("Campaignid", campaign.Id.ToString()));

        if (chkContacts.Checked && chkLeads.Checked)
        {
           //Don't Set Any Filters
        }
        if (!chkContacts.Checked && !chkLeads.Checked)
        {
            criteria.Add(expressions.Eq("TargetType", "NONE"));
        }
        if (chkContacts.Checked && !chkLeads.Checked)
        {
            criteria.Add(expressions.Eq("TargetType", "Contact"));
        }
        if (!chkContacts.Checked && chkLeads.Checked)
        {
            criteria.Add(expressions.Eq("TargetType", "Lead"));
        }

        if (chkPriority.Checked)
            criteria.Add(expressions.Eq("Priority", lbxPriority.SelectedItem.Text));
        if (chkGroup.Checked)
            criteria.Add(expressions.Eq("GroupName", lbxGroups.SelectedItem.Text));
        if (chkStatus.Checked)
            criteria.Add(expressions.Eq("Status", lbxStatus.SelectedItem.Text));
        if (chkStage.Checked)
            criteria.Add(expressions.Eq("Stage", lbxStages.SelectedItem.Text));
        if (chkResponded.Checked)
        {
            if (rdgResponded.SelectedIndex == 0)
            {
                criteria.Add(expressions.IsNotNull("ResponseDate"));
            }
            else
            {
                criteria.Add(expressions.IsNull("ResponseDate"));
            }
        }
    }