/// <summary> /// /// </summary> /// <param name="channelID"></param> /// <param name="cblStation"></param> /// <param name="isSelected"></param> static public void StationOfChannelBind(int channelID, CheckBoxList cblStation, bool isSelected) { //ListItem item = this.ddlChannel.SelectedItem; //if (item != null) //{ //int id = int.Parse(item.Value); //WaterUserClass wu = GetWaterUser(); //if (wu != null) //{ //ChannelClass ch = wu.ChannelCollection.GetChannelByID(id); ChannelClass ch = ChannelFactory.CreateChannel(channelID); if (ch != null) { ListItemCollection stationList = GetStationListItemCollection(ch.StationCollection); cblStation.DataTextField = "Text"; cblStation.DataValueField = "Value"; cblStation.DataSource = stationList; cblStation.DataBind(); foreach (ListItem stitem in cblStation.Items) { stitem.Selected = isSelected; } } //} //} }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void ddlChannel_SelectedIndexChanged(object sender, EventArgs e) { ListItem item = this.ddlChannel.SelectedItem; if (item != null) { int id = int.Parse(item.Value); WaterUserClass wu = GetWaterUser(); if (wu != null) { ChannelClass ch = wu.ChannelCollection.GetChannelByID(id); if (ch != null) { ListItemCollection stationList = GetStationListItemCollection(ch.StationCollection); this.cblStation.DataTextField = "Text"; this.cblStation.DataValueField = "Value"; this.cblStation.DataSource = stationList; this.cblStation.DataBind(); foreach (ListItem stitem in this.cblStation.Items) { stitem.Selected = IsSelectAllStation; } } } } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnAddChannel_Click(object sender, EventArgs e) { ChannelClass newChannel = new ChannelClass(); newChannel.ChannelName = "new channel"; this.UCChannel1.Bind(newChannel); //SessionManager.ChannelSession. }
/// <summary> /// /// </summary> /// <param name="c"></param> internal void Bind(ChannelClass c) { if (c != null) { this.txtChannelName.Text = c.ChannelName; this.txtChannelRemark.Text = c.ChannelRemark; } }
/// <summary> /// /// </summary> /// <param name="c"></param> /// <returns></returns> private TreeNode CreateChannelTreeNode(ChannelClass c) { string channelvalue = "c" + c.ChannelID; TreeNode n = new TreeNode(c.ChannelName); n.Value = channelvalue; return(n); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnOK_Click(object sender, EventArgs e) { ChannelCollection cc = SessionManager.WaterUserSession.WaterUser.ChannelCollection; cc.Clear(); foreach (ListItem item in this.clChannel.Items) { if (item.Selected) { int id = Convert.ToInt32(item.Value); ChannelClass c = ChannelFactory.CreateChannel(id); cc.Add(c); } } Response.Redirect("WaterUser.aspx"); }
/// <summary> /// /// </summary> /// <param name="channelID"></param> private StationCollection GetStationList(int channelID) { ChannelClass c = ChannelFactory.CreateChannel(channelID); return(c.StationCollection); //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; }
/// <summary> /// /// </summary> /// <param name="channelID"></param> /// <param name="cblStation"></param> /// <param name="deviceTypes"></param> /// <param name="isSelected"></param> static public void StationOfChannelBind(int channelID, CheckBoxList cblStation, string[] deviceTypes, bool isSelected) { ChannelClass ch = ChannelFactory.CreateChannel(channelID); if (ch != null) { StationCollection sts = ch.StationCollection.GetStationCollection(deviceTypes); ListItemCollection stationList = GetStationListItemCollection(sts); cblStation.DataTextField = "Text"; cblStation.DataValueField = "Value"; cblStation.DataSource = stationList; cblStation.DataBind(); foreach (ListItem stitem in cblStation.Items) { stitem.Selected = isSelected; } } }
/// <summary> /// /// </summary> private void BindChannelOrStation(TreeNode selected) { if (IsChannelTreeNode(selected)) { int channelID = GetSelectedID(selected); ChannelClass c = ChannelFactory.CreateChannel(channelID); this.UCChannel1.Bind(c); this.UCChannel1.Visible = true; this.UCStation1.Visible = false; } else { int stationID = GetSelectedID(selected); StationClass s = StationFactory.CreateStationByStationID(stationID); this.UCStation1.Bind(s); this.UCChannel1.Visible = false; this.UCStation1.Visible = true; } }
public static bool ConnectionServer(ChannelModel model) { //获取远程对象 var channelGroup = model.ChannelGroupType == "1" ? ChannelGroup.TCP : ChannelGroup.HTTP; string protocol = "tcp"; if (channelGroup == ChannelGroup.HTTP) { protocol = "http"; } string uri = GetServerUrl(protocol, model); try { ChannelClass.StartChannel(channelGroup, model.ChannelName); _iHiCoordinator = Activator.GetObject(typeof(IHiCoordinator), uri) as IHiCoordinator; _wrapper = new EventWrapper(); _wrapper.Server2ClientEvent += GetServerMessage; if (_iHiCoordinator != null) { _iHiCoordinator.Server2ClientEvent += _wrapper.OnServer2ClientEvent; } ChannelDetail = model; string clientName = ChannelClass.GetMyHostName(); if (_iHiCoordinator != null) { _iHiCoordinator.IClient2Server(clientName + "成功连接服务"); } return(true); } catch (Exception ex) { MsgBox.ShowInformation("启动服务失败:" + ex.Message + "\n\n" + uri); return(false); } }