private void AddScheduleRenovationButton(int row, RenovationDto renovation)
        {
            Button scheduleBtn = CreateScheduleButton();

            Grid.SetRow(scheduleBtn, row);
            Grid.SetColumn(scheduleBtn, DynamicGrid.ColumnDefinitions.Count - 2);
            DynamicGrid.Children.Add(scheduleBtn);

            SchedulingDto schDto = renovation.toSchedulingDto();

            timeInterval = new TimeInterval(schDto.TimeInterval.Start, schDto.TimeInterval.End);

            scheduleBtn.Click += (s, e) =>
            {
                List <int> doctors = doctorServerController.GetDoctorsByRoomsAndShifts(schDto).ToList();
                foreach (int doctorId in doctors)
                {
                    renovationServerController.ScheduleRenovation(renovation.TimeInterval, doctorId, AllConstants.PatientIdForRenovation);
                }
                MessageBox.Show("Renovation is successfully scheduled!");
                foreach (Window window in Application.Current.Windows)
                {
                    if (window.GetType() == typeof(RoomRenovation))
                    {
                        if ((window as RoomRenovation).RenovationTypeComboBox.Text.Equals("Complex"))
                        {
                            RoomInformation roomInformation = new RoomInformation(schDto);

                            if ((window as RoomRenovation).ComplexRenovationTypeComboBox.Text.Equals("Separate room"))
                            {
                                roomInformation.MergingStackPanel.Visibility  = Visibility.Hidden;
                                roomInformation.DividingStackPanel.Visibility = Visibility.Visible;
                                roomInformation.Room1Name.Text = mapObjectController.GetMapObjectById(renovation.SourceRoomId).Name;
                                int workTime = mapObjectController.GetMapObjectById(renovation.SourceRoomId).MapObjectDescription.Information.Split("=")[1].Length;
                                roomInformation.WorkTime1.Text = mapObjectController.GetMapObjectById(renovation.SourceRoomId).MapObjectDescription.Information.Split("=")[1].Substring(0, workTime - 1);
                            }
                            else if ((window as RoomRenovation).ComplexRenovationTypeComboBox.Text.Equals("Join rooms"))
                            {
                                roomInformation.DividingStackPanel.Visibility = Visibility.Hidden;
                                roomInformation.MergingStackPanel.Visibility  = Visibility.Visible;
                                roomInformation.RoomName.Text = mapObjectController.GetMapObjectById(renovation.SourceRoomId).Name;
                                int workTime = mapObjectController.GetMapObjectById(renovation.SourceRoomId).MapObjectDescription.Information.Split("=")[1].Length;
                                roomInformation.WorkTime.Text = mapObjectController.GetMapObjectById(renovation.SourceRoomId).MapObjectDescription.Information.Split("=")[1].Substring(0, workTime - 1);
                                List <int> doctors1 = doctorServerController.GetDoctorsByRoomsAndShifts(schDto).ToList();
                                foreach (int doctorId in doctors1)
                                {
                                    startDate = schDto.TimeInterval.Start.AddDays(1);
                                    examinationServerController.ScheduleExamination(startDate, doctorId, AllConstants.PatientIdForRelocation);
                                }
                            }
                            roomInformation.ShowDialog();
                        }
                    }
                }
                this.Close();
            };
        }
        private void ScheduleRenovation(SchedulingDto schDto)
        {
            List <int> doctors = doctorServerController.GetDoctorsByRoomsAndShifts(schDto).ToList();

            foreach (int doctorId in doctors)
            {
                renovationServerController.ScheduleRenovation(timeInterval, doctorId, AllConstants.PatientIdForRenovation);
            }
            DestinationRoomComboBox.SelectedIndex = 0;
            MessageBox.Show("Renovation is successfully scheduled!");
            if (RenovationTypeComboBox.Text.Equals("Complex"))
            {
                RoomInformation roomInformation = new RoomInformation(schDto);

                if (ComplexRenovationTypeComboBox.Text.Equals("Separate room"))
                {
                    roomInformation.MergingStackPanel.Visibility  = Visibility.Hidden;
                    roomInformation.DividingStackPanel.Visibility = Visibility.Visible;
                    roomInformation.Room1Name.Text = mapObjectController.GetMapObjectById(mapObjectId).Name;
                    int workTime = mapObjectController.GetMapObjectById(mapObjectId).MapObjectDescription.Information.Split("=")[1].Length;
                    roomInformation.WorkTime1.Text = mapObjectController.GetMapObjectById(mapObjectId).MapObjectDescription.Information.Split("=")[1].Substring(0, workTime - 1);
                }
                else if (ComplexRenovationTypeComboBox.Text.Equals("Join rooms"))
                {
                    roomInformation.DividingStackPanel.Visibility = Visibility.Hidden;
                    roomInformation.MergingStackPanel.Visibility  = Visibility.Visible;
                    roomInformation.RoomName.Text = mapObjectController.GetMapObjectById(mapObjectId).Name;
                    int workTime = mapObjectController.GetMapObjectById(mapObjectId).MapObjectDescription.Information.Split("=")[1].Length;
                    roomInformation.WorkTime.Text = mapObjectController.GetMapObjectById(mapObjectId).MapObjectDescription.Information.Split("=")[1].Substring(0, workTime - 1);
                    List <int> doctors1 = doctorServerController.GetDoctorsByRoomsAndShifts(schDto).ToList();
                    foreach (int doctorId in doctors1)
                    {
                        startDate = schDto.TimeInterval.Start.AddDays(1);
                        examinationServerController.ScheduleExamination(startDate, doctorId, AllConstants.PatientIdForRelocation);
                    }
                }

                roomInformation.ShowDialog();
            }
            this.Close();
        }