コード例 #1
0
        public List <DashboardQuery> getDashboardQueries(string query)
        {
            List <DashboardQuery> data       = null;
            SqlConnection         connection = new SqlConnection(CONN_STRING);

            try
            {
                connection.Open();

                SqlCommand command = new SqlCommand(query, connection);
                try
                {
                    SqlDataReader reader = command.ExecuteReader();
                    try
                    {
                        data = new List <DashboardQuery>();
                        while (reader.Read())
                        {
                            DashboardQuery dashboardQuery = new DashboardQuery();
                            dashboardQuery.Id         = reader[0].ToString();
                            dashboardQuery.Title      = reader[1].ToString();
                            dashboardQuery.Reportlist = reader[2].ToString();
                            dashboardQuery.Judul      = reader[3].ToString();
                            dashboardQuery.Query1     = reader[4].ToString();

                            data.Add(dashboardQuery);
                        }
                    }
                    catch (Exception e)
                    {
                        Debug.WriteLine(e.Message);
                        errorMessage = e.Message;
                    }
                    finally
                    {
                        reader.Close();
                    }
                }
                catch (Exception e)
                {
                    Debug.WriteLine(e.Message);
                    errorMessage = e.Message;
                }
                finally
                {
                    command.Dispose();
                }
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.Message);
                errorMessage = e.Message;
            }
            finally
            {
                connection.Dispose();
            }

            return(data);
        }
コード例 #2
0
 public HomeController(ICommandBus commandBus,
                       HomeTimeSheet indexQuery,
                       DashboardQuery dashboardQuery)
 {
     this.commandBus     = commandBus;
     this.indexQuery     = indexQuery;
     this.dashboardQuery = dashboardQuery;
 }
コード例 #3
0
ファイル: HomeController.cs プロジェクト: NotMyself/App
        public async Task<ActionResult> Index()
        {
            Logger.Trace("Index");

            var query = new DashboardQuery();
            var result = await mediator.SendAsync(query);

            if (result == null)
                return HttpNotFound();

            return View(result);
        }
コード例 #4
0
 public void DoStuff()
 {
     var quary = new DashboardQuery <DailyStatsQuery>()
     {
         Options = new ObjectAnnotation.QueryOptions()
         {
             Filter = new ObjectAnnotation.Filters.Filter()
             {
                 AreaType = new ObjectAnnotation.Filters.AreaType(Common.AreaTypeMetrics.overview)
             },
         }
     };
     var result = quary.DoQuery();
 }
        QueryResponce <T> IQueryEngine <T> .DoQuery()
        {
            var retries = ConfigOptions.DashboardRetries;

            DashboardQuery.Options = Options;

            for (var i = 1; i <= retries; i++)
            {
                try {
                    Logger.LogInformation($"Qerying dashboard. Making attempt {i} of {retries}.");
                    var result = DashboardQuery.DoQuery();
                    Logger.LogInformation("Successfully queried dashboard.");
                    return(result);
                }
                catch (Exception ex)
                {
                    if (i < retries)
                    {
                        Logger.LogWarning(ex, $"Problem querying dashboard.");
                        var pauseBeforeRetry = true;
                        if (pauseBeforeRetry)
                        {
                            Logger.LogWarning($"Pausing before retry.");
                            Thread.Sleep(10000);
                        }
                        Logger.LogWarning($" Retrying...");
                    }
                    else
                    {
                        Logger.LogError(ex, $"Problem querying dashboard. Retries exceeded. Skipping query.");
                        // throw new Exception("Fatal Failure in achive");
                    }
                }
            }
            return(DashboardQuery.GetEmptyQuery());
        }
コード例 #6
0
        public IActionResult GetAllMonthWiseData()
        {
            var     errors         = new List <string>();
            var     dashBoardQuery = new DashboardQuery(_expenseConnection);
            dynamic dashboardData  = null;

            try
            {
                dashboardData = dashBoardQuery.GetMonthWiseExpenditure();

                _logger.LogInformation("User : {username} fetches dashboard data", LoggedInUser);
            }
            catch (Exception Ex)
            {
                _logger.LogInformation("User : {username} gets expection while trying to get dashboard data", LoggedInUser);

                if (_expenseConnection.InTransaction)
                {
                    _expenseConnection.RollBack();
                }

                LogExecption(Ex, _expenseConnection);

                errors = new List <string>()
                {
                    _appConfiguration.Messages.InternalServerError
                };
            }

            return(Json(new
            {
                success = (errors.Count == 0),
                data = dashboardData,
                error = errors
            }));
        }
        /// <summary>
        /// Gets the Job and Step details for a Job.
        /// </summary>
        /// <param name="jobId">The id of the Job.</param>
        /// <returns>A Job and list of Steps for that Job.</returns>
        DashboardDetailJob IDashboardService.GetJobDetails(int jobId)
        {
            IDashboardQuery query = new DashboardQuery();

            return(query.GetJobDetails(jobId));
        }
        /// <summary>
        /// Gets a list of Jobs for the search criteria.
        /// </summary>
        /// <param name="searchCriteria">The search criteria.</param>
        /// <returns>A DashboardJob of data.</returns>
        DashboardJob IDashboardService.GetJobList(JobSearchCriteria searchCriteria)
        {
            IDashboardQuery query = new DashboardQuery();

            return(query.GetJobList(searchCriteria));
        }
コード例 #9
0
 public DashboardController(DashboardQuery query)
 {
     _query = query;
 }