private void butOK_Click(object sender, System.EventArgs e) { //generic num already handled MedicationCur.MedName = textMedName.Text; if (MedicationCur.MedName == "") { MsgBox.Show(this, "Not allowed to save a medication without a Drug Name."); return; } if (CultureInfo.CurrentCulture.Name.EndsWith("US")) //United States { if (MedicationCur.RxCui == 0 && !MsgBox.Show(this, true, "Warning: RxNorm was not picked. " + "RxNorm uniquely identifies drugs in the United States and helps you keep your medications organized. " + "RxNorm is used to send information to and from eRx if you are using or plan to use eRx.\r\n" + "Click OK to continue without an RxNorm, or click Cancel to stay in this window.")) { return; } else if (MedicationCur.RxCui != 0) { List <Medication> listExistingMeds = Medications.GetAllMedsByRxCui(MedicationCur.RxCui); if (listExistingMeds.FindAll(x => x.MedicationNum != MedicationCur.MedicationNum).Count > 0) { MsgBox.Show(this, "A medication in the medication list is already using the selected RxNorm.\r\n" + "Please select a different RxNorm or use the other medication instead."); return; } } } if (MedicationCur.MedicationNum == MedicationCur.GenericNum) { MedicationCur.Notes = textNotes.Text; } else { MedicationCur.Notes = ""; } //MedicationCur has its RxCui set when the butRxNormSelect button is pressed. //The following behavior must match what happens when the user clicks the RxNorm column in FormMedications to pick RxCui. Medications.Update(MedicationCur); MedicationPats.UpdateRxCuiForMedication(MedicationCur.MedicationNum, MedicationCur.RxCui); DataValid.SetInvalid(InvalidType.Medications); DialogResult = DialogResult.OK; }
private void gridAllMedications_CellClick(object sender, ODGridClickEventArgs e) { Medication med = (Medication)gridAllMedications.Rows[e.Row].Tag; if (CultureInfo.CurrentCulture.Name.EndsWith("US") && e.Col == 3) //United States RxNorm Column { FormRxNorms formRxNorm = new FormRxNorms(); formRxNorm.IsSelectionMode = true; formRxNorm.InitSearchCodeOrDescript = med.MedName; formRxNorm.ShowDialog(); if (formRxNorm.DialogResult == DialogResult.OK) { med.RxCui = PIn.Long(formRxNorm.SelectedRxNorm.RxCui); //The following behavior mimics FormMedicationEdit OK click. Medications.Update(med); MedicationPats.UpdateRxCuiForMedication(med.MedicationNum, med.RxCui); DataValid.SetInvalid(InvalidType.Medications); } FillTab(); } }
private void butOK_Click(object sender, System.EventArgs e) { //generic num already handled MedicationCur.MedName = textMedName.Text; if (MedicationCur.MedName == "") { MsgBox.Show(this, "Not allowed to save a medication without a Drug Name."); return; } if (MedicationCur.MedicationNum == MedicationCur.GenericNum) { MedicationCur.Notes = textNotes.Text; } else { MedicationCur.Notes = ""; } //MedicationCur has its RxCui set when the butRxNormSelect button is pressed. Medications.Update(MedicationCur); MedicationPats.UpdateRxCuiForMedication(MedicationCur.MedicationNum, MedicationCur.RxCui); DialogResult = DialogResult.OK; }