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 void Fetch(int session_code, IDataReader source)
        {
            try
            {
                _base.CopyValues(source);

                if (Childs)
                {
                    string query;

                    Tema.DoLOCK(Session(session_code));
                    query = Temas.SELECT_BY_SUBMODULO(this.Oid);
                    IDataReader reader = nHManager.Instance.SQLNativeSelect(query, Session(session_code));
                    _temas = Temas.GetChildList(reader, GChilds);
                }
            }
            catch (Exception ex)
            {
                iQExceptionHandler.TreatException(ex);
            }

            MarkOld();
        }