private void butAddBrand_Click(object sender, System.EventArgs e) { if (listMeds.SelectedIndex == -1) { MessageBox.Show(Lan.g(this, "You must first highlight the generic medication from the list. If it is not already on the list, then you must add it first.")); return; } Medication selected = Medications.List[listMeds.SelectedIndex]; if (selected.MedicationNum != selected.GenericNum) { MessageBox.Show(Lan.g(this, "The selected medication is not generic.")); return; } Medication MedicationCur = new Medication(); Medications.Insert(MedicationCur); //so that we will have the primary key MedicationCur.GenericNum = selected.MedicationNum; FormMedicationEdit FormME = new FormMedicationEdit(); FormME.MedicationCur = MedicationCur; FormME.IsNew = true; FormME.ShowDialog(); FillMedList(); }
private void butAddBrand_Click(object sender, System.EventArgs e) { if (gridAllMedications.GetSelectedIndex() == -1) { MessageBox.Show(Lan.g(this, "You must first highlight the generic medication from the list. If it is not already on the list, then you must add it first.")); return; } Medication medSelected = (Medication)gridAllMedications.Rows[gridAllMedications.GetSelectedIndex()].Tag; if (medSelected.MedicationNum != medSelected.GenericNum) { MessageBox.Show(Lan.g(this, "The selected medication is not generic.")); return; } Medication MedicationCur = new Medication(); Medications.Insert(MedicationCur); //so that we will have the primary key MedicationCur.GenericNum = medSelected.MedicationNum; FormMedicationEdit FormME = new FormMedicationEdit(); FormME.MedicationCur = MedicationCur; FormME.IsNew = true; FormME.ShowDialog(); //This window refreshes the Medication cache if the user clicked OK. FillTab(); }
private void gridAllMedications_CellDoubleClick(object sender, ODGridClickEventArgs e) { Medication med = (Medication)gridAllMedications.Rows[e.Row].Tag; med = Medications.GetMedication(med.MedicationNum); if (med == null) //Possible to delete the medication from a separate WS while medication loaded in memory. { MsgBox.Show(this, "An error occurred loading medication."); return; } if (IsSelectionMode) { SelectedMedicationNum = med.MedicationNum; DialogResult = DialogResult.OK; } else //normal mode from main menu { if (!CultureInfo.CurrentCulture.Name.EndsWith("US") || e.Col != 3) //Not United States RxNorm Column { FormMedicationEdit FormME = new FormMedicationEdit(); FormME.MedicationCur = med; FormME.ShowDialog(); //This window refreshes the Medication cache if the user clicked OK. FillTab(); } } }
private void butEdit_Click(object sender, System.EventArgs e) { FormMedicationEdit FormME = new FormMedicationEdit(); FormME.MedicationCur = Medications.GetMedication(MedicationPatCur.MedicationNum); FormME.ShowDialog(); if (FormME.DialogResult != DialogResult.OK) { return; } FillForm(); }
private void butAddGeneric_Click(object sender, System.EventArgs e) { Medication MedicationCur = new Medication(); Medications.Insert(MedicationCur); //so that we will have the primary key MedicationCur.GenericNum = MedicationCur.MedicationNum; FormMedicationEdit FormME = new FormMedicationEdit(); FormME.MedicationCur = MedicationCur; FormME.IsNew = true; FormME.ShowDialog(); //This window refreshes the Medication cache if the user clicked OK. FillTab(); }
private void butAddGeneric_Click(object sender, System.EventArgs e) { Medication MedicationCur = new Medication(); Medications.Insert(MedicationCur); //so that we will have the primary key MedicationCur.GenericNum = MedicationCur.MedicationNum; FormMedicationEdit FormME = new FormMedicationEdit(); FormME.MedicationCur = MedicationCur; FormME.IsNew = true; FormME.ShowDialog(); FillMedList(); }
private void butConvertGeneric_Click(object sender, EventArgs e) { if (gridMissing.SelectedIndices.Length == 0) { MsgBox.Show(this, "Please select an item from the list before attempting to convert."); return; } List <MedicationPat> listMedPats = (List <MedicationPat>)gridMissing.Rows[gridMissing.SelectedIndices[0]].Tag; List <Medication> listRxCuiMeds = null; Medication medGeneric = null; if (listMedPats[0].RxCui != 0) { listRxCuiMeds = Medications.GetAllMedsByRxCui(listMedPats[0].RxCui); medGeneric = listRxCuiMeds.FirstOrDefault(x => x.MedicationNum == x.GenericNum); if (medGeneric == null && listRxCuiMeds.FirstOrDefault(x => x.MedicationNum != x.GenericNum) != null) //A Brand Medication exists with matching RxCui. { MsgBox.Show(this, "A brand medication matching the RxNorm of the selected medication already exists in the medication list. " + "You cannot create a generic for the selected medication. Use the Convert to Brand button instead."); return; } } if (listRxCuiMeds == null || listRxCuiMeds.Count == 0) //No medications found matching the RxCui { medGeneric = new Medication(); medGeneric.MedName = listMedPats[0].MedDescript; medGeneric.RxCui = listMedPats[0].RxCui; Medications.Insert(medGeneric); //To get primary key. medGeneric.GenericNum = medGeneric.MedicationNum; Medications.Update(medGeneric); //Now that we have primary key, flag the medication as a generic. FormMedicationEdit FormME = new FormMedicationEdit(); FormME.MedicationCur = medGeneric; FormME.IsNew = true; FormME.ShowDialog(); //This window refreshes the Medication cache if the user clicked OK. if (FormME.DialogResult != DialogResult.OK) { return; //User canceled. } } else if (medGeneric != null && !MsgBox.Show(this, true, "A generic medication matching the RxNorm of the selected medication already exists in the medication list. " + "Click OK to use the existing medication as the generic for the selected medication, or click Cancel to abort.")) { return; } Cursor = Cursors.WaitCursor; MedicationPats.UpdateMedicationNumForMany(medGeneric.MedicationNum, listMedPats.Select(x => x.MedicationPatNum).ToList()); FillTab(); Cursor = Cursors.Default; MsgBox.Show(this, "Done."); }
private void butEdit_Click(object sender, System.EventArgs e) { Medications.Refresh(); FormMedicationEdit FormME = new FormMedicationEdit(); FormME.MedicationCur = Medications.GetMedication(MedicationPatCur.MedicationNum); FormME.ShowDialog(); if (FormME.DialogResult != DialogResult.OK) { return; } textMedName.Text = Medications.GetMedication(MedicationPatCur.MedicationNum).MedName; textGenericName.Text = Medications.GetGeneric(MedicationPatCur.MedicationNum).MedName; textMedNote.Text = Medications.GetGeneric(MedicationPatCur.MedicationNum).Notes; }
private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e) { if (IsSelectionMode) { SelectedMedicationNum = medList[e.Row].MedicationNum; DialogResult = DialogResult.OK; } else //normal mode from main menu //edit { FormMedicationEdit FormME = new FormMedicationEdit(); FormME.MedicationCur = medList[e.Row]; FormME.ShowDialog(); FillGrid(); } }
private void listMeds_DoubleClick(object sender, System.EventArgs e) { if (SelectMode) { MedicationNum = Medications.List[listMeds.SelectedIndex].MedicationNum; DialogResult = DialogResult.OK; } else //normal mode from main menu //edit { FormMedicationEdit FormME = new FormMedicationEdit(); FormME.MedicationCur = Medications.List[listMeds.SelectedIndex]; FormME.ShowDialog(); FillMedList(); } }
private void butEdit_Click(object sender, System.EventArgs e) { Medications.Refresh(); FormMedicationEdit FormME = new FormMedicationEdit(); FormME.MedicationCur = Medications.GetMedication(MedicationPatCur.MedicationNum); //The edit button is not visible if MedicationNum=0. FormME.ShowDialog(); if (FormME.DialogResult != DialogResult.OK) { return; } MedicationPatCur.RxCui = FormME.MedicationCur.RxCui; textMedName.Text = Medications.GetMedication(MedicationPatCur.MedicationNum).MedName; //The edit button is not visible if MedicationNum=0. textGenericName.Text = Medications.GetGeneric(MedicationPatCur.MedicationNum).MedName; //The edit button is not visible if MedicationNum=0. textMedNote.Text = Medications.GetGeneric(MedicationPatCur.MedicationNum).Notes; //The edit button is not visible if MedicationNum=0. textRxNormDesc.Text = RxNorms.GetDescByRxCui(MedicationPatCur.RxCui.ToString()); }
private void butAddBrand_Click(object sender, System.EventArgs e) { if(gridMain.GetSelectedIndex()==-1){ MessageBox.Show(Lan.g(this,"You must first highlight the generic medication from the list. If it is not already on the list, then you must add it first.")); return; } Medication selected=medList[gridMain.GetSelectedIndex()]; if(selected.MedicationNum!=selected.GenericNum){ MessageBox.Show(Lan.g(this,"The selected medication is not generic.")); return; } Medication MedicationCur=new Medication(); Medications.Insert(MedicationCur);//so that we will have the primary key MedicationCur.GenericNum=selected.MedicationNum; FormMedicationEdit FormME=new FormMedicationEdit(); FormME.MedicationCur=MedicationCur; FormME.IsNew=true; FormME.ShowDialog(); FillGrid(); }
private void gridAllMedications_CellDoubleClick(object sender, ODGridClickEventArgs e) { Medication med = (Medication)gridAllMedications.Rows[e.Row].Tag; if (IsSelectionMode) { SelectedMedicationNum = med.MedicationNum; DialogResult = DialogResult.OK; } else //normal mode from main menu { if (!CultureInfo.CurrentCulture.Name.EndsWith("US") || e.Col != 3) //Not United States RxNorm Column { FormMedicationEdit FormME = new FormMedicationEdit(); FormME.MedicationCur = med; FormME.ShowDialog(); //This window refreshes the Medication cache if the user clicked OK. FillTab(); } } }
private void butEdit_Click(object sender, System.EventArgs e) { Medications.RefreshCache(); FormMedicationEdit FormME = new FormMedicationEdit(); Medication med = Medications.GetMedication(MedicationPatCur.MedicationNum); //The edit button is not visible if MedicationNum=0. if (med == null) //Possible to delete the medication from a separate WS while medication loaded in memory. { MsgBox.Show(this, "An error occurred loading medication."); return; } FormME.ShowDialog(); if (FormME.DialogResult != DialogResult.OK) { return; } MedicationPatCur.RxCui = FormME.MedicationCur.RxCui; textMedName.Text = Medications.GetMedication(MedicationPatCur.MedicationNum).MedName; //The edit button is not visible if MedicationNum=0. textGenericName.Text = Medications.GetGeneric(MedicationPatCur.MedicationNum).MedName; //The edit button is not visible if MedicationNum=0. textMedNote.Text = Medications.GetGeneric(MedicationPatCur.MedicationNum).Notes; //The edit button is not visible if MedicationNum=0. textRxNormDesc.Text = RxNorms.GetDescByRxCui(MedicationPatCur.RxCui.ToString()); }
private void butEdit_Click(object sender, System.EventArgs e) { Medications.Refresh(); FormMedicationEdit FormME=new FormMedicationEdit(); FormME.MedicationCur=Medications.GetMedication(MedicationPatCur.MedicationNum);//The edit button is not visible if MedicationNum=0. FormME.ShowDialog(); if(FormME.DialogResult!=DialogResult.OK){ return; } MedicationPatCur.RxCui=FormME.MedicationCur.RxCui; textMedName.Text=Medications.GetMedication(MedicationPatCur.MedicationNum).MedName;//The edit button is not visible if MedicationNum=0. textGenericName.Text=Medications.GetGeneric(MedicationPatCur.MedicationNum).MedName;//The edit button is not visible if MedicationNum=0. textMedNote.Text=Medications.GetGeneric(MedicationPatCur.MedicationNum).Notes;//The edit button is not visible if MedicationNum=0. textRxNormDesc.Text=RxNorms.GetDescByRxCui(MedicationPatCur.RxCui.ToString()); }
private void butEdit_Click(object sender, System.EventArgs e) { Medications.Refresh(); FormMedicationEdit FormME=new FormMedicationEdit(); FormME.MedicationCur=Medications.GetMedication(MedicationPatCur.MedicationNum); FormME.ShowDialog(); if(FormME.DialogResult!=DialogResult.OK){ return; } textMedName.Text=Medications.GetMedication(MedicationPatCur.MedicationNum).MedName; textGenericName.Text=Medications.GetGeneric(MedicationPatCur.MedicationNum).MedName; textMedNote.Text=Medications.GetGeneric(MedicationPatCur.MedicationNum).Notes; }
private void gridMain_CellDoubleClick(object sender,ODGridClickEventArgs e) { if(IsSelectionMode){ SelectedMedicationNum=medList[e.Row].MedicationNum; DialogResult=DialogResult.OK; } else{//normal mode from main menu //edit FormMedicationEdit FormME=new FormMedicationEdit(); FormME.MedicationCur=medList[e.Row]; FormME.ShowDialog(); FillGrid(); } }
private void butAddGeneric_Click(object sender, System.EventArgs e) { Medication MedicationCur=new Medication(); Medications.Insert(MedicationCur);//so that we will have the primary key MedicationCur.GenericNum=MedicationCur.MedicationNum; FormMedicationEdit FormME=new FormMedicationEdit(); FormME.MedicationCur=MedicationCur; FormME.IsNew=true; FormME.ShowDialog(); FillGrid(); }