public void UpdateAccountInfo(LinkedInAccountInfo accountInfo)
        {
            SqlUpdate cmdUpdate = Update("sm_linkedinaccounts")
                                  .Set("user_id", accountInfo.UserID)
                                  .Set("user_name", accountInfo.UserName)
                                  .Where("access_token", accountInfo.AccessToken)
                                  .Where("access_token_secret", accountInfo.AccessTokenSecret);

            DbManager.ExecuteNonQuery(cmdUpdate);
        }
        public void UpdateAccountInfo(LinkedInAccountInfo accountInfo)
        {
            SqlUpdate cmdUpdate = Update("sm_linkedinaccounts")
                           .Set("user_id", accountInfo.UserID)
                           .Set("user_name", accountInfo.UserName)
                           .Where("access_token", accountInfo.AccessToken)
                           .Where("access_token_secret", accountInfo.AccessTokenSecret);

            DbManager.ExecuteNonQuery(cmdUpdate);
        }
        private static LinkedInAccountInfo ToLinkedInAccountInfo(object[] row)
        {
            LinkedInAccountInfo accountInfo = new LinkedInAccountInfo
            {
                AccessToken       = Convert.ToString(row[0]),
                AccessTokenSecret = Convert.ToString(row[1]),
                UserID            = Convert.ToString(row[2]),
                AssociatedID      = ToGuid(row[3]),
                UserName          = Convert.ToString(row[4]),
                TokenType         = (LinkedInAccountInfo.TokenTypes)Convert.ToInt32(row[5])
            };

            return(accountInfo);
        }
        public void CreateNewAccountInfo(LinkedInAccountInfo accountInfo)
        {
            using (var tx = DbManager.BeginTransaction())
            {
                DeleteAccountInfo(accountInfo.AssociatedID);

                SqlInsert cmdInsert = Insert("sm_linkedinaccounts")
                                      .ReplaceExists(true)
                                      .InColumnValue("access_token", accountInfo.AccessToken)
                                      .InColumnValue("access_token_secret", accountInfo.AccessTokenSecret)
                                      .InColumnValue("user_id", accountInfo.UserID)
                                      .InColumnValue("associated_id", accountInfo.AssociatedID)
                                      .InColumnValue("user_name", accountInfo.UserName)
                                      .InColumnValue("token_type", (int)accountInfo.TokenType);

                DbManager.ExecuteNonQuery(cmdInsert);

                tx.Commit();
            }
        }
        public void CreateNewAccountInfo(LinkedInAccountInfo accountInfo)
        {
            using (var tx = DbManager.BeginTransaction())
            {
                DeleteAccountInfo(accountInfo.AssociatedID);

                SqlInsert cmdInsert = Insert("sm_linkedinaccounts")
                           .ReplaceExists(true)
                           .InColumnValue("access_token", accountInfo.AccessToken)
                           .InColumnValue("access_token_secret", accountInfo.AccessTokenSecret)
                           .InColumnValue("user_id", accountInfo.UserID)
                           .InColumnValue("associated_id", accountInfo.AssociatedID)
                           .InColumnValue("user_name", accountInfo.UserName)
                           .InColumnValue("token_type", (int)accountInfo.TokenType);

                DbManager.ExecuteNonQuery(cmdInsert);

                tx.Commit();
            }
        }
        private static LinkedInAccountInfo ToLinkedInAccountInfo(object[] row)
        {
            LinkedInAccountInfo accountInfo = new LinkedInAccountInfo
            {
                AccessToken = Convert.ToString(row[0]),
                AccessTokenSecret = Convert.ToString(row[1]),
                UserID = Convert.ToString(row[2]),
                AssociatedID = ToGuid(row[3]),
                UserName = Convert.ToString(row[4]),
                TokenType = (LinkedInAccountInfo.TokenTypes)Convert.ToInt32(row[5])
            };

            return accountInfo;
        }