Exemple #1
0
        public IHttpActionResult Get(string id)
        {
            ChartHelperForRest helper = null;

            try
            {
                helper = new ChartHelperForRest(Map);
                return(Ok(helper.GetChartData(id, System.Web.HttpContext.Current.Server.UrlDecode(System.Web.HttpContext.Current.Request.QueryString.ToString()))));
            }
            catch (ChartIdIsMissingException chartIdIsMissingException)
            {
                return(ResponseMessage(Request.CreateResponse(HttpStatusCode.NotFound, chartIdIsMissingException.Message)));
            }
            catch (ChartHandledException chartHandledException)
            {
                int?dashboardId = Database.GetDashboardPK(Convert.ToInt32(id));
                if (!dashboardId.HasValue)
                {
                    return(ResponseMessage(Request.CreateResponse(HttpStatusCode.NotFound, chartHandledException.Message)));
                }

                try
                {
                    return(Ok(helper.GetChartJsonObjectWithException(dashboardId.Value, Convert.ToInt32(id), chartHandledException)));
                }
                catch (Exception exception)
                {
                    throw new BackAndApiUnexpectedResponseException(exception, this);
                }
            }
            catch (Exception exception)
            {
                throw new BackAndApiUnexpectedResponseException(exception, this);
            }
        }
Exemple #2
0
        public ActionResult Get(string pk, string parameters)
        {
            ChartHelperForRest helper = null;

            try
            {
                helper = new ChartHelperForRest(Map);
                return(Json(helper.GetChartData(pk, parameters)));
            }
            catch (ChartIdIsMissingException)
            {
                return(new ChartNotFoundApiHttpException(pk, Response));
            }
            catch (ChartHandledException exception)
            {
                int?dashboardId = Database.GetDashboardPK(Convert.ToInt32(pk));
                if (!dashboardId.HasValue)
                {
                    return(new ChartNotFoundApiHttpException(pk, Response));
                }

                try
                {
                    return(Json(helper.GetChartJsonObjectWithException(dashboardId.Value, Convert.ToInt32(pk), exception)));
                }
                catch (Exception e)
                {
                    return(UnexpectedException(e, Response));
                }
            }
            catch (Exception exception)
            {
                return(UnexpectedException(exception, Response));
            }
        }
        public IHttpActionResult Get(string id, string parameters = null)
        {
            try
            {
                ChartHelperForRest helper = new ChartHelperForRest(Map);

                return(Ok(helper.GetDashboardData(id, parameters)));
            }
            catch (DashboardIdIsMissingException exception)
            {
                return(ResponseMessage(Request.CreateResponse(HttpStatusCode.NotFound, exception.Message)));
            }
            catch (DashboardIdNotFoundException exception)
            {
                return(ResponseMessage(Request.CreateResponse(HttpStatusCode.NotFound, exception.Message)));
            }
            catch (Exception exception)
            {
                throw new BackAndApiUnexpectedResponseException(exception, this);
            }
        }
Exemple #4
0
        public ActionResult Get(string pk, string parameters)
        {
            try
            {
                ChartHelperForRest helper = new ChartHelperForRest(Map);

                return(Json(helper.GetDashboardData(pk, parameters)));
            }
            catch (DashboardIdIsMissingException)
            {
                return(new DashboardNotFoundApiHttpException(pk, Response));
            }
            catch (DashboardIdNotFoundException)
            {
                return(new DashboardNotFoundApiHttpException(pk, Response));
            }
            catch (Exception exception)
            {
                return(UnexpectedException(exception, Response));
            }
        }