public void Dispose() { foreach (string roomId in roomIds) { Rooms.DeleteRoom(roomId); } }
//method to delete a room private void btnDeleteRoom_Click(object sender, EventArgs e) { if (roomID != 0) { myRoom.DeleteRoom(roomID); } else { MessageBox.Show("Select the Room to delete !!!"); } DGVRooms.DataSource = Database.Load_DGVRooms().DataSource; }
private void btn_DeleteRoom_Click(object sender, EventArgs e) { if (dgvRooms.SelectedRows.Count > 0) { if (DialogResult.Yes == MessageBox.Show("Czy napewno chcesz usunąć ten pokój z bazy?", "Pytanie", MessageBoxButtons.YesNo, MessageBoxIcon.Question)) { theRoom.DeleteRoom(dgvRooms.SelectedRows[0].Cells[0].Value.ToString()); dgvRooms.DataSource = theRoom.GetRooms(); } } else { MessageBox.Show("Proszę zaznaczyć pokój na liście!", "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// Delete a room. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnRoomDelete_Click(object sender, EventArgs e) { if (dgvRoom.CurrentCell != null) { if (MessageBox.Show("Deseja excluir a sala?", "Mecalux", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) { int roomId = (int)dgvRoom.CurrentRow.Cells[0].Value; bookings = new Bookings(roomId.ToString()); bookingList = Functions.ConvertToList <Booking>(bookings.LoadXML()).Where(x => x.RoomId == roomId).ToList(); if (bookingList.Count > 0) { MessageBox.Show("Não é possível excluir a sala, pois há agendamento(s) atribuído(s) a ela.", "Mecalux", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { rooms.DeleteRoom(dgvRoom.CurrentRow.Cells[0].Value.ToString()); dgvRoom.DataSource = rooms.LoadXML(); } } } }
public void Delete() { if (names != null) { rooms.DeleteRoom(index); names.RemoveAt(index); if (index == names.Count) { index--; } if (index < 0) { roomName.text = "No rooms created"; } else { roomName.text = names[index]; } if (PlayerPrefs.HasKey("rooms")) { PlayerPrefs.DeleteKey("rooms"); PlayerPrefs.Save(); } try { string jsonString = JsonUtility.ToJson(rooms); Debug.Log("___SERIALIZED___ " + jsonString); PlayerPrefs.SetString("rooms", jsonString); PlayerPrefs.Save(); } catch (Exception e) { Debug.Log("\n\n\n" + e.GetType() + "\n\n\n"); } } }
public ObjectResult DeleteRoom([FromBody] Room body) { using (var connectionHelper = ConnectionHelper.GetConnectionHelper()) { connectionHelper.OpenConnection(); var checkUserAdmin = Rooms.CheckAdmin(connectionHelper.GetConnection(), body.Id, body.AdminId); if (checkUserAdmin == true) { var deleteResult = Rooms.DeleteRoom(connectionHelper.GetConnection(), body.Id); if (deleteResult == true) { connectionHelper.CloseConnection(); return(Ok(new { })); } else { connectionHelper.CloseConnection(); return(StatusCode(400, new { ErrorCode = "LCEF787WNABTB2MAA4PWQGVEYA46E6B4" })); } } else { connectionHelper.CloseConnection(); return(StatusCode(400, new { ErrorCode = "M4VKD2TG2LGZVAVD5UHS624ZYZB7M7H5" })); } } }
public void Dispose() { Rooms.DeleteRoom(_roomName); }