Пример #1
0
        public ServiceResponse <TabularResponse> ChartData([FromQuery] TabularQuery tabularQuery)
        {
            try
            {
                //var seriesNames = new Dictionary<string, string>();

                //var byDate = data.GroupBy(d => d.StatTime)
                //                 .OrderBy(g => g.Key)
                //                 .ToList();

                //foreach(var date in byDate)
                //{
                //    var dataPoint = new Dictionary<string, object>
                //    {
                //        { "date", date.Key }
                //    };
                //    foreach(
                //}

                var data   = Db.Backlog.AsQueryable();
                var result = data.ApplyQuery(tabularQuery);

                return(new ServiceResponse <TabularResponse>(true, result));
            }
            catch (Exception ex)
            {
                Logger.LogError($"{nameof(ChartData)} : {ex.GetType()} : {ex.Message}");
                return(new ServiceResponse <TabularResponse>(false, null, ex.Message));
            }
        }
Пример #2
0
        public ServiceResponse <TabularResponse> GetGridData([FromQuery] GridQuery query, [FromQuery] TabularQuery tabularQuery)
        {
            try
            {
                IQueryable <GridDataModel> data = null;

                if (query.DataSet == GridDataSetType.Backlog)
                {
                    data = Db.Backlog.Select(b => new GridDataModel
                    {
                        CustomerId     = b.CustomerId,
                        CustomerName   = b.CustomerName,
                        StatTime       = b.StatTime,
                        Backlog        = b.Backlog,
                        LastReceivedOn = b.LastReceivedOn,
                        TotalReceived  = b.TotalReceived
                    }).AsQueryable();
                }
                else
                {
                    data = Db.Performance.Select(b => new GridDataModel
                    {
                        CustomerId                   = b.CustomerId,
                        CustomerName                 = b.CustomerName,
                        StatTime                     = b.StatTime,
                        DatabaseConnections          = b.DatabaseConnections,
                        IdleDatabaseConnections      = b.IdleDatabaseConnections,
                        TotalDatabaseConnections     = b.TotalDatabaseConnections,
                        TotalIdleDatabaseConnections = b.TotalIdleDatabaseConnections,
                        PctProcessorTime             = b.PctProcessorTime / 100.0,
                        AvailableMBytes              = b.AvailableMBytes,
                        PctPagingFileUsage           = b.PctPagingFileUsage / 100.0
                    }).AsQueryable();
                }

                var result = data.ApplyQuery(tabularQuery);
                return(new ServiceResponse <TabularResponse>(true, result));
            }
            catch (Exception ex)
            {
                Logger.LogError($"{nameof(GetGridData)} : {ex.GetType()} : {ex.Message}");
                return(new ServiceResponse <TabularResponse>(false, null, ex.Message));
            }
        }