示例#1
0
    /// <summary>
    /// Fills tooltip with appropriate data.
    /// </summary>
    private void AccountContactTooltip(Image image, ArrayList roleIDs)
    {
        StringBuilder sb = new StringBuilder();

        sb.AppendFormat("<em>{0}</em><br />", GetString("om.contactrole.roles"));
        string[] array = new string[roleIDs.Count];
        for (int i = 0; i < roleIDs.Count; i++)
        {
            array[i] = ValidationHelper.GetString(roleIDs[i], "0");
        }

        // Get contact role display names
        DataSet ds = ContactRoleInfoProvider.GetContactRoles(SqlHelperClass.GetWhereCondition <int>("ContactRoleID", array, false), "ContactRoleDisplayName", -1, "ContactRoleDisplayName");

        if (!DataHelper.DataSourceIsEmpty(ds))
        {
            // Loop through all distinct values of given column
            foreach (DataRow row in ds.Tables[0].Rows)
            {
                sb.AppendFormat("<br />&nbsp;-&nbsp;{0}", HTMLHelper.HTMLEncode(ValidationHelper.GetString(row["ContactRoleDisplayName"], string.Empty)));
            }
        }

        image.ToolTip += sb.ToString();
    }
    /// <summary>
    /// Fills tooltip with appropriate data.
    /// </summary>
    private string AccountContactTooltip(IList <int> roleIDs)
    {
        StringBuilder sb = new StringBuilder();

        sb.AppendFormat("<div><em>{0}</em></div>", GetString("om.contactrole.roles"));

        // Get contact role display names
        var contactRoles = ContactRoleInfoProvider.GetContactRoles()
                           .WhereIn("ContactRoleID", roleIDs)
                           .OrderBy("ContactRoleDisplayName")
                           .Column("ContactRoleDisplayName");


        // Loop through all distinct values of given column
        foreach (var contactRole in contactRoles)
        {
            sb.AppendFormat("<div>&nbsp;-&nbsp;{0}</div>", HTMLHelper.HTMLEncode(contactRole.ContactRoleDisplayName));
        }

        return(sb.ToString());
    }