public static PuntoReciclajeDTOA Convert(PuntoReciclajeEN en, NHibernate.ISession session = null) { PuntoReciclajeDTOA dto = null; PuntoReciclajeRESTCAD puntoReciclajeRESTCAD = null; PuntoReciclajeCEN puntoReciclajeCEN = null; PuntoReciclajeCP puntoReciclajeCP = null; if (en != null) { dto = new PuntoReciclajeDTOA(); puntoReciclajeRESTCAD = new PuntoReciclajeRESTCAD(session); puntoReciclajeCEN = new PuntoReciclajeCEN(puntoReciclajeRESTCAD); puntoReciclajeCP = new PuntoReciclajeCP(session); // // Attributes dto.Id = en.Id; dto.Latitud = en.Latitud; dto.Longitud = en.Longitud; dto.EsValido = en.EsValido; // // TravesalLink /* Rol: PuntoReciclaje o--> Contenedor */ dto.Contenedores = null; List <ContenedorEN> Contenedores = puntoReciclajeRESTCAD.Contenedores(en.Id).ToList(); if (Contenedores != null) { dto.Contenedores = new List <ContenedorDTOA>(); foreach (ContenedorEN entry in Contenedores) { dto.Contenedores.Add(ContenedorAssembler.Convert(entry, session)); } } /* Rol: PuntoReciclaje o--> Estancia */ dto.EstanciaPunto = EstanciaAssembler.Convert((EstanciaEN)en.Estancia, session); // // Service } return(dto); }
public static AccionReciclarDTOA Convert(AccionEN en, NHibernate.ISession session = null) { AccionReciclarDTOA dto = null; AccionReciclarRESTCAD accionReciclarRESTCAD = null; AccionReciclarCEN accionReciclarCEN = null; AccionReciclarCP accionReciclarCP = null; if (en != null) { dto = new AccionReciclarDTOA(); accionReciclarRESTCAD = new AccionReciclarRESTCAD(session); accionReciclarCEN = new AccionReciclarCEN(accionReciclarRESTCAD); accionReciclarCP = new AccionReciclarCP(session); AccionReciclarEN enHijo = accionReciclarRESTCAD.ReadOIDDefault(en.Id); // // Attributes dto.Id = en.Id; if (enHijo != null) { dto.Cantidad = enHijo.Cantidad; } dto.Fecha = en.Fecha; // // TravesalLink /* Rol: AccionReciclar o--> Item */ dto.ItemAccion = ItemAssembler.Convert((ItemEN)enHijo.Item, session); /* Rol: AccionReciclar o--> Contenedor */ dto.ContenedorAccion = ContenedorAssembler.Convert((ContenedorEN)enHijo.Contenedor, session); // // Service } return(dto); }