Пример #1
0
        public List <Domain.Myfashion.Domain.LinkedInGroup.Group_Updates> GetGroupPostData(oAuthLinkedIn OAuth, int Count, string groupid, string linkedinId)
        {
            Domain.Myfashion.Domain.LinkedInGroup.Group_Updates        group_Updates    = new Domain.Myfashion.Domain.LinkedInGroup.Group_Updates();
            List <Domain.Myfashion.Domain.LinkedInGroup.Group_Updates> GroupUpdatesList = new List <Domain.Myfashion.Domain.LinkedInGroup.Group_Updates>();
            ShareAndSocialStream socialStream = new ShareAndSocialStream();

            xmlResult = socialStream.Get_GroupPostData(OAuth, Count, groupid);

            XmlNodeList xmlNodeList = xmlResult.GetElementsByTagName("post");


            foreach (XmlNode xn in xmlNodeList)
            {
                try
                {
                    XmlElement Element = (XmlElement)xn;

                    try
                    {
                        group_Updates.LinkedInProfileId = linkedinId;
                    }
                    catch (Exception ex)
                    { Console.WriteLine(ex.StackTrace); }

                    try
                    {
                        group_Updates.id = groupid;
                    }
                    catch (Exception ex)
                    { Console.WriteLine(ex.StackTrace); }
                    try
                    {
                        group_Updates.GpPostid = Element.GetElementsByTagName("id")[0].InnerText;
                    }
                    catch (Exception ex)
                    { Console.WriteLine(ex.StackTrace); }

                    try
                    {
                        group_Updates.firstname = Element.GetElementsByTagName("first-name")[0].InnerText;
                    }
                    catch (Exception ex)
                    { Console.WriteLine(ex.StackTrace); }



                    try
                    {
                        string following = Element.GetElementsByTagName("is-following")[0].InnerText;
                        if (following == "true")
                        {
                            group_Updates.isFollowing = 1;
                        }
                        else
                        {
                            group_Updates.isFollowing = 0;
                        }
                    }
                    catch (Exception ex)
                    { Console.WriteLine(ex.StackTrace); }
                    try
                    {
                        string like = Element.GetElementsByTagName("is-liked")[0].InnerText;
                        if (like == "true")
                        {
                            group_Updates.isLiked = 1;
                        }
                        else
                        {
                            group_Updates.isLiked = 0;
                        }
                    }
                    catch (Exception ex)
                    { Console.WriteLine(ex.StackTrace); }

                    try
                    {
                        group_Updates.likes_total = Element.GetElementsByTagName("likes")[0].Attributes["total"].Value;
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    try
                    {
                        group_Updates.comments_total = Element.GetElementsByTagName("comments")[0].Attributes["total"].Value;
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }

                    try
                    {
                        group_Updates.summary = Element.GetElementsByTagName("summary")[0].InnerText;
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }

                    try
                    {
                        group_Updates.lastname = Element.GetElementsByTagName("last-name")[0].InnerText;
                    }
                    catch (Exception ex)
                    { Console.WriteLine(ex.StackTrace); }
                    try
                    {
                        group_Updates.headline = Element.GetElementsByTagName("headline")[0].InnerText;
                    }
                    catch (Exception ex)
                    { Console.WriteLine(ex.StackTrace); }
                    try
                    {
                        group_Updates.pictureurl = Element.GetElementsByTagName("picture-url")[0].InnerText;
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                        group_Updates.pictureurl = "www.socioboard.com/Themes/" + System.Configuration.ConfigurationManager.AppSettings["domain"] + "/Contents/img/blank_img.png";//"../../Contents/img/blank_img.png";
                    }

                    try
                    {
                        group_Updates.title = Element.GetElementsByTagName("title")[0].InnerText;
                    }
                    catch (Exception ex)
                    { Console.WriteLine(ex.StackTrace); }

                    GroupUpdatesList.Add(group_Updates);
                }
                catch (Exception ex)
                { Console.WriteLine(ex.StackTrace); }
            }
            return(GroupUpdatesList);
        }
Пример #2
0
        public List <Group_Updates> GetGroupPostData(oAuthLinkedIn OAuth, int Count, string groupid)
        {
            Group_Updates group_Updates = new Group_Updates();

            ShareAndSocialStream socialStream = new ShareAndSocialStream();

            xmlResult = socialStream.Get_GroupPostData(OAuth, Count, groupid);

            XmlNodeList xmlNodeList = xmlResult.GetElementsByTagName("post");


            foreach (XmlNode xn in xmlNodeList)
            {
                try
                {
                    //string following = string.Empty;
                    //string like = string.Empty;

                    XmlElement Element = (XmlElement)xn;

                    try
                    {
                        // string abbb = Element.GetElementsByTagName("creator").Item(0).InnerXml;
                        //XmlNodeList xmlNodeList1 = Element.GetElementsByTagName("creator");
                        //foreach (XmlNode x in xmlNodeList1)
                        //{
                        //    XmlElement Elements = (XmlElement)x;
                        //    try
                        //    {
                        //        group_Updates.GpPostid = Elements.GetElementsByTagName("id")[0].InnerText;
                        //    }
                        //    catch(Exception ex)
                        //    { Console.WriteLine(ex.StackTrace); }
                        //}


                        group_Updates.GpPostid = Element.GetElementsByTagName("id")[0].InnerText;
                    }
                    catch (Exception ex)
                    { Console.WriteLine(ex.StackTrace); }

                    try
                    {
                        group_Updates.firstname = Element.GetElementsByTagName("first-name")[0].InnerText;
                    }
                    catch (Exception ex)
                    { Console.WriteLine(ex.StackTrace); }



                    try
                    {
                        string following = Element.GetElementsByTagName("is-following")[0].InnerText;
                        if (following == "true")
                        {
                            group_Updates.isFollowing = 1;
                        }
                        else
                        {
                            group_Updates.isFollowing = 0;
                        }
                    }
                    catch (Exception ex)
                    { Console.WriteLine(ex.StackTrace); }
                    try
                    {
                        string like = Element.GetElementsByTagName("is-liked")[0].InnerText;
                        if (like == "true")
                        {
                            group_Updates.isLiked = 1;
                        }
                        else
                        {
                            group_Updates.isLiked = 0;
                        }
                    }
                    catch (Exception ex)
                    { Console.WriteLine(ex.StackTrace); }

                    try
                    {
                        group_Updates.likes_total = Element.GetElementsByTagName("likes")[0].Attributes["total"].Value;
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    try
                    {
                        group_Updates.comments_total = Element.GetElementsByTagName("comments")[0].Attributes["total"].Value;
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }

                    try
                    {
                        group_Updates.summary = Element.GetElementsByTagName("summary")[0].InnerText;
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }

                    try
                    {
                        group_Updates.lastname = Element.GetElementsByTagName("last-name")[0].InnerText;
                    }
                    catch (Exception ex)
                    { Console.WriteLine(ex.StackTrace); }
                    try
                    {
                        group_Updates.headline = Element.GetElementsByTagName("headline")[0].InnerText;
                    }
                    catch (Exception ex)
                    { Console.WriteLine(ex.StackTrace); }
                    try
                    {
                        group_Updates.pictureurl = Element.GetElementsByTagName("picture-url")[0].InnerText;
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                        group_Updates.pictureurl = "../../Contents/img/blank_img.png";
                    }

                    try
                    {
                        group_Updates.title = Element.GetElementsByTagName("title")[0].InnerText;
                    }
                    catch (Exception ex)
                    { Console.WriteLine(ex.StackTrace); }

                    GroupUpdatesList.Add(group_Updates);
                }
                catch (Exception ex)
                { Console.WriteLine(ex.StackTrace); }
            }
            return(GroupUpdatesList);
        }