private void Button_Click_OK(object sender, RoutedEventArgs e) { if (tbDescriptionRenovation.Text == "" || tbDescriptionRenovation.Text == null || tbEndTime.Text == "" || tbEndTime.Text == null || tbStartTime.Text == "" || tbStartTime.Text == null || dpDateRenovationEnd.Text == "" || dpDateRenovationEnd.Text == null || dpDateRenovationStart.Text == "" || dpDateRenovationStart.Text == null || cbRooms.Text == "") { MessageBox.Show("Niste popunili sva polja!", "Upozorenje!", MessageBoxButton.OK, MessageBoxImage.Warning); } else { Model.BasicRenovation renovation = CreateRenovation(); if (renovationController.renovationService.IsRoomFree(renovation.StartTime, renovation.EndTime, renovation.room.RoomId)) { renovationController.CreateRenovation(renovation); addRenovation.Show(); addRenovation.RenovationList.LoadAllRenovations(); this.Close(); MessageBox.Show("Uspešno ste zakazali osnovno renoviranje!", "Uspešno!", MessageBoxButton.OK, MessageBoxImage.Information); } else { MessageBox.Show("Soba nije slobodna u izabranom terminu"); } } }
private void addRenovation() { Controller.BasicRenovationController controller = new Controller.BasicRenovationController(); controller.GetAllRenovations(); Model.BasicRenovation basicRenovation = new Model.BasicRenovation(controller.renovationService.renovationRepository.getNextRenovationId(), int.Parse(lbuID.Content.ToString()), DateTime.Parse(renovationSeparation.dpDateRenovationStart.Text.ToString() + " " + renovationSeparation.tbStartTime.Text.ToString()), DateTime.Parse(renovationSeparation.dpDateRenovationEnd.Text.ToString() + " " + renovationSeparation.tbEndTime.Text.ToString()), "Create room"); controller.CreateRenovation(basicRenovation); }
private void DeleteRoom() { if (int.Parse(lbArea.Content.ToString()) == 0) { Controller.BasicRenovationController basicRenovationController = new Controller.BasicRenovationController(); basicRenovationController.GetAllRenovations(); Model.BasicRenovation basicRenovation = new Model.BasicRenovation(basicRenovationController.renovationService.renovationRepository.getNextRenovationId(), int.Parse(cbRooms.SelectedItem.ToString()), DateTime.Parse(dpDateRenovationStart.Text.ToString() + " " + tbStartTime.Text.ToString()), DateTime.Parse(dpDateRenovationEnd.Text.ToString() + " " + tbEndTime.Text.ToString()), "Separating room"); basicRenovationController.CreateRenovation(basicRenovation); roomController.DeleteRoom(int.Parse(cbRooms.SelectedItem.ToString())); } }