Exemplo n.º 1
0
        private void ScheduleEquipmentRelocation(TransferEquipmentDTO relocationAppointmentDTO)
        {
            IsAlternativeAppointmentsSectionVisible = false;

            _equipmentService.ScheduleEquipmentTransfer(relocationAppointmentDTO);
            this.Close();
            InfoDialog infoDialog = new InfoDialog("Uspešno ste zakazali premeštanje opreme!");

            infoDialog.ShowDialog();
        }
Exemplo n.º 2
0
        public int InitializeEquipmentTransfer(TransferEquipmentDTO transferEquipmentDTO)
        {
            int unavailaleRoomNumber = CheckStartingAndDestinationRoomsAvailability(transferEquipmentDTO);

            if (unavailaleRoomNumber != -1)
            {
                return(unavailaleRoomNumber);
            }
            return(CheckEquipmentAvailability(transferEquipmentDTO));
        }
Exemplo n.º 3
0
 private int CheckStartingAndDestinationRoomsAvailability(TransferEquipmentDTO transferEquipmentDTO)
 {
     if (CheckRoomAvailibility(transferEquipmentDTO.DateAndTimeOfTransfer, transferEquipmentDTO.StartingRoomNumber) != -1)
     {
         return(transferEquipmentDTO.StartingRoomNumber);
     }
     if (CheckRoomAvailibility(transferEquipmentDTO.DateAndTimeOfTransfer, transferEquipmentDTO.DestinationRoomNumber) != -1)
     {
         return(transferEquipmentDTO.DestinationRoomNumber);
     }
     return(-1);
 }
Exemplo n.º 4
0
        private DateTime GetLastDateWhenEquipmentIsUsed(TransferEquipmentDTO transferEquipmentDTO)
        {
            DateTime lastDateWhenEquipmentIsUsed = new DateTime();

            foreach (var e in _examinationRepository.GetFollowingExaminationsByRoom(transferEquipmentDTO.StartingRoomNumber).Where(e => e.DateAndTime.CompareTo(transferEquipmentDTO.DateAndTimeOfTransfer) > 0))
            {
                if (_equipmentInExaminationRepository.GetEquipmentInExaminationByExaminationId(e.Id).Find(eie => eie.EquipmentTypeID == transferEquipmentDTO.EquipmentTypeId) != null)
                {
                    lastDateWhenEquipmentIsUsed = e.DateAndTime;
                }
            }
            return(lastDateWhenEquipmentIsUsed);
        }
Exemplo n.º 5
0
        private int CheckEquipmentAvailability(TransferEquipmentDTO transferEquipmentDTO)
        {
            int roomNumber = -1;

            foreach (var e in _examinationRepository.GetFollowingExaminationsByRoom(transferEquipmentDTO.StartingRoomNumber).Where(e => e.DateAndTime.CompareTo(transferEquipmentDTO.DateAndTimeOfTransfer) > 0))
            {
                if (_equipmentInExaminationRepository.GetEquipmentInExaminationByExaminationId(e.Id).Find(eie => eie.EquipmentTypeID == transferEquipmentDTO.EquipmentTypeId) != null)
                {
                    roomNumber = transferEquipmentDTO.StartingRoomNumber;
                }
            }
            return(roomNumber);
        }
Exemplo n.º 6
0
        public List <DateTime> GetAlternativeAppointments(TransferEquipmentDTO transferEquipmentDTO)
        {
            List <DateTime> alternativeAppointments = new List <DateTime>();

            if (CheckEquipmentAvailability(transferEquipmentDTO) != -1)
            {
                transferEquipmentDTO.DateAndTimeOfTransfer = GetLastDateWhenEquipmentIsUsed(transferEquipmentDTO);
            }
            do
            {
                alternativeAppointments = ChooseAppointments(transferEquipmentDTO, alternativeAppointments);
            }while (alternativeAppointments.Count != 10);

            return(alternativeAppointments);
        }
Exemplo n.º 7
0
        private List <DateTime> ChooseAppointments(TransferEquipmentDTO transferEquipmentDTO, List <DateTime> alternativeAppointments)
        {
            foreach (DateTime date in GetPotentiallyAlternativeAppointments(transferEquipmentDTO.DateAndTimeOfTransfer))
            {
                transferEquipmentDTO.DateAndTimeOfTransfer = date;

                if (CheckStartingAndDestinationRoomsAvailability(transferEquipmentDTO) == -1 &&
                    _equipmentTransferRepository.GetEquipmentTransferByRoomNumberAndDate(transferEquipmentDTO.StartingRoomNumber, transferEquipmentDTO.DateAndTimeOfTransfer) == null &&
                    _equipmentTransferRepository.GetEquipmentTransferByRoomNumberAndDate(transferEquipmentDTO.DestinationRoomNumber, transferEquipmentDTO.DateAndTimeOfTransfer) == null)
                {
                    alternativeAppointments.Add(date);
                }

                if (alternativeAppointments.Count == 10)
                {
                    break;
                }
            }
            return(alternativeAppointments);
        }
Exemplo n.º 8
0
        private void ScheduleEquipmentRelocationButton_Click(object sender, RoutedEventArgs e)
        {
            TransferEquipmentDTO relocationAppointmentDTO = CreateEquipmentRelocationDTOFromUserInput();

            if (AlternativeRelocationAppointmentsDataGrid.SelectedItem == null)
            {
                int relocationResult = _equipmentService.InitializeEquipmentTransfer(relocationAppointmentDTO);

                if (relocationResult == -1)
                {
                    ScheduleEquipmentRelocation(relocationAppointmentDTO);
                }
                else
                {
                    long problematicRoomId = relocationResult;
                    ShowInfoDialogAndAlternativeAppointmentsForUnavailableRelocationAppointment(problematicRoomId, relocationAppointmentDTO);
                }
            }
            else
            {
                relocationAppointmentDTO.DateAndTimeOfTransfer = (DateTime)AlternativeRelocationAppointmentsDataGrid.SelectedItem;
                ScheduleEquipmentRelocation(relocationAppointmentDTO);
            }
        }
Exemplo n.º 9
0
        private void ShowInfoDialogAndAlternativeAppointmentsForUnavailableRelocationAppointment(long problematicRoomId, TransferEquipmentDTO unavailableRelocationAppointmentDTO)
        {
            DisplayAlternativeRelocationAppointmentsSection();

            MarkProblematicRelocationRoomOnMap(problematicRoomId);
            ShowRelocationUnavailableDialog(problematicRoomId);

            GetAndDisplayAlternativeAppointmentsForRelocationAppointment(unavailableRelocationAppointmentDTO);
        }
 public List <DateTime> GetAlternativeAppointments(TransferEquipmentDTO transferEquipmentDTO)
 {
     return((List <DateTime>)HTTPGetRequestWithObjectAsParam <DateTime>("equipment/getAlternativeAppointments", transferEquipmentDTO));
 }
Exemplo n.º 11
0
 public void ScheduleEquipmentTrasfer(TransferEquipmentDTO transferEquipmentDTO)
 {
     _equipmentTransferRepository.AddEquipmentTransfer(new EquipmentTransfer(transferEquipmentDTO.StartingRoomNumber, transferEquipmentDTO.DateAndTimeOfTransfer));
     _equipmentTransferRepository.AddEquipmentTransfer(new EquipmentTransfer(transferEquipmentDTO.DestinationRoomNumber, transferEquipmentDTO.DateAndTimeOfTransfer));
 }
Exemplo n.º 12
0
        private void GetAndDisplayAlternativeAppointmentsForRelocationAppointment(TransferEquipmentDTO unavailableRelocationAppointmentDTO)
        {
            List <DateTime> alternativeRelocationAppointments = _equipmentService.GetAlternativeAppointments(unavailableRelocationAppointmentDTO);

            AlternativeRelocationAppointmentsDataGrid.ItemsSource = alternativeRelocationAppointments;
        }
 public ActionResult ScheduleEquipmentTransfer(TransferEquipmentDTO transferEquipmentDTO)
 {
     _equipmentService.ScheduleEquipmentTrasfer(transferEquipmentDTO);
     return(Ok());
 }
 public ActionResult GetAlternativeAppointments(TransferEquipmentDTO transferEquipmentDTO)
 {
     return(Ok(_equipmentService.GetAlternativeAppointments(transferEquipmentDTO)));
 }
 public ActionResult InitializeEquipmentTransfer(TransferEquipmentDTO transferEquipmentDTO)
 {
     return(Ok(_equipmentService.InitializeEquipmentTransfer(transferEquipmentDTO)));
 }
        public string ScheduleEquipmentTransfer(TransferEquipmentDTO transferEquipmentDTO)
        {
            IRestResponse response = AddHTTPPostRequest("equipment/scheduleTransfer", transferEquipmentDTO);

            return(response.Content);
        }
 public int InitializeEquipmentTransfer(TransferEquipmentDTO transferEquipmentDTO)
 {
     return((int)HTTPGetSingleItemRequestWithObjectAsParam <int>("equipment/initilizeTransfer", transferEquipmentDTO));
 }