public override void PostScheduleMessage(dynamic data) { try { oAuthTwitter OAuthTwt = new oAuthTwitter(); TwitterAccountRepository fbaccrepo = new TwitterAccountRepository(); TwitterAccount twtaccount = fbaccrepo.getUserInformation(data.UserId, data.ProfileId); OAuthTwt.CallBackUrl = System.Configuration.ConfigurationSettings.AppSettings["callbackurl"]; OAuthTwt.ConsumerKey = System.Configuration.ConfigurationSettings.AppSettings["consumerKey"]; OAuthTwt.ConsumerKeySecret = System.Configuration.ConfigurationSettings.AppSettings["consumerSecret"]; OAuthTwt.AccessToken = twtaccount.OAuthToken; OAuthTwt.AccessTokenSecret = twtaccount.OAuthSecret; OAuthTwt.TwitterScreenName = twtaccount.TwitterScreenName; OAuthTwt.TwitterUserId = twtaccount.TwitterUserId; #region For Testing // For Testing //OAuthTwt.ConsumerKey = "udiFfPxtCcwXWl05wTgx6w"; //OAuthTwt.ConsumerKeySecret = "jutnq6N32Rb7cgbDSgfsrUVgRQKMbUB34yuvAfCqTI"; //OAuthTwt.AccessToken = "1904022338-Ao9chvPouIU8ejE1HMG4yJsP3hOgEoXJoNRYUF7"; //OAuthTwt.AccessTokenSecret = "Wj93a8csVFfaFS1MnHjbmbPD3V6DJbhEIf4lgSAefORZ5"; //OAuthTwt.TwitterScreenName = ""; //OAuthTwt.TwitterUserId = ""; #endregion TwitterUser twtuser = new TwitterUser(); if (string.IsNullOrEmpty(data.ShareMessage)) { data.ShareMessage = "There is no data in Share Message !"; } JArray post = twtuser.Post_Status_Update(OAuthTwt, data.ShareMessage); Console.WriteLine("Message post on twitter for Id :" + twtaccount.TwitterUserId + " and Message: " + data.ShareMessage); ScheduledMessageRepository schrepo = new ScheduledMessageRepository(); schrepo.updateMessage(data.Id); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); Log log = new Log(); log.CreatedDate = DateTime.Now; log.Exception = ex.Message; log.Id = Guid.NewGuid(); log.ModuleName = "TwitterScheduler"; log.ProfileId = data.ProfileId; log.Status = false; LogRepository logRepo = new LogRepository(); logRepo.AddLog(log); } }
public override void PostScheduleMessage(dynamic data) { try { oAuthTwitter OAuthTwt = new oAuthTwitter(); TwitterAccountRepository fbaccrepo = new TwitterAccountRepository(); TwitterAccount twtaccount = fbaccrepo.getUserInformation(data.UserId, data.ProfileId); OAuthTwt.CallBackUrl = System.Configuration.ConfigurationSettings.AppSettings["callbackurl"]; OAuthTwt.ConsumerKey = System.Configuration.ConfigurationSettings.AppSettings["consumerKey"]; OAuthTwt.ConsumerKeySecret= System.Configuration.ConfigurationSettings.AppSettings["consumerSecret"]; OAuthTwt.AccessToken = twtaccount.OAuthToken; OAuthTwt.AccessTokenSecret= twtaccount.OAuthSecret; OAuthTwt.TwitterScreenName = twtaccount.TwitterScreenName; TwitterUser twtuser = new TwitterUser(); JArray post = twtuser.Post_Status_Update(OAuthTwt, data.ShareMessage); Console.WriteLine("Message post on twitter for Id :" + twtaccount.TwitterUserId + " and Message: " + data.ShareMessage); ScheduledMessageRepository schrepo = new ScheduledMessageRepository(); schrepo.updateMessage(data.Id); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } }
public override void PostScheduleMessage(dynamic data) { try { FacebookAccountRepository fbaccrepo = new FacebookAccountRepository(); //IEnumerable<FacebookAccount> lstfbaccount = fbaccrepo.getUserDetails(data.ProfileId); FacebookAccount fbaccount = fbaccrepo.getUserDetails(data.ProfileId); //FacebookAccount fbaccount = null; //foreach (FacebookAccount item in lstfbaccount) //{ // fbaccount = item; // break; //} FacebookClient fbclient = new FacebookClient(fbaccount.AccessToken); var args = new Dictionary<string, object>(); args["message"] = data.ShareMessage; //var facebookpost = fbclient.Post("/me/feed", args); var facebookpost = ""; if (fbaccount.Type == "page") { facebookpost = fbclient.Post("/" + fbaccount.FbUserId + "/feed", args).ToString(); } else { facebookpost = fbclient.Post("/me/feed", args).ToString(); } Console.WriteLine("Message post on facebook for Id :" + fbaccount.FbUserId + " and Message: " + data.ShareMessage); ScheduledMessageRepository schrepo = new ScheduledMessageRepository(); ScheduledMessage schmsg = new ScheduledMessage(); schmsg.Id = data.Id; schmsg.ProfileId = data.ProfileId; schmsg.ProfileType = ""; schmsg.Status = true; schmsg.UserId = data.UserId; schmsg.ShareMessage = data.ShareMessage; schmsg.ScheduleTime = data.ScheduleTime; schmsg.ClientTime = data.ClientTime; schmsg.CreateTime = data.CreateTime; schmsg.PicUrl = data.PicUrl; schrepo.updateMessage(data.Id); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } }
public override void PostScheduleMessage(dynamic data) { try { LinkedInAccountRepository linkedinrepo = new LinkedInAccountRepository(); LinkedInAccount linkedinaccount = linkedinrepo.getLinkedinAccountDetailsById(data.ProfileId); Console.WriteLine("========================================================================="); // IEnumerable<LinkedInAccount> lstlinkedinaccount = linkedinrepo.getLinkedinAccountDetailsById(data.ProfileId); //foreach (LinkedInAccount item in lstlinkedinaccount) //{ // linkedinaccount = item; // break; //} oAuthLinkedIn Linkedin_oauth = new oAuthLinkedIn(); Linkedin_oauth.ConsumerKey = System.Configuration.ConfigurationSettings.AppSettings["LiApiKey"].ToString(); Linkedin_oauth.ConsumerSecret = System.Configuration.ConfigurationSettings.AppSettings["LiSecretKey"].ToString(); Linkedin_oauth.FirstName = linkedinaccount.LinkedinUserName; Linkedin_oauth.Token = linkedinaccount.OAuthToken; Linkedin_oauth.TokenSecret = linkedinaccount.OAuthSecret; Linkedin_oauth.Verifier = linkedinaccount.OAuthVerifier; LinkedInUser linkeduser = new LinkedInUser(); var response = linkeduser.SetStatusUpdate(Linkedin_oauth, data.ShareMessage); Console.WriteLine("Message post on linkedin for Id :" + linkedinaccount.LinkedinUserId + " and Message: " + data.ShareMessage); Console.WriteLine("============================================================="); ScheduledMessageRepository schrepo = new ScheduledMessageRepository(); ScheduledMessage schmsg = new ScheduledMessage(); schmsg.Id = data.Id; schmsg.ProfileId = data.ProfileId; schmsg.ProfileType = "linkedin"; schmsg.Status = true; schmsg.UserId = data.UserId; schmsg.ShareMessage = data.ShareMessage; schmsg.ScheduleTime = data.ScheduleTime; schmsg.ClientTime = data.ClientTime; schmsg.CreateTime = data.CreateTime; schmsg.PicUrl = data.PicUrl; schrepo.updateMessage(data.Id); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } }
public override void PostScheduleMessage(dynamic data) { try { FacebookAccountRepository fbaccrepo = new FacebookAccountRepository(); FacebookAccount fbaccount = fbaccrepo.getUserDetails(data.ProfileId); FacebookClient fbclient = new FacebookClient(fbaccount.AccessToken); var args = new Dictionary<string, object>(); args["message"] = data.ShareMessage; var facebookpost = fbclient.Post("/me/feed", args); Console.WriteLine("Message post on facebook for Id :" + fbaccount.FbUserId + " and Message: " + data.ShareMessage); ScheduledMessageRepository schmesgrepo = new ScheduledMessageRepository(); schmesgrepo.updateMessage(data.Id); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } }
public override void PostScheduleMessage(dynamic data) { try { LinkedInAccountRepository linkedinrepo = new LinkedInAccountRepository(); LinkedInAccount linkedinaccount = linkedinrepo.getUserInformation(data.UserId, data.ProfileId); oAuthLinkedIn Linkedin_oauth = new oAuthLinkedIn(); Linkedin_oauth.ConsumerKey = System.Configuration.ConfigurationSettings.AppSettings["LiApiKey"]; Linkedin_oauth.ConsumerSecret = System.Configuration.ConfigurationSettings.AppSettings["LiSecretKey"]; Linkedin_oauth.FirstName = linkedinaccount.LinkedinUserName; Linkedin_oauth.Token = linkedinaccount.OAuthToken; Linkedin_oauth.TokenSecret = linkedinaccount.OAuthSecret; Linkedin_oauth.Verifier = linkedinaccount.OAuthVerifier; LinkedInUser linkeduser = new LinkedInUser(); var response = linkeduser.SetStatusUpdate(Linkedin_oauth, data.ShareMessage); Console.WriteLine("Message post on linkedin for Id :" + linkedinaccount.LinkedinUserId + " and Message: " + data.ShareMessage); ScheduledMessageRepository schrepo = new ScheduledMessageRepository(); schrepo.updateMessage(data.Id); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } }