private void btnAdd_Click(object sender, EventArgs e) { if (isUser) { A_frmAddUser f = new A_frmAddUser(this); f.ShowDialog(); //Flash(); } }
private void btnLaws_Click(object sender, EventArgs e) { int num = 0; int index = -1; for (int i = 0; i < dgv.Rows.Count; i++) { if (dgv.Rows[i].Cells["cl"].Value != null && int.Parse(dgv.Rows[i].Cells["cl"].Value.ToString()) == 1) { num++; index = i; } } if (num == 0) { MessageBox.Show("请选择要修改的记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } else if (num > 1) { MessageBox.Show("每次只能修改一条记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } else { if (index != -1) { if (isUser) { string username = dgv.Rows[index].Cells[1].Value.ToString(); string usergroup = dgv.Rows[index].Cells[2].Value.ToString(); bool isenable = Convert.ToBoolean(dgv.Rows[index].Cells[3].Value); string remark = dgv.Rows[index].Cells[4].Value.ToString(); A_frmAddUser f = new A_frmAddUser(dgv.Rows[index].Cells[1].Value.ToString(), 1, usergroup, isenable, remark, this); f.ShowDialog(); //Flash(); } } } }
private void btnLaws_Click(object sender, EventArgs e) { int num = 0; int index = -1; for (int i = 0; i < dgv.Rows.Count; i++) { if (dgv.Rows[i].Cells["cl"].Value != null && int.Parse(dgv.Rows[i].Cells["cl"].Value.ToString()) == 1) { num++; index = i; } } if (num == 0) { MessageBox.Show("请选择要修改的记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } else if (num > 1) { MessageBox.Show("每次只能修改一条记录!", "提示", MessageBoxButtons.OK,MessageBoxIcon.Asterisk); } else { if (index != -1) { if (isUser) { string username = dgv.Rows[index].Cells[1].Value.ToString(); string usergroup = dgv.Rows[index].Cells[2].Value.ToString(); bool isenable = Convert.ToBoolean(dgv.Rows[index].Cells[3].Value); string remark = dgv.Rows[index].Cells[4].Value.ToString(); A_frmAddUser f = new A_frmAddUser(dgv.Rows[index].Cells[1].Value.ToString(), 1, usergroup, isenable, remark,this); f.ShowDialog(); //Flash(); } } } }