コード例 #1
0
        /// <summary>
        /// Checks and sets a specific value to the DB and adds a Social Media Message
        /// </summary>
        /// <param name="tweet">tweetenvi tweet object</param>
        /// <param name="MediaType">MediaType</param>
        private void SetSocialMediaMessage(ITweet tweet, int MediaType = 0)
        {
            Location                     location;
            LocationController           locationController           = new LocationController();
            SocialMediaMessageController socialMediaMessageController = new SocialMediaMessageController();

            if (tweet.Coordinates != null)
            {
                location = new Location(tweet.Coordinates.Latitude, tweet.Coordinates.Longitude);
            }
            else
            {
                location = Offence.Location;
            }
            int messageID = socialMediaMessageController.SetSocialMediaMessage(new SocialMediaMessage(0, tweet.CreatedAt, tweet.Text, tweet.CreatedBy.Name, tweet.CreatedBy.ScreenName, location, tweet.Id, Offence, MediaType));

            SocialMediaImageController imageController = new SocialMediaImageController();

            foreach (var media in tweet.Media)
            {
                imageController.SetSocialMediaImage(new SocialMediaImage
                {
                    SocialMediaMessageID = messageID,
                    URL = media.MediaURLHttps
                });
            }
        }
コード例 #2
0
        /// <summary>
        /// Adds an offence to the list of offences for this window.
        /// </summary>
        /// <param name="description">offence description</param>
        /// <param name="category">offence Categorie(enum value)</param>
        /// <param name="dateTime">offence date and time</param>
        /// <param name="location">offence location</param>
        public static void AddOffence(string description, OffenceCategories category, DateTime dateTime, Location location)
        {
            OffenceController offenceController = new OffenceController();
            Offence           offence           = new Offence(dateTime, description, location, category);

            offence.ID = offenceController.SetOffence(offence);

            new Scraper(offence).SetSocialMediaMessages();

            _offences.Add(offence);
        }