Beispiel #1
0
        private void saveButton_Click(object sender, EventArgs e)
        {
            string name = inventoryItemName.Text;
            int    type = Convert.ToInt32(inventoryItemType.SelectedValue);

            room.AddInventoryItem(name, type);
            List <Room> tempRooms = Program.building.GetRooms();

            for (int i = 0; i < tempRooms.Count; i++)
            {
                if (tempRooms[i].GetId() == room.GetId())
                {
                    tempRooms[i] = room;
                    Program.building.SetRooms(tempRooms);
                }
            }
            EditRoom er = (EditRoom)Application.OpenForms["EditRoom"];

            er.ReloadInventoryTable();
            this.Close();
            return;
        }
Beispiel #2
0
        private void RoomsDataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                DataGridView dgv = sender as DataGridView;
                if (dgv == null)
                {
                    return;
                }

                int  roomId = Convert.ToInt32(dgv.Rows[e.RowIndex].Cells[0].Value);
                Room room   = Program.dataManagement.GetRoom(roomId);
                if (room != null)
                {
                    EditRoom er = new EditRoom(room);
                    er.ShowDialog();
                }
            }
            catch (Exception exc)
            {
            }
        }