コード例 #1
0
    /// <summary>
    /// Loads account-contact role collisions.
    /// </summary>
    private void LoadContactCollisions()
    {
        StringBuilder resultQuery = new StringBuilder("AccountID IN (" + parentAccount.AccountID);

        foreach (DataRow dr in mergedAccounts.Tables[0].Rows)
        {
            resultQuery.Append("," + dr["AccountID"]);
        }
        resultQuery.Append(")");
        // Get all account-contact relations
        DataSet relations = new AccountContactListInfo().Generalized.GetData(null, resultQuery.ToString(), null, -1, "ContactID,ContactFirstName,ContactMiddleName,ContactLastName,ContactRoleID", false);

        // Group by contactID to get distinct results
        DataTable result       = relations.Tables[0].DefaultView.ToTable(true, "ContactID");
        int       totalMerging = 0;

        // Display contact-account relations
        if (!DataHelper.DataSourceIsEmpty(result))
        {
            // Display prefix
            Literal prepend = new Literal();
            prepend.Text = "<table class=\"CollisionPanel\">";
            plcAccountContact.Controls.Add(prepend);

            // Display collisions
            foreach (DataRow dr in result.Rows)
            {
                totalMerging += DisplayRoleCollisions(ValidationHelper.GetInteger(dr[0], 0), relations);
            }

            // Display suffix if any relation found
            if (totalMerging > 0)
            {
                Literal append = new Literal();
                append.Text = "</table>";
                plcAccountContact.Controls.Add(append);
            }
            else
            {
                tabContacts.Visible       = false;
                tabContacts.HeaderText    = null;
                plcAccountContact.Visible = false;
            }
        }
        // Hide content
        else
        {
            tabContacts.Visible       = false;
            tabContacts.HeaderText    = null;
            plcAccountContact.Visible = false;
        }
    }
コード例 #2
0
    /// <summary>
    /// Loads account-contact role collisions.
    /// </summary>
    private void LoadContactCollisions()
    {
        StringBuilder resultQuery = new StringBuilder("AccountID IN (" + mParentAccount.AccountID);
        foreach (DataRow dr in mMergedAccounts.Tables[0].Rows)
        {
            resultQuery.Append("," + dr["AccountID"]);
        }
        resultQuery.Append(")");
        // Get all account-contact relations
        DataSet relations = new AccountContactListInfo().Generalized.GetData(null, resultQuery.ToString(), null, -1, "ContactID,ContactFirstName,ContactMiddleName,ContactLastName,ContactRoleID", false);

        // Group by contactID to get distinct results
        DataTable result = relations.Tables[0].DefaultView.ToTable(true, "ContactID");
        int totalMerging = 0;

        // Display contact-account relations
        if (!DataHelper.DataSourceIsEmpty(result))
        {
            // Display prefix
            Literal prepend = new Literal();
            prepend.Text = "<div class=\"form-horizontal\">";
            plcAccountContact.Controls.Add(prepend);

            // Display collisions
            foreach (DataRow dr in result.Rows)
            {
                totalMerging += DisplayRoleCollisions(ValidationHelper.GetInteger(dr[0], 0), relations);
            }

            // Display suffix if any relation found
            if (totalMerging > 0)
            {
                Literal append = new Literal();
                append.Text = "</div>";
                plcAccountContact.Controls.Add(append);
            }
            else
            {
                tabContacts.Visible = false;
                tabContacts.HeaderText = null;
                plcAccountContact.Visible = false;
            }
        }
            // Hide content
        else
        {
            tabContacts.Visible = false;
            tabContacts.HeaderText = null;
            plcAccountContact.Visible = false;
        }
    }