Ejemplo n.º 1
0
        public static void Replenish(Int32 pzn, Int32 quantity, DateTime?dateOfAction, PharmacyContainer db)
        {
            Drug drug = GetDrug(pzn, db);

            drug.Apply(ReplenishEvent.Create(drug, quantity, FailOnNull(dateOfAction)));
            db.SaveChanges();
        }
Ejemplo n.º 2
0
 public static void Restock(Int32 pzn, Int32 quantity, DateTime dateOfAction)
 {
     using (PharmacyContainer db = new PharmacyContainer())
     {
         Drug drug = GetDrug(pzn, db);
         drug.Apply(RestockEvent.Create(drug, quantity, dateOfAction));
         db.SaveChanges();
     }
 }
Ejemplo n.º 3
0
 public void ApplyDrug(Drug drug)
 {
     Drug.DrugState state = drugs.Where(d => d.drug == drug).FirstOrDefault() ?? drug.GetDrugState(this);
     state.strength++;
     drug.Apply(state);
     if (!drugs.Contains(state))
     {
         drugs.Add(state);
     }
 }