private void ShowInfo(int HostID) { WebDemo.BLL.WebDemo.Hosts bll = new WebDemo.BLL.WebDemo.Hosts(); WebDemo.Model.WebDemo.Hosts model = bll.GetModel(HostID); this.lblCollectorID.Text = model.CollectorID.ToString(); this.lblHostID.Text = model.HostID.ToString(); this.lblHostName.Text = model.HostName; this.lblHostAddr.Text = model.HostAddr; this.lblRemark.Text = model.Remark; this.lblflag.Text = model.flag.ToString(); this.lblLimitNum.Text = model.LimitNum.ToString(); this.lblHostComType.Text = model.HostComType.ToString(); this.lblHostType.Text = model.HostType.ToString(); this.lblHostRDate.Text = model.HostRDate; this.lblDownloadFlag.Text = model.DownloadFlag.ToString(); this.lblPowerType.Text = model.PowerType.ToString(); this.lblHostNo.Text = model.HostNo.ToString(); this.lblHostLimitNum.Text = model.HostLimitNum.ToString(); this.lblIsRelay.Text = model.IsRelay.ToString(); this.lblIsDownMeterType.Text = model.IsDownMeterType.ToString(); }
protected void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (!PageValidate.IsNumber(txtCollectorID.Text)) { strErr += "集中器编号格式错误!\\n"; } if (!PageValidate.IsNumber(txtHostID.Text)) { strErr += "楼宇主机编号格式错误!\\n"; } if (this.txtHostName.Text.Trim().Length == 0) { strErr += "楼宇主机名称不能为空!\\n"; } if (this.txtHostAddr.Text.Trim().Length == 0) { strErr += "地址不能为空!\\n"; } if (this.txtRemark.Text.Trim().Length == 0) { strErr += "备注信息不能为空!\\n"; } if (!PageValidate.IsNumber(txtflag.Text)) { strErr += "flag格式错误!\\n"; } if (!PageValidate.IsNumber(txtLimitNum.Text)) { strErr += "LimitNum格式错误!\\n"; } if (!PageValidate.IsNumber(txtHostComType.Text)) { strErr += "HostComType格式错误!\\n"; } if (!PageValidate.IsNumber(txtHostType.Text)) { strErr += "HostType格式错误!\\n"; } if (this.txtHostRDate.Text.Trim().Length == 0) { strErr += "HostRDate不能为空!\\n"; } if (!PageValidate.IsNumber(txtDownloadFlag.Text)) { strErr += "DownloadFlag格式错误!\\n"; } if (!PageValidate.IsNumber(txtPowerType.Text)) { strErr += "PowerType格式错误!\\n"; } if (!PageValidate.IsNumber(txtHostNo.Text)) { strErr += "HostNo格式错误!\\n"; } if (!PageValidate.IsNumber(txtHostLimitNum.Text)) { strErr += "HostLimitNum格式错误!\\n"; } if (!PageValidate.IsNumber(txtIsRelay.Text)) { strErr += "IsRelay格式错误!\\n"; } if (!PageValidate.IsNumber(txtIsDownMeterType.Text)) { strErr += "IsDownMeterType格式错误!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } int CollectorID = int.Parse(this.txtCollectorID.Text); int HostID = int.Parse(this.txtHostID.Text); string HostName = this.txtHostName.Text; string HostAddr = this.txtHostAddr.Text; string Remark = this.txtRemark.Text; int flag = int.Parse(this.txtflag.Text); int LimitNum = int.Parse(this.txtLimitNum.Text); int HostComType = int.Parse(this.txtHostComType.Text); int HostType = int.Parse(this.txtHostType.Text); string HostRDate = this.txtHostRDate.Text; int DownloadFlag = int.Parse(this.txtDownloadFlag.Text); int PowerType = int.Parse(this.txtPowerType.Text); int HostNo = int.Parse(this.txtHostNo.Text); int HostLimitNum = int.Parse(this.txtHostLimitNum.Text); int IsRelay = int.Parse(this.txtIsRelay.Text); int IsDownMeterType = int.Parse(this.txtIsDownMeterType.Text); WebDemo.Model.WebDemo.Hosts model = new WebDemo.Model.WebDemo.Hosts(); model.CollectorID = CollectorID; model.HostID = HostID; model.HostName = HostName; model.HostAddr = HostAddr; model.Remark = Remark; model.flag = flag; model.LimitNum = LimitNum; model.HostComType = HostComType; model.HostType = HostType; model.HostRDate = HostRDate; model.DownloadFlag = DownloadFlag; model.PowerType = PowerType; model.HostNo = HostNo; model.HostLimitNum = HostLimitNum; model.IsRelay = IsRelay; model.IsDownMeterType = IsDownMeterType; WebDemo.BLL.WebDemo.Hosts bll = new WebDemo.BLL.WebDemo.Hosts(); bll.Add(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx"); }