Ejemplo n.º 1
0
        private void EditRoomButton_Click(object sender, System.EventArgs e)
        {
            var selectedRoom = (Room)this.roomBindingSource.Current;

            if (selectedRoom == null)
            {
                MessageBox.Show("Не е избрана стая за редакция!");
                return;
            }

            var editForm = new RoomAddEditForm(selectedRoom);

            editForm.ShowDialog();

            if (editForm.DialogResult == DialogResult.OK)
            {
                var room = editForm.Room;

                if (room != null)
                {
                    room = this.roomRepository.AddOrUpdateRoom(room);
                    this.roomBindingSource[this.roomBindingSource.Position] = room;
                }
            }
        }
Ejemplo n.º 2
0
        private void AddRoomButton_Click(object sender, System.EventArgs e)
        {
            var editForm = new RoomAddEditForm(null);

            editForm.ShowDialog();

            if (editForm.DialogResult == DialogResult.OK)
            {
                var room = editForm.Room;

                if (room != null)
                {
                    room = this.roomRepository.AddOrUpdateRoom(room);
                    this.roomBindingSource.Add(room);
                }
            }
        }