예제 #1
0
 public async Task <IHttpActionResult> GetReportsList(string reportName, string categoryName)
 {
     try
     {
         ReportsRepository reportsRepo = new ReportsRepository();
         var reportsList = new baseResponse <IEnumerable <Chart> > {
             responseObject = await reportsRepo.GetChartList(reportName, categoryName)
         };
         return(Ok(reportsList));
     }
     catch (Exception ex)
     {
         return(InternalServerError(ex));
     }
 }
예제 #2
0
 public IHttpActionResult GetCategoryReportsList()
 {
     try
     {
         ReportsRepository reportsRepo = new ReportsRepository();
         var item = new baseResponse <IEnumerable <Category> >()
         {
             responseObject = reportsRepo.GetCategoryList()
         };
         return(Ok(item));
     }
     catch (Exception ex)
     {
         return(InternalServerError(ex));
     }
 }
예제 #3
0
        public async Task <IHttpActionResult> CreateTempQuery(string queryName, [FromBody] BaseRequest <string> wiql)
        {
            try
            {
                if (!string.IsNullOrEmpty(queryName) && wiql != null && !string.IsNullOrEmpty(wiql.RequestBody))
                {
                    ReportsRepository reportRepo = new ReportsRepository();
                    var linkString = await reportRepo.GeneratTempQuery(wiql.RequestBody, queryName);

                    baseResponse <string> response = new baseResponse <string> {
                        responseObject = linkString
                    };
                    return(Ok(response));
                }
                return(BadRequest());
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }
예제 #4
0
        public async Task <IHttpActionResult> GetFilterQueryLink(string categoryName, string reportName, string chartName, string filterBy)
        {
            try
            {
                ReportsRepository reportRepo = new ReportsRepository();
                var result = await reportRepo.GetFilterQueryLink(categoryName, reportName, chartName, filterBy);

                baseResponse <string> response = new baseResponse <string> {
                    responseObject = result
                };

                if (string.IsNullOrEmpty(result))
                {
                    return(NotFound());
                }

                return(Ok(response));
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }