/// <summary> /// Builds a PuertoList from IList<!--<Puerto>--> and retrieve PuertoInfo Childs from DB /// </summary> /// <param name="list"></param> /// <returns>PuertoList</returns> public static PuertoList GetChildList(IList <Puerto> list) { PuertoList flist = new PuertoList(); if (list != null) { int sessionCode = Puerto.OpenSession(); CriteriaEx criteria = null; flist.IsReadOnly = false; foreach (Puerto item in list) { criteria = PuertoDespachante.GetCriteria(sessionCode); criteria.AddEq("OidPuerto", item.Oid); criteria.AddOrder("Codigo", true); item.PuertoDespachantes = PuertoDespachantes.GetChildList(criteria.List <PuertoDespachante>()); flist.AddItem(item.GetInfo()); } flist.IsReadOnly = true; Puerto.CloseSession(sessionCode); } return(flist); }
/// <summary> /// Builds a PuertoDespachanteList /// </summary> /// <param name="list"></param> /// <returns>PuertoDespachanteList</returns> public static PuertoDespachanteList GetList(bool childs) { CriteriaEx criteria = PuertoDespachante.GetCriteria(PuertoDespachante.OpenSession()); criteria.Childs = childs; criteria.Query = SELECT(); PuertoDespachanteList list = DataPortal.Fetch <PuertoDespachanteList>(criteria); CloseSession(criteria.SessionCode); return(list); }