Пример #1
0
 public void Dispose()
 {
     foreach (string roomId in roomIds)
     {
         Rooms.DeleteRoom(roomId);
     }
 }
Пример #2
0
        //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;
        }
Пример #3
0
 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);
     }
 }
Пример #4
0
 /// <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();
             }
         }
     }
 }
Пример #5
0
    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");
            }
        }
    }
Пример #6
0
        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"
                    }));
                }
            }
        }
Пример #7
0
 public void Dispose()
 {
     Rooms.DeleteRoom(_roomName);
 }