Пример #1
0
        public bool CallUser(string userId, string message)
        {
            var tokenSetting = _settingRepository.FindSetting(userId, "alert_token");

            if (tokenSetting != null)
            {
                var callSetting = _settingRepository.FindSetting(userId, "call_enabled");

                var trueValues = new string[] { "1", "true" };

                if (callSetting == null || trueValues.Contains(callSetting.Value))
                {
                    _callService.Call(tokenSetting.Value, message);

                    return(true);
                }
            }

            return(false);
        }
        public void Intercept(IInvocation invocation)
        {
            var method = invocation.Method;

            /*if (method.Name == "GetHashCode")
             *  return new ReturnMessage(this.GetHashCode(), null, 0, methodCall.LogicalCallContext, methodCall);
             * if (method.Name == "Equals")
             *  return new ReturnMessage(this.Equals(methodCall.Args[0]), null, 0, methodCall.LogicalCallContext, methodCall);
             * if (method.Name == "ToString")
             *  return new ReturnMessage(this.ToString(), null, 0, methodCall.LogicalCallContext, methodCall);*/

            try
            {
                var data   = CallToData(method, invocation);
                var result = _service.Call(data);
                invocation.ReturnValue = DataToResult(result, method);
            }
            catch (Exception e)
            {
                invocation.ReturnValue = null;
            }
        }
Пример #3
0
 public void Call(string contact)
 {
     callService.Call(contact);
 }
 public void Receive(byte[] data)
 {
     _unmarshaller.Call(data);
 }