public void SaveAccount(ClientAccount Acct)
        {
            LDocumentHeader head = Acct.AccountHeader;

            Acct.AccountHeader = null; //we don't want this extra data saved here
            LDocumentPart part = new LDocumentPart();
            part.SequenceNumber = 0;
            part.DocType = DocumentType.CLIENTACCOUNT;
            part._id = Acct._id;
            part.DocumentID = Acct._id;
            List<LDocumentPart> parts = new List<LDocumentPart>();
            part.Data = DocManager.SerializeToJSONByteArray<ClientAccount>(Acct);
            parts.Add(part);
            DocManager.SaveDocument(new LRI(head.DocumentLRI), head, parts);
            //reattach head
            Acct.AccountHeader = head;
        }
Beispiel #2
0
 public ServiceResponse<bool> SavePart(ServiceCredentials Credentials, LRI lri, LDocumentPart part, int SequenceNumber)
 {
     if (CheckSession(Credentials))
     {
         return ConnMgr.GetProvider<ILDataProviderChannel>(lri).SavePart(Credentials, lri, part, SequenceNumber);
     }
     else
     {
         return new ServiceResponse<bool>(true);
     }
 }
Beispiel #3
0
 public ServiceResponse<bool> SavePart(ServiceCredentials Credentials, LRI lri, LDocumentPart part, int SequenceNumber)
 {
     if (ValidateSession(Credentials, lri) && CanAccessDocument(Credentials, lri, LDocACLPermission.WRITE))
     {
         DocManager.SavePart(lri, part, SequenceNumber);
         ServiceResponse<bool> Rep = new ServiceResponse<bool>(true);
         return Rep;
     }
     else return ServiceResponse<bool>.InvalidCredentails();
 }
Beispiel #4
0
        //public bool CreateChildIdentity(string ParentLRI, string ChildUserLRI, string passwordhash, string ChildPinHash, string KeyFromChild)
        //{
        //    return true;
        //}
        //should be overloaded, called when an ID is added to save it to a persistant location
        public static void SaveIdentity(LRI userLRI)
        {
            LDocumentHeader header = LDocManager.GetDocHeader(userLRI);
            if (header == null)
            {
                //create it
                header = new LDocumentHeader();
                header.DocumentLRI = userLRI.LRIString;
                header.FQDT = "lcharms.user";
                header.DocumentID = userLRI.DocumentID;
                header.DocType = DocumentType.DOC_HEADER;
                List<LDocumentPart> parts = new List<LDocumentPart>();
                LDocumentPart idPart = new LDocumentPart();
                idPart.DocumentID = userLRI.DocumentID;
                idPart.SequenceNumber = 0;
                idPart.DocType = DocumentType.DOC_PART;
                parts.Add(idPart);
                LDocManager.CreateDoc(userLRI, header, parts);
            }
            else
            {

            }
            //CouchDBMgr.WriteDocument(userLRI.DocumentID, Identities[userLRI.LRIString]);
        }