Exemplo n.º 1
0
        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 AddDivideRenovation(DivideRenovationDTO divideRenovationDTO)
        {
            DivideRenovation addedBaseRenovation = (DivideRenovation)_renovationService.AddDivideRenovation(DivideRenovationMapper.DivideRenovationDTOToDivideRenovation(divideRenovationDTO));

            if (addedBaseRenovation == null)
            {
                return(NotFound("NotFound"));
            }
            return(Ok());
        }
        public static DivideRenovation DivideRenovationDTOToDivideRenovation(DivideRenovationDTO divideRenovationDTO)
        {
            TypeOfUsage firstRoomType  = new TypeOfUsage();
            TypeOfUsage secondRoomType = new TypeOfUsage();

            switch (divideRenovationDTO.FirstRoomType)
            {
            case TypeOfMapObject.EXAMINATION_ROOM:
                firstRoomType = TypeOfUsage.CONSULTING_ROOM;
                break;

            case TypeOfMapObject.HOSPITALIZATION_ROOM:
                firstRoomType = TypeOfUsage.SICKROOM;
                break;

            case TypeOfMapObject.OPERATION_ROOM:
                firstRoomType = TypeOfUsage.OPERATION_ROOM;
                break;

            default:
                break;
            }

            switch (divideRenovationDTO.SecondRoomType)
            {
            case TypeOfMapObject.EXAMINATION_ROOM:
                secondRoomType = TypeOfUsage.CONSULTING_ROOM;
                break;

            case TypeOfMapObject.HOSPITALIZATION_ROOM:
                secondRoomType = TypeOfUsage.SICKROOM;
                break;

            case TypeOfMapObject.OPERATION_ROOM:
                secondRoomType = TypeOfUsage.OPERATION_ROOM;
                break;

            default:
                break;
            }
            return(new DivideRenovation(new RenovationPeriod(divideRenovationDTO.baseRenovation.StartTime, divideRenovationDTO.baseRenovation.EndTime),
                                        divideRenovationDTO.baseRenovation.Description,
                                        divideRenovationDTO.baseRenovation.TypeOfRenovation,
                                        divideRenovationDTO.baseRenovation.RoomId,
                                        divideRenovationDTO.FirstRoomDescription,
                                        divideRenovationDTO.SecondRoomDescription,
                                        firstRoomType,
                                        secondRoomType));
        }
Exemplo n.º 4
0
        private void TryToScheduleDivideRenovation(DivideRenovationDTO divideRenovationDTO)
        {
            bool isSuccessfullyScheduled = _renovatonService.ScheduleDivideRenovation(divideRenovationDTO);

            if (isSuccessfullyScheduled)
            {
                ShowRenovationSuccessfullyScheduledDialog();
            }
            else
            {
                List <RenovationPeriodDTO> alternativeRenovationAppointments = _renovatonService.GetDivideRenovationAlternativeAppointments(divideRenovationDTO);
                AlternativeRenovationAppointmentsDataGrid.ItemsSource = alternativeRenovationAppointments;
                DisplayAlternativeRenovationAppointmentsSection();
                ShowRenovationUnavailableDialog();
            }
        }
        public IActionResult GetAlternativeAppointmentsForDivideRenovation(DivideRenovationDTO divideRenovationDTO)
        {
            List <RenovationPeriodDTO> alternativeAppointments = new List <RenovationPeriodDTO>();

            try
            {
                _renovationService.GetDivideRenovationAlternativeAppointmets(DivideRenovationMapper.DivideRenovationDTOToDivideRenovation(divideRenovationDTO)).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));
            }
        }
Exemplo n.º 6
0
        public bool ScheduleDivideRenovation(DivideRenovationDTO divideRenovationDTO)
        {
            IRestResponse response = AddHTTPPostRequest("renovation/addDivideRenovation", divideRenovationDTO);

            return(response.IsSuccessful);
        }
Exemplo n.º 7
0
 public List <RenovationPeriodDTO> GetDivideRenovationAlternativeAppointments(DivideRenovationDTO divideRenovationDTO)
 {
     return((List <RenovationPeriodDTO>)HTTPGetRequestWithObjectAsParam <RenovationPeriodDTO>("renovation/getDivideRenovationAlternativeAppointments", divideRenovationDTO));
 }