Ejemplo n.º 1
0
        private void dataGridView1_SelectionChanged(object sender, EventArgs e)
        {
            var selectedRows = (sender as DataGridView)?.SelectedRows;

            selectedHealthRecord = new HealthRecord();

            var patientService = new PatientService();
            var doctorService  = new DoctorService();

            if (selectedRows != null && selectedRows.Count > 0)
            {
                var selected = selectedRows[0];

                selectedHealthRecord.Id = selected.Cells["RecordId"].Value.ToString();
                selectedHealthRecord.CountDayWithoutWork = Convert.ToInt32(selected.Cells["CWithoutWork"].Value);
                selectedHealthRecord.Notes             = selected.Cells["CNotes"].Value.ToString();
                selectedHealthRecord.IsAmbulance       = Convert.ToBoolean(selected.Cells["CAmbulance"].Value);
                selectedHealthRecord.IsCanContinueWork = Convert.ToBoolean(selected.Cells["CCanWork"].Value);
                selectedHealthRecord.Diagnosis         = selected.Cells["CDiagnose"].Value.ToString();
                selectedHealthRecord.IsDispencary      = Convert.ToBoolean(selected.Cells["CDispancer"].Value);
                selectedHealthRecord.Patient           =
                    patientService.GetByFullNameAndId(selected.Cells["CPFullName"].Value.ToString());

                selectedHealthRecord.Doctor =
                    doctorService.GetByFullNameAndId(selected.Cells["CDFullName"].Value.ToString());
            }
        }