public string GenerateMessage(Meeting meeting)
 {
     var message = meeting.Title;
     var hashTags = "#" + meeting.City.Name.ToLower();
     var link = "geekhub.dk/m/" + meeting.Id;
     return SendTweetWithLink(message, hashTags , link);
 }
 public string GenerateMessage(Meeting meeting)
 {
     var message = meeting.Title;
     var hashTags = "#" + meeting.City.Name.ToLower();
     var link = "geekhub.dk/m/" + meeting.Id;
     var date = meeting.StartsAt.ToString("d. MMM");
     return SendTweetWithLink(message, hashTags, link, date);
 }
Пример #3
0
 private void SetID(Meeting meeting)
 {
     if (DataContext.Current.Meetings.Any()) {
         meeting.Id = DataContext.Current.Meetings.Max(x => x.Id) + 1;
     }
     else {
         meeting.Id = 1;
     }
 }
Пример #4
0
 public WidgetMeetingViewModel(Meeting meeting)
 {
     Tooltip = string.Format("{0} - {1} - {2}", meeting.City.Name, meeting.StartsAt.ToString("d. MMM YYYY, HH:mm"), meeting.Title);
     Day = meeting.StartsAt.ToString("dd");
     Month = meeting.StartsAt.ToString("MMM");
     Link = MeetingUrlGenerator.CreateFullMeetingUrl(meeting.Id, null);
     Tags = meeting.Tags.Select(x => x.Name);
     Organizers = string.Join(" & ", meeting.Organizers.Select(x => x.Name));
     Title = meeting.Title;
     Location = meeting.City.Name;
 }
Пример #5
0
        private void AddTagsToMeeting(Meeting meeting, string tagsString)
        {
            meeting.Tags.Clear();

            var tags = TagsToString(tagsString);

            foreach (var tag in tags) {
                var tagRecord = new Tag() { Name = tag };
                meeting.Tags.Add(tagRecord);
            }
        }
Пример #6
0
 public RssViewItemModel(Meeting meeting)
 {
     Title = string.Format("{0} - {1}", meeting.Title, meeting.StartsAt.ToString("dd. MMM yyyy"));
     Link = MeetingUrlGenerator.CreateFullMeetingUrl(meeting.Id, "rss");
     Guid = Link;
     var description = string.Format("<strong>{0} - {1}</strong><br/>{2}",
         meeting.City.Name,
         string.Join(" & ", meeting.Organizers.Select(x => x.Name)),
         HttpUtility.HtmlEncode(meeting.Description));
     Description = new HtmlString(description);
 }
Пример #7
0
        private void AddOrganizersToMeeting(Meeting meeting, string organizersString)
        {
            meeting.Organizers.Clear();

            var organizers = TagsToString(organizersString);

            foreach (var organizer in organizers) {
                var organizerRecord = new Organizer() { Name = organizer };
                meeting.Organizers.Add(organizerRecord);
            }
        }
Пример #8
0
        public Meeting Create(MeetingFormModel formModel)
        {
            var meeting = new Meeting();

            SetID(meeting);

            _meetingFormModelBinder.FormModelToMeeting(formModel, meeting);

            DataContext.Current.Meetings.Add(meeting);

            return meeting;
        }
Пример #9
0
        public MeetingFormModel(Meeting meeting)
        {
            Url = meeting.Url;
            Title = meeting.Title;
            StartsAtDate = meeting.StartsAt.ToString("yyyy/MM/dd");
            Organizers = string.Join(",", meeting.Organizers.Select(x => x.Name));
            Tags = string.Join(",", meeting.Tags.Select(x => x.Name));
            Description = meeting.Description;

            if (meeting.City != null) {
                City = meeting.City.Name;
            }
        }
Пример #10
0
        public void FormatTest1()
        {
            var m = new Meeting() {
                City = new City() { Name = "Odense" },
                Title = "Mit møde",
                Id = 1
            };

            var a = new TwitterMeetingAlertGenerator();
            var actual = a.GenerateMessage(m);

            Assert.Equal("Mit møde (1. jan) #odense geekhub.dk/m/1", actual);
        }
Пример #11
0
 public JsonMeetingViewModel(Meeting meeting)
 {
     Id = meeting.Id;
     Title = meeting.Title;
     StartsAt = meeting.StartsAt;
     CreatedAt = meeting.CreatedAt;
     Description = meeting.Description;
     Url = meeting.Url;
     Tags = meeting.Tags.Select(x=>x.Name).ToArray();
     Organizers = meeting.Organizers.Select(x => x.Name).ToArray();
     Address = meeting.AddressFormatted;
     City = meeting.City.Name;
     Latitude = meeting.Latitude;
     Longtitude = meeting.Longtitude;
 }
Пример #12
0
        public void FormModelToMeeting(MeetingFormModel formModel, Meeting meeting)
        {
            meeting.Url = formModel.Url;
            meeting.Title = formModel.Title;
            meeting.StartsAt = DateTime.Parse(formModel.StartsAtDate);

            if (formModel.City.IsPresent()) {
                meeting.City = new City() { Name = formModel.City };
            }

            AddOrganizersToMeeting(meeting, formModel.Organizers);
            AddTagsToMeeting(meeting, formModel.Tags);

            meeting.Description = formModel.Description;
        }
Пример #13
0
        public void Create(JsonViewModel.JsonMeetingViewModel formModel)
        {
            var meeting = new Meeting();

            SetID(meeting);

            meeting.Address = formModel.Address;
            meeting.AddressFormatted = formModel.Address;
            meeting.City = new City() { Name = formModel.City };
            meeting.CreatedAt = formModel.CreatedAt;
            meeting.Description = formModel.Description;
            meeting.Latitude = formModel.Latitude;
            meeting.Longtitude = formModel.Longtitude;
            meeting.Organizers.AddRange(formModel.Organizers.Select(x=>new Organizer() { Name = x}));
            meeting.StartsAt = formModel.StartsAt;
            meeting.Tags.AddRange(formModel.Tags.Select(x=>new Tag() { Name = x}));
            meeting.Title = formModel.Title;
            meeting.Url = formModel.Url;

            DataContext.Current.Meetings.Add(meeting);
        }
Пример #14
0
        public void FormModelToMeeting(MeetingFormModel formModel, Meeting meeting)
        {
            meeting.Url = formModel.Url;
            meeting.Title = formModel.Title;
            meeting.Address = formModel.Address;
            meeting.AddressFormatted = formModel.AddressFormatted;
            if (formModel.AddressLat.IsPresent() && formModel.AddressLng.IsPresent()) {
                meeting.Latitude = double.Parse(formModel.AddressLat, CultureInfo.InvariantCulture);
                meeting.Longtitude = double.Parse(formModel.AddressLng, CultureInfo.InvariantCulture);
            }
            meeting.StartsAt = DateTime.Parse(formModel.StartsAtDate + " " + formModel.StartsAtTime);

            if (formModel.City.IsPresent()) {
                meeting.City = new City() { Name = formModel.City };
            }

            AddOrganizersToMeeting(meeting, formModel.Organizers);
            AddTagsToMeeting(meeting, formModel.Tags);

            meeting.Description = formModel.Description;
        }
Пример #15
0
        public MeetingFormModel(Meeting meeting)
        {
            Url = meeting.Url;
            Title = meeting.Title;
            Address = meeting.Address;
            AddressFormatted = meeting.AddressFormatted;
            if (meeting.Latitude.HasValue) {
                AddressLat = meeting.Latitude.Value.ToString(CultureInfo.InvariantCulture);
            }
            if (meeting.Longtitude.HasValue) {
                AddressLng = meeting.Longtitude.Value.ToString(CultureInfo.InvariantCulture);
            }

            StartsAtDate = meeting.StartsAt.ToString("yyyy/MM/dd");
            StartsAtTime = meeting.StartsAt.ToString("HH:mm");
            Organizers = string.Join(",", meeting.Organizers.Select(x => x.Name));
            Tags = string.Join(",", meeting.Tags.Select(x => x.Name));
            Description = meeting.Description;

            if (meeting.City != null) {
                City = meeting.City.Name;
            }
        }
Пример #16
0
 public MeetingViewModel(Meeting meeting)
 {
     Url = "http://geekhub.dk/meetings/" + meeting.Id + "/?utm_source=email";
     Title = meeting.Title;
     City = meeting.City.Name;
     StartsAt = meeting.StartsAt.ToString("dd. MMM");
     Organizers = string.Join(" & ", meeting.Organizers.Select(x => x.Name));
     Description = meeting.Description.Replace(Environment.NewLine, "<br/>");
 }