private void btnEditUser_Click(object sender, EventArgs e) { if (gridUser.RowCount > 0) { DataRow row = gridUser.GetDataRow(gridUser.GetSelectedRows()[0]); EditUser.oldInfo = row; EditUser edit = new EditUser(); edit.ShowDialog(); dgvListUser.DataSource = User_BUS.ListUsers(); } else { MessageBox.Show("Error!", "My Application", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } }
private void btnDeleteUser_Click(object sender, EventArgs e) { if (gridUser.RowCount > 0) { DataRow row = gridUser.GetDataRow(gridUser.GetSelectedRows()[0]); DialogResult dialogResult = MessageBox.Show("Are you sure?", "Delete user", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { User_BUS.DeleteUser(row["IDUser"].ToString()); MessageBox.Show("User was deleted", "My Application", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } dgvListUser.DataSource = User_BUS.ListUsers(); } else { MessageBox.Show("Error!", "My Application", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } }
private void btnUpdate_Click(object sender, EventArgs e) { dgvListUser.DataSource = User_BUS.ListUsers(); }
private void ListUser_Load(object sender, EventArgs e) { dgvListUser.DataSource = User_BUS.ListUsers(); }