예제 #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);
            }
        }
예제 #2
0
        private void DataPortal_Fetch(CriteriaEx criteria)
        {
            try
            {
                _base.Record.Oid = 0;
                SessionCode      = criteria.SessionCode;

                _base.CopyValues((SecureItem)(criteria.UniqueResult()));
            }
            catch (NHibernate.ADOException)
            {
                if (Transaction() != null)
                {
                    Transaction().Rollback();
                }
                throw new iQLockException(Resources.Messages.LOCK_ERROR);
            }
            catch (Exception ex)
            {
                if (Transaction() != null)
                {
                    Transaction().Rollback();
                }
                throw new iQPersistentException(iQExceptionHandler.GetAllMessages(ex));
            }
        }
        private void DataPortal_Delete(CriteriaCs criteria)
        {
            try
            {
                // Iniciamos la conexion y la transaccion
                SessionCode = OpenSession();
                BeginTransaction();

                //Si no hay integridad referencial, aquí se deben borrar las listas hijo
                CriteriaEx criterio = GetCriteria();
                criterio.AddOidSearch(criteria.Oid);
                Session().Delete((DepartamentoRecord)(criterio.UniqueResult()));
                Transaction().Commit();
            }
            catch (Exception ex)
            {
                if (Transaction() != null)
                {
                    Transaction().Rollback();
                }
                iQExceptionHandler.TreatException(ex);
            }
            finally
            {
                CloseSession();
            }
        }
예제 #4
0
        private void DataPortal_Delete(CriteriaCs criteria)
        {
            try
            {
                // Iniciamos la conexion y la transaccion
                SessionCode = OpenSession();
                BeginTransaction();

                CriteriaEx criterio = GetCriteria();
                criterio.AddOidSearch(criteria.Oid);
                Session().Delete((SecureItemRecord)(criterio.UniqueResult()));

                Transaction().Commit();
            }
            catch (Exception ex)
            {
                if (Transaction() != null)
                {
                    Transaction().Rollback();
                }
                throw new iQPersistentException(iQExceptionHandler.GetAllMessages(ex));
            }
            finally
            {
                CloseSession();
            }
        }
예제 #5
0
        private void DataPortal_Delete(CriteriaCs criteria)
        {
            try
            {
                SessionCode = OpenSession();
                BeginTransaction();

                //Si no hay integridad referencial, aquí se deben borrar las listas hijo
                CriteriaEx criterio = GetCriteria();
                criterio.AddOidSearch(criteria.Oid);

                TransporterRecord obj = (TransporterRecord)(criterio.UniqueResult());
                _base.Record.CopyValues(obj);

                _base.ProviderBase.Productos = ProductoProveedores.GetChildList(this, false);
                _base.ProviderBase.Productos.Clear();
                _base.ProviderBase.Productos.Update(this);

                Session().Delete(obj);
                Transaction().Commit();
            }
            catch (Exception ex)
            {
                if (Transaction() != null)
                {
                    Transaction().Rollback();
                }
                iQExceptionHandler.TreatException(ex);
            }
            finally
            {
                CloseSession();
            }
        }
예제 #6
0
        private void DataPortal_Fetch(CriteriaEx criteria)
        {
            try
            {
                Oid         = 0;
                SessionCode = criteria.SessionCode;

                CopyValues((Schema)(criteria.UniqueResult()));

                Session().Lock(Session().Get <Schema>(Oid), LockMode.UpgradeNoWait);
            }
            catch (NHibernate.ADOException)
            {
                if (Transaction() != null)
                {
                    Transaction().Rollback();
                }
                throw new iQLockException(Resources.Messages.LOCK_ERROR);
            }
            catch (Exception ex)
            {
                if (Transaction() != null)
                {
                    Transaction().Rollback();
                }
                throw new iQPersistentException(iQExceptionHandler.GetAllMessages(ex));
            }
        }
예제 #7
0
        // called to retrieve data from the database
        private void DataPortal_Fetch(CriteriaEx criteria)
        {
            try
            {
                SessionCode = criteria.SessionCode;

                Childs = criteria.Childs;

                if (nHMng.UseDirectSQL)
                {
                    Sesion.DoLOCK(Session());

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

                    if (reader.Read())
                    {
                        _base.CopyValues(reader);
                    }
                }
                else
                {
                    _base.Record.CopyValues((SesionRecord)(criteria.UniqueResult()));
                }
            }
            catch (Exception ex)
            {
                if (Transaction() != null)
                {
                    Transaction().Rollback();
                }
                iQExceptionHandler.TreatException(ex);
            }
        }
예제 #8
0
        private void DataPortal_Delete(CriteriaCs criteria)
        {
            // Iniciamos la conexion y la transaccion
            SessionCode = OpenSession();
            BeginTransaction();

            try
            {
                CriteriaEx criterio = GetCriteria();
                criterio.AddOidSearch(criteria.Oid);
                Session().Delete((Schema)(criterio.UniqueResult()));

                Transaction().Commit();

                //Borramos los usuarios que únicamente tenían acceso a esta empresa
                Users usuarios = Users.GetNoSchemaList();

                foreach (User usr in usuarios)
                {
                    User.Delete(usr.Oid);
                }
            }
            catch (Exception ex)
            {
                if (Transaction() != null)
                {
                    Transaction().Rollback();
                }
                throw new iQPersistentException(iQExceptionHandler.GetAllMessages(ex));
            }
            finally
            {
                CloseSession();
            }
        }
        private void DataPortal_Delete(CriteriaCs criterio)
        {
            try
            {
                //Iniciamos la conexion y la transaccion
                SessionCode = OpenSession();
                BeginTransaction();

                CriteriaEx criteria = GetCriteria();
                criteria.AddOidSearch(criterio.Oid);

                // Obtenemos el objeto
                ClaseTeoricaRecord obj = (ClaseTeoricaRecord)(criteria.UniqueResult());
                Session().Delete(Session().Get <ClaseTeoricaRecord>(obj.Oid));

                Transaction().Commit();
            }
            catch (Exception ex)
            {
                if (Transaction() != null)
                {
                    Transaction().Rollback();
                }
                iQExceptionHandler.TreatException(ex);
            }
            finally
            {
                CloseSession();
            }
        }
        // called to retrieve data from the database
        private void DataPortal_Fetch(CriteriaEx criteria)
        {
            try
            {
                SessionCode = criteria.SessionCode;

                Childs = criteria.Childs;

                if (nHMng.UseDirectSQL)
                {
                    IncidenciaCronograma.DoLOCK(Session());

                    IDataReader reader = nHMng.SQLNativeSelect(criteria.Query, Session());

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

                    if (Childs)
                    {
                        IncidenciaSesionCronograma.DoLOCK(Session());

                        //PENDIENTE
                        //string query = IncidenciaSesionesCronogramas.SELECT_SESIONES_PLAN(this.Oid);
                        //reader = nHManager.Instance.SQLNativeSelect(query, Session());
                        //_sesiones = IncidenciaSesionesCronogramas.GetChildList(reader);
                    }
                }
                else
                {
                    _base.Record.CopyValues((IncidenciaCronogramaRecord)(criteria.UniqueResult()));

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

                    if (Childs)
                    {
                        criteria = IncidenciaSesionCronograma.GetCriteria(Session());
                        criteria.AddEq("OidIncidencia", this.Oid);
                        _sesiones = IncidenciaSesionesCronogramas.GetChildList(criteria.List <IncidenciaSesionCronograma>());
                    }
                }
            }
            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);
            }
        }
예제 #11
0
        private void DataPortal_Delete(CriteriaCs criteria)
        {
            try
            {
                // Iniciamos la conexion y la transaccion
                SessionCode = OpenSession();
                BeginTransaction();
                CriteriaEx criterio = GetCriteria();
                criterio.AddOidSearch(criteria.Oid);
                Session().Delete((PlanExtraRecord)(criterio.UniqueResult()));

                Transaction().Commit();
            }
            catch (Exception ex)
            {
                if (Transaction() != null)
                {
                    Transaction().Rollback();
                }
                iQExceptionHandler.TreatException(ex);
            }
            finally
            {
                CloseSession();
            }
        }
예제 #12
0
        // called to retrieve data from the database
        private void DataPortal_Fetch(CriteriaEx criteria)
        {
            try
            {
                SessionCode = criteria.SessionCode;

                Childs = criteria.Childs;

                if (nHMng.UseDirectSQL)
                {
                    ClaseExtra.DoLOCK(Session());

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

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

                    if (Childs)
                    {
                        Sesion.DoLOCK(Session());

                        string query = Sesions.SELECT_BY_CLASE_EXTRA(this.Oid);
                        reader   = nHManager.Instance.SQLNativeSelect(query, Session());
                        _sesions = Sesions.GetChildList(reader);
                    }
                }
                else
                {
                    _base.Record.CopyValues((ClaseExtraRecord)(criteria.UniqueResult()));

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

                    if (Childs)
                    {
                        criteria = Sesion.GetCriteria(Session());
                        criteria.AddEq("OidClaseExtra", this.Oid);
                        _sesions = Sesions.GetChildList(criteria.List <Sesion>());
                    }
                }
            }
            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);
            }
        }
예제 #13
0
        //private void DataPortal_Fetch(CriteriaEx criteria)
        //{
        //    try
        //    {
        //        SessionCode = criteria.SessionCode;

        //        CopyValues((Empresa)(criteria.UniqueResult()));

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

        //        criteria = ContactoE.GetCriteria(Session());
        //        criteria.AddEq("OidEmpresa", this.Oid);
        //        _contactos = ContactosE.GetChildList(criteria.List<ContactoE>());

        //    }
        //    catch (NHibernate.ADOException)
        //    {
        //        if (Transaction() != null) Transaction().Rollback();
        //        throw new iQLockException(Resources.Messages.LOCK_ERROR);
        //    }
        //    catch (Exception ex)
        //    {
        //        if (Transaction() != null) Transaction().Rollback();
        //        iQExceptionHandler.TreatException(ex);
        //    }
        //}

        private void DataPortal_Fetch(CriteriaEx criteria)
        {
            try
            {
                SessionCode = criteria.SessionCode;
                Childs      = criteria.Childs;

                if (nHMng.UseDirectSQL)
                {
                    Empresa.DoLOCK("COMMON", Session());

                    IDataReader reader = Empresa.DoSELECT("COMMON", Session(), criteria.Oid);

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

                    if (Childs)
                    {
                        ContactoEmpresa.DoLOCK("COMMON", Session());

                        string query = ContactoEmpresas.SELECT_BY_FIELD("COMMON", "OidEmpresa", this.Oid);
                        reader     = nHManager.Instance.SQLNativeSelect(query, Session());
                        _contactos = ContactoEmpresas.GetChildList(reader);
                    }
                }
                else
                {
                    CopyValues((Empresa)(criteria.UniqueResult()));

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

                    if (Childs)
                    {
                        criteria = ContactoEmpresa.GetCriteria(Session());
                        criteria.AddEq("OidEmpresa", this.Oid);
                        _contactos = ContactoEmpresas.GetChildList(criteria.List <ContactoEmpresa>());
                    }
                }
            }
            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);
            }
        }
예제 #14
0
        private void DataPortal_Fetch(CriteriaEx criteria)
        {
            try
            {
                SessionCode = criteria.SessionCode;
                Childs      = criteria.Childs;

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

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

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

                        ClaseTeorica.DoLOCK(Session());
                        query       = ClaseTeoricas.SELECT_BY_PLAN(this.Oid);
                        reader      = nHManager.Instance.SQLNativeSelect(query, Session());
                        _c_teoricas = ClaseTeoricas.GetChildList(reader);

                        ClasePractica.DoLOCK(Session());
                        query        = ClasePracticas.SELECT_BY_PLAN(this.Oid);
                        reader       = nHManager.Instance.SQLNativeSelect(query, Session());
                        _c_practicas = ClasePracticas.GetChildList(reader);
                    }
                }
                else
                {
                    _base.Record.CopyValues((PlanEstudiosRecord)(criteria.UniqueResult()));
                    //Session().Lock(Session().Get<PlanEstudiosRecord>(Oid), LockMode.UpgradeNoWait);

                    if (Childs)
                    {
                        criteria = ClaseTeorica.GetCriteria(Session());
                        criteria.AddEq("OidPlan", this.Oid);
                        _c_teoricas = ClaseTeoricas.GetChildList(criteria.List <ClaseTeorica>());

                        criteria = ClasePractica.GetCriteria(Session());
                        criteria.AddEq("OidPlan", this.Oid);
                        _c_practicas = ClasePracticas.GetChildList(criteria.List <ClasePractica>());
                    }
                }
            }
            catch (Exception ex)
            {
                if (Transaction() != null)
                {
                    Transaction().Rollback();
                }
                iQExceptionHandler.TreatException(ex);
            }
        }
        // called to retrieve data from the database
        private void DataPortal_Fetch(CriteriaEx criteria)
        {
            try
            {
                SessionCode = criteria.SessionCode;

                Childs = criteria.Childs;

                if (nHMng.UseDirectSQL)
                {
                    Instructor_Promocion.DoLOCK(Session());

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

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

                    if (Childs)
                    {
                        string query;

                        Submodulo_Instructor_Promocion.DoLOCK(Session());

                        query       = Submodulos_Instructores_Promociones.SELECT_BY_INSTRUCTOR_PROMOCION(this.Oid);
                        reader      = nHManager.Instance.SQLNativeSelect(query, Session());
                        _submodulos = Submodulos_Instructores_Promociones.GetChildList(reader);
                    }
                }
                else
                {
                    _base.Record.CopyValues((Instructor_PromocionRecord)(criteria.UniqueResult()));

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

                    if (Childs)
                    {
                        criteria = Submodulo_Instructor_Promocion.GetCriteria(Session());
                        criteria.AddEq("OidInstructorPromocion", this.Oid);
                        _submodulos = Submodulos_Instructores_Promociones.GetChildList(criteria.List <Submodulo_Instructor_Promocion>());
                    }
                }
            }
            catch (Exception ex)
            {
                if (Transaction() != null)
                {
                    Transaction().Rollback();
                }
                iQExceptionHandler.TreatException(ex);
            }
        }
        // called to retrieve data from the database
        private void DataPortal_Fetch(CriteriaEx criteria)
        {
            try
            {
                SessionCode = criteria.SessionCode;

                Childs = criteria.Childs;

                if (nHMng.UseDirectSQL)
                {
                    ClaseTeorica.DoLOCK(Session());

                    string      query  = SELECT(criteria.Oid);
                    IDataReader reader = nHManager.Instance.SQLNativeSelect(query);

                    if (reader.Read())
                    {
                        _base.CopyValues(reader);
                    }
                }
                else
                {
                    _base.Record.CopyValues((ClaseTeoricaRecord)(criteria.UniqueResult()));

                    //Session().Lock(Session().Get<ClaseTeoricaRecord>(Oid), LockMode.UpgradeNoWait);
                }
            }
            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);
            }
        }
예제 #17
0
        // called to retrieve data from the database
        private void DataPortal_Fetch(CriteriaEx criteria)
        {
            try
            {
                SessionCode = criteria.SessionCode;

                Childs = criteria.Childs;

                if (nHMng.UseDirectSQL)
                {
                    SesionCronograma.DoLOCK(Session());

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

                    if (reader.Read())
                    {
                        _base.CopyValues(reader);
                    }
                }
                else
                {
                    _base.Record.CopyValues((SesionCronogramaRecord)(criteria.UniqueResult()));

                    //Session().Lock(Session().Get<SesionCronogramaRecord>(Oid), LockMode.UpgradeNoWait);
                }
            }
            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);
            }
        }
예제 #18
0
        private void DataPortal_Fetch(CriteriaEx criteria)
        {
            try
            {
                CopyValues((Empresa)(criteria.UniqueResult()));
                SessionCode = criteria.SessionCode;
                Childs      = criteria.Childs;

                if (Childs)
                {
                    criteria = ContactoEmpresa.GetCriteria(Session());
                    criteria.AddEq("OidEmpresa", this.Oid);
                    _contactos = ContactoEmpresaList.GetChildList(criteria.List <ContactoEmpresa>());
                }
            }
            catch (Exception ex)
            {
                iQExceptionHandler.TreatException(ex);
            }
        }
예제 #19
0
        private void DataPortal_Fetch(CriteriaEx criteria)
        {
            try
            {
                Oid         = 0;
                SessionCode = criteria.SessionCode;
                Childs      = criteria.Childs;

                _base.CopyValues((ItemMap)(criteria.UniqueResult()));
            }
            catch (Exception ex)
            {
                if (Transaction() != null)
                {
                    Transaction().Rollback();
                }
                iQExceptionHandler.SetCaller(ex, "ItemMap::DataPortal_Fetch");
                iQExceptionHandler.TreatException(ex, new object[] { criteria.Query });
            }
        }
예제 #20
0
        /// <summary>
        /// Obtiene un registro de la base de datos
        /// </summary>
        /// <param name="criteria">Criterios de consulta</param>
        /// <remarks>Lo llama el DataPortal tras generar el objeto</remarks>
        private void DataPortal_Fetch(CriteriaEx criteria)
        {
            try
            {
                SessionCode = criteria.SessionCode;
                Childs      = criteria.Childs;

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

                    if (reader.Read())
                    {
                        _base.CopyValues(reader);
                    }
                }
                else
                {
                    Session().Lock(Session().Get <IncidenciaRecord>(Oid), LockMode.UpgradeNoWait);
                    _base.Record.CopyValues((IncidenciaRecord)(criteria.UniqueResult()));
                }
                MarkOld();
            }
            catch (NHibernate.ADOException ex)
            {
                if (Transaction() != null)
                {
                    Transaction().Rollback();
                }
                iQExceptionHandler.ThrowExceptionByCode(ex);
            }
            catch (Exception ex)
            {
                if (Transaction() != null)
                {
                    Transaction().Rollback();
                }
                iQExceptionHandler.TreatException(ex);
            }
        }
예제 #21
0
        private void DataPortal_Delete(CriteriaCs criterio)
        {
            if (this.AgenteDocumentos.Count < 0)
            {
                throw new iQException("Existe al menos un agente asociado con este documento. No se puede borrar.");
            }

            try
            {
                //Iniciamos la conexion y la transaccion
                SessionCode = OpenSession();
                BeginTransaction();

                //Si no hay integridad referencial, aqui se deben borrar las listas hijo
                CriteriaEx criteria = GetCriteria();
                criteria.AddOidSearch(criterio.Oid);

                // Obtenemos el objeto
                DocumentRecord obj = (DocumentRecord)(criteria.UniqueResult());
                Session().Delete(Session().Get <DocumentRecord>(obj.Oid));

                Transaction().Commit();
            }
            catch (Exception ex)
            {
                if (Transaction() != null)
                {
                    Transaction().Rollback();
                }
                iQExceptionHandler.TreatException(ex);
            }
            finally
            {
                CloseSession();
            }
        }
예제 #22
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);
            }
        }
예제 #23
0
        // called to retrieve data from the database
        private void DataPortal_Fetch(CriteriaEx criteria)
        {
            try
            {
                SessionCode = criteria.SessionCode;

                Childs = criteria.Childs;

                if (nHMng.UseDirectSQL)
                {
                    MaterialDocente.DoLOCK(Session());

                    IDataReader reader = nHMng.SQLNativeSelect(criteria.Query, Session());

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

                    if (Childs)
                    {
                        RevisionMaterial.DoLOCK(Session());

                        string query = RevisionMaterials.SELECT_BY_MATERIAL(this.Oid);
                        reader      = nHManager.Instance.SQLNativeSelect(query, Session());
                        _revisiones = RevisionMaterials.GetChildList(criteria.SessionCode, reader);

                        Material_Plan.DoLOCK(Session());

                        query   = Material_Plans.SELECT(GetInfo(false));
                        reader  = nHManager.Instance.SQLNativeSelect(query, Session());
                        _planes = Material_Plans.GetChildList(reader);

                        Material_Alumno.DoLOCK(Session());

                        query    = Material_Alumnos.SELECT_BY_MATERIAL(this.Oid);
                        reader   = nHManager.Instance.SQLNativeSelect(query, Session());
                        _alumnos = Material_Alumnos.GetChildList(reader);
                    }
                }
                else
                {
                    _base.Record.CopyValues((MaterialDocenteRecord)(criteria.UniqueResult()));

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

                    if (Childs)
                    {
                        criteria = RevisionMaterial.GetCriteria(Session());
                        criteria.AddEq("OidMaterial", this.Oid);
                        _revisiones = RevisionMaterials.GetChildList(criteria.List <RevisionMaterial>());

                        criteria = Material_Plan.GetCriteria(Session());
                        criteria.AddEq("OidMaterial", this.Oid);
                        _planes = Material_Plans.GetChildList(criteria.List <Material_Plan>());

                        criteria = Material_Alumno.GetCriteria(Session());
                        criteria.AddEq("OidMaterial", this.Oid);
                        _alumnos = Material_Alumnos.GetChildList(criteria.List <Material_Alumno>());
                    }
                }
            }
            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);
            }
        }
예제 #24
0
        // called to retrieve data from the database
        private void DataPortal_Fetch(CriteriaEx criteria)
        {
            try
            {
                SessionCode = criteria.SessionCode;

                Childs = criteria.Childs;

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

                    IDataReader reader = InformeAmpliacion.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_INFORME_AMPLIACION(this.Oid);
                        reader        = nHManager.Instance.SQLNativeSelect(query, Session());
                        _ampliaciones = Ampliaciones.GetChildList(reader);

                        NotificacionInterna.LOCK(AppContext.ActiveSchema.Code);
                        query           = NotificacionesInternas.SELECT_BY_INFORME_AMPLIACION(this.Oid, TipoNotificacionAsociado.SOLICITUD_AMPLIACION);
                        reader          = nHManager.Instance.SQLNativeSelect(query, Session());
                        _notificaciones = NotificacionesInternas.GetChildList(reader);
                    }
                }
                else
                {
                    _base.Record.CopyValues((InformeAmpliacionRecord)(criteria.UniqueResult()));

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

                    if (Childs)
                    {
                        criteria = Ampliacion.GetCriteria(Session());
                        criteria.AddEq("OidInformeAmpliacion", this.Oid);
                        _ampliaciones = Quality.Ampliaciones.GetChildList(criteria.List <Ampliacion>());

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