Beispiel #1
0
        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);
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        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);
        }