Ejemplo n.º 1
0
        /// <summary>
        /// Creates the specified illness period for the specified patient.
        /// </summary>
        /// <param name="period">The period.</param>
        /// <param name="patient">The patient.</param>
        public void Create(IllnessPeriodDto period, LightPatientDto patient)
        {
            var entity        = this.Session.Get <Patient>(patient.Id);
            var illnessPeriod = Mapper.Map <IllnessPeriodDto, IllnessPeriod>(period);

            entity.IllnessHistory.Add(illnessPeriod);
            this.Session.SaveOrUpdate(entity);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Removes the specified illness period from the specified patient's
        /// illness history.
        /// </summary>
        /// <param name="illnessPeriod">The illness period.</param>
        /// <param name="forPatient">The patient.</param>
        public void Remove(IllnessPeriodDto illnessPeriod, LightPatientDto forPatient)
        {
            Assert.IsNotNull(illnessPeriod, "illnessPeriod");
            Assert.IsNotNull(forPatient, "patient");

            var entity = this.Session.Get <Patient>(forPatient.Id);

            for (int i = 0; i < entity.IllnessHistory.Count; i++)
            {
                if (entity.IllnessHistory[i].Id == illnessPeriod.Id)
                {
                    entity.IllnessHistory.RemoveAt(i);
                    break;
                }
            }
            this.Session.Update(entity);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Creates the specified illness period for the specified patient.
 /// </summary>
 /// <param name="period">The period.</param>
 /// <param name="patient">The patient.</param>
 public void Create(IllnessPeriodDto period, LightPatientDto patient)
 {
     new Creator(this.Session).Create(period, patient);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Removes the specified illness period from the specified patient's
 /// illness history.
 /// </summary>
 /// <param name="illnessPeriod">The illness period.</param>
 /// <param name="patient">The patient.</param>
 public void Remove(IllnessPeriodDto illnessPeriod, LightPatientDto patient)
 {
     new Remover(this.Session).Remove(illnessPeriod, patient);
 }