Esempio n. 1
0
        private void Fetch(InformeDiscrepancia source)
        {
            try
            {
                SessionCode = source.SessionCode;

                _base.CopyValues(source);

                CriteriaEx criteria = InformeAmpliacion.GetCriteria(Session());
                criteria.AddEq("OidInformeDiscrepancia", this.Oid);
                _ampliaciones = InformesAmpliaciones.GetChildList(criteria.List <InformeAmpliacion>());

                criteria = InformeCorrector.GetCriteria(Session());
                criteria.AddEq("OidInformeDiscrepancia", this.Oid);
                _correctores = InformesCorrectores.GetChildList(criteria.List <InformeCorrector>());

                criteria = Discrepancia.GetCriteria(Session());
                criteria.AddEq("OidInformeDiscrepancia", this.Oid);
                _discrepancias = Discrepancias.GetChildList(criteria.List <Discrepancia>());

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

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

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

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

                    query        = InformesCorrectores.SELECT_BY_INFORME_DISCREPANCIA(this.Oid);
                    reader       = nHManager.Instance.SQLNativeSelect(query, Session(session_code));
                    _correctores = InformesCorrectores.GetChildList(session_code, reader);

                    query          = Discrepancias.SELECT_BY_INFORME_DISCREPANCIA(this.Oid);
                    reader         = nHManager.Instance.SQLNativeSelect(query, Session(session_code));
                    _discrepancias = Discrepancias.GetChildList(session_code, reader);

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

            MarkOld();
        }
Esempio n. 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)
                {
                    InformeDiscrepancia.LOCK(AppContext.ActiveSchema.Code);

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

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

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

                        string query = InformesAmpliaciones.SELECT_BY_INFORME_DISCREPANCIA(this.Oid);
                        reader        = nHManager.Instance.SQLNativeSelect(query, Session());
                        _ampliaciones = InformesAmpliaciones.GetChildList(criteria.SessionCode, reader);

                        InformeCorrector.LOCK(AppContext.ActiveSchema.Code);

                        query        = InformesCorrectores.SELECT_BY_INFORME_DISCREPANCIA(this.Oid);
                        reader       = nHManager.Instance.SQLNativeSelect(query, Session());
                        _correctores = InformesCorrectores.GetChildList(criteria.SessionCode, reader);

                        Discrepancia.LOCK(AppContext.ActiveSchema.Code);

                        query          = Discrepancias.SELECT_BY_INFORME_DISCREPANCIA(this.Oid);
                        reader         = nHManager.Instance.SQLNativeSelect(query, Session());
                        _discrepancias = Discrepancias.GetChildList(criteria.SessionCode, reader);

                        NotificacionInterna.LOCK(AppContext.ActiveSchema.Code);

                        query           = NotificacionesInternas.SELECT_BY_INFORME_DISCREPANCIA(this.Oid, TipoNotificacionAsociado.INFORME_DISCREPANCIAS);
                        reader          = nHManager.Instance.SQLNativeSelect(query, Session());
                        _notificaciones = NotificacionesInternas.GetChildList(reader);
                    }
                }
                else
                {
                    _base.Record.CopyValues((InformeDiscrepanciaRecord)(criteria.UniqueResult()));

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

                    if (Childs)
                    {
                        criteria = InformeAmpliacion.GetCriteria(Session());
                        criteria.AddEq("OidInformeDiscrepancia", this.Oid);
                        _ampliaciones = InformesAmpliaciones.GetChildList(criteria.List <InformeAmpliacion>());

                        criteria = InformeCorrector.GetCriteria(Session());
                        criteria.AddEq("OidInformeDiscrepancia", this.Oid);
                        _correctores = InformesCorrectores.GetChildList(criteria.List <InformeCorrector>());

                        criteria = Discrepancia.GetCriteria(Session());
                        criteria.AddEq("OidInformeDiscrepancia", this.Oid);
                        _discrepancias = Discrepancias.GetChildList(criteria.List <Discrepancia>());

                        criteria = NotificacionInterna.GetCriteria(Session());
                        criteria.AddEq("OidAsociado", this.Oid);
                        criteria.AddEq("TipoAsociado", (long)TipoNotificacionAsociado.INFORME_DISCREPANCIAS);
                        _notificaciones = NotificacionesInternas.GetChildList(criteria.List <NotificacionInterna>());
                    }
                }
            }
            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);
            }
        }