예제 #1
0
 public override string ToString()
 {
     return("\n----------- ServerAccount ---------------" +
            "\nFacebookId:\t" + mFbAccountId.ToString() +
            "\nAccountId:\t" + mAccountId.ToString() +
            "\nNickname:\t" + mNickname +
            "\nFirstname:\t" + mFirstName +
            "\nLastname:\t" + mLastName +
            "\nUserProperties:\n" + mUserProperties.ToString() +
            "\n-----------------------------------------\n");
 }
예제 #2
0
        public static bool SetUserProperties(Database Database, Guid UserID, UserProperties Setting, string Value)
        {
            SqlCommand cmd = Database.NewConnection.CreateCommand();

            try
            {
                cmd.Parameters.AddWithValue("@USERID@", UserID);
                cmd.Parameters.AddWithValue("@VALUE@", Value);
                cmd.CommandText = "UPDATE [Security.Users] SET [" + Setting.ToString().Replace('_', '.') + "] = @VALUE@ WHERE UserID = @USERID@";
                int affected = cmd.ExecuteNonQuery();
                return(affected == 1);
            }
            catch (Exception)
            {
                return(false);
            }
            finally
            {
                cmd.Connection.Close();
            }
        }
예제 #3
0
        public static string GetUserProperties(Database Database, Guid UserID, UserProperties Setting)
        {
            SqlCommand cmd = Database.NewConnection.CreateCommand();

            try
            {
                cmd.Parameters.AddWithValue("@USERID@", UserID);
                cmd.CommandText = "SELECT [" + Setting.ToString().Replace('_', '.') + "] FROM [Security.Users] WHERE UserID = @USERID@";
                object result = cmd.ExecuteScalar();
                if (result.GetType() == typeof(DBNull))
                {
                    return(null);
                }
                return((string)result);
            }
            catch (Exception)
            {
                return(null);
            }
            finally
            {
                cmd.Connection.Close();
            }
        }
예제 #4
0
 public override string ToString()
 {
     return(mUserProperties.ToString());
 }