public void ChangeDetails(string conceptName, string strength, MedicationForm medicationForm) { ConceptName = conceptName; Strength = strength; MedicationForm = medicationForm; MedicationFormId = medicationForm.Id; }
public Concept(string conceptName, string strength, MedicationForm medicationForm) { ConceptName = conceptName; Strength = strength; MedicationForm = medicationForm; MedicationFormId = medicationForm.Id; Active = true; }
protected void btnSaveMedication_Click(object sender, EventArgs e) { Medication medication = null; MedicationForm form = null; int selectedFormId = 0; if (txtUID.Value == "0") { if (!IsMedicationUnique(txtDrugName.Value, Convert.ToInt32(txtPackSize.Value), txtStrength.Value, 0)) { divErrorDuplicate.Visible = true; RenderItems(); return; } if (Int32.TryParse(ddlMedicationForm.SelectedValue, out selectedFormId)) { form = GetMedicationForm(selectedFormId); } medication = new Medication { DrugName = txtDrugName.Value, Active = true, PackSize = Convert.ToInt32(txtPackSize.Value), Strength = txtStrength.Value, CatalogNo = txtCatalog.Value, MedicationForm = form }; UnitOfWork.Repository <Medication>().Save(medication); } else { medication = GetMedication(Convert.ToInt32(txtUID.Value)); if (medication != null) { if (!IsMedicationUnique(txtDrugName.Value, Convert.ToInt32(txtPackSize.Value), txtStrength.Value, medication.Id)) { divErrorDuplicate.Visible = true; RenderItems(); return; } medication.DrugName = txtDrugName.Value; medication.PackSize = Convert.ToInt32(txtPackSize.Value); medication.Strength = txtStrength.Value; medication.CatalogNo = txtCatalog.Value; medication.MedicationForm = GetMedicationForm(Convert.ToInt32(ddlMedicationForm.SelectedValue)); UnitOfWork.Repository <Medication>().Update(medication); } } UnitOfWork.Complete(); RenderItems(); divstatus.Visible = true; }