Beispiel #1
0
        private double CountUsedAmount(int WaterUserID, DateTime bg, DateTime ed)
        {
            int[]  InDevices  = WaterUserInDBI.GetInDeviceIds(WaterUserID);
            int[]  OutDevices = WaterUserOutDBI.GetOutDeviceIds(WaterUserID);
            double InData     = 0;
            double OutData    = 0;

            for (int i = 0; i < InDevices.Length; i++)
            {
                DataTable dtin = DitchDataDBI.GetData(bg, ed, InDevices[i]);
                if (dtin.Rows.Count != 0)
                {
                    InData = InData + double.Parse(dtin.Rows[dtin.Rows.Count - 1]["UsedAmount"].ToString()) - double.Parse(dtin.Rows[0]["UsedAmount"].ToString());
                }
            }

            for (int o = 0; o < OutDevices.Length; o++)
            {
                DataTable dtout = DitchDataDBI.GetData(bg, ed, OutDevices[o]);
                if (dtout.Rows.Count != 0)
                {
                    OutData = OutData + double.Parse(dtout.Rows[dtout.Rows.Count - 1]["UsedAmount"].ToString()) - double.Parse(dtout.Rows[0]["UsedAmount"].ToString());
                }
            }

            return(InData - OutData);
        }
Beispiel #2
0
        private double CountChannelAmount(int ChannelID, DateTime bg, DateTime ed)
        {
            int    InDevices  = ChannelDBI.GetInDeviceIds(ChannelID);
            int    OutDevices = ChannelDBI.GetOutDeviceIds(ChannelID);
            double InData     = 0;
            double OutData    = 0;

            DataTable dtin = DitchDataDBI.GetData(bg, ed, InDevices);

            if (dtin.Rows.Count != 0)
            {
                InData = InData + double.Parse(dtin.Rows[dtin.Rows.Count - 1]["UsedAmount"].ToString()) - double.Parse(dtin.Rows[0]["UsedAmount"].ToString());
            }



            DataTable dtout = DitchDataDBI.GetData(bg, ed, OutDevices);

            if (dtout.Rows.Count != 0)
            {
                OutData = OutData + double.Parse(dtout.Rows[dtout.Rows.Count - 1]["UsedAmount"].ToString()) - double.Parse(dtout.Rows[0]["UsedAmount"].ToString());
            }


            return(InData - OutData);
        }
Beispiel #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Query()
        {
            // TODO: 2011-05-27 page_load 之前不能调用 IsValid
            //
            //if (IsValid)
            DateTime begin = UCConditionDTTwo1.Begin;
            DateTime end   = UCConditionDTTwo1.End;

            //int[] deviceIDs = UCConditionDTTwo1.GetQueryDeviceIDs();
            DeviceCollection dc = UCConditionDTTwo1.Stations.GetDeviceCollection();

            int[] deviceIDs = dc.GetDeviceIDs();
            if (deviceIDs.Length == 0)
            {
                // TODO: 2011-05-16 not select station msg
                //
                return;
            }

            DataTable tbl = DitchDataDBI.GetData(begin, end, deviceIDs);

            _h.Bind();
            //DataTable tbl = GetDataTable(begin, end, deviceIDs[0]);
            //ColumnNameTextCollection nts = GetColumnNameTextCollection();
            //GridViewHelper.SetGridViewColumn(this.GridView1, nts);
            //this.GridView1.DataSource = tbl;
            //this.DataBind();


            this.UCZedChart1.GraphPaneConfig = this.GetGraphPaneConfig();
            this.UCZedChart1.DataSource      = tbl;
        }
Beispiel #4
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        private DataTable GetDataTable()
        {
            DateTime begin = UCConditionDTTwo1.Begin;
            DateTime end   = UCConditionDTTwo1.End;

            //int[] deviceIDs = UCConditionDTTwo1.GetQueryDeviceIDs();
            DeviceCollection dc = UCConditionDTTwo1.Stations.GetDeviceCollection();

            int[] deviceIDs = dc.GetDeviceIDs();
            if (deviceIDs.Length == 0)
            {
                // TODO: 2011-05-16 not select station msg
                //
                return(null);
            }

            //DataTable tbl = DitchDataDBI.GetData(begin, end, deviceIDs);
            DataTable tbl = DitchDataDBI.GetData(begin, end, deviceIDs[0]);

            return(tbl);
        }