Example #1
0
 private void Button_Click_Ok(object sender, RoutedEventArgs e)
 {
     if (tbDescription.Text == "" || tbDescription.Text == null || tbArea.Text == "" || tbArea.Text == null ||
         tbFloor.Text == "" || tbFloor.Text == null || cbRoomType.Text == "")
     {
         MessageBox.Show("Niste popunili sva polja!", "Upozorenje!", MessageBoxButton.OK, MessageBoxImage.Warning);
     }
     else
     {
         var        room_list = new RoomList();
         Model.Room room      = new Model.Room(roomList.control.roomService.roomRepository.next_roomID, tbDescription.Text,
                                               int.Parse(tbFloor.Text), double.Parse(tbArea.Text),
                                               (Model.RoomType)Enum.Parse(typeof(Model.RoomType), cbRoomType.Text));
         roomList.control.roomService.roomRepository.next_roomID++;
         roomList.control.CreateRoom(room);
         roomList.Load();
         room_list.Show();
         this.Close();
         MessageBox.Show("Uspešno ste kreirali salu!", "Uspešno!", MessageBoxButton.OK, MessageBoxImage.Information);
     }
 }
 private void Button_Click_Ok(object sender, RoutedEventArgs e)
 {
     if (tbuDescription.Text == "" || tbuDescription.Text == null || tbuArea.Text == "" || tbuArea.Text == null ||
         cbRoomType.Text == "")
     {
         MessageBox.Show("Niste popunili sva polja!", "Upozorenje!", MessageBoxButton.OK, MessageBoxImage.Warning);
     }
     else
     {
         roomList = new RoomList();
         int            rID         = int.Parse(lbuID.Content.ToString());
         double         area        = double.Parse(tbuArea.Text);
         String         description = tbuDescription.Text;
         Model.RoomType rt          = (Model.RoomType)Enum.Parse(typeof(Model.RoomType), cbRoomType.Text);
         roomList.control.UpdateRoom(rID, description, area, rt);
         roomList.Load();
         roomList.Show();
         this.Close();
         MessageBox.Show("Uspešno ste izmenili salu!", "Uspešno!", MessageBoxButton.OK, MessageBoxImage.Information);
     }
 }