コード例 #1
0
        /// <summary>
        /// insert or update channel
        /// </summary>
        public void Save()
        {
            string n = this.ChannelName;
            string r = this.ChannelRemark;

            if (IsAdd())
            {
                ChannelDBI.AddChannel(n, r, GetStationIDs());
            }
            else
            {
                // edit
                //
                ChannelDBI.EditChannel(this.ChannelID, n, r, GetStationIDs());
            }

            // save station color
            //
            foreach (StationClass station in StationCollection)
            {
                if (station.Color != System.Drawing.Color.White)
                {
                    StationDBI.UpdateColor(station.StationID, station.Color);
                }
            }
        }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        private void Fill()
        {
            DataTable tbl = ChannelDBI.GetChannelDataTable();

            this.GridView1.DataSource = tbl;
            this.GridView1.DataBind();
        }
コード例 #3
0
ファイル: pWUsedWater.aspx.cs プロジェクト: wwkkww1983/yh
        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);
        }
コード例 #4
0
ファイル: pProject.aspx.cs プロジェクト: wwkkww1983/yh
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnDeleteChannel_Click(object sender, EventArgs e)
        {
            TreeNode tn = this.TreeView1.SelectedNode;

            if (IsChannelTreeNode(tn))
            {
                int id = GetSelectedID(tn);
                ChannelDBI.DeleteChannel(id);
                BindTree();
            }
        }
コード例 #5
0
        protected void DropDownList4_SelectedIndexChanged(object sender, EventArgs e)
        {
            ListItem li = this.DropDownList4.SelectedItem;

            if (li != null)
            {
                string    value    = li.Value;
                int       ParentID = Convert.ToInt32(value);
                DataTable dt       = ChannelDBI.GetLowLevelChannelDataTable(ParentID);
                DataBind(dt, DropDownList5);
            }
        }
コード例 #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            Trace.Warn("GridView1.DataKeys.Count = " + this.GridView1.DataKeys.Count);
            Trace.Warn("GridView1_RowDeleting RowIndex = " + e.RowIndex);
            // TODO:
            //
            int    index = e.RowIndex;
            object value = this.GridView1.DataKeys[index].Value;
            int    id    = Convert.ToInt32(value);

            ChannelDBI.DeleteChannel(id);
            Fill();
        }
コード例 #7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="source"></param>
        /// <param name="args"></param>
        protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args)
        {
            string n        = this.txtChannelName.Text.Trim();
            int    ignoreID = GetEditChannelID();
            bool   b        = ChannelDBI.ExistChannelName(n, ignoreID);

            if (b)
            {
                args.IsValid = false;
            }
            else
            {
                args.IsValid = true;
            }
        }
コード例 #8
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="channelID"></param>
        private StationCollection GetStationList(int channelID)
        {
            StationCollection list       = new StationCollection();
            DataTable         stationTbl = ChannelDBI.GetStationDataTable(channelID);

            foreach (DataRow row in stationTbl.Rows)
            {
                StationClass sc = new StationClass();
                sc.StationID   = Convert.ToInt32(row["StationID"]);
                sc.StationName = row["Name"].ToString();
                //this.StationCollection.Add(sc);
                list.Add(sc);
            }
            return(list);
        }
コード例 #9
0
        /// <summary>
        /// insert or update channel
        /// </summary>
        public void Save()
        {
            string n = this.ChannelName;
            string r = this.ChannelRemark;

            if (IsAdd())
            {
                ChannelDBI.AddChannel(n, r, GetStationIDs());
            }
            else
            {
                // edit
                //
                ChannelDBI.EditChannel(this.ChannelID, n, r, GetStationIDs());
            }
        }
コード例 #10
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="?"></param>
        public void SetChannalInfo(int channelID)
        {
            this.ChannelID = channelID;
            DataTable tbl = ChannelDBI.GetChannelDataTable(channelID);

            if (tbl.Rows.Count > 0)
            {
                DataRow r = tbl.Rows[0];
                this.ChannelName   = r["ChannelName"].ToString();
                this.ChannelRemark = r["Remark"].ToString();
                //this.StationCollection =

                this.StationCollection.Clear();
                StationCollection stationsOfChannel = GetStationList(channelID);
                //this.StationCollection.Add(stationsOfChannel
                this.StationCollection = stationsOfChannel;
            }
        }
コード例 #11
0
        private void BindCheckBoxListGan()
        {
            DataTable dt = ChannelDBI.GetChannelTableForLevel(5);

            DataBindQD(dt, DropDownList4);
        }