///<summary>Loops through corresponding list and sets the index to the item matching fieldName passed in. Only called on load.</summary> private void SetListMedicalSelectedIndex(MedicalListType medListType, string fieldName) { switch (medListType) { case MedicalListType.allergy: for (int i = 0; i < allergyList.Count; i++) { if (AllergyDefs.GetDescription(allergyList[i].AllergyDefNum) == fieldName) { listMedical.SelectedIndex = i; } } break; case MedicalListType.problem: for (int i = 0; i < _listDiseaseDefs.Count; i++) { if (_listDiseaseDefs[i].DiseaseName == fieldName) { listMedical.SelectedIndex = i; } } break; } }
private void butOK_Click(object sender, EventArgs e) { //Validate if (textDate.Text != "") { try { DateTime.Parse(textDate.Text); } catch { MessageBox.Show("Please input a valid date."); return; } } //Save if (textDate.Text != "") { AllergyCur.DateAdverseReaction = DateTime.Parse(textDate.Text); } else { AllergyCur.DateAdverseReaction = DateTime.MinValue; } AllergyCur.AllergyDefNum = allergyDefList[comboAllergies.SelectedIndex].AllergyDefNum; AllergyCur.Reaction = textReaction.Text; AllergyCur.SnomedReaction = ""; if (snomedReaction != null) { AllergyCur.SnomedReaction = snomedReaction.SnomedCode; } AllergyCur.StatusIsActive = checkActive.Checked; if (AllergyCur.IsNew) { Allergies.Insert(AllergyCur); SecurityLogs.MakeLogEntry(Permissions.PatAllergyListEdit, AllergyCur.PatNum, AllergyDefs.GetDescription(AllergyCur.AllergyDefNum) + " added"); } else { Allergies.Update(AllergyCur); SecurityLogs.MakeLogEntry(Permissions.PatAllergyListEdit, AllergyCur.PatNum, AllergyDefs.GetDescription(AllergyCur.AllergyDefNum) + " edited"); } DialogResult = DialogResult.OK; }
private void butDelete_Click(object sender, EventArgs e) { if (AllergyCur.IsNew) { DialogResult = DialogResult.Cancel; return; } if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "Delete?")) { return; } Allergies.Delete(AllergyCur.AllergyNum); SecurityLogs.MakeLogEntry(Permissions.PatAllergyListEdit, AllergyCur.PatNum, AllergyDefs.GetDescription(AllergyCur.AllergyDefNum) + " deleted"); DialogResult = DialogResult.OK; }
private void butPicker_Click(object sender, EventArgs e) { switch (listRestriction.SelectedIndex) { case 0: //Birthdate //Not visible break; case 1: //problem if (sender.Equals(butPicker)) { FormIcd9s FormI9 = new FormIcd9s(); FormI9.IsSelectionMode = true; FormI9.ShowDialog(); if (FormI9.DialogResult != DialogResult.OK) { return; } textCompareString.Text = FormI9.SelectedIcd9.ICD9Code; textSNOMED.Text = ""; } else if (sender.Equals(butSNOMED)) { FormSnomeds FormS = new FormSnomeds(); FormS.IsSelectionMode = true; FormS.ShowDialog(); if (FormS.DialogResult != DialogResult.OK) { return; } textSNOMED.Text = FormS.SelectedSnomed.SnomedCode; textCompareString.Text = ""; } break; case 2: //Medication FormMedications FormM = new FormMedications(); FormM.IsSelectionMode = true; FormM.ShowDialog(); if (FormM.DialogResult != DialogResult.OK) { return; } textCompareString.Text = Medications.GetNameOnly(FormM.SelectedMedicationNum); break; case 3: //LabResult //Not visible break; case 4: //Gender //Not visible break; case 5: //Comm preference FormCommPrefPicker FormCPP = new FormCommPrefPicker(); FormCPP.ShowDialog(); if (FormCPP.DialogResult != DialogResult.OK) { return; } textCompareString.Text = Enum.GetName(typeof(ContactMethod), FormCPP.ContMethCur); break; case 6: //Alergy FormAllergySetup FormAS = new FormAllergySetup(); FormAS.IsSelectionMode = true; FormAS.ShowDialog(); if (FormAS.DialogResult != DialogResult.OK) { return; } textCompareString.Text = AllergyDefs.GetDescription(FormAS.SelectedAllergyDefNum); break; default: //should never happen break; } }