/// <summary> /// Post a new connection request to the specified account. /// </summary> /// <param name="SignedConnectionRequest">The request to post</param> /// <param name="AccountId">The account to post it to.</param> public void PostConnectionRequest ( SignedConnectionRequest SignedConnectionRequest, string AccountId) { var ConnectionRequest = SignedConnectionRequest.Data; var Account = GetAccount(AccountId); var ConnectionsPending = GetPending(Account); if (ConnectionsPending == null) { ConnectionsPending = new ConnectionsPending(AccountId); } // Delete any expired requests ConnectionsPending.Purge(); // Add the pending connection ConnectionsPending.Requests.Add(SignedConnectionRequest); PortalStore.Update(ConnectionsPending, ConnectionsPending.PrimaryKey(Account.UserProfileUDF), null); return; }
/// <summary> /// Construct an instance from the specified tagged JSONReader stream. /// </summary> public static void Deserialize(JSONReader JSONReader, out JSONObject Out) { JSONReader.StartObject (); if (JSONReader.EOR) { Out = null; return; } string token = JSONReader.ReadToken (); Out = null; switch (token) { case "PortalEntry" : { Out = null; throw new Exception ("Can't create abstract type"); } case "Account" : { var Result = new Account (); Result.Deserialize (JSONReader); Out = Result; break; } case "AccountProfile" : { var Result = new AccountProfile (); Result.Deserialize (JSONReader); Out = Result; break; } case "ConnectionsPending" : { var Result = new ConnectionsPending (); Result.Deserialize (JSONReader); Out = Result; break; } default : { throw new Exception ("Not supported"); } } JSONReader.EndObject (); }
/// <summary> /// Deserialize a tagged stream /// </summary> /// <param name="JSONReader"></param> public static new ConnectionsPending FromTagged (JSONReader JSONReader) { ConnectionsPending Out = null; JSONReader.StartObject (); if (JSONReader.EOR) { return null; } string token = JSONReader.ReadToken (); switch (token) { case "ConnectionsPending" : { var Result = new ConnectionsPending (); Result.Deserialize (JSONReader); Out = Result; break; } default : { //Ignore the unknown data //throw new Exception ("Not supported"); break; } } JSONReader.EndObject (); return Out; }
/// <summary> /// Deserialize a tagged stream /// </summary> /// <param name="JSONReader"></param> public static new PortalEntry FromTagged (JSONReader JSONReader) { PortalEntry Out = null; JSONReader.StartObject (); if (JSONReader.EOR) { return null; } string token = JSONReader.ReadToken (); switch (token) { case "PortalEntry" : { Out = null; throw new Exception ("Can't create abstract type"); } case "Account" : { var Result = new Account (); Result.Deserialize (JSONReader); Out = Result; break; } case "AccountProfile" : { var Result = new AccountProfile (); Result.Deserialize (JSONReader); Out = Result; break; } case "ConnectionsPending" : { var Result = new ConnectionsPending (); Result.Deserialize (JSONReader); Out = Result; break; } default : { //Ignore the unknown data //throw new Exception ("Not supported"); break; } } JSONReader.EndObject (); return Out; }