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("测点名称不能为空,温度上限应大于温度下限!");
            }
        }
Ejemplo n.º 2
0
        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("测点名称不能为空,温度上限应大于温度下限!");
            }
        }