Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void UCRain1_QueryEvent(object sender, EventArgs e)
        {
            int[]    deviceIDs = this.UCRain1.SelectedStationCollection.GetDeviceCollection().GetDeviceIDs();
            DateTime begin     = this.UCRain1.Begin;
            DateTime end       = this.UCRain1.End;

            DataTable tbl = RainDBI.GetSumData(deviceIDs, begin, end);
            DataTable r   = new DataTable();

            r.Columns.Add("Name", typeof(string));
            r.Columns.Add("RainFill", typeof(float));

            foreach (StationClass s in this.UCRain1.SelectedStationCollection)
            {
                string name     = s.StationName;
                double rainfill = FindRainFill(tbl, name);

                DataRow newRow = r.NewRow();
                newRow["Name"]     = name;
                newRow["rainFill"] = rainfill;
                r.Rows.Add(newRow);
            }

            FixRainFillDot(r);
            this.UCAMChart1.SetColumnChartInfo(r, "Name", "RainFill", "", "LineName", GetTitle(),
                                               strings.RainFillWithUnit, "F2");

            H.DataSource = r;
            H.Bind();
        }
Example #2
0
        /// <summary>
        ///
        /// </summary>
        private void Query()
        {
            int[] deviceIDs = this.UCRain1.SelectedStationCollection.GetDeviceCollection().GetDeviceIDs();
            if (deviceIDs.Length == 1)
            {
                RangeType rt    = this.UCRain1.RangeType;
                DateTime  begin = this.UCRain1.Begin;
                DateTime  end   = this.UCRain1.End;

                DataTable tbl = null;

                switch (rt)
                {
                case RangeType.Real:
                    tbl = RainDBI.GetData(begin, end, deviceIDs);
                    break;

                case RangeType.Day:
                case RangeType.Month:
                case RangeType.Year:
                    tbl = RainDBI.GetDayData(begin, end, deviceIDs);
                    break;
                }

                H.DataSource = tbl;
                H.Bind();
            }
            else
            {
                ClientScript.RegisterStartupScript(
                    this.GetType(), "key",
                    JavaScriptHelper.GetAlertScript("只能选择一个测点.")
                    );
            }
        }