Esempio n. 1
0
 public void Save(UserParameters up)
 {
     User.Update(int.Parse(this.Id), up);
     
 }
Esempio n. 2
0
 public static void Create(UserParameters userParams)
 {
     NameValueCollection parameters = new NameValueCollection();
     AddUserParam(parameters, userParams);
     string response = Yammer.HttpUtility.Post(Resources.YAMMER_USERS_CREATE, parameters);
 }
Esempio n. 3
0
        private static void AddUserParam(NameValueCollection parameters, UserParameters userParams)
        {
            PropertyInfo[] pic = userParams.GetType().GetProperties();
            UserAttribute name;
            foreach (PropertyInfo pi in pic)
            {
                object value = pi.GetValue(userParams, null);
                bool include = false;
                if (value != null)
                {
                    string typeName = value.GetType().Name;
                    switch (typeName)
                    {
                        case "String":
                            name = (UserAttribute)UserAttribute.GetCustomAttribute(pi, typeof(UserAttribute));
                            parameters.Add(name.Name, pi.GetValue(userParams, null).ToString());
                            break;
                        case "List`1":
                            name = (UserAttribute)UserAttribute.GetCustomAttribute(pi, typeof(UserAttribute));
                            if (name.Name == "education[]")
                            {
                                List<UserEducation> edl = (List<UserEducation>)pi.GetValue(userParams, null);
                                foreach (UserEducation pc in edl)
                                    parameters.Add(name.Name, pc.School + "," + pc.Degree + "," + pc.Description + "," + pc.StartYear + "," + pc.EndYear);

                            }
                            else if (name.Name == "previous_companies[]")
                            {
                                List<PreviousCompany> pcl = (List<PreviousCompany>)pi.GetValue(userParams, null);
                                foreach (PreviousCompany pc in pcl)
                                    parameters.Add(name.Name, pc.Company + "," + pc.Position + "," + pc.Description + "," + pc.StartYear + "," + pc.EndYear);
                            }
                            break;
                        default:
                            include = false;
                            break;
                    }
                }
            }
        }
Esempio n. 4
0
 public static void Update(int id, UserParameters userParams)
 {
     NameValueCollection parameters = new NameValueCollection();
     AddUserParam(parameters, userParams);
     string response = Yammer.HttpUtility.Put(Resources.YAMMER_USERS_MODIFY + id.ToString() + ".xml", parameters);
     Session.Assets.UpdateUsers();
 }