public void UpdateSubscriber(ChatMember subscriber) { if(subscriber == null) { if(Log.IsWarnEnabled) { Log.WarnFormat("Attempted to update a null subscriber."); } return; } UpdateInMemoryCollection(subscriber); UpdateChatMemberInDataStore(subscriber); }
void UpdateInMemoryCollection(ChatMember subscriber) { _subscribers.RemoveAll(x => x.Jid == subscriber.Jid); _subscribers.Add(subscriber); }
private void SaveSubscriberToDataStore(ChatMember newSub) { try { if(_repository != null) _repository.Save(newSub); } catch(Exception) { if (Log.IsErrorEnabled) Log.ErrorFormat("Error saving chat member Jid:{0} Alias:{1} to repository.",newSub.Jid,newSub.Alias); } }
private void UpdateChatMemberInDataStore(ChatMember subscriber) { try { if (_repository != null) _repository.Update(subscriber); } catch (Exception) { if (Log.IsErrorEnabled) Log.ErrorFormat("Error updating chat member Jid:{0} Alias:{1} to repository.", subscriber.Jid, subscriber.Alias); } }
private void RemoveSubscriberFromDataStore(ChatMember leavingSub) { try { if(_repository != null) _repository.Delete(leavingSub); } catch (Exception e) { if (Log.IsErrorEnabled) Log.ErrorFormat("Error saving chat member Jid:{0} Alias:{1} to repository. Exception: {2}", leavingSub.Jid, e.Message); } }