Beispiel #1
0
        public DoctorOfficeInformation(string Id)
        {
            InitializeComponent();
            this.DataContext = this;


            if (Login.role != 3)
            {
                NewDoctor.Visibility             = Visibility.Hidden;
                ButtonSave.Visibility            = Visibility.Hidden;
                DoctorsComboBox.Visibility       = Visibility.Hidden;
                FromTXT.IsEnabled                = false;
                ToTXT.IsEnabled                  = false;
                NameOfCurrentDoctor.IsEnabled    = false;
                SurnameOfCurrentDoctor.IsEnabled = false;



                NumberOfFloorTxt.IsEnabled = false;
                NameOfClinicTxt.IsEnabled  = false;
            }

            Room r1 = _informationControler.GetRoomById(Id);

            if (r1 != null)
            {
                Room room = _informationControler.GetRoomById(Id);

                DoctorsRoom = DoctorRoomConverter.ConvertRoomToDoctorRoomView(_informationControler.GetRoomById(Id));
                doctor      = _informationControler.GetDoctorById(room.DoctordId);

                DoctorsRoom.NameOfDoctor    = doctor.Name;
                DoctorsRoom.SurnameOfDoctor = doctor.Surname;
                DoctorsRoom.JmbgOfDoctor    = doctor.Jmbg;
            }


            _idRoom = Id;



            AllNameAndSurnameAndJmbgFromDoctors = new ObservableCollection <string>();


            AllDoctors = new ObservableCollection <DoctorView>(DoctorConverter.ConvertDoctorToDoctorViewList(
                                                                   Backend.App.Instance().DoctorService.GetAllEntities().ToList()));



            foreach (DoctorView curentDoctor in AllDoctors)
            {
                if (!curentDoctor.IdOfDoctor.Equals(doctor.Id.ToString()))
                {
                    AllNameAndSurnameAndJmbgFromDoctors.Add(curentDoctor.NameOfDoctor + " " + curentDoctor.SurnameOfDoctor + " Doctor ID:" + curentDoctor.IdOfDoctor);
                }
            }
        }
        private void ButtonClick(object sender, RoutedEventArgs e)
        {
            if (EquipmnetRadioButon.IsChecked == true && !search.Text.ToString().Equals(""))
            {
                ObservableCollection <StorageModel> equipments = new ObservableCollection <StorageModel>();
                equipments = StorageRepository.GetInstance().SearchedItemsByName(search.Text);

                if (equipments.Count == 0)
                {
                    MessageBox.Show("There are no items like '" + search.Text + "' in storage!", "Storage");
                    return;
                }

                Storage storage = new Storage(equipments);
                storage.Show();
            }

            if (RoomsRadioButon.IsChecked == true)
            {
                SearchController _searchController = new SearchController();

                SearchedPatientsRooms = new ObservableCollection <PatientsRoomVieW>(PatientsRoomConverter.ConvertRoomToPatientsRoomView(_searchController.SearchPatientsRooms(search.Text.ToString()).ToList()));


                SearchedDoctorsRooms = new ObservableCollection <DoctorRoomView>(DoctorRoomConverter.ConvertRoomToDoctorRoomView(_searchController.SearchDoctorsRooms(search.Text.ToString()).ToList()));

                SearchedAnotherRooms = new ObservableCollection <RoomWorkTime>(WorkTimeRoomConverter.ConvertRoomToRoomWorkTime(_searchController.SearchAnotherRooms(search.Text.ToString()).ToList()));

                if (SearchedPatientsRooms.Count == 0 && SearchedDoctorsRooms.Count == 0 && SearchedAnotherRooms.Count == 0)
                {
                    MessageBox.Show("There are no search results! ", "Notice", MessageBoxButton.OK, MessageBoxImage.Information);
                    return;
                }

                SearchedRooms searchedRoom = new SearchedRooms(SearchedPatientsRooms, SearchedDoctorsRooms, SearchedAnotherRooms);
                searchedRoom.Show();
            }
        }
        private void CreateDynamicCanvas()
        {
            Rectangle = new ObservableCollection <Rectangles>();
            Rectangle = GroundFloor1Repository.GetInstance().GetAllRectangles();

            storage = StorageRepository.GetInstance().GetAllStorage();



            DrOfficeInfo = new ObservableCollection <DoctorRoomView>(DoctorRoomConverter.ConvertRoomToDoctorRoomView(
                                                                         Backend.App.Instance().RoomService.GetAllEntitiesByType(1).ToList()));

            WorkTime = new ObservableCollection <RoomWorkTime>(WorkTimeRoomConverter.ConvertRoomToRoomWorkTime(
                                                                   Backend.App.Instance().RoomService.GetAllEntitiesByType(4).ToList()));

            foreach (Rectangles r in Rectangle)
            {
                Rectangle rect = new Rectangle()
                {
                    Fill   = r.Paint,
                    Height = r.Height,
                    Width  = r.Width,
                    Name   = r.Id
                };

                TextBlock txtb = new TextBlock()
                {
                    Width      = r.WidthText,
                    Height     = r.HeightText,
                    Text       = r.Text,
                    Background = r.Background
                };
                canvas.Children.Add(txtb);
                foreach (DoctorRoomView room in DrOfficeInfo)
                {
                    if (r.Id.Equals(room.IdOfRoom))
                    {
                        rect.MouseDown += RoomInformation;
                    }
                }

                foreach (StorageModel s in storage)
                {
                    if (r.Id.Equals(s.IdS))
                    {
                        rect.MouseDown += StorageInfo;
                        break;
                    }
                }

                foreach (RoomWorkTime s in WorkTime)
                {
                    if (r.Id.Equals(s.IdOfRoom))
                    {
                        rect.MouseDown += WorkTimeInfo;
                    }
                }

                Canvas.SetLeft(txtb, r.LeftText);
                Canvas.SetTop(txtb, r.TopText);
                Canvas.SetLeft(rect, r.Left);
                Canvas.SetTop(rect, r.Top);
                canvas.Children.Add(rect);
            }
        }