示例#1
0
        //update
        private void simpleButton3_Click(object sender, System.EventArgs e)
        {
            if (CheckMachinState())
            {
                MessageBox.Show("请完成分配动作.", "系统信息!",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);

                return;
            }

            int machineAddr = Convert.ToInt32(gridView1.GetDataRow(gridView1.GetSelectedRows()[0])["machine_address"]);

            ModifiMachineAddress diagForm = new ModifiMachineAddress();

            diagForm.StartPosition = FormStartPosition.CenterScreen;

            diagForm.ShowDialog();

            int modifyMachineAddr = diagForm.ModifyAddress;

            MachineInfo = new MachineSystem().GetMachineAddrList();

            DataTable dt = MachineInfo.Tables[0];

            DataRow[] rows = dt.Select("machine_address='" + modifyMachineAddr.ToString() + "'");

            if (rows.Length > 0)
            {
                MessageBox.Show("地址冲突,请修改地址重试.", "系统信息!",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            else
            {
                gridView1.SetRowCellValue(gridView1.GetSelectedRows()[0], gridView1.Columns[0], modifyMachineAddr);
                gridView1.SetRowCellValue(gridView1.GetSelectedRows()[0], gridView1.Columns[1], "待修改");

                originalAddr = Convert.ToByte(machineAddr);
                currentAddr  = Convert.ToByte(modifyMachineAddr);
            }
        }
示例#2
0
		//update
		private void simpleButton3_Click(object sender, System.EventArgs e)
		{
			if(CheckMachinState())
			{
				MessageBox.Show("请完成分配动作.","系统信息!",
					MessageBoxButtons.OK,MessageBoxIcon.Information);

				return;
			}

			int machineAddr = Convert.ToInt32(gridView1.GetDataRow(gridView1.GetSelectedRows()[0])["machine_address"]);

			ModifiMachineAddress diagForm = new ModifiMachineAddress();
			diagForm.StartPosition = FormStartPosition.CenterScreen;

			diagForm.ShowDialog();

			int modifyMachineAddr = diagForm.ModifyAddress;

			MachineInfo = new MachineSystem().GetMachineAddrList();

			DataTable dt = MachineInfo.Tables[0];

			DataRow[] rows =dt.Select("machine_address='"+modifyMachineAddr.ToString()+"'");

			if(rows.Length>0)
			{
				MessageBox.Show("地址冲突,请修改地址重试.","系统信息!",
					MessageBoxButtons.OK,MessageBoxIcon.Information);
				return;
			}
			else
			{
				gridView1.SetRowCellValue(gridView1.GetSelectedRows()[0],gridView1.Columns[0],modifyMachineAddr);
				gridView1.SetRowCellValue(gridView1.GetSelectedRows()[0],gridView1.Columns[1],"待修改");

				originalAddr = Convert.ToByte(machineAddr);
				currentAddr = Convert.ToByte(modifyMachineAddr);
			}
		}