예제 #1
0
    public static void ListsMemberInterestGroupings_FillRow(object resultObj, out SqlInt32 id, out SqlString name, out SqlString group_names,
                                                            out SqlString group_interest_name, out SqlBoolean interested)
    {
        MemberInterestGroupRow row = (MemberInterestGroupRow)resultObj;

        id                  = row.Id ?? SqlInt32.Null;
        name                = row.Name;
        group_names         = row.GroupNames;
        group_interest_name = row.GroupInterestName;
        interested          = row.Interested;
    }
예제 #2
0
    public static IEnumerable ListsMemberInterestGroupings(SqlString apikey, SqlString list_id, SqlString email, SqlString euid, SqlString leid)
    {
        List <MemberInterestGroupRow> rows = new List <MemberInterestGroupRow>();

        string cListId = list_id.ToString();

        MailChimpManager mc = new MailChimpManager(apikey.ToString());

        MemberInfoResult memberResult = mc.GetMemberInfo(cListId, new List <EmailParameter>
        {
            new EmailParameter {
                Email = email.ToString(),
                EUId  = euid.ToString(),
                LEId  = leid.ToString()
            }
        });

        if (memberResult.SuccessCount > 0)
        {
            MemberInfo memberInfo = memberResult.Data[0];

            if (memberInfo.MemberMergeInfo.Groupings != null)
            {
                foreach (Grouping grouping in memberInfo.MemberMergeInfo.Groupings)
                {
                    string groupNames = (grouping.GroupNames == null) ? string.Empty : string.Join(",", grouping.GroupNames.ToArray());

                    foreach (MailChimp.Lists.Grouping.GroupInterest interest in grouping.GroupInterests)
                    {
                        MemberInterestGroupRow row = new MemberInterestGroupRow
                        {
                            Id                = grouping.Id,
                            Name              = grouping.Name,
                            GroupNames        = groupNames,
                            GroupInterestName = interest.Name,
                            Interested        = interest.Interested
                        };
                        rows.Add(row);
                    }
                }
            }
        }
        return(rows);
    }