Ejemplo n.º 1
0
 public void UpdateLinkedIn()
 {
     while (true)
     {
         try
         {
             Model.DatabaseRepository dbr = new Model.DatabaseRepository();
             AppSettings _appsetting      = new AppSettings();
             List <Domain.Socioboard.Models.LinkedInAccount> lstLinkedinCompanyPage = dbr.Find <Domain.Socioboard.Models.LinkedInAccount>(t => t.IsActive).ToList();
             foreach (var item in lstLinkedinCompanyPage)
             {
                 oAuthLinkedIn _oauth = new oAuthLinkedIn();
                 _oauth.ConsumerKey    = Helper.AppSettings.LinkedinApiKey;
                 _oauth.ConsumerSecret = Helper.AppSettings.LinkedinSecretKey;
                 _oauth.Token          = item.OAuthToken;
                 Console.WriteLine(item.LinkedinUserName + "Updating Started");
                 LinkedPageFeed.UpdateLinkedIn(item, _oauth);
                 Console.WriteLine(item.LinkedinUserName + "Updated");
             }
             Thread.Sleep(60000);
         }
         catch (Exception ex)
         {
             Console.WriteLine("issue in web api calling" + ex.StackTrace);
             Thread.Sleep(600000);
         }
     }
 }
 public void UpdateLinkedIn()
 {
     while (true)
     {
         try
         {
             DatabaseRepository dbr         = new DatabaseRepository();
             AppSettings        _appsetting = new AppSettings();
             List <Domain.Socioboard.Models.LinkedInAccount> lstLinkedinCompanyPage = dbr.Find <Domain.Socioboard.Models.LinkedInAccount>(t => t.IsActive).ToList();
             //lstLinkedinCompanyPage = lstLinkedinCompanyPage.Where(t => t.LinkedinUserName.Contains("AvinashVerma")).ToList();
             foreach (var item in lstLinkedinCompanyPage)
             {
                 try
                 {
                     oAuthLinkedIn _oauth = new oAuthLinkedIn();
                     //_oauth.ConsumerKey = "81k55eukagnqfa";
                     //_oauth.ConsumerSecret = "d9rqHEf7ewdSbsF1";
                     _oauth.ConsumerKey    = AppSettings.LinkedinConsumerKey;
                     _oauth.ConsumerSecret = AppSettings.LinkedinConsumerSecret;
                     _oauth.Token          = item.OAuthToken;
                     Console.WriteLine(item.LinkedinUserName + "Updating Started");
                     LinkedPageFeed.UpdateLinkedIn(item, _oauth);
                     Console.WriteLine(item.LinkedinUserName + "Updated");
                 }
                 catch (Exception)
                 {
                     Thread.Sleep(60000);
                 }
             }
             Thread.Sleep(60000);
         }
         catch (Exception ex)
         {
             Console.WriteLine("issue in web api calling" + ex.StackTrace);
             Thread.Sleep(600000);
         }
     }
 }