Example #1
0
        public WorkTimeView(string id)
        {
            InitializeComponent();

            this.DataContext      = this;
            _informationControler = new InformationEditController();

            if (Login.role != 3)
            {
                ButtonSave.Visibility = Visibility.Hidden;

                FromTXT.IsEnabled = false;
                ToTXT.IsEnabled   = false;
            }

            if (id.Equals("HospitalA") || id.Equals("HospitalB"))
            {
                NameOfClinicTxtBlock.Visibility  = Visibility.Hidden;
                NumberOfFloorTxtBlock.Visibility = Visibility.Hidden;
                NameOfClinicTxt.Visibility       = Visibility.Hidden;
                NumberOfFloorTxt.Visibility      = Visibility.Hidden;
            }



            Room r1 = _informationControler.GetRoomById(id);

            if (r1 != null)
            {
                WorkTimeVie = WorkTimeRoomConverter.ConvertRoomToRoomWorkTime(_informationControler.GetRoomById(id));
            }
        }
Example #2
0
        private void CreateDynamicCanvas()
        {
            Rectangle = new ObservableCollection <Rectangles>();
            Rectangle = DinamiclyDrawingRepository.GetInstance().GetAllRectangles();
            Storage   = StorageRepository.GetInstance().GetAllStorage();
            RoomsInfo = new ObservableCollection <PatientsRoomVieW>(PatientsRoomConverter.ConvertRoomToPatientsRoomView(
                                                                        Backend.App.Instance().RoomService.GetAllEntitiesByType(3).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 (PatientsRoomVieW room in RoomsInfo)
                {
                    if (r.Id.Equals(room.IdOfRoom))
                    {
                        rect.MouseDown += RoomInformation;
                    }
                }

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

                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);
            }
        }
        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();
            }
        }