public void Unsubscribe(IAccountServicesCallback currentCallbackProxy)
 {
     if (_subscribers.Contains(currentCallbackProxy))
     {
         _subscribers.Remove(currentCallbackProxy);
     }
 }
 public void Subscribe(IAccountServicesCallback currentCallbackProxy)
 {
     if (!_subscribers.Contains(currentCallbackProxy))
     {
         _subscribers.Add(currentCallbackProxy);
     }
 }
 public void NotifyAllAccountModification(Account modifiedAccount, IAccountServicesCallback currentCallbackProxy)
 {
     if (_subscribers.Count > 0)
     {
         foreach (IAccountServicesCallback sub in _subscribers)
         {
             sub.NotifyAccountModification(modifiedAccount);
         }
     }
 }
 public void NotifyAllAccountRemoval(Account removedAccount, IAccountServicesCallback currentCallbackProxy)
 {
     if (_subscribers.Count > 0)
     {
         foreach (IAccountServicesCallback sub in _subscribers)
         {
             sub.NotifyAccountRemoval(removedAccount);
         }
     }
 }
 public void NotifyAllAccountAddition(Account addedAccount, IAccountServicesCallback currentCallbackProxy)
 {
     if (_subscribers.Count > 0)
     {
         foreach (IAccountServicesCallback sub in _subscribers)
         {
             sub.NotifyAccountAddition(addedAccount);
         }
     }
 }
        public Account DeleteAccount(Account accountToBeDeleted)
        {
            Account deletedAccount = DbManager.Instance.DeleteAccount(accountToBeDeleted);

            if (deletedAccount != null)
            {
                IAccountServicesCallback currentCallbackProxy = OperationContext.Current.GetCallbackChannel <IAccountServicesCallback>();
                AccountServiceCallback.Instance.NotifyAllAccountRemoval(deletedAccount, currentCallbackProxy);

                return(deletedAccount);
            }

            return(null);
        }
        public Account ModifyAccount(Account accountToModify)
        {
            Account modifiedAccount = DbManager.Instance.ModifyAccount(accountToModify);

            if (modifiedAccount != null)
            {
                IAccountServicesCallback currentCallbackProxy = OperationContext.Current.GetCallbackChannel <IAccountServicesCallback>();
                AccountServiceCallback.Instance.NotifyAllAccountModification(modifiedAccount, currentCallbackProxy);

                return(modifiedAccount);
            }

            return(null);
        }
        public Account CreateNewAccount(Account accountToCreate)
        {
            Account createdAccount = DbManager.Instance.AddAccount(accountToCreate);

            if (createdAccount != null)
            {
                IAccountServicesCallback currentCallbackProxy = OperationContext.Current.GetCallbackChannel <IAccountServicesCallback>();
                AccountServiceCallback.Instance.NotifyAllAccountAddition(createdAccount, currentCallbackProxy);

                return(createdAccount);
            }

            return(null);
        }
        public void Unsubscribe()
        {
            IAccountServicesCallback currentCallbackProxy = OperationContext.Current.GetCallbackChannel <IAccountServicesCallback>();

            AccountServiceCallback.Instance.Unsubscribe(currentCallbackProxy);
        }