Ejemplo n.º 1
0
        public static void GetContactFromComments(FbComments[] data, SocialNetworkEvent socialEvent)
        {
            try
            {
                var activityTypeBusinessLogic = new DictionaryBusinessLogic<ActivityType>(new DictionaryRepository<ActivityType>(_factory));
                var activityBusinessLogic = new ActivityBusinessLogic(new ActivityRepository(_factory), new TagBusinessLogic(new TagRepository(_factory)),
                new DictionaryBusinessLogic<ActivityType>(new DictionaryRepository<ActivityType>(new DatabaseFactory())));


                foreach (var comments in data)
                {
                    foreach (var fbFrom in comments.data.Select(x => x.@from))
                    {
                        var contact = TryAddContact(fbFrom.id, fbFrom.name);
                        var activity = new Activity
                        {
                            Author = contact,
                            CreateDate = DateTime.Now,
                            Type = activityTypeBusinessLogic.GetByCode(int.Parse(ActivityEnum.Comment.ToString("D")))
                        };
                        activityBusinessLogic.Add(activity);
                        socialEvent.Activities.Add(activity);
                    }
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Ejemplo n.º 2
0
 public static void GetContactFrom(FbFeed[] data)
 {
     try
     {
         foreach (var fbFeed in data)
         {
             var socialEvent = new SocialNetworkEvent();
             var contact = TryAddContact([email protected], [email protected]);
             socialEvent.Avtor = contact;
             socialEvent.CreateDate = DateTime.Parse(fbFeed.created_time);
             socialEvent.EventId = fbFeed.id;
             socialEvent.Message = fbFeed.message ?? String.Empty;
             socialEvent.Link = fbFeed.link;
             socialEvent.Type = fbFeed.type;
             socialEvent.Tags = TryGetTags(fbFeed.message);
             socialEvent.Activities = new List<Activity>();
             GetContactFromLikes(data.Select(x => x.likes).Where(x => x != null).ToArray(), socialEvent);
             GetContactFromComments(data.Select(x => x.comments).Where(x => x != null).ToArray(), socialEvent);
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Ejemplo n.º 3
0
        public static void GetContactFromLikes(FbLikes[] data, SocialNetworkEvent socialEvent)
        {
            try
            {
                var activityBusinessLogic = new ActivityBusinessLogic(new ActivityRepository(_factory), new TagBusinessLogic(new TagRepository(_factory)),
                new DictionaryBusinessLogic<ActivityType>(new DictionaryRepository<ActivityType>(_factory)));

                foreach (var likes in data)
                {
                    foreach (var like in likes.data)
                    {
                        var contact = TryAddContact(like.id, like.name);
                        var activity = new Activity
                        {
                            Author = contact,
                            CreateDate = DateTime.Now,
                            Type = activityBusinessLogic.GetActivityType(int.Parse(ActivityEnum.Like.ToString("D")))
                        };
                        //activityBusinessLogic.Add(activity);
                        socialEvent.Activities.Add(activity);
                    }
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }