Ejemplo n.º 1
0
        //public static void Track(Status status)
        //{
        //    DbIncrementRetweetCount.Run(status.RetweetedStatus.ID);
        //    var origTime = TwitterAPI.Utility.Parse.TwitterToDateTime(status.RetweetedStatus.CreatedAt);
        //    var timeSince = (int)(DateTime.Now.ToUniversalTime() - origTime).TotalSeconds;
        //    DbTwitterRetweetTrack.Insert(long.Parse(status.ID), long.Parse(status.RetweetedStatus.ID), timeSince,
        //        TwitterAPI.Utility.Parse.TwitterToDateTime(status.CreatedAt));
        //}
        public static void Track(StatusJson status)
        {
            DbIncrementRetweetCount.Run(status.RetweetId);

            var origTime = status.CreatedAt.FromEpoch();
            var timeSince = (int)(DateTime.Now.ToUniversalTime() - origTime).TotalSeconds;

            DbTwitterRetweetTrack.Insert(long.Parse(status.Id), long.Parse(status.RetweetId), timeSince,
                status.CreatedAt.FromEpoch());
        }
Ejemplo n.º 2
0
        public static StatusJson ToInternal(Status status)
        {
            Status a = status;
            var statusJson = new StatusJson();

            if (status.RetweetedStatus != null)
            {
                a = status.RetweetedStatus;
                statusJson.Retweet = true;
                statusJson.RetweetId = a.ID;
                statusJson.RetweetedBy = new StatusUserJson();
                statusJson.RetweetedBy.Id = status.User.Id;
                statusJson.RetweetedBy.Name = status.User.Name;
                statusJson.RetweetedBy.ProfileImageUrl = status.User.ProfileImageURL;
                statusJson.RetweetedBy.ScreenName = status.User.ScreenName;

            }

            // Make sure to use the id from the retweet, otherwise the key
            // may already exist. We want to know who RT'd
            statusJson.Id = status.ID;
            statusJson.Coordinates = a.Coordinates;
            statusJson.Entities = a.Entities;
            statusJson.Geo = a.Geo;
            statusJson.InReplyToStatusId = a.InReplyToStatusID;
            statusJson.InReplyToUserId = a.InReplyToUserID;
            statusJson.Place = a.Place;
            statusJson.Source = a.Source;
            statusJson.Text = a.Text;
            statusJson.User = new StatusUserJson();
            statusJson.User.Id = a.User.Id;
            statusJson.User.Name = a.User.Name;
            statusJson.User.ScreenName = a.User.ScreenName;
            statusJson.User.ProfileImageUrl = a.User.ProfileImageURL;
            statusJson.CreatedAt = TwitterAPI.Utility.Parse.TwitterToDateTime(a.CreatedAt).ToEpoch();

            return statusJson;
        }