Beispiel #1
0
        /// <summary>
        /// Builds a DocumentoList from IList<!--<Documento>--> and retrieve DocumentoInfo Childs from DB
        /// </summary>
        /// <param name="list"></param>
        /// <returns>DocumentoList</returns>
        public static DocumentoList GetChildList(IList <Documento> list)
        {
            DocumentoList flist = new DocumentoList();

            if (list != null)
            {
                int        sessionCode = Documento.OpenSession();
                CriteriaEx criteria    = null;

                flist.IsReadOnly = false;

                foreach (Documento item in list)
                {
                    criteria = AgenteDocumento.GetCriteria(sessionCode);
                    criteria.AddEq("OidDocumento", item.Oid);
                    criteria.AddOrder("Codigo", true);

                    item.AgenteDocumentos = AgenteDocumentos.GetChildList(criteria.List <AgenteDocumento>());


                    flist.Add(item.GetInfo());
                }

                flist.IsReadOnly = true;

                Documento.CloseSession(sessionCode);
            }

            return(flist);
        }
Beispiel #2
0
        /// <summary>
        /// Builds a AgenteDocumentoList
        /// </summary>
        /// <param name="list"></param>
        /// <returns>AgenteDocumentoList</returns>
        public static AgenteDocumentoList GetList(bool childs)
        {
            CriteriaEx criteria = AgenteDocumento.GetCriteria(AgenteDocumento.OpenSession());

            criteria.Childs = childs;

            criteria.Query = SELECT();

            AgenteDocumentoList list = DataPortal.Fetch <AgenteDocumentoList>(criteria);

            CloseSession(criteria.SessionCode);
            return(list);
        }
Beispiel #3
0
        public static long CountAssociations(long oid)
        {
            CriteriaEx criteria = AgenteDocumento.GetCriteria(AgenteDocumento.OpenSession());

            criteria.Childs = false;

            QueryConditions conditions = new QueryConditions()
            {
                Document = DocumentoInfo.New(oid)
            };

            criteria.Query = AgenteDocumentos.SELECT(conditions);

            AgenteDocumentoList list = DataPortal.Fetch <AgenteDocumentoList>(criteria);

            CloseSession(criteria.SessionCode);
            return(list.Count);
        }