private void InitData()
        {
            bindingConfiguration.Add(_configuration);
            foreach (var kv in _configuration.Calculations)
            {
                var calculation = new CalculationControl(I18N.GetString(kv.Key), kv.Value);
                calculationContainer.Controls.Add(calculation);
            }

            serverSelector.DataSource = _servers;

            _dataTable.Columns.Add("Timestamp", typeof(DateTime));
            _dataTable.Columns.Add("Speed", typeof(int));
            _speedSeries.XValueMember  = "Timestamp";
            _speedSeries.YValueMembers = "Speed";

            // might be empty
            _dataTable.Columns.Add("Package Loss", typeof(int));
            _dataTable.Columns.Add("Ping", typeof(int));
            _packageLossSeries.XValueMember  = "Timestamp";
            _packageLossSeries.YValueMembers = "Package Loss";
            _pingSeries.XValueMember         = "Timestamp";
            _pingSeries.YValueMembers        = "Ping";

            StatisticsChart.DataSource = _dataTable;
            LoadChartData();
            StatisticsChart.DataBind();
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获取在线人数统计
        /// </summary>
        /// <param name="context"></param>
        private void GetUserOnlineStatictics(HttpContext context)
        {
            string stime = GameRequest.GetQueryString("stime");
            string etime = GameRequest.GetQueryString("etime");

            stime = string.IsNullOrEmpty(stime) ? DateTime.Now.ToString("yyyy-MM-dd") : stime;
            etime = string.IsNullOrEmpty(etime) ? DateTime.Now.ToString("yyyy-MM-dd") : etime;
            stime = stime + " 00:00:00";
            etime = etime + " 23:59:59";
            IList <StatisticsOnline> list = FacadeManage.aidePlatformFacade.GetUserOnlineStatistics(stime, etime);
            List <StatisticsChart>   data = new List <StatisticsChart>();

            if (list != null && list.Count > 0)
            {
                StatisticsChart sc = null;
                foreach (StatisticsOnline item in list)
                {
                    sc       = new StatisticsChart();
                    sc.time  = item.DTime.ToString("yyyy-MM-dd HH:mm:ss");
                    sc.count = item.RUser;
                    sc.type  = "在线用户";
                    data.Add(sc);

                    sc       = new StatisticsChart();
                    sc.time  = item.DTime.ToString("yyyy-MM-dd HH:mm:ss");
                    sc.count = item.AUser;
                    sc.type  = "在线机器人";
                    data.Add(sc);
                }
            }
            ajv.SetValidDataValue(true);
            ajv.AddDataItem("data", data);
            context.Response.Write(ajv.SerializeToJson());
        }
Exemplo n.º 3
0
        /// <summary>
        /// 获取损耗统计
        /// </summary>
        /// <param name="context"></param>
        private void GetWasteStatictics(HttpContext context)
        {
            string stime = GameRequest.GetQueryString("stime");
            string etime = GameRequest.GetQueryString("etime");

            DateTime sDate = string.IsNullOrEmpty(stime) ? DateTime.Now.AddDays(-1) : Convert.ToDateTime(stime);
            DateTime eDate = string.IsNullOrEmpty(etime) ? DateTime.Now.AddDays(-7) : Convert.ToDateTime(etime);

            if (sDate >= eDate)
            {
                sDate = eDate.AddDays(-7);
            }
            DataSet ds = FacadeManage.aideNativeWebFacade.GetDataStatistics(Fetch.GetDateID(sDate), Fetch.GetDateID(eDate));
            List <StatisticsChart> data = new List <StatisticsChart>();

            if (ds != null && ds.Tables[0].Rows.Count > 0)
            {
                StatisticsChart sc = null;
                foreach (DataRow item in ds.Tables[0].Rows)
                {
                    sc       = new StatisticsChart();
                    sc.time  = Convert.ToDateTime(item["CollectDate"]).ToString("yyyy-MM-dd");
                    sc.count = Convert.ToInt64(item["GameWaste"]) / 1000;
                    sc.type  = "游戏损耗";
                    data.Add(sc);
                }
            }
            ajv.SetValidDataValue(true);
            ajv.AddDataItem("data", data);
            context.Response.Write(ajv.SerializeToJson());
        }
Exemplo n.º 4
0
        /// <summary>
        /// 获取游戏税收统计
        /// </summary>
        /// <param name="context"></param>
        private void GetGameRevenueStatictics(HttpContext context)
        {
            string stime = GameRequest.GetQueryString("stime");
            string etime = GameRequest.GetQueryString("etime");

            if (string.IsNullOrEmpty(stime) || string.IsNullOrEmpty(etime))
            {
                return;
            }
            stime = stime + " 00:00:00";
            etime = etime + " 23:59:59";
            IList <StatisticsRevenue> list = FacadeManage.aideTreasureFacade.GetDayGameRevenue(stime, etime);
            List <StatisticsChart>    data = new List <StatisticsChart>();

            if (list != null && list.Count > 0)
            {
                StatisticsChart sc = null;
                foreach (StatisticsRevenue item in list)
                {
                    sc       = new StatisticsChart();
                    sc.time  = item.TimeDate;
                    sc.count = item.Revenue;
                    sc.type  = "游戏税收";
                    data.Add(sc);
                }
            }
            ajv.SetValidDataValue(true);
            ajv.AddDataItem("data", data);
            context.Response.Write(ajv.SerializeToJson());
        }
Exemplo n.º 5
0
        private void LoadChartData()
        {
            var serverName = _servers[serverSelector.SelectedIndex];

            _dataTable.Rows.Clear();

            //return directly when no data is usable
            if (_controller.availabilityStatistics?.FilteredStatistics == null)
            {
                return;
            }
            List <StatisticsRecord> statistics;

            if (!_controller.availabilityStatistics.FilteredStatistics.TryGetValue(serverName, out statistics))
            {
                return;
            }
            IEnumerable <IGrouping <int, StatisticsRecord> > dataGroups;

            if (allMode.Checked)
            {
                _pingSeries.XValueType        = ChartValueType.DateTime;
                _packageLossSeries.XValueType = ChartValueType.DateTime;
                _speedSeries.XValueType       = ChartValueType.DateTime;
                dataGroups = statistics.GroupBy(data => data.Timestamp.DayOfYear);
                StatisticsChart.ChartAreas["DataArea"].AxisX.LabelStyle.Format  = "g";
                StatisticsChart.ChartAreas["DataArea"].AxisX2.LabelStyle.Format = "g";
            }
            else
            {
                _pingSeries.XValueType        = ChartValueType.Time;
                _packageLossSeries.XValueType = ChartValueType.Time;
                _speedSeries.XValueType       = ChartValueType.Time;
                dataGroups = statistics.GroupBy(data => data.Timestamp.Hour);
                StatisticsChart.ChartAreas["DataArea"].AxisX.LabelStyle.Format  = "HH:00";
                StatisticsChart.ChartAreas["DataArea"].AxisX2.LabelStyle.Format = "HH:00";
            }
            if (dataGroups == null)
            {
                return;
            }
            var finalData = from dataGroup in dataGroups
                            orderby dataGroup.Key
                            select new
            {
                dataGroup.First().Timestamp,
                Speed = dataGroup.Max(data => data.MaxInboundSpeed) ?? 0,
                Ping  = (int)(dataGroup.Average(data => data.AverageResponse) ?? 0),
                PackageLossPercentage = (int)(dataGroup.Average(data => data.PackageLoss) ?? 0) * 100
            };

            foreach (var data in finalData.Where(data => data.Speed != 0 || data.PackageLossPercentage != 0 || data.Ping != 0))
            {
                _dataTable.Rows.Add(data.Timestamp, data.Speed, data.PackageLossPercentage, data.Ping);
            }
            StatisticsChart.DataBind();
        }
Exemplo n.º 6
0
        private void loadChartData()
        {
            string serverName = _servers[serverSelector.SelectedIndex];

            _dataTable.Rows.Clear();

            //return directly when no data is usable
            if (_controller.availabilityStatistics?.FilteredStatistics == null)
            {
                return;
            }
            List <AvailabilityStatistics.RawStatisticsData> statistics;

            if (!_controller.availabilityStatistics.FilteredStatistics.TryGetValue(serverName, out statistics))
            {
                return;
            }
            IEnumerable <IGrouping <int, AvailabilityStatistics.RawStatisticsData> > dataGroups;

            if (allMode.Checked)
            {
                dataGroups = statistics.GroupBy(data => data.Timestamp.DayOfYear);
                StatisticsChart.ChartAreas["DataArea"].AxisX.LabelStyle.Format  = "MM/dd/yyyy";
                StatisticsChart.ChartAreas["DataArea"].AxisX2.LabelStyle.Format = "MM/dd/yyyy";
            }
            else
            {
                dataGroups = statistics.GroupBy(data => data.Timestamp.Hour);
                StatisticsChart.ChartAreas["DataArea"].AxisX.LabelStyle.Format  = "HH:00";
                StatisticsChart.ChartAreas["DataArea"].AxisX2.LabelStyle.Format = "HH:00";
            }
            var finalData = from dataGroup in dataGroups
                            orderby dataGroup.Key
                            select new
            {
                Timestamp   = dataGroup.First().Timestamp,
                Ping        = (int)dataGroup.Average(data => data.RoundtripTime),
                PackageLoss = (int)
                              (dataGroup.Count(data => data.ICMPStatus == IPStatus.TimedOut.ToString())
                               / (float)dataGroup.Count() * 100)
            };

            foreach (var data in finalData)
            {
                _dataTable.Rows.Add(data.Timestamp, data.PackageLoss, data.Ping);
            }
            StatisticsChart.DataBind();
        }
Exemplo n.º 7
0
 public Contols()
 {
     StartButton            = new StartButton();
     Chart                  = new StatisticsChart();
     EfCheckBox             = new EfCheckBox();
     CompositeTypesCheckBox = new CompositeTypesCheckBox();
     BinaryCopyCheckBox     = new BinaryCopyCheckBox();
     StartBatchBox          = new StartBatchBox();
     BatchIncrementBox      = new BatchIncrementBox();
     InsertionsCountBox     = new InsertionsCountBox();
     IteranceBox            = new IteranceBox();
     StartBatchLabel        = new StartBatchLabel();
     BatchIncrementLabel    = new BatchIncrementLabel();
     InsertionsCountLabel   = new InsertionsCountLabel();
     IteranceLabel          = new IteranceLabel();
 }
Exemplo n.º 8
0
        /// <summary>
        /// 获取用户注册统计
        /// </summary>
        /// <param name="context"></param>
        private void GetRegisterStatictics(HttpContext context)
        {
            string stime = GameRequest.GetQueryString("stime");
            string etime = GameRequest.GetQueryString("etime");

            if (string.IsNullOrEmpty(stime) || string.IsNullOrEmpty(etime))
            {
                return;
            }
            DateTime sDate = Convert.ToDateTime(stime);
            DateTime eDate = Convert.ToDateTime(etime);

            if (sDate >= eDate)
            {
                return;
            }
            IList <SystemStreamInfo> list = FacadeManage.aideAccountsFacade.GetRecordEveryDayRegister(Fetch.GetDateID(sDate), Fetch.GetDateID(eDate));
            List <StatisticsChart>   data = new List <StatisticsChart>();

            if (list != null && list.Count > 0)
            {
                StatisticsChart sc = null;
                foreach (SystemStreamInfo item in list)
                {
                    sc       = new StatisticsChart();
                    sc.time  = item.CollectDate.ToString("yyyy-MM-dd");
                    sc.count = item.WebRegisterSuccess;
                    sc.type  = "网站注册人数";
                    data.Add(sc);

                    sc       = new StatisticsChart();
                    sc.time  = item.CollectDate.ToString("yyyy-MM-dd");
                    sc.count = item.GameRegisterSuccess;
                    sc.type  = "APP注册人数";
                    data.Add(sc);

                    sc       = new StatisticsChart();
                    sc.time  = item.CollectDate.ToString("yyyy-MM-dd");
                    sc.count = (item.WebRegisterSuccess + item.GameRegisterSuccess);
                    sc.type  = "总注册人数";
                    data.Add(sc);
                }
            }
            ajv.SetValidDataValue(true);
            ajv.AddDataItem("data", data);
            context.Response.Write(ajv.SerializeToJson());
        }
Exemplo n.º 9
0
        private void InitData()
        {
            bindingConfiguration.Add(_configuration);
            foreach (var kv in _configuration.Calculations)
            {
                var calculation = new CalculationControl(kv.Key, kv.Value);
                calculationContainer.Controls.Add(calculation);
            }

            serverSelector.DataSource = _servers;

            _dataTable.Columns.Add("Timestamp", typeof(DateTime));
            _dataTable.Columns.Add("Package Loss", typeof(int));
            _dataTable.Columns.Add("Ping", typeof(int));

            StatisticsChart.Series["Package Loss"].XValueMember  = "Timestamp";
            StatisticsChart.Series["Package Loss"].YValueMembers = "Package Loss";
            StatisticsChart.Series["Ping"].XValueMember          = "Timestamp";
            StatisticsChart.Series["Ping"].YValueMembers         = "Ping";
            StatisticsChart.DataSource = _dataTable;
            loadChartData();
            StatisticsChart.DataBind();
        }
Exemplo n.º 10
0
        private void GetRevenueStatictics(HttpContext context)
        {
            string stime = GameRequest.GetQueryString("stime");
            string etime = GameRequest.GetQueryString("etime");

            if (string.IsNullOrEmpty(stime) || string.IsNullOrEmpty(etime))
            {
                return;
            }
            stime = stime + " 00:00:00";
            etime = etime + " 23:59:59";
            IList <StatisticsRevenue>       insureList = FacadeManage.aideTreasureFacade.GetDayInsureRevenue(stime, etime);
            IList <StatisticsRevenue>       gameList   = FacadeManage.aideTreasureFacade.GetDayGameRevenue(stime, etime);
            IList <StatisticsChart>         data       = new List <StatisticsChart>();
            SortedDictionary <string, long> totalList  = new SortedDictionary <string, long>();

            if (insureList != null && insureList.Count > 0)
            {
                foreach (StatisticsRevenue item in insureList)
                {
                    var sc = new StatisticsChart
                    {
                        time  = item.TimeDate,
                        count = item.Revenue,
                        type  = "银行税收(包含存、取、转)"
                    };
                    if (totalList.ContainsKey(item.TimeDate))
                    {
                        totalList[item.TimeDate] += item.Revenue;
                    }
                    else
                    {
                        totalList.Add(item.TimeDate, item.Revenue);
                    }
                    data.Add(sc);
                }
            }
            if (gameList != null && gameList.Count > 0)
            {
                foreach (StatisticsRevenue item in gameList)
                {
                    var sc = new StatisticsChart
                    {
                        time  = item.TimeDate,
                        count = item.Revenue,
                        type  = "游戏税收"
                    };
                    if (totalList.ContainsKey(item.TimeDate))
                    {
                        totalList[item.TimeDate] += item.Revenue;
                    }
                    else
                    {
                        totalList.Add(item.TimeDate, item.Revenue);
                    }
                    data.Add(sc);
                }
            }
            foreach (var total in totalList)
            {
                data.Add(new StatisticsChart()
                {
                    time  = total.Key,
                    type  = "总税收",
                    count = total.Value
                });
            }
            ajv.SetValidDataValue(true);
            ajv.AddDataItem("data", data);
            context.Response.Write(ajv.SerializeToJson());
        }