public static NameValueCollection AddMembershipParams(MembershipParameters groupParams)
        {
            MembershipParameters.Parameters = new NameValueCollection();
            PropertyInfo[] pic = groupParams.GetType().GetProperties();
            foreach (PropertyInfo pi in pic)
            {
                object value = pi.GetValue(groupParams, null);
                bool include = false;
                if (value != null)
                {
                    string typeName = value.GetType().Name;
                    switch (typeName)
                    {
                        case "Int32":
                            if ((int)value > 0)
                                include = true;
                            break;
                        case "SortBy":
                            if ((SortBy)value != SortBy.NONE)
                                include = true;
                            break;
                        default:
                            include = true;
                            break;
                    }


                    if (include)
                    {
                        MembershipParameterAttribute name = (MembershipParameterAttribute)MembershipParameterAttribute.GetCustomAttribute(pi, typeof(MembershipParameterAttribute));
                        if(name != null)
                            Parameters.Add(name.Name, pi.GetValue(groupParams, null).ToString());
                    }
                }
            }

            return MembershipParameters.Parameters;

        }
示例#2
0
 public static string GetAllUsers(MembershipParameters membershipParams)
 {
     NameValueCollection parameters = Yammer.APIWrapper.MembershipParameters.AddMembershipParams(membershipParams);
     return Yammer.APIWrapper.HttpUtility.Get(Resources.Users.All, parameters);               
 }
示例#3
0
 public static List<User> GetAllUsers(MembershipParameters membershipParams)
 {
     string response = Json.GetAllUsers(membershipParams);
     return JsonConvert.DeserializeObject<List<User>>(response); 
 }
示例#4
0
 public static List<Group> GetAllGroups(MembershipParameters groupParams)
 {
     return JsonConvert.DeserializeObject<List<Group>>(Json.GetAllGroups(groupParams));
 }        
示例#5
0
 public static string GetAllGroups(MembershipParameters groupParams)
 {
     MembershipParameters.AddMembershipParams(groupParams);
     string response = Yammer.APIWrapper.HttpUtility.Get(Resources.Groups.All, MembershipParameters.Parameters);
     return response;
 }