private void FillMedicalHistoryGrid() { dgvMedicalHistory.DataSource = MedicalHistoryManager.GetMedicalHistorys(medicalHistory => medicalHistory.PatientId == Patient.Id) .Select(medicalHistory => new MedicalHistoryVm { Description = medicalHistory.Description }).ToList(); }
private void dgvMedicalHistory_DoubleClick(object sender, EventArgs e) { if (ShowConfirmationDialog("هل أنت متأكد من أنك تريد حذف التاريخ المرضي المحدد؟") != DialogResult.Yes) { return; } Cursor = Cursors.WaitCursor; var medicalHistory = MedicalHistoryManager.GetMedicalHistoryByDescriptionAndPatientId( dgvMedicalHistory.SelectedRows[0].Cells[0].Value.ToString(), Patient.Id); if (medicalHistory == null) { Cursor = Cursors.Default; return; } MedicalHistoryManager.DeleteMedicalHistory(medicalHistory); FillMedicalHistoryGrid(); dgvMedicalHistory.Refresh(); Cursor = Cursors.Default; }
private void btnAddMedicalHistory_Click(object sender, EventArgs e) { Cursor = Cursors.WaitCursor; if (string.IsNullOrEmpty(txtMedicalHistory.Text.FullTrim())) { txtMedicalHistory.BackColor = ErrorColor; Cursor = Cursors.Default; return; } var medicalHistory = new MedicalHistory { Description = txtMedicalHistory.Text.FullTrim(), PatientId = Patient.Id }; MedicalHistoryManager.AddMedicalHistory(medicalHistory); Patient.MedicalHistories.Add(medicalHistory); ClearMedicalHistoryInputs(); FillMedicalHistoryGrid(); Cursor = Cursors.Default; }