예제 #1
0
        private void ButtonMostViewedObject(object sender, RoutedEventArgs e)
        {
            if (Restriction == 1)
            {
                MessageBox.Show("You don't have permission to open this!");
                return;
            }
            Room room = SearchDataBaseForMostViewedRoom();

            if (room == null)
            {
                MessageBox.Show("Open some room idiot!");
                return;
            }
            if (room.RoomType == RoomType.AuxiliaryRoom || room.RoomType == RoomType.StorageRoom)
            {
                AdditionalInformationAuxiliaryRoom additionalInformationAuxiliaryRoom = new AdditionalInformationAuxiliaryRoom(room.Id, this);
                additionalInformationAuxiliaryRoom.ShowDialog();
            }
            else if (room.RoomType == RoomType.ExaminationRoom)
            {
                AdditionalInformationExaminationRoom additionalInformationExaminationRoom = new AdditionalInformationExaminationRoom(room.Id, this);
                additionalInformationExaminationRoom.ShowDialog();
            }
            else if (room.RoomType == RoomType.OperationRoom)
            {
                AdditionalInformationOperatingRoom additionalInformationOperatingRoom = new AdditionalInformationOperatingRoom(room.Id, this);
                additionalInformationOperatingRoom.ShowDialog();
            }
            else if (room.RoomType == RoomType.PatientRoom)
            {
                AdditionalInformationPatientRoom additionalInformationPatientRoom = new AdditionalInformationPatientRoom(room.Id, this);
                additionalInformationPatientRoom.ShowDialog();
            }
        }
        private void AdditionalInformationExaminationRoom(object sender, MouseButtonEventArgs e)
        {
            System.Windows.Shapes.Rectangle r = (System.Windows.Shapes.Rectangle)sender;
            int roomId = Int32.Parse(r.Uid);

            RoomEvent roomEvent = new RoomEvent();
            roomEvent.RoomId = roomId;
            string jsonRoom = JsonConvert.SerializeObject(roomEvent);
            HttpClient httpClient = new HttpClient();
            var content = new StringContent(jsonRoom, Encoding.UTF8, "application/json");
            var result = httpClient.PostAsync("http://localhost:60304/api/roomEvent/", content);
            result.Wait();


            if (page.getRestriction() != 1)
            {
                AdditionalInformationExaminationRoom additionalInformation = new AdditionalInformationExaminationRoom(roomId, page);
                additionalInformation.ShowDialog();
            }
        }