Ejemplo n.º 1
0
        public void SendTweetsForMeetings(TimeSpan waitTime)
        {
            var meetings = _meetingsRepository.GetUpcommingMeetings();

            foreach (var meeting in meetings)
            {
                // We will wait for 1 hour before sending tweets
                if (DateTime.Now - meeting.CreatedAt < waitTime)
                {
                    continue;
                }

                if (!DataContext.Current.MeetingTweetAlerts.Any(x => x.MeetingId == meeting.Id))
                {
                    var alert = new MeetingTweetAlert();
                    alert.Message   = _twitterMeetingAlertGenerator.GenerateMessage(meeting);
                    alert.DateSent  = DateTime.Now;
                    alert.MeetingId = meeting.Id;

                    try {
                        _twitterAdapter.SendTweet(alert.Message);
                    } catch (Exception ex) {
                        alert.DateFailed  = DateTime.Now;
                        alert.FailMessage = ex.Message;
                        Debug.WriteLine("Could not send twitter message for meeting {0}: {1}", meeting.Id, ex.Message);
                    }

                    DataContext.Current.MeetingTweetAlerts.Add(alert);
                }
            }
        }
Ejemplo n.º 2
0
        public ActionResult MeetingsForFrontpage()
        {
            var upcommingMeetings = MeetingsRepository.GetUpcommingMeetings(Request.QueryString).ToArray();

            //ViewBag.MapData = MeetingsMapHelper.CreateMeetingMapModel(upcommingMeetings, Url);
            return(PartialView(upcommingMeetings));
        }
Ejemplo n.º 3
0
        public ActionResult Index()
        {
            ViewBag.MetaDescription =
                "Geekhub.dk er stedet hvor udviklere finder deres events/arrangementer - foreslå dit event til listen, og spred budskabet.";

            var upcommingMeetings = MeetingsRepository.GetUpcommingMeetings(Request.QueryString);

            return(View(upcommingMeetings));
        }
Ejemplo n.º 4
0
        public ActionResult Widget()
        {
            var title    = Request.QueryString["title"].Or("Udvikler events i danmark");
            var meetings = MeetingsRepository.GetUpcommingMeetings(Request.QueryString);

            var model = new WidgetViewModel(title, meetings.Take(5));

            return(PartialView(model));
        }
Ejemplo n.º 5
0
        public ActionResult Json()
        {
            var model   = MeetingsRepository.GetUpcommingMeetings(Request.QueryString);
            var options = new JsonSerializerSettings();

            options.ContractResolver = new CamelCasePropertyNamesContractResolver();
            var json = JsonConvert.SerializeObject(new JsonViewModel(model), options);

            return(Content(json, "application/json"));
        }
Ejemplo n.º 6
0
        public ActionResult Ics()
        {
            var meetings = MeetingsRepository.GetUpcommingMeetings(Request.QueryString);

            return(new CalendarResult("Geekhub", meetings));
        }
Ejemplo n.º 7
0
        public ActionResult Rss()
        {
            var model = MeetingsRepository.GetUpcommingMeetings(Request.QueryString);

            return(PartialView(new RssViewModel(model)));
        }