Пример #1
0
        private void btn_OK_Click(object sender, EventArgs e)
        {
            if (!CheckInfo())
            {
                return;
            }

            DAL.DAL_Device    devicedal = new DAL.DAL_Device();
            DAL.DAO.DeviceDao devicedao = new DAL.DAO.DeviceDao();

            devicedao.Devicename     = txb_DeviceName.Text;
            devicedao.Devicetype     = cmb_DeviceType.Text;
            devicedao.Code           = txb_DeviceCode.Text;
            devicedao.Deviceposition = cmb_DevicePosition.Text;
            devicedao.Netaddress     = txb_addr_part1.Text + "." + txb_addr_part2.Text + "." + txb_addr_part3.Text + "." + txb_addr_part4.Text;

            if (devicedal.insertDeviceInfo(devicedao))
            {
                MessageBox.Show("添加成功");
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            else
            {
                MessageBox.Show("添加失败");
            }
        }
Пример #2
0
        private void NewDeviceForm_Load(object sender, EventArgs e)
        {
            LoadLanguage("");

            this.txb_addr_part1.KeyPress += new System.Windows.Forms.KeyPressEventHandler(new Smart.ToolUtil.StringControlUtil().NumTextKeyPress);
            this.txb_addr_part2.KeyPress += new System.Windows.Forms.KeyPressEventHandler(new Smart.ToolUtil.StringControlUtil().NumTextKeyPress);
            this.txb_addr_part3.KeyPress += new System.Windows.Forms.KeyPressEventHandler(new Smart.ToolUtil.StringControlUtil().NumTextKeyPress);
            this.txb_addr_part4.KeyPress += new System.Windows.Forms.KeyPressEventHandler(new Smart.ToolUtil.StringControlUtil().NumTextKeyPress);


            DAL.DAL_Device   devicedal   = new DAL.DAL_Device();
            DAL.DAL_Position positiondal = new DAL.DAL_Position();

            DataTable _dt = devicedal.GetDeviceTypeList();

            if (_dt != null)
            {
                cmb_DeviceType.Items.Clear();

                foreach (DataRow _row in _dt.Rows)
                {
                    cmb_DeviceType.Items.Add(_row[0]);
                }
            }
            _dt = positiondal.selectPositionListInfo("");
            if (_dt != null)
            {
                cmb_DevicePosition.Items.Clear();

                foreach (DataRow _row in _dt.Rows)
                {
                    cmb_DevicePosition.Items.Add(_row[1]);
                }
            }
        }
Пример #3
0
        private void EditDeviceForm_Load(object sender, EventArgs e)
        {
            LoadLanguage("");

            this.txb_addr_part1.KeyPress += new System.Windows.Forms.KeyPressEventHandler(new Smart.ToolUtil.StringControlUtil().NumTextKeyPress);
            this.txb_addr_part2.KeyPress += new System.Windows.Forms.KeyPressEventHandler(new Smart.ToolUtil.StringControlUtil().NumTextKeyPress);
            this.txb_addr_part3.KeyPress += new System.Windows.Forms.KeyPressEventHandler(new Smart.ToolUtil.StringControlUtil().NumTextKeyPress);
            this.txb_addr_part4.KeyPress += new System.Windows.Forms.KeyPressEventHandler(new Smart.ToolUtil.StringControlUtil().NumTextKeyPress);

            DAL.DAL_Device devicedal = new DAL.DAL_Device();

            DAL.DAO.DeviceDao devicedao = devicedal.selectDeviceInfoWithID(deviceid);

            if (devicedao == null)
            {
                MessageBox.Show("获取设备信息失败!");
                this.Close();
            }
            else
            {
                this.txb_DeviceName.Text = devicedao.Devicename;
                this.txb_DeviceCode.Text = devicedao.Code;

                string[] address = devicedao.Netaddress.Split('.');

                this.txb_addr_part1.Text = address[0];
                this.txb_addr_part2.Text = address[1];
                this.txb_addr_part3.Text = address[2];
                this.txb_addr_part4.Text = address[3];

                this.cmb_DevicePosition.Text = devicedao.Deviceposition;
            }
            DAL.DAL_Position positiondal = new DAL.DAL_Position();

            //DataTable _dt = devicedal.GetDeviceTypeList();
            //if (_dt != null)
            //{
            //    cmb_DeviceType.Items.Clear();

            //    foreach (DataRow _row in _dt.Rows)
            //    {
            //        cmb_DeviceType.Items.Add(_row[0]);
            //    }

            //}
            DataTable _dt = positiondal.selectPositionListInfo("");

            if (_dt != null)
            {
                cmb_DevicePosition.Items.Clear();

                foreach (DataRow _row in _dt.Rows)
                {
                    cmb_DevicePosition.Items.Add(_row[1]);
                }
            }
        }
Пример #4
0
        private void DeviceAuthorize_Load(object sender, EventArgs e)
        {
            DAL.DAL_Device    devicedal = new DAL.DAL_Device();
            DAL.DAO.DeviceDao devicedao = devicedal.selectDeviceInfoWithID(deviceid);

            this.lab_DeviceName.Text = devicedao.Devicename;
            this.lab_DevceType.Text  = devicedao.Devicetype;
            this.lab_Position.Text   = devicedao.Deviceposition;
            GetDeviceAuthrizeList("");
        }
Пример #5
0
        private void btn_SearchDevice_Click(object sender, EventArgs e)
        {
            DAL.DAL_Device devicedal = new DAL.DAL_Device();

            DataTable _dt = devicedal.selectDeviceInfoWithPositionAndKey(this.txb_SearchDeviceKey.Text, cmb_DevicePosition.Text);

            if (_dt != null)
            {
                this.DeviceInfoGrid.DataSource = _dt;
            }
        }
Пример #6
0
        private void DeviceAuthorize_Load(object sender, EventArgs e)
        {
            LoadLanguage("");

            DAL.DAL_Device    devicedal = new DAL.DAL_Device();
            DAL.DAO.DeviceDao devicedao = devicedal.selectDeviceInfoWithID(deviceid);

            this.lab_DeviceName.Text = devicedao.Devicename;
            this.lab_DevceType.Text  = devicedao.Devicetype;
            this.lab_Position.Text   = devicedao.Deviceposition;

            DAL.DAL_Group groupdal = new DAL.DAL_Group();

            DataTable _dt = groupdal.selectGroupListInfo();

            GetDeviceAuthorizeList("");
        }
Пример #7
0
        private void btn_Device_Delete_Click(object sender, EventArgs e)
        {
            if (this.DeviceInfoGrid.SelectedRows.Count <= 0)
            {
                MessageBox.Show("请选择要删除的设备");
            }
            else if (MessageBox.Show("你确定要删除名称为" + DeviceInfoGrid.SelectedRows[0].Cells[1].Value + "的设备吗?", "删除", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                DAL.DAL_Device vehicle = new DAL.DAL_Device();

                if (vehicle.deleteDeviceWithId(DeviceInfoGrid.SelectedRows[0].Cells[0].Value.ToString()))
                {
                    MessageBox.Show("删除成功!");
                }
                else
                {
                    MessageBox.Show("删除失败!");
                }
            }
        }
Пример #8
0
        private void btn_OK_Click(object sender, EventArgs e)
        {
            DAL.DAL_Device devicedal = new DAL.DAL_Device();

            devicedao = new DAL.DAO.DeviceDao();

            devicedao.Devicename     = txb_DeviceName.Text;
            devicedao.Code           = txb_DeviceCode.Text;
            devicedao.Deviceposition = cmb_DevicePosition.Text;
            devicedao.Netaddress     = txb_addr_part1.Text + "." + txb_addr_part2.Text + "." + txb_addr_part3.Text + "." + txb_addr_part4.Text;

            if (devicedal.updateDeviceInfo(deviceid, devicedao))
            {
                MessageBox.Show("修改成功");
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            else
            {
                MessageBox.Show("修改失败");
            }
        }