Example #1
0
        private void Fetch(int session_code, IDataReader source)
        {
            try
            {
                _base.CopyValues(source);

                if (Childs)
                {
                    Ampliacion.LOCK(AppContext.ActiveSchema.Code);

                    string      query  = Ampliaciones.SELECT_BY_DISCREPANCIA(this.Oid);
                    IDataReader reader = nHManager.Instance.SQLNativeSelect(query, Session(session_code));
                    _ampliaciones = Ampliaciones.GetChildList(reader);

                    AccionCorrectora.LOCK(AppContext.ActiveSchema.Code);

                    query        = AccionesCorrectoras.SELECT_BY_DISCREPANCIA(this.Oid);
                    reader       = nHManager.Instance.SQLNativeSelect(query, Session(session_code));
                    _correctoras = AccionesCorrectoras.GetChildList(reader);
                }
            }
            catch (Exception ex)
            {
                iQExceptionHandler.TreatException(ex);
            }

            MarkOld();
        }
Example #2
0
        private void Fetch(int session_code, IDataReader source)
        {
            try
            {
                _base.CopyValues(source);

                if (Childs)
                {
                    AccionCorrectora.LOCK(AppContext.ActiveSchema.Code);

                    string      query  = AccionesCorrectoras.SELECT_BY_INFORME_CORRECTOR(this.Oid);
                    IDataReader reader = nHManager.Instance.SQLNativeSelect(query, Session(session_code));
                    _acciones = AccionesCorrectoras.GetChildList(reader);

                    NotificacionInterna.LOCK(AppContext.ActiveSchema.Code);

                    query           = NotificacionesInternas.SELECT_BY_INFORME_CORRECTOR(this.Oid, TipoNotificacionAsociado.INFORME_ACCIONES_CORRECTORAS);
                    reader          = nHManager.Instance.SQLNativeSelect(query, Session(session_code));
                    _notificaciones = NotificacionesInternas.GetChildList(reader);
                }
            }
            catch (Exception ex)
            {
                iQExceptionHandler.TreatException(ex);
            }

            MarkOld();
        }
Example #3
0
        // called to retrieve data from the database
        private void DataPortal_Fetch(CriteriaEx criteria)
        {
            try
            {
                SessionCode = criteria.SessionCode;

                Childs = criteria.Childs;

                if (nHMng.UseDirectSQL)
                {
                    InformeCorrector.LOCK(AppContext.ActiveSchema.Code);

                    IDataReader reader = InformeCorrector.DoSELECT(AppContext.ActiveSchema.Code, Session(), criteria.Oid);

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

                    if (Childs)
                    {
                        AccionCorrectora.LOCK(AppContext.ActiveSchema.Code);

                        string query = AccionesCorrectoras.SELECT_BY_INFORME_CORRECTOR(this.Oid);
                        reader    = nHManager.Instance.SQLNativeSelect(query, Session());
                        _acciones = AccionesCorrectoras.GetChildList(reader);

                        NotificacionInterna.LOCK(AppContext.ActiveSchema.Code);

                        query           = NotificacionesInternas.SELECT_BY_INFORME_CORRECTOR(this.Oid, TipoNotificacionAsociado.INFORME_ACCIONES_CORRECTORAS);
                        reader          = nHManager.Instance.SQLNativeSelect(query, Session());
                        _notificaciones = NotificacionesInternas.GetChildList(reader);
                    }
                }
            }
            catch (Exception ex)
            {
                if (Transaction() != null)
                {
                    Transaction().Rollback();
                }
                iQExceptionHandler.TreatException(ex);
            }
        }
Example #4
0
        private void Fetch(Discrepancia source)
        {
            try
            {
                SessionCode = source.SessionCode;

                _base.CopyValues(source);

                CriteriaEx criteria = Ampliacion.GetCriteria(Session());
                criteria.AddEq("OidDiscrepancia", this.Oid);
                _ampliaciones = Ampliaciones.GetChildList(criteria.List <Ampliacion>());

                criteria = AccionCorrectora.GetCriteria(Session());
                criteria.AddEq("OidDiscrepancia", this.Oid);
                _correctoras = AccionesCorrectoras.GetChildList(criteria.List <AccionCorrectora>());
            }
            catch (Exception ex)
            {
                iQExceptionHandler.TreatException(ex);
            }

            MarkOld();
        }
Example #5
0
        private void Fetch(InformeCorrector source)
        {
            try
            {
                SessionCode = source.SessionCode;

                _base.CopyValues(source);

                CriteriaEx criteria = AccionCorrectora.GetCriteria(Session());
                criteria.AddEq("OidInformeCorrector", this.Oid);
                _acciones = AccionesCorrectoras.GetChildList(criteria.List <AccionCorrectora>());

                criteria = NotificacionInterna.GetCriteria(Session());
                criteria.AddEq("OidAsociado", this.Oid);
                criteria.AddEq("TipoAsociado", (long)TipoNotificacionAsociado.INFORME_ACCIONES_CORRECTORAS);
                _notificaciones = NotificacionesInternas.GetChildList(criteria.List <NotificacionInterna>());
            }
            catch (Exception ex)
            {
                iQExceptionHandler.TreatException(ex);
            }

            MarkOld();
        }
Example #6
0
        // called to retrieve data from the database
        private void DataPortal_Fetch(CriteriaEx criteria)
        {
            try
            {
                SessionCode = criteria.SessionCode;

                Childs = criteria.Childs;

                if (nHMng.UseDirectSQL)
                {
                    Discrepancia.LOCK(AppContext.ActiveSchema.Code);

                    IDataReader reader = Discrepancia.DoSELECT(AppContext.ActiveSchema.Code, Session(), criteria.Oid);

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

                    if (Childs)
                    {
                        Ampliacion.LOCK(AppContext.ActiveSchema.Code);

                        string query = Ampliaciones.SELECT_BY_DISCREPANCIA(this.Oid);
                        reader        = nHManager.Instance.SQLNativeSelect(query, Session());
                        _ampliaciones = Ampliaciones.GetChildList(reader);

                        AccionCorrectora.LOCK(AppContext.ActiveSchema.Code);

                        query        = AccionesCorrectoras.SELECT_BY_DISCREPANCIA(this.Oid);
                        reader       = nHManager.Instance.SQLNativeSelect(query, Session());
                        _correctoras = AccionesCorrectoras.GetChildList(reader);
                    }
                }
                else
                {
                    _base.Record.CopyValues((DiscrepanciaRecord)(criteria.UniqueResult()));

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

                    if (Childs)
                    {
                        criteria = Ampliacion.GetCriteria(Session());
                        criteria.AddEq("OidDiscrepancia", this.Oid);
                        _ampliaciones = Ampliaciones.GetChildList(criteria.List <Ampliacion>());
                    }
                }
            }
            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);
            }
        }