private void button4_Click(object sender, EventArgs e) { DialogResult rr = MessageBox.Show("确定要删除测点(仪表)数据吗?", "确定要删除提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); int tt = (int)rr; if (tt == 1) { string code = this.dataGridView1.SelectedRows[0].Cells[1].Value.ToString(); string meter = this.dataGridView1.SelectedRows[0].Cells[2].Value.ToString(); if (code != null && !"".Equals(code) && meter != null && !"".Equals(meter)) { bean.deviceInformation di = new bean.deviceInformation(); di.measureCode = code; di.meterNo = meter; service.deviceInformationService dis = new service.deviceInformationService(); bool bl = dis.deletetDeviceInformation(di); if (bl) { //删除仪表数据的同时修改管理主机的仪表数量 service.manageHostService mhs = new service.manageHostService(); bean.manageHose mh = new bean.manageHose(); mh.measureCode = di.measureCode; mhs.updateManageHostCdNum(mh); //刷新仪表页面 checkPointInfo(); MessageBox.Show("删除成功!"); //刷新首页 if (this.RefreshEvent != null) { RefreshEvent(1, null); } } } } }
private void button4_Click(object sender, EventArgs e) { if (flag) { foreach (Control ctr in this.pictureBox1.Controls) { //判断该控件是不是Label if (ctr is Label) { //将ctr转换成Label并赋值给ck Label lb = ctr as Label; string[] code1 = lb.Name.Split('_'); Point tt = lb.Location; bean.deviceInformation di = new bean.deviceInformation(); di.measureCode = code1[0].ToString(); di.meterNo = code1[1].ToString(); di.pointX = tt.X; di.pointY = tt.Y; service.deviceInformationService dis = new service.deviceInformationService(); dis.updateIformationByPoint(di); } } MessageBox.Show("平面图仪表位置信息保存成功!"); string code = this.comboBox1.SelectedValue.ToString(); imgWenshidu(code); flag = false; } else { MessageBox.Show("请先编辑测点位置,再点击保存!"); } }
private void button1_Click(object sender, EventArgs e) { string code = this.textBox5.Text; string meter = this.textBox6.Text; 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 type = this.comboBox3.SelectedValue.ToString(); if (name != null && double.Parse(t_high) > double.Parse(t_low)) { bean.deviceInformation di = new bean.deviceInformation(); di.measureCode = code; di.meterNo = meter; di.terminalname = 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.housecode = type; if (this.checkBox1.Checked) { di.powerflag = Int32.Parse(this.checkBox1.Tag.ToString()); } else { di.powerflag = 1; }; bool isok = dis.updateIformation(di); if (isok) { this.DialogResult = DialogResult.OK; } } else { MessageBox.Show("测点名称不能为空,温度上限应大于温度下限!"); } }
private void button1_Click(object sender, EventArgs e) { string name = this.textBox3.Text; string codemeter = this.textBox4.Text; string t_high = this.numericUpDown4.Value.ToString(); string t_low = this.numericUpDown2.Value.ToString(); string h_high = this.numericUpDown1.Value.ToString(); string h_low = this.numericUpDown5.Value.ToString(); if (name != null && double.Parse(t_high) > double.Parse(t_low)) { bean.deviceInformation di = new bean.deviceInformation(); string[] mm = codemeter.Split('-'); di.measureCode = mm[0]; di.meterNo = mm[1]; di.terminalname = 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); if (this.checkBox1.Checked) { di.powerflag = Int32.Parse(this.checkBox1.Tag.ToString()); } else { di.powerflag = 1; }; service.deviceInformationService dis = new service.deviceInformationService(); bool isok = dis.updateIformation(di); if (isok) { this.DialogResult = DialogResult.OK; } } else { MessageBox.Show("测点名称不能为空,温度上限应大于温度下限!"); } }
private void button1_Click(object sender, EventArgs e) { DialogResult result = MessageBox.Show("确定要统一设置所有温湿度上下限吗?", "操作提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { string t_high = this.numericUpDown4.Value.ToString(); string t_low = this.numericUpDown2.Value.ToString(); string h_high = this.numericUpDown1.Value.ToString(); string h_low = this.numericUpDown5.Value.ToString(); bean.deviceInformation di = new bean.deviceInformation(); 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); bool bl = dis.updateAllIformation(di); if (bl) { selectdeviceinfo(); MessageBox.Show("测点报警信息设置成功!"); this.DialogResult = DialogResult.OK; } } }
private void button1_Click(object sender, EventArgs e) { string cdname = this.textBox1.Text; string cdnum = this.textBox2.Text; string mcode = this.comboBox1.SelectedValue.ToString(); string type = this.comboBox3.SelectedValue.ToString(); 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 (cdname != null && !"".Equals(cdname) && cdnum != null && !"".Equals(cdnum) && mcode != null && !"".Equals(mcode)) { if (float.Parse(t1) > float.Parse(t2)) { if (cdnum.Length == 2) { bean.deviceInformation di = new bean.deviceInformation(); di.h_high = float.Parse(h1); di.h_low = float.Parse(h2); di.t_high = float.Parse(t1); di.t_low = float.Parse(t2); di.terminalname = cdname; di.measureCode = mcode; di.meterNo = cdnum; di.housecode = type; bool bl = dis.queryDeviceBycode(di); if (bl) { bool isok = dis.insertDeviceInformation(di); if (isok) {//测点添加成功的同时 要修改管理主机表中的测点个数 bean.manageHose bm = new bean.manageHose(); bm.measureCode = di.measureCode; service.manageHostService mh = new service.manageHostService(); mh.updateManageHostCdNum(bm); this.DialogResult = DialogResult.OK; this.Close(); } } else { MessageBox.Show("测点编号已存在,请重新输入!"); } } else { MessageBox.Show("请填写格式正确的测点编号!"); } } else { MessageBox.Show("温度上限应大于温度下限,请重新输入!"); } } else { MessageBox.Show("信息输入不完整,请重新输入!"); } }