예제 #1
0
        public bool ContainsSenderKey(SenderKeyName senderKeyName)
        {
            String senderKeyId = senderKeyName.GetSender().GetName() + " : " + senderKeyName.GetGroupId();
            SenderKeysRepository senderKeysRepository = new SenderKeysRepository();

            return(senderKeysRepository.Contains(senderKeyId));
        }
예제 #2
0
        public void RemoveSenderKey(SenderKeyName senderKeyName)
        {
            String senderKeyId = senderKeyName.GetSender().GetName() + " : " + senderKeyName.GetGroupId();
            SenderKeysRepository senderKeysRepository = new SenderKeysRepository();
            List <SenderKeys>    senderKeys           = senderKeysRepository.GetSenderKeys(senderKeyId);

            if (senderKeys != null && senderKeys.Count > 0)
            {
                SenderKeys senderKey = senderKeys.First();
                senderKeysRepository.Delete(senderKey);
            }
        }
예제 #3
0
        public SenderKeyRecord LoadSenderKey(SenderKeyName senderKeyName)
        {
            String senderKeyId = senderKeyName.GetSender().GetName() + " : " + senderKeyName.GetGroupId();
            SenderKeysRepository senderKeysRepository = new SenderKeysRepository();
            List <SenderKeys>    senderKeys           = senderKeysRepository.GetSenderKeys(senderKeyId);

            if (senderKeys != null && senderKeys.Count > 0)
            {
                SenderKeys      senderKey       = senderKeys.First();
                SenderKeyRecord senderKeyRecord = new SenderKeyRecord(senderKey.Record);
                return(senderKeyRecord);
            }

            return(new SenderKeyRecord());
        }
예제 #4
0
        public void StoreSenderKey(SenderKeyName senderKeyName, SenderKeyRecord record)
        {
            if (ContainsSenderKey(senderKeyName))
            {
                RemoveSenderKey(senderKeyName);
            }

            String senderKeyId = senderKeyName.GetSender().GetName() + " : " + senderKeyName.GetGroupId();
            SenderKeysRepository senderKeysRepository = new SenderKeysRepository();

            SenderKeys senderKey = new SenderKeys()
            {
                Record      = record.Serialize(),
                SenderKeyId = senderKeyId
            };

            senderKeysRepository.Save(senderKey);
        }