private void button1_Click(object sender, EventArgs e) { string housename = this.textBox1.Text; string t1 = this.numericUpDown1.Value.ToString(); string t2 = this.numericUpDown2.Value.ToString(); string h1 = this.numericUpDown3.Value.ToString(); string h2 = this.numericUpDown4.Value.ToString(); if (housename != null && !"".Equals(housename)) { bean.houseInfo hi = new bean.houseInfo(); hi.name = housename; hi.h_high = float.Parse(h1); hi.h_low = float.Parse(h2); hi.t_high = float.Parse(t1); hi.t_low = float.Parse(t2); service.houseTypeService hts = new service.houseTypeService(); bool bl = hts.addHouseManage(hi); if (bl) { this.DialogResult = DialogResult.OK; this.Close(); } } else { MessageBox.Show("库房名称为空,请重新输入!"); } }
private void addManageHost_Load(object sender, EventArgs e) { string str = Application.StartupPath;//项目路径 this.button1.BackgroundImage = Image.FromFile(@str + "/images/save.png"); this.button2.BackgroundImage = Image.FromFile(@str + "/images/cancel.png"); service.houseTypeService hts = new service.houseTypeService(); this.comboBox1.DataSource = hts.queryhouseType(); //绑定数据源 this.comboBox1.DisplayMember = "name"; //显示给用户的数据集表项 this.comboBox1.ValueMember = "id"; //操作时获取的值 this.comboBox2.SelectedIndex = 0; this.comboBox3.SelectedIndex = 0; string[] ArryPort = System.IO.Ports.SerialPort.GetPortNames(); this.comboBox5.Items.Clear(); if (ArryPort.Length > 0) { for (int i = 0; i < ArryPort.Length; i++) { this.comboBox5.Items.Add(ArryPort[i]); } } }
private void updateManageHost_Load(object sender, EventArgs e) { name0 = this.textBox1.Text; string str = Application.StartupPath;//项目路径 this.button1.BackgroundImage = Image.FromFile(@str + "/images/save.png"); this.button2.BackgroundImage = Image.FromFile(@str + "/images/cancel.png"); service.houseTypeService hts = new service.houseTypeService(); this.comboBox1.DataSource = hts.queryhouseType(); //绑定数据源 this.comboBox1.DisplayMember = "name"; //显示给用户的数据集表项 this.comboBox1.ValueMember = "id"; //操作时获取的值 string hcode = this.textBox3.Text; if (hcode != null && !"".Equals(hcode)) { this.comboBox1.Text = hcode; } string[] ArryPort = System.IO.Ports.SerialPort.GetPortNames(); //this.comboBox4.Items.Clear(); if (ArryPort.Length > 0) { for (int i = 0; i < ArryPort.Length; i++) { this.comboBox4.Items.Add(ArryPort[i]); } } }
private void measurePointInsert_Load(object sender, EventArgs e) { string str = Application.StartupPath;//项目路径 this.button1.BackgroundImage = Image.FromFile(@str + "/images/save.png"); this.button2.BackgroundImage = Image.FromFile(@str + "/images/cancel.png"); service.manageHostService mh = new service.manageHostService(); DataTable dt1 = mh.queryManageHost(); if (dt1.Rows.Count > 0) { this.comboBox1.DataSource = dt1; //绑定数据源 this.comboBox1.DisplayMember = "hostName"; //显示给用户的数据集表项 this.comboBox1.ValueMember = "measureCode"; //操作时获取的值 } service.houseTypeService hts = new service.houseTypeService(); this.comboBox3.DataSource = hts.queryhouseType(); //绑定数据源 this.comboBox3.DisplayMember = "name"; //显示给用户的数据集表项 this.comboBox3.ValueMember = "id"; //操作时获取的值 }
private void measurePointSetPropert_Load(object sender, EventArgs e) { string str = Application.StartupPath;//项目路径 this.button1.BackgroundImage = Image.FromFile(@str + "/images/save.png"); this.button2.BackgroundImage = Image.FromFile(@str + "/images/cancel.png"); service.houseTypeService hts = new service.houseTypeService(); this.comboBox3.DataSource = hts.queryhouseType(); //绑定数据源 this.comboBox3.DisplayMember = "name"; //显示给用户的数据集表项 this.comboBox3.ValueMember = "id"; //操作时获取的值 string hcode = this.textBox2.Text; this.button3.BackgroundImage = Image.FromFile(@str + "/images/save.png"); this.button4.BackgroundImage = Image.FromFile(@str + "/images/cancel.png"); this.comboBox1.DataSource = hts.queryhouseType(); //绑定数据源 this.comboBox1.DisplayMember = "name"; //显示给用户的数据集表项 this.comboBox1.ValueMember = "id"; //操作时获取的值 ///新增测点权限分配 service.changGuicheckService cgs = new service.changGuicheckService(); DataTable dta = cgs.checkcedianAll(null).Tables[0]; int t = dta.Rows.Count; if (t > 0) { for (int i = 0; i < t; i++) { string tag = dta.Rows[i]["terminalname"].ToString(); this.checkedListBox1.Items.Add(tag); } } if (hcode != null && !"".Equals(hcode)) { //this.comboBox3.SelectedIndex = Int32.Parse(hcode)-1; this.comboBox3.Text = hcode; this.comboBox1.Text = hcode; } }
private void button1_Click(object sender, EventArgs e) { string name = this.textBox1.Text; string t_high = this.numericUpDown1.Value.ToString(); string t_low = this.numericUpDown2.Value.ToString(); string h_high = this.numericUpDown3.Value.ToString(); string h_low = this.numericUpDown4.Value.ToString(); string id = this.textBox2.Text.ToString(); if (name != null && !"".Equals(name) && id != null && !"".Equals(id)) { bean.houseInfo di = new bean.houseInfo(); di.name = name; di.t_high = float.Parse(t_high); di.t_low = float.Parse(t_low); di.h_high = float.Parse(h_high); di.h_low = float.Parse(h_low); di.id = id; if (this.checkBox2.Checked) { di.isUsed = 1; } else { di.isUsed = 0; } service.houseTypeService his = new service.houseTypeService(); bool isok = his.updateHouseInfoById(di); if (isok) { service.deviceInformationService dis = new service.deviceInformationService(); if (this.checkBox1.Checked) { bool bl = dis.updateWsdByHouseCode(di); if (bl) { if (di.isUsed == 1) { MessageBox.Show(di.name + " 库房下所有的测点(仪表)都已修改为空库测点!"); } MessageBox.Show(di.name + " 库房下所有的测点(仪表)温湿度上下限已同步修改成功!"); } } else { bool bl = dis.updateWsdByHouseKong(di); if (bl) { if (di.isUsed == 1) { MessageBox.Show(di.name + " 库房下所有的测点(仪表)都已修改为空库测点!"); } else { MessageBox.Show(di.name + " 库房下所有的测点(仪表)都已取消空库设定!"); } } } this.DialogResult = DialogResult.OK; } } }