Exemplo n.º 1
0
    public Error Insert(AccountModel.Account _account)
    {
        string query = string.Format("INSERT INTO Account (UUID, Profile, CreatedAt, UpdatedAt) VALUES ('{0}', '{1}', '{2}', '{3}')",
                                     _account.accountID, _account.profile, ModelUtility.NewUtcNow(), ModelUtility.NewUtcNow());

        return(SQLiteUtility.Execute(connection, query));
    }
Exemplo n.º 2
0
    public AccountModel.Account QueryProfile(string _accountID, out Error _err)
    {
        _err = Error.OK;

        AccountModel.Account account = new AccountModel.Account();
        string query = string.Format("SELECT * FROM Account WHERE UUID='{0}'", _accountID);

        _err = SQLiteUtility.Execute(connection, query, (_reader) =>
        {
            while (_reader.Read())
            {
                account.profile = _reader.GetString(_reader.GetOrdinal("Profile"));
            }
        });

        return(account);
    }
Exemplo n.º 3
0
    private static void fetchProfile(Dictionary <string, Any> _params, Service.OnReplyCallback _onReply, Service.OnErrorCallback _onError)
    {
        MockReply reply = new MockReply();

        try
        {
            string accountID = _params["accountID"].AsString;
            Error  error;
            AccountModel.Account account = daoAccount.QueryProfile(accountID, out error);
            reply.data.Add("profile", account.profile);
        }
        catch (System.Exception e)
        {
            reply.code    = -1;
            reply.message = e.Message;
        }

        _onReply(reply.ToJSON());
    }
Exemplo n.º 4
0
    public Error Delete(AccountModel.Account _account)
    {
        string query = string.Format("DELETE FROM Account WHERE UUID='{0}'", _account.accountID);

        return(SQLiteUtility.Execute(connection, query));
    }