private void btnEditRoom_Click(object sender, EventArgs e) { if (gridRoom.RowCount > 0) { DataRow row = gridRoom.GetDataRow(gridRoom.GetSelectedRows()[0]); EditRoom.oldInfo = row; EditRoom edit = new EditRoom(); edit.ShowDialog(); dgvListRoom.DataSource = Room_BUS.ListRoom(); } else { MessageBox.Show("Error!", "My Application", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } }
private void btnDeleteRoom_Click(object sender, EventArgs e) { if (gridRoom.RowCount > 0) { DataRow row = gridRoom.GetDataRow(gridRoom.GetSelectedRows()[0]); DialogResult dialogResult = MessageBox.Show("Are you sure?", "Delete room", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { Room_BUS.DeleteRoom(row["IDRoom"].ToString()); MessageBox.Show("Room was deleted", "My Application", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } dgvListRoom.DataSource = Room_BUS.ListRoom(); } else { MessageBox.Show("Error!", "My Application", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } }
private void btnUpdate_Click(object sender, EventArgs e) { dgvListRoom.DataSource = Room_BUS.ListRoom(); }
private void ListRoom_Load(object sender, EventArgs e) { dgvListRoom.DataSource = Room_BUS.ListRoom(); }