public bool ContainsSenderKey(SenderKeyName senderKeyName) { String senderKeyId = senderKeyName.GetSender().GetName() + " : " + senderKeyName.GetGroupId(); SenderKeysRepository senderKeysRepository = new SenderKeysRepository(); return(senderKeysRepository.Contains(senderKeyId)); }
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); } }
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()); }
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); }