Exemplo n.º 1
0
        private static TwitterAccountInfo ToTwitterAccountInfo(object[] row)
        {
            TwitterAccountInfo accountInfo = new TwitterAccountInfo
            {
                AccessToken       = Convert.ToString(row[0]),
                AccessTokenSecret = Convert.ToString(row[1]),
                ScreenName        = Convert.ToString(row[2]),
                UserID            = Convert.ToDecimal(row[3]),
                AssociatedID      = ToGuid(row[4]),
                UserName          = (row[5] != null && row[5] != DBNull.Value) ? Convert.ToString(row[5]) : null
            };

            return(accountInfo);
        }
        private static TwitterAccountInfo ToTwitterAccountInfo(object[] row)
        {
            TwitterAccountInfo accountInfo = new TwitterAccountInfo
            {
                AccessToken = Convert.ToString(row[0]),
                AccessTokenSecret = Convert.ToString(row[1]),
                ScreenName = Convert.ToString(row[2]),
                UserID = Convert.ToDecimal(row[3]),
                AssociatedID = ToGuid(row[4]),
                UserName = (row[5] != null && row[5] != DBNull.Value) ? Convert.ToString(row[5]) : null
            };

            return accountInfo;
        }
Exemplo n.º 3
0
        public void CreateNewAccountInfo(TwitterAccountInfo accountInfo)
        {
            using (var tx = DbManager.BeginTransaction())
            {
                DeleteAccountInfo(accountInfo.AssociatedID);

                SqlInsert cmdInsert = Insert("sm_twitteraccounts")
                                      .ReplaceExists(true)
                                      .InColumnValue("access_token", accountInfo.AccessToken)
                                      .InColumnValue("access_token_secret", accountInfo.AccessTokenSecret)
                                      .InColumnValue("screen_name", accountInfo.ScreenName)
                                      .InColumnValue("user_id", accountInfo.UserID)
                                      .InColumnValue("associated_id", accountInfo.AssociatedID)
                                      .InColumnValue("user_name", accountInfo.UserName);

                DbManager.ExecuteNonQuery(cmdInsert);

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

                SqlInsert cmdInsert = Insert("sm_twitteraccounts")
                           .ReplaceExists(true)
                           .InColumnValue("access_token", accountInfo.AccessToken)
                           .InColumnValue("access_token_secret", accountInfo.AccessTokenSecret)
                           .InColumnValue("screen_name", accountInfo.ScreenName)
                           .InColumnValue("user_id", accountInfo.UserID)
                           .InColumnValue("associated_id", accountInfo.AssociatedID)
                           .InColumnValue("user_name", accountInfo.UserName);

                DbManager.ExecuteNonQuery(cmdInsert);

                tx.Commit();
            }
        }