public IHttpActionResult SendNotification(webModels.TestNotificationRequest request)
        {
            var notification = _notificationManager.GetNewNotification(request.Type, request.ObjectId, request.ObjectTypeId, request.Language);
            foreach (var param in request.NotificationParameters)
            {
                var property = notification.GetType().GetProperty(param.Key);
                var jObject = param.Value as Newtonsoft.Json.Linq.JObject;
                if (jObject != null)
                {
                    property.SetValue(notification, jObject.ToObject<Dictionary<string, string>>());
                }
                else
                {
                    property.SetValue(notification, param.Value);
                }
            }
            var result = _notificationManager.SendNotification(notification);

            return Ok(result.ErrorMessage);
        }
        public IHttpActionResult RenderNotificationContent(webModels.TestNotificationRequest request)
        {
            var retVal = new webModels.RenderNotificationContentResult();
            var notification = _notificationManager.GetNewNotification(request.Type, request.ObjectId, request.ObjectTypeId, request.Language);
            foreach (var param in request.NotificationParameters)
            {
                var property = notification.GetType().GetProperty(param.Key);
                var jObject = param.Value as Newtonsoft.Json.Linq.JObject;
                if (jObject != null)
                {
                    property.SetValue(notification, jObject.ToObject<Dictionary<string, string>>());
                }
                else
                {
                    property.SetValue(notification, param.Value);
                }
            }
            _eventTemplateResolver.ResolveTemplate(notification);

            retVal.Subject = notification.Subject;
            retVal.Body = notification.Body;

            return Ok(retVal);
        }
        public IHttpActionResult SendNotification(webModels.TestNotificationRequest request)
        {
            var notification = _notificationManager.GetNewNotification(request.Type, request.ObjectId, request.ObjectTypeId, request.Language);
            foreach (var param in request.NotificationParameters)
            {
                SetValue(notification, param);
            }
            var result = _notificationManager.SendNotification(notification);

            return Ok(result.ErrorMessage);
        }
        private void SetValue(Notification notification, webModels.NotificationParameter param)
        {
            var property = notification.GetType().GetProperty(param.ParameterName);
            var jObject = param.Value as Newtonsoft.Json.Linq.JObject;
            var jArray = param.Value as Newtonsoft.Json.Linq.JArray;
            if (jObject != null && param.IsDictionary)
            {
                property.SetValue(notification, jObject.ToObject<Dictionary<string, string>>());
            }
            else
            {
                switch (param.Type)
                {
                    case NotificationParameterValueType.Boolean:
                        if (jArray != null && param.IsArray)
                            property.SetValue(notification, jArray.ToObject<Boolean[]>());
                        else
                            property.SetValue(notification, param.Value.ToNullable<Boolean>());
                        break;

                    case NotificationParameterValueType.DateTime:
                        if (jArray != null && param.IsArray)
                            property.SetValue(notification, jArray.ToObject<DateTime[]>());
                        else
                            property.SetValue(notification, param.Value.ToNullable<DateTime>());
                        break;

                    case NotificationParameterValueType.Decimal:
                        if (jArray != null && param.IsArray)
                            property.SetValue(notification, jArray.ToObject<Decimal[]>());
                        else
                            property.SetValue(notification, Convert.ToDecimal(param.Value));
                        break;

                    case NotificationParameterValueType.Integer:
                        if (jArray != null && param.IsArray)
                            property.SetValue(notification, jArray.ToObject<Int32[]>());
                        else
                            property.SetValue(notification, param.Value.ToNullable<Int32>());
                        break;

                    case NotificationParameterValueType.String:
                        if (jArray != null && param.IsArray)
                            property.SetValue(notification, jArray.ToObject<String[]>());
                        else
                            property.SetValue(notification, (string)param.Value);
                        break;

                    default:
                        if (jArray != null && param.IsArray)
                            property.SetValue(notification, jArray.ToObject<String[]>());
                        else
                            property.SetValue(notification, (string)param.Value);
                        break;
                }
            }
        }
        public IHttpActionResult RenderNotificationContent(webModels.TestNotificationRequest request)
        {
            var retVal = new webModels.RenderNotificationContentResult();
            var notification = _notificationManager.GetNewNotification(request.Type, request.ObjectId, request.ObjectTypeId, request.Language);
            foreach (var param in request.NotificationParameters)
            {
                SetValue(notification, param);
            }
            _eventTemplateResolver.ResolveTemplate(notification);

            retVal.Subject = notification.Subject;
            retVal.Body = notification.Body;

            return Ok(retVal);
        }