private void btnAddDepart_Click(object sender, EventArgs e) { FrmAddDept addDept = new FrmAddDept(); addDept.flag = 1; addDept.DeptId = (int)dgvDepart.SelectedRows[0].Cells["deptId"].Value; addDept.fdm = this; addDept.ShowDialog(); }
private void tsmiDeatilDepart_Click(object sender, EventArgs e) { if (dgvDepart.SelectedRows.Count == 1) { FrmAddDept addDept = new FrmAddDept(); addDept.flag = (int)optAED.Detail; addDept.DeptId = (int)dgvDepart.SelectedRows[0].Cells["deptId"].Value; addDept.ShowDialog(); } else if (dgvDepart.SelectedRows.Count > 1) { MessageBox.Show("您选择了多个部门,请选择一个查看!"); } else if (dgvDepart.SelectedRows.Count <= 0) { MessageBox.Show("您没有选择要查看的部门!"); } }
private void btnEditDepart_Click(object sender, EventArgs e) { if (dgvDepart.SelectedRows.Count == 1) { FrmAddDept addDept = new FrmAddDept(); addDept.flag = 0; addDept.DeptId = (int)dgvDepart.SelectedRows[0].Cells["deptId"].Value; addDept.DepartName = dgvDepart.SelectedRows[0].Cells["DeptName"].Value.ToString().Trim(); addDept.fdm = this; addDept.ShowDialog(); } else if (dgvDepart.SelectedRows.Count > 1) { MessageBox.Show("您选择了多个部门,请选择一个修改!"); } else if (dgvDepart.SelectedRows.Count <= 0) { MessageBox.Show("您没有选择要修改的部门!"); } }