private void NotifyUserOnTwitter(ChatMessage message, User user, TwitterUser u) { TweetSharp.TwitterService svc = new TwitterService(GetClientInfo()); svc.AuthenticateWith(ConfigurationManager.AppSettings["User.Token"], ConfigurationManager.AppSettings["User.TokenSecret"]); svc.SendTweet(String.Format(_tweetFormat, u.ScreenName, String.IsNullOrEmpty(user.TwitterUserName) ? user.JabbrUserName : user.TwitterUserName, message.Room)); }
public void MarkUserNotified(string UserName) { var userRec = this.Users.FirstOrDefault(u => u.JabbrUserName == UserName); if (userRec == null) { userRec = new User() { JabbrUserName = UserName }; this.Users.Add(userRec); } userRec.LastNotification = DateTime.Now; this.SaveChanges(); }
public User FetchOrCreateUser(string forUser) { var user = this.Users.FirstOrDefault(u => u.JabbrUserName == forUser); if (user == null) { user = new User() { LastNotification = DateTime.Now.AddMinutes(-60), JabbrUserName = forUser }; this.Users.Add(user); this.SaveChanges(); } return user; }