コード例 #1
0
        public void DoLogon()
        {
            IntPtr  hwnd     = new System.Windows.Interop.WindowInteropHelper(Application.Current.MainWindow).Handle;
            tagRECT rcClient = new tagRECT();

            _pieCharIndex       = PieChartServer.AddPieChart(hwnd, rcClient);
            _lineCharIndex      = LineChartServer.AddCurveChart(hwnd, rcClient);
            _histogramCharIndex = HistogramServer.AddHistogramChart(hwnd, rcClient, 0, 3000, 300, Color.Red.ToArgb(), Color.Black.ToArgb(), Color.Green.ToArgb());
            _occupancyCharIndex = OccupancyChartServer.AddOccupancyChart(hwnd, rcClient, 0, 3000, 300);


            PieChartServer.AddData(_pieCharIndex, MainWindowViewModel._businesstype.Count - 1);
            LineChartServer.AddData(_lineCharIndex, 13, 12, 1200);
            HistogramServer.AddData(_histogramCharIndex, 12);
            OccupancyChartServer.AddData(_occupancyCharIndex, 12);

            PieChartServer.ShowPieList(_pieCharIndex, false);
            HistogramServer.ShowHistogramList(_histogramCharIndex, false);
            OccupancyChartServer.ShowOccupancyList(_occupancyCharIndex, false);
            ResizeShowCharts();

            Thread tQuery = new Thread(() =>
            {   ////循环查询
                QueryShebeiguzhang(null);
                QueryBenyuebanliyewu(null);
                QueryHongKongWangLai(null);
                QueryTaiWanWangLai(null);
                QuerySheBeiZaiXian(null);
                QueryGuanLiCiShu(null);
                QueryLineChartData(null);
                QueryOccupancyChartData(null);
                QueryPieChartData(null);
                QueryHistogramChartData(null);
            }
                                       );

            tQuery.IsBackground = true;
            tQuery.Start();
        }
コード例 #2
0
        string MakeStatisticsQuerySql(object obj)
        {
            DateTime realstartTime = DateTime.Parse(startTime);
            DateTime realendTime   = DateTime.Parse(endTime);

            string str          = "select ";
            string strCondition = "";
            int    index        = 0;

            do
            {
                strCondition += " ( ";
                strCondition += "select count(*) as totalCnt from Zhiqianshuju where Xuhao>=-1";
                strCondition += MakeDeviceConditionSql("Zhiqianshuju");
                strCondition += " and Zhiqianshuju.[Riqi]>=" + Common.ConvertDateTimeInt(realstartTime);

                if (dataTypeText.Contains("天"))
                {
                    realstartTime = realstartTime.AddDays(1);
                }
                else if (dataTypeText.Contains("周"))
                {
                    realstartTime = realstartTime.AddDays(7);
                }
                else if (dataTypeText.Contains("月"))
                {
                    realstartTime = realstartTime.AddMonths(1);
                }
                else if (dataTypeText.Contains("年"))
                {
                    realstartTime = realstartTime.AddYears(1);
                }

                if (realstartTime < realendTime)
                {
                    strCondition += " and Zhiqianshuju.[Riqi]<" + Common.ConvertDateTimeInt(realstartTime);
                }
                else
                {
                    strCondition += " and Zhiqianshuju.[Riqi]<" + Common.ConvertDateTimeInt(realendTime);
                }
                strCondition += " ) as " + "'" + index + "'";

                index++;
                if (realstartTime < realendTime && index < 12)
                {
                    strCondition += ",";
                }
            } while (realstartTime < realendTime && index < 12);


            Application.Current.Dispatcher.Invoke(
                new Action(() =>
            {
                IntPtr hwnd      = new System.Windows.Interop.WindowInteropHelper(Application.Current.MainWindow).Handle;
                tagRECT rcClient = new tagRECT();

                PieChartServer.RemovePieChart(_pieCharIndex);
                LineChartServer.RemoveCurveChart(_lineCharIndex);
                HistogramServer.RemoveHistogramChart(_histogramCharIndex);

                _pieCharIndex       = PieChartServer.AddPieChart(hwnd, rcClient);
                _lineCharIndex      = LineChartServer.AddCurveChart(hwnd, rcClient);
                _histogramCharIndex = HistogramServer.AddHistogramChart(hwnd, rcClient, 0, 3000, 300, Color.Red.ToArgb(), Color.Black.ToArgb(), Color.Green.ToArgb());
                ResizeShowCharts();

                PieChartServer.AddData(_pieCharIndex, index);
                LineChartServer.AddData(_lineCharIndex, 13, index, 3600);
                HistogramServer.AddData(_histogramCharIndex, index);
            }));

            return(str + strCondition);
        }
コード例 #3
0
        string MakeStatisticsQuerySql(object obj)
        {
            DateTime realstartTime = DateTime.Parse(startTime);
            DateTime realendTime   = DateTime.Parse(endTime);

            string str          = "select ";
            string strCondition = "";
            int    index        = 0;

            do
            {
                DateTime begintime = realstartTime;
                DateTime endtime   = realstartTime;

                strCondition += " ( ";

                if (dataTypeText.Contains("天"))
                {
                    realstartTime = realstartTime.AddDays(1);
                }
                else if (dataTypeText.Contains("周"))
                {
                    realstartTime = realstartTime.AddDays(7);
                }
                else if (dataTypeText.Contains("月"))
                {
                    realstartTime = realstartTime.AddMonths(1);
                }
                else if (dataTypeText.Contains("年"))
                {
                    realstartTime = realstartTime.AddYears(1);
                }

                if (realstartTime < realendTime)
                {
                    endtime = realstartTime;
                }
                else
                {
                    endtime = realendTime;
                }

                strCondition += MakeBenyuebanliyewuCurMonthQuerySql(obj, begintime, endtime);
                strCondition += " ) as " + "'" + index + "'";

                index++;
                if (realstartTime < realendTime && index < 31)
                {
                    strCondition += ",";
                }
            } while (realstartTime < realendTime && index < 31);

            Application.Current.Dispatcher.Invoke(
                new Action(() =>
            {
                IntPtr hwnd      = new System.Windows.Interop.WindowInteropHelper(Application.Current.MainWindow).Handle;
                tagRECT rcClient = new tagRECT();

                PieChartServer.RemovePieChart(_pieCharIndex);
                LineChartServer.RemoveCurveChart(_lineCharIndex);
                HistogramServer.RemoveHistogramChart(_histogramCharIndex);

                _pieCharIndex       = PieChartServer.AddPieChart(hwnd, rcClient);
                _lineCharIndex      = LineChartServer.AddCurveChart(hwnd, rcClient);
                _histogramCharIndex = HistogramServer.AddHistogramChart(hwnd, rcClient, 0, 3000, 300, Color.Red.ToArgb(), Color.Black.ToArgb(), Color.Green.ToArgb());
                ResizeShowCharts();

                PieChartServer.AddData(_pieCharIndex, index);
                LineChartServer.AddData(_lineCharIndex, 13, index, 3600);
                HistogramServer.AddData(_histogramCharIndex, index);
            }));

            return(str + strCondition);
        }