public bool EditDrug(Drug drug) { Drug ret = DrugRepository.GetInstance().Update(drug); if (ret != null) { return(true); } else { return(false); } }
public bool DisableDrugUse(Drug drug) { drug.InUse = false; Drug ret = DrugRepository.GetInstance().Update(drug); if (ret != null) { return(true); } else { return(false); } }
public Prescription Read(uint id) { List <string[]> data = Persistence.ReadEntryByPrimaryKey(path, id.ToString()); if (data.Count == 1) { uint presID = uint.Parse(data[0][0]); uint drugID = uint.Parse(data[0][1]); Drug d = DrugRepository.GetInstance().Read(drugID); uint num = uint.Parse(data[0][2]); string usage = data[0][3]; Prescription ret = new Prescription(num, usage, d); ret.SetId(presID); return(ret); } return(null); }
public List <Drug> SearchDrugs(string query) { List <Drug> list = DrugRepository.GetInstance().GetAll(); if (query.Equals("")) { return(list); } List <Drug> ret = new List <Drug>(); foreach (Drug d in list) { if (d.InUse && d.Name.Contains(query)) { ret.Add(d); } } return(ret); }
public Examination AppendExamination(Examination examination, MedicalRecord medicalRecord) { foreach (Prescription p in examination.Prescription) { DrugStateChange oldState = p.drug.drugStateChange; DrugStateChange newState = new DrugStateChange(DateTime.Now, oldState.TotalNumber - (int)p.Number, oldState.Threshold, oldState.DrugId); DrugStateChangeRepository.GetInstance().Create(newState); p.drug.drugStateChange = newState; DrugRepository.GetInstance().Update(p.drug); PrescriptionRepository.GetInstance().Create(p); } foreach (Referral r in examination.Referral) { ReferralRepository.GetInstance().Create(r); } examination = ExaminationRepository.GetInstance().Create(examination); medicalRecord.AddExamination(examination); MedicalRecordRepository.GetInstance().Update(medicalRecord); return(examination); }
public Drug AddDrug(Drug drug) { return(DrugRepository.GetInstance().Create(drug)); }
public List <Drug> GetAllDrugs() { return(DrugRepository.GetInstance().GetAll()); }