예제 #1
0
        public UpdateVisit(VisitItem visit = null)
        {
            InitializeComponent();

            patients = DataManipulations.GetPatients();
            if (patients.Count == 0)
            {
                btOk.IsEnabled = false;
            }
            cbPatient.ItemsSource = patients;

            cbDiagnosis.ItemsSource = Diagnoses.diagnoses;

            if (visit != null)
            {
                visitId = visit.Id;

                if (Diagnoses.diagnoses.Contains(visit.Diagnosis))
                {
                    cbDiagnosis.SelectedItem = visit.Diagnosis;
                }

                var patient = patients.FirstOrDefault(x => x.Id == visit.PatientId);
                if (patient != null)
                {
                    cbPatient.SelectedItem = patient;
                }

                cbVisit.SelectedIndex = visit.Initial ? 0 : 1;

                //tbName.Text = patient.Name;
                //tbAddress.Text = patient.Address;
                //tbPhone.Text = patient.Phone;
                //cbGender.SelectedIndex = patient.Gender == "♂" ? 0 : 1;
            }
        }
예제 #2
0
        /// <summary>
        /// Converts Patient model objects to Patient view objects
        /// </summary>
        public static void UpdatePatients()
        {
            var patientsData = DataManipulations.GetPatients();

            PatientsList.Clear();
            if (patientsData.Count > 0)
            {
                foreach (var patient in patientsData)
                {
                    PatientsList.Add(new PatientItem()
                    {
                        Address     = patient.Address,
                        DateOfBirth = patient.DateOfBirth.ToString("dd/MM/yyyy"),
                        Gender      =
                            patient.MaleGender
                                ? "♂"
                                : "♀",
                        Id    = patient.Id,
                        Name  = patient.Name,
                        Phone = patient.Phone
                    });
                }
            }
        }