/// <summary> /// To retrieve updates from 1st degree connections of the authenticated user /// </summary> /// <param name="OAuth"></param> /// <param name="LinkedInId"></param> /// <param name="Count"></param> /// <returns></returns> public List<User_Updates> GetUserUpdates(oAuthLinkedIn OAuth, string LinkedInId, int Count) { User_Updates user_Updates = new User_Updates(); // SocialStream socialStream = new SocialStream(); ShareAndSocialStream socialStream = new ShareAndSocialStream(); xmlResult = socialStream.Get_UserUpdates(OAuth,LinkedInId, Count); XmlNodeList xmlNodeList = xmlResult.GetElementsByTagName("update"); foreach (XmlNode xn in xmlNodeList) { try { XmlElement Element = (XmlElement)xn; double timestamp = Convert.ToDouble(Element.GetElementsByTagName("timestamp")[0].InnerText); user_Updates.DateTime = JavaTimeStampToDateTime(timestamp); try { user_Updates.UpdateType = Element.GetElementsByTagName("update-type")[0].InnerText; } catch { } try { user_Updates.PersonId = Element.GetElementsByTagName("id")[0].InnerText; } catch { } try { user_Updates.PersonFirstName = Element.GetElementsByTagName("first-name")[0].InnerText; } catch { } try { user_Updates.PersonLastName = Element.GetElementsByTagName("last-name")[0].InnerText; } catch { } try { user_Updates.PersonHeadLine = Element.GetElementsByTagName("headline")[0].InnerText; } catch { } try { user_Updates.PersonHeadLine = Element.GetElementsByTagName("headline")[0].InnerText; } catch { } try { user_Updates.PictureUrl = Element.GetElementsByTagName("picture-url")[0].InnerText; } catch { } string MessageType = ""; try { MessageType = Element.GetElementsByTagName("update-type")[0].InnerText; } catch { } if (MessageType == "CONN") { XmlElement innerElement = (XmlElement)xn; string personFirstName = ""; string personLastName = ""; string Personheadline = ""; if (innerElement.SelectSingleNode("picture-url") == null) { personFirstName = innerElement.GetElementsByTagName("first-name")[1].InnerText; } if (innerElement.SelectSingleNode("picture-url") == null) { personLastName = innerElement.GetElementsByTagName("last-name")[1].InnerText; } if (innerElement.SelectSingleNode("picture-url") == null) { Personheadline = innerElement.GetElementsByTagName("headline")[1].InnerText; } user_Updates.Message = user_Updates.PersonFirstName + " " + user_Updates.PersonLastName + " is now connected to " + personFirstName + " " + personLastName; } else if (MessageType == "NCON") { XmlElement innerElement = (XmlElement)xn; string personFirstName = ""; string personLastName = ""; string Personheadline = ""; if (innerElement.SelectSingleNode("picture-url") == null) { personFirstName = innerElement.GetElementsByTagName("first-name")[1].InnerText; } if (innerElement.SelectSingleNode("picture-url") == null) { personLastName = innerElement.GetElementsByTagName("last-name")[1].InnerText; } if (innerElement.SelectSingleNode("picture-url") == null) { Personheadline = innerElement.GetElementsByTagName("headline")[1].InnerText; } user_Updates.Message = user_Updates.PersonFirstName + " " + user_Updates.PersonLastName + " is now connected with " + personFirstName + " " + personLastName; } else if (MessageType == "CCEM") { XmlElement innerElement = (XmlElement)xn; string personFirstName = ""; string personLastName = ""; string Personheadline = ""; if (innerElement.SelectSingleNode("picture-url") == null) { personFirstName = innerElement.GetElementsByTagName("first-name")[1].InnerText; } if (innerElement.SelectSingleNode("picture-url") == null) { personLastName = innerElement.GetElementsByTagName("last-name")[1].InnerText; } if (innerElement.SelectSingleNode("picture-url") == null) { Personheadline = innerElement.GetElementsByTagName("headline")[1].InnerText; } user_Updates.Message = user_Updates.PersonFirstName + " " + user_Updates.PersonLastName + " is now connected with " + personFirstName + " " + personLastName; } else if (MessageType == "SHAR") { //user_Updates.Message = user_Updates.PersonFirstName + " " + user_Updates.PersonLastName + "Updated their profile picture"; } else if (MessageType == "STAT") { user_Updates.Message = Element.GetElementsByTagName("current-status")[0].InnerText; } else if (MessageType == "VIRL") { //user_Updates.Message = user_Updates.PersonFirstName + " " + user_Updates.PersonLastName + "Updated their profile picture"; } else if (MessageType == "JGRP") { //user_Updates.Message = user_Updates.PersonFirstName + " " + user_Updates.PersonLastName + "Updated their profile picture"; } else if (MessageType == "QSTN") { //user_Updates.Message = user_Updates.PersonFirstName + " " + user_Updates.PersonLastName + "Updated their profile picture"; } else if (MessageType == "ANSW") { //user_Updates.Message = user_Updates.PersonFirstName + " " + user_Updates.PersonLastName + "Updated their profile picture"; } else if (MessageType == "APPM") { //user_Updates.Message = user_Updates.PersonFirstName + " " + user_Updates.PersonLastName + "Updated their profile picture"; } else if (MessageType == "APPS") { //user_Updates.Message = user_Updates.PersonFirstName + " " + user_Updates.PersonLastName + "Updated their profile picture"; } else if (MessageType == "PRFU") { //user_Updates.Message = user_Updates.PersonFirstName + " " + user_Updates.PersonLastName + "Updated their profile picture"; } else if (MessageType == "PRFX") { //user_Updates.Message = user_Updates.PersonFirstName + " " + user_Updates.PersonLastName + "Updated their profile picture"; } else if (MessageType == "PREC") { //user_Updates.Message = user_Updates.PersonFirstName + " " + user_Updates.PersonLastName + "Updated their profile picture"; } else if (MessageType == "SVPR") { //user_Updates.Message = user_Updates.PersonFirstName + " " + user_Updates.PersonLastName + "Updated their profile picture"; } else if (MessageType == "JOBP") { //user_Updates.Message = user_Updates.PersonFirstName + " " + user_Updates.PersonLastName + "Updated their profile picture"; } else if (MessageType == "CMPY") { //user_Updates.Message = user_Updates.PersonFirstName + " " + user_Updates.PersonLastName + "Updated their profile picture"; } else if (MessageType == "MSFC") { //user_Updates.Message = user_Updates.PersonFirstName + " " + user_Updates.PersonLastName + "Updated their profile picture"; } else if (MessageType == "PICU") { user_Updates.Message = user_Updates.PersonFirstName + " " + user_Updates.PersonLastName + " Updated their profile picture"; } else if (MessageType == "PROF") { user_Updates.Message = user_Updates.PersonFirstName + " " + user_Updates.PersonLastName + " Updated their profile"; } UserUpdatesList.Add(user_Updates); } catch { } } return UserUpdatesList; }
/// <summary> /// To retrieve updates from 1st degree connections of the authenticated user /// </summary> /// <param name="OAuth"></param> /// <param name="LinkedInId"></param> /// <param name="Count"></param> /// <returns></returns> public List <User_Updates> GetUserUpdates(oAuthLinkedIn OAuth, string LinkedInId, int Count) { User_Updates user_Updates = new User_Updates(); // SocialStream socialStream = new SocialStream(); ShareAndSocialStream socialStream = new ShareAndSocialStream(); xmlResult = socialStream.Get_UserUpdates(OAuth, LinkedInId, Count); XmlNodeList xmlNodeList = xmlResult.GetElementsByTagName("update"); foreach (XmlNode xn in xmlNodeList) { try { XmlElement Element = (XmlElement)xn; double timestamp = Convert.ToDouble(Element.GetElementsByTagName("timestamp")[0].InnerText); user_Updates.DateTime = JavaTimeStampToDateTime(timestamp); try { user_Updates.UpdateType = Element.GetElementsByTagName("update-type")[0].InnerText; } catch { } try { user_Updates.PersonId = Element.GetElementsByTagName("id")[0].InnerText; } catch { } try { user_Updates.PersonFirstName = Element.GetElementsByTagName("first-name")[0].InnerText; } catch { } try { user_Updates.PersonLastName = Element.GetElementsByTagName("last-name")[0].InnerText; } catch { } try { user_Updates.PersonHeadLine = Element.GetElementsByTagName("headline")[0].InnerText; } catch { } try { user_Updates.Comment = Element.GetElementsByTagName("comment")[0].InnerText; } catch { } try { user_Updates.PictureUrl = Element.GetElementsByTagName("picture-url")[0].InnerText; } catch { } string MessageType = ""; try { MessageType = Element.GetElementsByTagName("update-type")[0].InnerText; } catch { } if (MessageType == "CONN") { XmlElement innerElement = (XmlElement)xn; string personFirstName = ""; string personLastName = ""; string Personheadline = ""; if (innerElement.SelectSingleNode("picture-url") == null) { personFirstName = innerElement.GetElementsByTagName("first-name")[1].InnerText; } if (innerElement.SelectSingleNode("picture-url") == null) { personLastName = innerElement.GetElementsByTagName("last-name")[1].InnerText; } if (innerElement.SelectSingleNode("picture-url") == null) { Personheadline = innerElement.GetElementsByTagName("headline")[1].InnerText; } user_Updates.Message = user_Updates.PersonFirstName + " " + user_Updates.PersonLastName + " is now connected to " + personFirstName + " " + personLastName; } else if (MessageType == "NCON") { XmlElement innerElement = (XmlElement)xn; string personFirstName = ""; string personLastName = ""; string Personheadline = ""; if (innerElement.SelectSingleNode("picture-url") == null) { personFirstName = innerElement.GetElementsByTagName("first-name")[1].InnerText; } if (innerElement.SelectSingleNode("picture-url") == null) { personLastName = innerElement.GetElementsByTagName("last-name")[1].InnerText; } if (innerElement.SelectSingleNode("picture-url") == null) { Personheadline = innerElement.GetElementsByTagName("headline")[1].InnerText; } user_Updates.Message = user_Updates.PersonFirstName + " " + user_Updates.PersonLastName + " is now connected with " + personFirstName + " " + personLastName; } else if (MessageType == "CCEM") { XmlElement innerElement = (XmlElement)xn; string personFirstName = ""; string personLastName = ""; string Personheadline = ""; if (innerElement.SelectSingleNode("picture-url") == null) { personFirstName = innerElement.GetElementsByTagName("first-name")[1].InnerText; } if (innerElement.SelectSingleNode("picture-url") == null) { personLastName = innerElement.GetElementsByTagName("last-name")[1].InnerText; } if (innerElement.SelectSingleNode("picture-url") == null) { Personheadline = innerElement.GetElementsByTagName("headline")[1].InnerText; } user_Updates.Message = user_Updates.PersonFirstName + " " + user_Updates.PersonLastName + " is now connected with " + personFirstName + " " + personLastName; } else if (MessageType == "SHAR") { //user_Updates.Message = user_Updates.PersonFirstName + " " + user_Updates.PersonLastName + "Updated their profile picture"; user_Updates.Message = user_Updates.PersonFirstName + " " + user_Updates.PersonLastName + " " + "Updated as" + " " + user_Updates.Comment; } else if (MessageType == "STAT") { user_Updates.Message = Element.GetElementsByTagName("current-status")[0].InnerText; } else if (MessageType == "VIRL") { //user_Updates.Message = user_Updates.PersonFirstName + " " + user_Updates.PersonLastName + "Updated their profile picture"; } else if (MessageType == "JGRP") { //user_Updates.Message = user_Updates.PersonFirstName + " " + user_Updates.PersonLastName + "Updated their profile picture"; } else if (MessageType == "QSTN") { //user_Updates.Message = user_Updates.PersonFirstName + " " + user_Updates.PersonLastName + "Updated their profile picture"; } else if (MessageType == "ANSW") { //user_Updates.Message = user_Updates.PersonFirstName + " " + user_Updates.PersonLastName + "Updated their profile picture"; } else if (MessageType == "APPM") { //user_Updates.Message = user_Updates.PersonFirstName + " " + user_Updates.PersonLastName + "Updated their profile picture"; } else if (MessageType == "APPS") { //user_Updates.Message = user_Updates.PersonFirstName + " " + user_Updates.PersonLastName + "Updated their profile picture"; } else if (MessageType == "PRFU") { //user_Updates.Message = user_Updates.PersonFirstName + " " + user_Updates.PersonLastName + "Updated their profile picture"; } else if (MessageType == "PRFX") { //user_Updates.Message = user_Updates.PersonFirstName + " " + user_Updates.PersonLastName + "Updated their profile picture"; } else if (MessageType == "PREC") { //user_Updates.Message = user_Updates.PersonFirstName + " " + user_Updates.PersonLastName + "Updated their profile picture"; } else if (MessageType == "SVPR") { //user_Updates.Message = user_Updates.PersonFirstName + " " + user_Updates.PersonLastName + "Updated their profile picture"; } else if (MessageType == "JOBP") { //user_Updates.Message = user_Updates.PersonFirstName + " " + user_Updates.PersonLastName + "Updated their profile picture"; } else if (MessageType == "CMPY") { //user_Updates.Message = user_Updates.PersonFirstName + " " + user_Updates.PersonLastName + "Updated their profile picture"; } else if (MessageType == "MSFC") { //user_Updates.Message = user_Updates.PersonFirstName + " " + user_Updates.PersonLastName + "Updated their profile picture"; } else if (MessageType == "PICU") { user_Updates.Message = user_Updates.PersonFirstName + " " + user_Updates.PersonLastName + " Updated their profile picture"; } else if (MessageType == "PROF") { user_Updates.Message = user_Updates.PersonFirstName + " " + user_Updates.PersonLastName + " Updated their profile"; } UserUpdatesList.Add(user_Updates); } catch { } } return(UserUpdatesList); }