private void btnadd_Click(object sender, EventArgs e) { string Confirm = "增加教师需重新生成课表,确认继续修改?"; DialogResult dr = MessageBox.Show(Confirm, "确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); if (dr == DialogResult.OK) { truncateTable(); SubTeacher addform = new SubTeacher(); addform.getState(1); addform.ShowDialog(); } query(); }
private void grdview_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { string Confirm = "修改教师需要重新生成课表,确认继续修改?"; DialogResult dr = MessageBox.Show(Confirm, "确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); if (dr == DialogResult.OK) { truncateTable(); string[] arr = new string[7]; for (int i = 0; i < 7; i++) { arr[i] = grdview[i, grdview.SelectedCells[i].RowIndex].Value.ToString(); } SubTeacher alter = new SubTeacher(); alter.getState(2); alter.getArry(arr); alter.ShowDialog(); } query(); }
private void btnAlter_Click(object sender, EventArgs e) { string Confirm = "修改教师需要重新生成课表,确认继续修改?"; DialogResult dr = MessageBox.Show(Confirm, "确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); if (dr == DialogResult.OK) { truncateTable(); string sql = "select * from Z_tmp_teacherinfo"; object obj = dao.ExecuteScale(sql); if (obj == null) { MessageBox.Show("当前数据库没有数据!"); } else { if (grdview.DataSource == null) { MessageBox.Show("请选中要修改的行!"); query(); } else { string[] arr = new string[7]; for (int i = 0; i < 7; i++) { arr[i] = grdview[i, grdview.SelectedCells[i].RowIndex].Value.ToString(); } SubTeacher alter = new SubTeacher(); alter.getState(2); alter.getArry(arr); alter.ShowDialog(); } } query(); } }