예제 #1
0
        public static IMAppointmentDTOA Convert(EntityEN en, NHibernate.ISession session = null)
        {
            IMAppointmentDTOA    dto = null;
            IMAppointmentRESTCAD iMAppointmentRESTCAD = null;
            IMAppointmentCEN     iMAppointmentCEN     = null;
            IMAppointmentCP      iMAppointmentCP      = null;

            if (en != null)
            {
                dto = new IMAppointmentDTOA();
                iMAppointmentRESTCAD = new IMAppointmentRESTCAD(session);
                iMAppointmentCEN     = new IMAppointmentCEN(iMAppointmentRESTCAD);
                iMAppointmentCP      = new IMAppointmentCP(session);


                IMAppointmentEN enHijo = iMAppointmentRESTCAD.ReadOIDDefault(en.Id);



                //
                // Attributes

                dto.Id = en.Id;

                dto.Name = en.Name;


                if (enHijo != null)
                {
                    dto.Date = enHijo.Date;
                }


                dto.Description = en.Description;


                //
                // TravesalLink

                /* Rol: IMAppointment o--> Appointment */
                dto.ValueAppointment = AppointmentAssembler.Convert((AppointmentEN)enHijo.Appointment, session);


                //
                // Service
            }

            return(dto);
        }
        public static CareActivityDTOA Convert(CareActivityEN en, NHibernate.ISession session = null)
        {
            CareActivityDTOA    dto = null;
            CareActivityRESTCAD careActivityRESTCAD = null;
            CareActivityCEN     careActivityCEN     = null;
            CareActivityCP      careActivityCP      = null;

            if (en != null)
            {
                dto = new CareActivityDTOA();
                careActivityRESTCAD = new CareActivityRESTCAD(session);
                careActivityCEN     = new CareActivityCEN(careActivityRESTCAD);
                careActivityCP      = new CareActivityCP(session);



                //
                // Attributes

                dto.Id = en.Id;

                dto.Name = en.Name;


                dto.Description = en.Description;


                dto.Periodicity = en.Periodicity;


                dto.Duration = en.Duration;


                dto.Location = en.Location;


                dto.OutcomeCode = en.OutcomeCode;


                dto.TypeActivity = en.TypeActivity;


                dto.ActivityCode = en.ActivityCode;


                //
                // TravesalLink

                /* Rol: CareActivity o--> Comunication */
                dto.Comunications = null;
                List <ComunicationEN> Comunications = careActivityRESTCAD.Comunications(en.Id).ToList();
                if (Comunications != null)
                {
                    dto.Comunications = new List <ComunicationDTOA>();
                    foreach (ComunicationEN entry in Comunications)
                    {
                        dto.Comunications.Add(ComunicationAssembler.Convert(entry, session));
                    }
                }

                /* Rol: CareActivity o--> Appointment */
                dto.Appointments = null;
                List <AppointmentEN> Appointments = careActivityRESTCAD.Appointments(en.Id).ToList();
                if (Appointments != null)
                {
                    dto.Appointments = new List <AppointmentDTOA>();
                    foreach (AppointmentEN entry in Appointments)
                    {
                        dto.Appointments.Add(AppointmentAssembler.Convert(entry, session));
                    }
                }

                /* Rol: CareActivity o--> Medication */
                dto.Medications = MedicationAssembler.Convert((MedicationEN)en.Medication, session);

                /* Rol: CareActivity o--> NutritionOrder */
                dto.NutritionOrders = NutritionOrderAssembler.Convert((NutritionOrderEN)en.NutritionOrder, session);


                //
                // Service
            }

            return(dto);
        }