public MergeRenovationDTO(BaseRenovationDTO baseRenovation, int secondRoomId, string newRoomDescription, TypeOfMapObject roomType) { this.baseRenovation = baseRenovation; SecondRoomId = secondRoomId; NewRoomDescription = newRoomDescription; RoomType = roomType; }
private void ScheduleRenovationButton_Click(object sender, RoutedEventArgs e) { if (!CheckIsDateTimeIntervalValid()) { return; } BaseRenovationDTO baseRenovationDTO = CreateBaseRenovationDTOFromUserInput(); if (AlternativeRenovationAppointmentsDataGrid.SelectedItem != null) { baseRenovationDTO.StartTime = ((RenovationPeriodDTO)AlternativeRenovationAppointmentsDataGrid.SelectedItem).StartTime; baseRenovationDTO.EndTime = ((RenovationPeriodDTO)AlternativeRenovationAppointmentsDataGrid.SelectedItem).EndTime; } if (!(bool)IsComplexRenovationCheckBox.IsChecked) { TryToScheduleBaseRenovation(baseRenovationDTO); } else { if (RoomMergingComboBoxItem.IsSelected) { MergeRenovationDTO mergeRenovationDTO = CreateMergeRenovationDTOFromUserInput(baseRenovationDTO); TryToScheduleMergeRenovation(mergeRenovationDTO); } else if (RoomDivisionComboBoxItem.IsSelected) { DivideRenovationDTO divideRenovationDTO = CreateDivideRenovationDTOFromUserInput(baseRenovationDTO); TryToScheduleDivideRenovation(divideRenovationDTO); } } }
public DivideRenovationDTO(BaseRenovationDTO baseRenovation, string firstRoomDescription, string secondRoomDescription, TypeOfMapObject firstRoomType, TypeOfMapObject secondRoomType) { this.baseRenovation = baseRenovation; FirstRoomDescription = firstRoomDescription; SecondRoomDescription = secondRoomDescription; FirstRoomType = firstRoomType; SecondRoomType = secondRoomType; }
private MergeRenovationDTO CreateMergeRenovationDTOFromUserInput(BaseRenovationDTO baseRenovationDTO) { baseRenovationDTO.TypeOfRenovation = TypeOfRenovation.MERGE_RENOVATION; int secondRoomId = (int)((MapObject)SecondRoomForMergingComboBox.SelectedItem).MapObjectEntity.Id; string mergedRoomDescription = MergedRoomDescriptionTextBox.Text; TypeOfMapObject mergedRoomType = (TypeOfMapObject)MergedRoomTypeComboBox.SelectedItem; return(new MergeRenovationDTO(baseRenovationDTO, secondRoomId, mergedRoomDescription, mergedRoomType)); }
public ActionResult AddBaseRenovation(BaseRenovationDTO baseRenovationDTO) { BaseRenovation addedBaseRenovation = _renovationService.AddBaseRenovation(BaseRenovationMapper.BaseRenovationDTOToBaseRenovation(baseRenovationDTO)); if (addedBaseRenovation == null) { return(NotFound("NotFound")); } return(Ok()); }
public static BaseRenovation BaseRenovationDTOToBaseRenovation(BaseRenovationDTO baseRenovationDTO) { BaseRenovation baseRenovation = new BaseRenovation(); baseRenovation.RoomId = baseRenovationDTO.RoomId; baseRenovation.RenovationPeriod = new RenovationPeriod(baseRenovationDTO.StartTime, baseRenovationDTO.EndTime); baseRenovation.Description = baseRenovationDTO.Description; baseRenovation.TypeOfRenovation = baseRenovationDTO.TypeOfRenovation; return(baseRenovation); }
public RenovationInRoomMoreDetailsDialog(int renovationId) { InitializeComponent(); DataContext = this; RenovationId = renovationId; _renovationService = new RenovationService(); RenovationForDisplay = _renovationService.GetBaseRenovationById(RenovationId); }
private DivideRenovationDTO CreateDivideRenovationDTOFromUserInput(BaseRenovationDTO baseRenovationDTO) { baseRenovationDTO.TypeOfRenovation = TypeOfRenovation.DIVIDE_RENOVATION; string firstRoomDescription = RenovationFirstRoomDescriptionTextBox.Text; string secondRoomDescription = RenovationSecondRoomDescriptionTextBox.Text; TypeOfMapObject firstRoomType = (TypeOfMapObject)RenovationFirstRoomTypeComboBox.SelectedItem; TypeOfMapObject secondRoomType = (TypeOfMapObject)RenovationSecondRoomTypeComboBox.SelectedItem; return(new DivideRenovationDTO(baseRenovationDTO, firstRoomDescription, secondRoomDescription, firstRoomType, secondRoomType)); }
public static BaseRenovationDTO BaseRenovationToBaseRenovationDTO(BaseRenovation baseRenovation) { BaseRenovationDTO baseRenovationDTO = new BaseRenovationDTO(); baseRenovationDTO.RoomId = baseRenovation.RoomId; baseRenovationDTO.StartTime = baseRenovation.RenovationPeriod.BeginDate; baseRenovationDTO.EndTime = baseRenovation.RenovationPeriod.EndDate; baseRenovation.TypeOfRenovation = baseRenovation.TypeOfRenovation; baseRenovation.Description = baseRenovation.Description; return(baseRenovationDTO); }
private void TryToScheduleBaseRenovation(BaseRenovationDTO baseRenovationDTO) { bool isSuccessfullyScheduled = _renovatonService.ScheduleBaseRenovation(baseRenovationDTO); if (isSuccessfullyScheduled) { ShowRenovationSuccessfullyScheduledDialog(); } else { List <RenovationPeriodDTO> alternativeRenovationAppointments = _renovatonService.GetBaseRenovationAlternativeAppointments(baseRenovationDTO); AlternativeRenovationAppointmentsDataGrid.ItemsSource = alternativeRenovationAppointments; DisplayAlternativeRenovationAppointmentsSection(); ShowRenovationUnavailableDialog(); } }
public IActionResult GetAlternativeAppointmentsForBaseRenovation(BaseRenovationDTO baseRenovatonDTO) { List <RenovationPeriodDTO> alternativeAppointments = new List <RenovationPeriodDTO>(); try { _renovationService.GetAlternativeAppointemntsForBaseRenovation(new RenovationPeriod(baseRenovatonDTO.StartTime, baseRenovatonDTO.EndTime), baseRenovatonDTO.RoomId).ForEach(r => alternativeAppointments.Add(RenovationPeriodMapper.RenovationPeriodToRenovationPeriodDTO(r))); if (alternativeAppointments.Count == 0) { return(NotFound("NotFound")); } return(Ok(alternativeAppointments)); } catch (Exception e) { return(NotFound(e.Message)); } }
public bool ScheduleBaseRenovation(BaseRenovationDTO baseRenovationDTO) { IRestResponse response = AddHTTPPostRequest("renovation/addBaseRenovation", baseRenovationDTO); return(response.IsSuccessful); }
public List <RenovationPeriodDTO> GetBaseRenovationAlternativeAppointments(BaseRenovationDTO baseRenovationDTO) { return((List <RenovationPeriodDTO>)HTTPGetRequestWithObjectAsParam <RenovationPeriodDTO>("renovation/getBaseRenovationAlternativeAppointments", baseRenovationDTO)); }