public static MergeRenovation MergeRenovationDTOToMergeRenovation(MergeRenovationDTO mergeRenovationDTO) { TypeOfUsage roomType = new TypeOfUsage(); switch (mergeRenovationDTO.RoomType) { case TypeOfMapObject.EXAMINATION_ROOM: roomType = TypeOfUsage.CONSULTING_ROOM; break; case TypeOfMapObject.HOSPITALIZATION_ROOM: roomType = TypeOfUsage.SICKROOM; break; case TypeOfMapObject.OPERATION_ROOM: roomType = TypeOfUsage.OPERATION_ROOM; break; default: break; } return(new MergeRenovation(new RenovationPeriod(mergeRenovationDTO.baseRenovation.StartTime, mergeRenovationDTO.baseRenovation.EndTime), mergeRenovationDTO.baseRenovation.Description, mergeRenovationDTO.baseRenovation.TypeOfRenovation, mergeRenovationDTO.baseRenovation.RoomId, mergeRenovationDTO.SecondRoomId, mergeRenovationDTO.NewRoomDescription, 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 ActionResult AddMergeRenovation(MergeRenovationDTO mergeRenovationDTO) { MergeRenovation addedBaseRenovation = (MergeRenovation)_renovationService.AddMergeRenovation(MergeRenovationMapper.MergeRenovationDTOToMergeRenovation(mergeRenovationDTO)); if (addedBaseRenovation == null) { return(NotFound("NotFound")); } return(Ok()); }
private void TryToScheduleMergeRenovation(MergeRenovationDTO mergeRenovationDTO) { bool isSuccessfullyScheduled = _renovatonService.ScheduleMergeRenovation(mergeRenovationDTO); if (isSuccessfullyScheduled) { ShowRenovationSuccessfullyScheduledDialog(); } else { List <RenovationPeriodDTO> alternativeRenovationAppointments = _renovatonService.GetMergeRenovationAlternativeAppointments(mergeRenovationDTO); AlternativeRenovationAppointmentsDataGrid.ItemsSource = alternativeRenovationAppointments; DisplayAlternativeRenovationAppointmentsSection(); ShowRenovationUnavailableDialog(); } }
public IActionResult GetAlternativeAppointmentsForMergeRenovation(MergeRenovationDTO mergeRenovationDTO) { List <RenovationPeriodDTO> alternativeAppointments = new List <RenovationPeriodDTO>(); try { _renovationService.GetMergeRenovationAlternativeAppointmets(MergeRenovationMapper.MergeRenovationDTOToMergeRenovation(mergeRenovationDTO)).ToList().ForEach(x => alternativeAppointments.Add(new RenovationPeriodDTO(x.BeginDate, x.EndDate))); if (alternativeAppointments.Count == 0) { return(NotFound("NotFound")); } return(Ok(alternativeAppointments)); } catch (Exception e) { return(NotFound(e.Message)); } }
public bool ScheduleMergeRenovation(MergeRenovationDTO mergeRenovationDTO) { IRestResponse response = AddHTTPPostRequest("renovation/addMergeRenovation", mergeRenovationDTO); return(response.IsSuccessful); }
public List <RenovationPeriodDTO> GetMergeRenovationAlternativeAppointments(MergeRenovationDTO mergeRenovationDTO) { return((List <RenovationPeriodDTO>)HTTPGetRequestWithObjectAsParam <RenovationPeriodDTO>("renovation/getMergeRenovationAlternativeAppointments", mergeRenovationDTO)); }