private void AddSoba()
        {
            Soba novaSoba = new Soba();

            novaSoba.Sifra     = Convert.ToInt32(SifraTb.Text);
            novaSoba.Kapacitet = Convert.ToInt32(KapacitetTb.Text);
            novaSoba.Zauzetost = Convert.ToInt32(ZauzetostTb.Text);
            novaSoba.Tip       = (TypeOfUsage)TipCb.SelectedItem;
            novaSoba.Pocetak   = (DateTime)PocetakTb.SelectedDate;
            novaSoba.Kraj      = (DateTime)KrajTb.SelectedDate;
            Sobe.Add(novaSoba);
            RoomController             roomController             = new RoomController();
            RenovationPeriodController renovationPeriodController = new RenovationPeriodController();
            RenovationPeriod           p = new RenovationPeriod();
            Room room = new Room();

            room.Capacity   = novaSoba.Kapacitet;
            room.Number     = novaSoba.Sifra;
            room.Occupation = novaSoba.Zauzetost;
            room.Usage      = novaSoba.Tip;
            if (novaSoba.Pocetak != DateTime.Today && novaSoba.Kraj != DateTime.Today)
            {
                room.Renovation = true;
                p.room          = room;
                p.BeginDate     = novaSoba.Pocetak;
                p.EndDate       = novaSoba.Kraj;
                renovationPeriodController.ScheduleRenovation(p);
            }

            roomController.AddRoom(room);
            // Resetujemo polja
            ClearFields();

            UpdateTempSoba();
        }
        private void UpdateSoba()
        {
            SelektovanaSoba.Sifra     = Convert.ToInt32(SifraTb.Text);
            SelektovanaSoba.Kapacitet = Convert.ToInt32(KapacitetTb.Text);
            SelektovanaSoba.Zauzetost = Convert.ToInt32(ZauzetostTb.Text);
            SelektovanaSoba.Pocetak   = (DateTime)PocetakTb.SelectedDate;
            SelektovanaSoba.Tip       = (TypeOfUsage)TipCb.SelectedItem;
            SelektovanaSoba.Kraj      = (DateTime)KrajTb.SelectedDate;
            RoomController             roomController             = new RoomController();
            RenovationPeriodController renovationPeriodController = new RenovationPeriodController();
            RenovationPeriod           p = new RenovationPeriod();
            Room room = new Room();

            room.Capacity   = SelektovanaSoba.Kapacitet;
            room.Number     = SelektovanaSoba.Sifra;
            room.Occupation = SelektovanaSoba.Zauzetost;
            if (SelektovanaSoba.Pocetak == DateTime.Today && SelektovanaSoba.Kraj == DateTime.Today)
            {
                room.Renovation = false;
                renovationPeriodController.CancelRenovation(room.Number);
            }
            else if (SelektovanaSoba.Pocetak == DateTime.MinValue && SelektovanaSoba.Kraj == DateTime.MinValue)
            {
                room.Renovation = false;
                renovationPeriodController.CancelRenovation(room.Number);
            }
            else
            {
                if (renovationPeriodController.ViewRenovationByRoomNumber(room.Number) != null)
                {
                    room.Renovation = true;
                    p.room          = room;
                    p.BeginDate     = SelektovanaSoba.Pocetak;
                    p.EndDate       = SelektovanaSoba.Kraj;
                    renovationPeriodController.EditRenovation(p);
                }
                else
                {
                    room.Renovation = true;
                    p.room          = room;
                    p.BeginDate     = SelektovanaSoba.Pocetak;
                    p.EndDate       = SelektovanaSoba.Kraj;
                    renovationPeriodController.ScheduleRenovation(p);
                }
            }

            roomController.EditRoom(room);
        }
        private void ZakaziRenoviranje(object sender, RoutedEventArgs e)
        {
            DateTime dateFrom = (DateTime)DateFrom.SelectedDate;
            DateTime dateTo   = (DateTime)DateTo.SelectedDate;

            //if(_renovationPeriodController.IsAvailable(_selectedRoom, dateFrom, dateTo))
            //{
            _renovationPeriodController.ScheduleRenovation(_selectedRoom, dateFrom, dateTo);

            /*}
             * else
             * {
             *  MessageBox.Show("Ima zakazanih termina u tom periodu!", "Upozorenje", MessageBoxButton.OK);
             *  this.Close();
             * }*/
            _parent.UpdateTable();
            this.Close();
        }