public ResponseRegisterCard RegisterCard(RequestRegisterCard card) { ResponseRegisterCard result = new ResponseRegisterCard() { Registered = true }; if (card.CardId > 0) { try { if (myChannelFactory != null) { _RegisterCardClient = myChannelFactory.CreateChannel(); result = _RegisterCardClient.RegisterCard(card); ((ICommunicationObject)_RegisterCardClient).Close(); } } catch { if (_RegisterCardClient != null) { ((ICommunicationObject)_RegisterCardClient).Abort(); } } } else { throw new InvalidOperationException("Empty argument! Declare - RequestRegisterCard"); } return(result); }
public bool UpdateCardsPermissions(List <List <Status> > permissions, int cardId) { bool result = false; if (cardId > 0 && permissions != null && permissions.Count > 0) { try { if (myChannelFactory != null) { _RegisterCardClient = myChannelFactory.CreateChannel(); result = _RegisterCardClient.UpdateCardsPermissions(permissions, cardId); ((ICommunicationObject)_RegisterCardClient).Close(); } } catch { if (_RegisterCardClient != null) { ((ICommunicationObject)_RegisterCardClient).Abort(); } } } else { throw new InvalidOperationException("Empty argument! Declare - cardId"); } return(result); }
public List <RequestRegisterCard> GetCards() { List <RequestRegisterCard> result = new List <RequestRegisterCard>(); try { _RegisterCardClient = myChannelFactory.CreateChannel(); result = _RegisterCardClient.GetCards(); ((ICommunicationObject)_RegisterCardClient).Close(); } catch { if (_RegisterCardClient != null) { ((ICommunicationObject)_RegisterCardClient).Abort(); } } return(result); }