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);
        }
        internal void CopyValues(AgenteDocumento source)
        {
            if (source == null)
            {
                return;
            }

            _record.CopyValues(source.Base.Record);
        }
Beispiel #3
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 #4
0
        // called to copy objects data from list
        private void Fetch(IDataReader reader)
        {
            this.RaiseListChangedEvents = false;

            IsReadOnly = false;

            while (reader.Read())
            {
                this.Add(AgenteDocumento.GetChild(reader).GetInfo());
            }

            IsReadOnly = true;

            this.RaiseListChangedEvents = true;
        }
Beispiel #5
0
        private void Fetch(Documento source)
        {
            _base.CopyValues(source);

            if (Childs)
            {
                string      query = string.Empty;
                IDataReader reader;

                AgenteDocumento.DoLOCK(Session());
                query              = AgenteDocumentos.SELECT(this);
                reader             = nHManager.Instance.SQLNativeSelect(query, Session());
                _agente_documentos = AgenteDocumentos.GetChildList(reader);
            }

            MarkOld();
        }
Beispiel #6
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);
        }
Beispiel #7
0
        // called to retrieve data from the database
        private void DataPortal_Fetch(CriteriaEx criteria)
        {
            try
            {
                _base.Record.Oid = 0;;
                SessionCode      = criteria.SessionCode;
                Childs           = criteria.Childs;

                if (nHMng.UseDirectSQL)
                {
                    Documento.DoLOCK(Session());
                    IDataReader reader = nHMng.SQLNativeSelect(criteria.Query, Session());

                    if (reader.Read())
                    {
                        _base.CopyValues(reader);
                    }

                    if (Childs)
                    {
                        string query = string.Empty;

                        AgenteDocumento.DoLOCK(Session());
                        query              = AgenteDocumentos.SELECT(this);
                        reader             = nHManager.Instance.SQLNativeSelect(query, Session());
                        _agente_documentos = AgenteDocumentos.GetChildList(reader);
                    }
                }
            }
            catch (Exception ex)
            {
                if (Transaction() != null)
                {
                    Transaction().Rollback();
                }
                iQExceptionHandler.TreatException(ex, new object[] { criteria.Query });
            }
        }
Beispiel #8
0
 public static string SELECT(QueryConditions conditions)
 {
     return(AgenteDocumento.SELECT(conditions, false));
 }
Beispiel #9
0
 public static string SELECT()
 {
     return(AgenteDocumento.SELECT(new QueryConditions(), false));
 }