Пример #1
0
        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("库房名称为空,请重新输入!");
            }
        }
Пример #2
0
        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;
                }
            }
        }