Exemplo n.º 1
0
        public ActionResult Test()
        {
            for (int i = 0; i < 100; i++)
            {
                Attendee attendee = new Attendee { Name = "Some Guy", TwitterURL = "http://twitter.com/jptoto", AvatarURL = "http://a2.twimg.com/profile_images/1158960374/bc_normal.png" };
                string[] tagArray = new string[10];
                tagArray[0] = "developer";
                tagArray[1] = "designer";
                tagArray[2] = "asp.net";

                attendee.Tags = tagArray;
                _repository.Create(attendee);
            }
                return View("Index");
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            AttendeeRepository _repository = new AttendeeRepository() { Settings = Settings };

            var input = "@barcampphilly #ohai";

            var scrubbed = HttpUtility.UrlEncode(input);
            var reader = XmlReader.Create(string.Format("http://search.twitter.com/search.atom?&q={0}&rpp=100", scrubbed));
            var feed = SyndicationFeed.Load(reader);

            // Order these backwards so we allways do the newest feeds list since I suck at upserts
            foreach (SyndicationItem item in feed.Items.OrderBy(x=>x.Id))
            {
                Attendee attendee = new Attendee { Name = item.Authors[0].Name, TwitterURL = item.Authors[0].Uri, AvatarURL = item.Links[1].Uri.AbsoluteUri };

                // This whole situation here is cheese. C# arrays are annoying.
                string tweet = item.Title.Text;
                string[] tweetTags = tweet.Split(' ');
                string[] userTags = new string[20];
                int i = 0;
                foreach (string tag in tweetTags)
                {
                    if (tag.Contains("#") && (!tag.Contains("#ohai")))
                    {
                        userTags[i] = tag.Replace("#","");
                        i++;
                    }
                }

                attendee.Tags = userTags;

                // Really should try and get upserts working. Stop sucking already, Toto!
                _repository.Remove(new { TwitterURL = attendee.TwitterURL });
                _repository.Create(attendee);
            }
        }
Exemplo n.º 3
0
 public void Add(Attendee attendee)
 {
     List.Add(attendee);
 }