private void cboxDeleteBiuldInfo_SelectedIndexChanged(object sender, EventArgs e) { if (comboxFirstLoad) { comboxFirstLoad = false; return; } string buildID = cboxDeleteBiuldInfo.GetItemText(cboxDeleteBiuldInfo.SelectedValue); string buildName = cboxDeleteBiuldInfo.GetItemText(cboxDeleteBiuldInfo.Items[cboxBiuldInfo.SelectedIndex]); deleteDeviceInfo = DeviceManageDAL.GetDeviceInfo(buildID); if (deleteDeviceInfo == null || deleteDeviceInfo.Rows.Count == 0) { btnDeleteDevice.Enabled = false; MessageBox.Show("所选择区域没有绑定服务器,暂时无法使用,请选择正确的区域", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { comboBoxDeleteDevice.DataSource = deleteDeviceInfo; comboBoxDeleteDevice.DisplayMember = deleteDeviceInfo.Columns[1].ColumnName; comboBoxDeleteDevice.ValueMember = deleteDeviceInfo.Columns[0].ColumnName; Runtime.ShowLog("选择修改设备 所所区域为:" + buildName + " 区域代码:" + buildID); btnDeleteDevice.Enabled = true; } }
private void cboxDeleteBiuldInfo_Click(object sender, EventArgs e) { comboxFirstLoad = true; //获取区域列表 cboxDeleteBiuldInfo.DataSource = DeviceManageDAL.GetBuildInfo(); cboxDeleteBiuldInfo.DisplayMember = "F_BuildName"; cboxDeleteBiuldInfo.ValueMember = "F_BuildID"; string buildID = cboxDeleteBiuldInfo.GetItemText(cboxDeleteBiuldInfo.SelectedValue); string buildName = cboxDeleteBiuldInfo.GetItemText(cboxDeleteBiuldInfo.Items[cboxBiuldInfo.SelectedIndex]); //获取设备列表,并显示 DataTable DeviceInfo = new DataTable(); DeviceInfo = DeviceManageDAL.GetDeviceInfo(buildID); if (DeviceInfo == null || DeviceInfo.Rows.Count == 0) { btnDeleteDevice.Enabled = false; MessageBox.Show("所选择区域当前没有设备,请选择正确的区域", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { comboBoxDeleteDevice.DataSource = DeviceInfo; comboBoxDeleteDevice.DisplayMember = DeviceInfo.Columns[1].ColumnName; comboBoxDeleteDevice.ValueMember = DeviceInfo.Columns[0].ColumnName; Runtime.ShowLog("选择修改设备 所所区域为:" + buildName + " 区域代码:" + buildID); btnDeleteDevice.Enabled = true; } }
private void cboxBiuldInfo2_SelectedIndexChanged(object sender, EventArgs e) { if (comboxFirstLoad2) { comboxFirstLoad2 = false; return; } string buildName2 = cboxBiuldInfo2.GetItemText(cboxBiuldInfo2.Items[cboxBiuldInfo2.SelectedIndex]); string buildID2 = cboxBiuldInfo2.GetItemText(cboxBiuldInfo2.SelectedValue); //获取设备列表,并显示 DataTable DeviceInfo = new DataTable(); DeviceInfo = DeviceManageDAL.GetDeviceInfo(buildID2); cboxDeviceID2.DataSource = DeviceInfo; cboxDeviceID2.DisplayMember = DeviceInfo.Columns[1].ColumnName; cboxDeviceID2.ValueMember = DeviceInfo.Columns[0].ColumnName; //获取修改设备的模板信息 DataTable DeviceModify = new DataTable(); DeviceModify = DeviceManageDAL.GetDeviceModifyInfo(buildID2); if (DeviceModify == null || DeviceModify.Rows.Count == 0) { btnModifyDevice.Enabled = false; MessageBox.Show("所选择区域没有绑定服务器,暂时无法使用,请选择正确的区域", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { textBoxManufacturerId.Text = DeviceModify.Rows[0]["F_ManufacturerId"].ToString(); textBoxManufacturerName.Text = DeviceModify.Rows[0]["F_ManufacturerName"].ToString(); textBoxDeviceType.Text = DeviceModify.Rows[0]["F_DeviceType"].ToString(); textBoxModel.Text = DeviceModify.Rows[0]["F_Model"].ToString(); textBoxProtocolType.Text = DeviceModify.Rows[0]["F_ProtocolType"].ToString(); Runtime.ShowLog("选择修改设备 所所区域为:" + buildName2 + " 区域代码:" + buildID2); btnModifyDevice.Enabled = true; } }