private void WatchHouseConfigForm_Load(object sender, EventArgs e) { m_WatchHouseConfig = new WatchHouseConfig(); DataTable vTable = m_WatchHouseConfig.GetAll(); dataGridView_List.AutoGenerateColumns = false; dataGridView_List.DataSource = vTable; }
public void saveWatchHouseData() { int vGanTingID = 0; string vDianYuanID1 = "", vDianYuanID2 = ""; int vLED1Gao, vLED1Kuan, vLED2Gao, vLED2Kuan; string vOutInfo = ""; if (!int.TryParse(textBox_GanTing_ID.Text, out vGanTingID)) { MessageBox.Show("岗亭编号必须为数字", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } vDianYuanID1 = textBox_DY1_ID.Text.ToUpper(); vDianYuanID2 = textBox_DY2_ID.Text.ToUpper(); vLED1Gao = (int)numericUpDown_LED1_Gao.Value; vLED1Kuan = (int)numericUpDown_LED1_Kuan.Value; vLED2Gao = (int)numericUpDown_LED2_Gao.Value; vLED2Kuan = (int)numericUpDown_LED2_Kuan.Value; DataTable vSwitchTable1 = button_DY1_KaiGuan.Tag == null ? null : (DataTable)button_DY1_KaiGuan.Tag; DataTable vSwitchTable2 = button_DY2_KaiGuan.Tag == null ? null : (DataTable)button_DY2_KaiGuan.Tag; int vID = (int)dataGridView_List.SelectedRows[0].Cells["Column_ID"].Value; if (m_WatchHouseConfig.Update(vID, vGanTingID, textBox_GanTing_MC.Text, comboBox_GanTing_LX.Text, textBox_LED1_IP.Text, vLED1Gao, vLED1Kuan, textBox_LED2_IP.Text, vLED2Gao, vLED2Kuan, vDianYuanID1, vDianYuanID2, vSwitchTable1, vSwitchTable2, ref vOutInfo)) { MessageBox.Show("更新岗亭数据成功", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information); dataGridView_List.DataSource = m_WatchHouseConfig.GetAll(); } else { MessageBox.Show("更新失败", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } }