예제 #1
0
        private void dataGrid_Pres_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            this.indexSelected = dataGrid_Pres.SelectedIndex;
            if (indexSelected == -1 || presList.Count <= indexSelected)
            {
                presSelected            = null;
                btnUpdatePres.IsEnabled = false;
                return;
            }
            ;


            btnUpdatePres.IsEnabled = true;
            //presSelected = (prescription)presList.ElementAt<prescription>(dataGrid_Pres.SelectedIndex);
            presSelected = (prescription)dataGrid_Pres.SelectedItem;

            if (presSelected.patient.type != null)
            {
                cboPatientType_Pres.Text = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(presSelected.patient.type);
            }
            if (presSelected.patient.type.Equals("outdoor"))
            {
                txtDisease_Pres.IsEnabled = false;
            }
            else if (presSelected.patient.type.Equals("indoor"))
            {
                indoor indo = hms.getIndoorByPid(presSelected.pid);
                txtDisease_Pres.IsEnabled = true;
                txtDisease_Pres.Text      = indo.disease;
            }

            cboMed_Pres.Text    = presSelected.medicine.name;
            txtDosage_Pres.Text = presSelected.dosage;
        }