Exemple #1
0
        public AlertMsg DeleteSymmetricCryptoKey(long cryptoKeyID)
        {
            var      helper    = new SQLiteHelper();
            var      idParam   = new SQLiteParameter("id", cryptoKeyID);
            var      effResult = helper.ExecNonQuery("DELETE FROM OAuthSymmetricCryptoKey WHERE ID = @id;", idParam);
            AlertMsg result    = effResult;

            result.IsSuccess = effResult.EffectLines == 1;
            return(result);
        }
Exemple #2
0
        public AlertMsg AddOAuthUsers(OAuthUsers user)
        {
            var      helper        = new SQLiteHelper();
            var      claimedParam  = new SQLiteParameter("claimed", user.Claimed);
            var      friendlyParam = new SQLiteParameter("friendly", user.Friendly);
            var      effResult     = helper.ExecNonQuery("INSERT INTO OAuthUsers(Claimed, Friendly) VALUES(@claimed, @friendly)", claimedParam, friendlyParam);
            AlertMsg result        = effResult;

            result.IsSuccess = effResult.EffectLines == 1;
            return(result);
        }
Exemple #3
0
        public AlertMsg AddOAuthNonce(OAuthNonce nonce)
        {
            var      helper       = new SQLiteHelper();
            var      contextParam = new SQLiteParameter("context", nonce.Context);
            var      codeParam    = new SQLiteParameter("code", nonce.Code);
            var      timeParam    = new SQLiteParameter("time", nonce.Time.Ticks);
            var      effResult    = helper.ExecNonQuery("INSERT INTO OAuthNonce (Context, Code, Time) VALUES (@context, @code, @time);", contextParam, codeParam, timeParam);
            AlertMsg result       = effResult;

            result.IsSuccess = effResult.EffectLines == 1;
            return(result);
        }
Exemple #4
0
        public AlertMsg AddOAuthSymmetricCryptoKey(OAuthSymmetricCryptoKey cryptoKey)
        {
            var      helper          = new SQLiteHelper();
            var      bucketParam     = new SQLiteParameter("bucket", cryptoKey.Bucket);
            var      handleParam     = new SQLiteParameter("handle", cryptoKey.Handle);
            var      secretParam     = new SQLiteParameter("secret", Encoding.Unicode.GetString(cryptoKey.Secret));
            var      expiresUtcParam = new SQLiteParameter("expiresUtc", cryptoKey.ExpiresUtc.Ticks);
            var      effResult       = helper.ExecNonQuery("INSERT INTO OAuthSymmetricCryptoKey (Bucket, Handle, Secret, ExpiresUtc) VALUES (@bucket, @handle, @secret, @expiresUtc);", bucketParam, handleParam, secretParam, expiresUtcParam);
            AlertMsg result          = effResult;

            result.IsSuccess = effResult.EffectLines == 1;
            return(result);
        }
Exemple #5
0
        public AlertMsg AddOAuthClientAuthor(OAuthClientAuthor client)
        {
            var      helper         = new SQLiteHelper();
            var      clientIdParam  = new SQLiteParameter("clientId", client.ClientID);
            var      userIdParam    = new SQLiteParameter("userId", client.UserID);
            var      scopeParam     = new SQLiteParameter("scope", client.Scope);
            var      expireUtcParam = new SQLiteParameter("expireUtc", client.ExpireUtc.Ticks);
            var      timeParam      = new SQLiteParameter("time", client.Time.Ticks);
            var      effResult      = helper.ExecNonQuery("INSERT INTO OAuthClientAuthor (ClientId, UserId, Scope, ExpireUtc, Time) VALUES (@clientId, @userId, @scope, @expireUtc, @time);", clientIdParam, userIdParam, scopeParam, expireUtcParam, timeParam);
            AlertMsg result         = effResult;

            result.IsSuccess = effResult.EffectLines == 1;
            return(result);
        }
Exemple #6
0
        public AlertMsg AddOAuthClient(OAuthClient client)
        {
            var      helper        = new SQLiteHelper();
            var      clientParam   = new SQLiteParameter("client", client.Client);
            var      secretParam   = new SQLiteParameter("secret", client.Secret);
            var      callbackParam = new SQLiteParameter("callback", client.Callback);
            var      nameParam     = new SQLiteParameter("name", client.Name);
            var      typeParam     = new SQLiteParameter("type", client.Type);
            var      timeParam     = new SQLiteParameter("time", client.Time.Ticks);
            var      effResult     = helper.ExecNonQuery("INSERT INTO OAuthClient(Client, Secret, Callback, Name, Type, Time) VALUES(@client, @secret, @callback, @name, @type, @time)", clientParam, secretParam, callbackParam, nameParam, typeParam, timeParam);
            AlertMsg result        = effResult;

            result.IsSuccess = effResult.EffectLines == 1;
            return(result);
        }