public MedicineEffectsObject(MedicineEffectsDbRecord dbRecord) : base(dbRecord)
 {
     DbRecord.Effect   = DbRecord.Effect ?? new EffectDbRecord();
     DbRecord.Medicine = DbRecord.Medicine ?? new MedicineDbRecord();
     Effect            = new EffectObject(DbRecord.Effect);
     Medicine          = new MedicineObject(DbRecord.Medicine);
 }
        public static MedicineEffectsObject Create(EffectObject effect, MedicineObject medicine,
                                                   DateTime?validFrom = null, DateTime?validTo = null)
        {
            var o = new MedicineEffectsDbRecord
            {
                Effect    = effect?.DbRecord ?? new EffectDbRecord(),
                Medicine  = medicine?.DbRecord ?? new MedicineDbRecord(),
                ValidFrom = validFrom ?? DateTime.MinValue,
                ValidTo   = validTo ?? DateTime.MaxValue
            };

            o.EffectID   = o.Effect.ID;
            o.MedicineID = o.Medicine.ID;
            return(new MedicineEffectsObject(o));
        }
示例#3
0
 public void EffectsInMedicine(EffectObject effectObject)
 {
     if (effectObject is null)
     {
         return;
     }
     if (effectObject.DbRecord.ID == Constants.Unspecified)
     {
         return;
     }
     if (effectsInMedicine.Find(x => x.DbRecord.ID == effectObject.DbRecord.ID) != null)
     {
         return;
     }
     effectsInMedicine.Add(effectObject);
 }