public DefaultPage() { InitializeComponent(); var page1 = new RoomPage(); var page2 = new DrugPage(); var page3 = new ResourcePage(); var page4 = new EmployeesPage(); //profileFrame.Navigate(new UserAccount()); }
private void Button_Click_Prostorije(object sender, RoutedEventArgs e) { var nextPage = new RoomPage(); frame.Navigate(nextPage); }
private void button_Click(object sender, RoutedEventArgs e) { if (calendar.SelectedDate == null) { System.Windows.MessageBox.Show("Unesite datum renoviranja."); return; } DateTime renovationDateTime = (DateTime)calendar.SelectedDate; //RoomPage.SetRenovation((uint)idLabel.Content, (DateTime)calendar.SelectedDate); int roomLabel = Int32.Parse(idLabel.Content.ToString()); if (renovationDateTime < DateTime.Now) { System.Windows.MessageBox.Show("Unesite dobar datum renoviranja."); return; } if (renovationTypeComboBox.SelectedItem.Equals("mergeRooms")) { if (roomComboBox.SelectedItem == null) { System.Windows.MessageBox.Show("Unesite sobu sa kojom spajate."); return; } RoomView roomToDelete = (RoomView)roomComboBox.SelectedItem; if (_roomController.CanRenovate(roomLabel, renovationDateTime) && _roomController.CanRenovate((int)roomToDelete.Id, renovationDateTime)) { var mergedRoom = _roomController.Merge(roomLabel, (int)roomToDelete.Id); if (mergedRoom == null) { System.Windows.MessageBox.Show("Spajanje nije moguce"); return; } RoomPage.DeleteRoom(roomToDelete.Id); } else { System.Windows.MessageBox.Show("Renoviranje nije dozvoljeno"); return; } } else { if (_roomController.CanRenovate(roomLabel, renovationDateTime)) { if (renovationTypeComboBox.SelectedItem.Equals("splitRoom")) { Room oldRoom = _roomController.Get(roomLabel); Room newRoom = new Room(); newRoom.RoomType = oldRoom.RoomType; _roomController.Add(newRoom); RoomPage.RoomList.Add(new RoomView(newRoom, _roomController)); } } else { System.Windows.MessageBox.Show("Renoviranje nije dozvoljeno"); return; } } Renovation renovation = new Renovation(); renovation.Date = renovationDateTime; renovation.RenovationType = (RenovationType)renovationTypeComboBox.SelectedIndex; _roomController.AddRenovation(renovation); Room room = _roomController.Get(roomLabel); room.Renovation.Add(renovation.Id); _roomController.Update(room); RoomPage.SetRenovation((uint)idLabel.Content, (DateTime)calendar.SelectedDate); System.Windows.MessageBox.Show("Uspešno ste sačuvali informacije."); NavigationService.Navigate(new Page()); }