Exemplo n.º 1
0
        private static MedicalRecordCabinetDto CustomConversion(Patient src)
        {
            var cabinet = new MedicalRecordCabinetDto();

            cabinet.Folders.Refill(BuildFolders(src.MedicalRecords));
            return(cabinet);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Commits the changes on medical record cabinet.
        /// </summary>
        /// <param name="patient">The patient.</param>
        /// <param name="cabinet">The cabinet.</param>
        public void Update(MedicalRecordCabinetDto cabinet)
        {
            cabinet.ForeachRecords(record =>
            {
                switch (record.State)
                {
                case State.Clean:
                    //Nothing to do
                    break;

                case State.Updated:
                    record.LastUpdate = DateTime.Now;
                    this.Update(record);
                    break;

                case State.Created:
                    record.LastUpdate
                          = record.CreationDate
                          = DateTime.Now;
                    new Creator(this.Session).Create(record);
                    break;

                case State.Removed:
                    new Remover(this.Session).Remove(record);
                    break;

                default:
                    Assert.FailOnEnumeration(record.State);
                    break;
                }
            });
        }
 /// <summary>
 /// Executes the specified action on all the medical records of the specified cabinet
 /// </summary>
 /// <param name="cabinet">The cabinet.</param>
 /// <param name="action">The action.</param>
 public static void ForeachRecords(this MedicalRecordCabinetDto cabinet, Action <MedicalRecordDto> action)
 {
     foreach (var folder in cabinet.Folders)
     {
         foreach (var record in folder.Records)
         {
             action(record);
         }
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// Commits the changes on medical record cabinet.
 /// </summary>
 /// <param name="patient">The patient.</param>
 /// <param name="cabinet">The cabinet.</param>
 public void Update(MedicalRecordCabinetDto cabinet)
 {
     new Updator(this.Session).Update(cabinet);
 }
 public static TitledMedicalRecordCabinetDto CreateFrom(MedicalRecordCabinetDto cabinet)
 {
     return(Mapper.Map <MedicalRecordCabinetDto, TitledMedicalRecordCabinetDto>(cabinet));
 }