public static void updatePerscription(Perscription perscription) { List<Patient> patients = readFile(); foreach (Patient patient in patients) { List<Perscription> perscriptions = patient.getPerscriptions(); for (int k=0; k<perscriptions.Count; k++) { if (perscriptions.ElementAt(k).getId() == perscription.getId()) { perscriptions.RemoveAt(k); perscriptions.Insert(k, perscription); } } } saveAllPatients(patients); }
public void copy(Perscription other) { this.id = other.id; this.medication = other.medication; this.numberOfRefills = other.numberOfRefills; this.expectedSupplyDurationValue = other.expectedSupplyDurationValue; this.expectedSupplyDurationUnit = other.expectedSupplyDurationUnit; this.quantityRemaining = other.quantityRemaining; this.dosageInstruction = other.dosageInstruction; this.asNeeded = other.asNeeded; this.timingPeriod = other.timingPeriod; this.timingPeriodUnit = other.timingPeriodUnit; this.reminders = other.reminders; }
// returns true if you need to get a new perscription object from epic public bool changed(Perscription other) { return this.medication != other.medication || this.numberOfRefills != other.numberOfRefills || this.expectedSupplyDurationValue != other.expectedSupplyDurationValue || this.expectedSupplyDurationUnit != other.expectedSupplyDurationUnit || this.dosageInstruction != other.dosageInstruction || this.asNeeded != other.asNeeded || this.timingPeriod != other.timingPeriod || this.timingPeriodUnit != other.timingPeriodUnit; }