コード例 #1
0
        private void RegisterPatient_Click(object sender, RoutedEventArgs e)
        {
            int?insuranceNumber;

            if (!UserInputControl.InsuranceNumToInt(TextInsuranceNumber.Text, out insuranceNumber))
            {
                MessageBox.Show("TAJ-szám helytelen!");
                return;
            }
            TextLastName.Text = TextLastName.Text.Trim();
            if (!UserInputControl.CheckName(TextLastName.Text))
            {
                MessageBox.Show("Vezetéknév hibásan lett kitöltve!");
                return;
            }
            TextFirstName.Text = TextFirstName.Text.Trim();
            if (!UserInputControl.CheckName(TextFirstName.Text))
            {
                MessageBox.Show("Keresztnév hibásan lett kitöltve!");
                return;
            }

            patient = new Patient
            {
                FirstName       = TextFirstName.Text,
                LastName        = TextLastName.Text,
                dateOfBirth     = DatePickerBirth.SelectedDate,
                Address         = TextAddress.Text,
                InsuranceNumber = insuranceNumber,
                ID = -1
            };
            var admission = new Admission
            {
                Symptomes       = TextSymptoms.Text,
                TimeOfAdmission = DateTime.Now,
                Diagnosis       = "",
                PatientID       = -1
            };
            ViewModel data = new ViewModel
            {
                Patient   = patient,
                Admission = admission
            };
            var json          = JsonConvert.SerializeObject(data);
            var stringContent = new StringContent(json, Encoding.UTF8, "application/json");

            using (var HttpClient = new HttpClient())
            {
                var result = HttpClient.PostAsync("http://localhost:8080/assistant/", stringContent);
                if (result.Result.IsSuccessStatusCode)
                {
                    MessageBox.Show("Kész!\n");
                    TextSymptoms.Clear();
                }
                else
                {
                    MessageBox.Show("Hiba!\n" + result.Result);
                }
            }
        }
コード例 #2
0
        private void ButtonAdmission_Click(object sender, RoutedEventArgs e)
        {
            if (patient is null)
            {
                MessageBox.Show("Válasszon beteget a listából!");
                return;
            }
            var admission = new Admission
            {
                Symptomes       = TextSymptoms.Text,
                TimeOfAdmission = DateTime.Now,
                Diagnosis       = "",
                PatientID       = patient.ID
            };
            var json          = JsonConvert.SerializeObject(admission);
            var stringContent = new StringContent(json, Encoding.UTF8, "application/json");

            using (var HttpClient = new HttpClient())
            {
                var result = HttpClient.PostAsync("http://localhost:8080/assistant/" + patient.ID, stringContent);
                if (result.Result.IsSuccessStatusCode)
                {
                    MessageBox.Show("Kész!\n");
                    TextSymptoms.Clear();
                }
                else
                {
                    MessageBox.Show("Hiba!\n" + result.Result);
                }
            }
        }
コード例 #3
0
        private void ListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Patient patient = (Patient)PatientsList.SelectedItem;

            this.patient = patient;
            if (patient is null)
            {
                TextFirstName.Clear();
                TextLastName.Clear();
                DatePickerBirth.SelectedDate = DateTime.Now;
                TextAddress.Clear();
                TextInsuranceNumber.Clear();
            }
            else
            {
                TextFirstName.Text           = patient.FirstName;
                TextLastName.Text            = patient.LastName;
                DatePickerBirth.SelectedDate = patient.dateOfBirth;
                TextAddress.Text             = patient.Address;
                TextInsuranceNumber.Text     = UserInputControl.InsuranceNumToString(patient.InsuranceNumber);
            }
            TextSymptoms.Clear();
        }