public MergeRenovationDTO(BaseRenovationDTO baseRenovation, int secondRoomId, string newRoomDescription, TypeOfMapObject roomType)
 {
     this.baseRenovation = baseRenovation;
     SecondRoomId        = secondRoomId;
     NewRoomDescription  = newRoomDescription;
     RoomType            = roomType;
 }
Esempio n. 2
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 DivideRenovationDTO(BaseRenovationDTO baseRenovation, string firstRoomDescription, string secondRoomDescription, TypeOfMapObject firstRoomType, TypeOfMapObject secondRoomType)
 {
     this.baseRenovation   = baseRenovation;
     FirstRoomDescription  = firstRoomDescription;
     SecondRoomDescription = secondRoomDescription;
     FirstRoomType         = firstRoomType;
     SecondRoomType        = secondRoomType;
 }
Esempio n. 4
0
        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());
        }
Esempio n. 6
0
        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);
        }
Esempio n. 7
0
        public RenovationInRoomMoreDetailsDialog(int renovationId)
        {
            InitializeComponent();
            DataContext = this;

            RenovationId = renovationId;

            _renovationService = new RenovationService();

            RenovationForDisplay = _renovationService.GetBaseRenovationById(RenovationId);
        }
Esempio n. 8
0
        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));
        }
Esempio n. 9
0
        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);
        }
Esempio n. 10
0
        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));
            }
        }
Esempio n. 12
0
        public bool ScheduleBaseRenovation(BaseRenovationDTO baseRenovationDTO)
        {
            IRestResponse response = AddHTTPPostRequest("renovation/addBaseRenovation", baseRenovationDTO);

            return(response.IsSuccessful);
        }
Esempio n. 13
0
 public List <RenovationPeriodDTO> GetBaseRenovationAlternativeAppointments(BaseRenovationDTO baseRenovationDTO)
 {
     return((List <RenovationPeriodDTO>)HTTPGetRequestWithObjectAsParam <RenovationPeriodDTO>("renovation/getBaseRenovationAlternativeAppointments", baseRenovationDTO));
 }