Beispiel #1
0
        // called to retrieve data from the database
        private void DataPortal_Fetch(CriteriaEx criteria)
        {
            try
            {
                SessionCode = criteria.SessionCode;

                Childs = criteria.Childs;

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

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

                    if (Childs)
                    {
                        string query;

                        Tema.DoLOCK(Session());

                        query  = Temas.SELECT_BY_OID(this.Oid);
                        reader = nHManager.Instance.SQLNativeSelect(query, Session());
                        _temas = Temas.GetChildList(reader);
                    }
                }
                else
                {
                    _base.Record.CopyValues((SubmoduloRecord)(criteria.UniqueResult()));

                    //Session().Lock(Session().Get<SubmoduloRecord>(Oid), LockMode.UpgradeNoWait);

                    if (Childs)
                    {
                        criteria = Tema.GetCriteria(Session());
                        criteria.AddEq("OidSubmodulo", this.Oid);
                        _temas = Temas.GetChildList(criteria.List <Tema>());
                    }
                }
            }
            catch (NHibernate.ADOException)
            {
                if (Transaction() != null)
                {
                    Transaction().Rollback();
                }
                throw new iQLockException(moleQule.Library.Resources.Messages.LOCK_ERROR);
            }
            catch (Exception ex)
            {
                if (Transaction() != null)
                {
                    Transaction().Rollback();
                }
                iQExceptionHandler.TreatException(ex);
            }
        }
Beispiel #2
0
        //  private TemaList() { }

        /// <summary>
        /// Retrieve the complete list from db
        /// </summary>
        /// <returns>TemaList</returns>
        public static TemaList GetList(bool childs)
        {
            CriteriaEx criteria = Tema.GetCriteria(TemaList.OpenSession());

            criteria.Childs = childs;
            criteria.Query  = SELECT();

            //No criteria. Retrieve all de List
            TemaList list = DataPortal.Fetch <TemaList>(criteria);

            CloseSession(criteria.SessionCode);

            return(list);
        }
Beispiel #3
0
        /// <summary>
        /// Retrieve the complete list from db
        /// </summary>
        /// <returns>SubmoduloList</returns>
        public static TemaList GetModuloList(long oid_modulo, bool childs)
        {
            CriteriaEx criteria = Tema.GetCriteria(TemaList.OpenSession());

            criteria.Childs = childs;
            criteria.Query  = Temas.SELECT_BY_MODULO(oid_modulo);

            //No criteria. Retrieve all de List
            TemaList list = DataPortal.Fetch <TemaList>(criteria);

            CloseSession(criteria.SessionCode);

            return(list);
        }
Beispiel #4
0
        private void Fetch(Submodulo source)
        {
            try
            {
                SessionCode = source.SessionCode;

                _base.CopyValues(source);

                CriteriaEx criteria;

                criteria = Tema.GetCriteria(Session());
                criteria.AddEq("OidSubmodulo", this.Oid);
                _temas = Temas.GetChildList(criteria.List <Tema>());
            }
            catch (Exception ex)
            {
                iQExceptionHandler.TreatException(ex);
            }

            MarkOld();
        }