Пример #1
0
        private void Fetch(Examen source)
        {
            try
            {
                SessionCode = source.SessionCode;

                _base.CopyValues(source);

                CriteriaEx criteria = Pregunta_Examen.GetCriteria(Session());
                criteria.AddEq("OidExamen", this.Oid);
                _preguntas = Pregunta_Examens.GetChildList(criteria.List <Pregunta_Examen>());

                criteria = PreguntaExamen.GetCriteria(Session());
                criteria.AddEq("OidExamen", this.Oid);
                _preguntaexamens = PreguntaExamens.GetChildList(criteria.List <PreguntaExamen>());

                criteria = Alumno_Examen.GetCriteria(Session());
                criteria.AddEq("OidExamen", this.Oid);
                _alumnos = Alumno_Examens.GetChildList(criteria.List <Alumno_Examen>());

                criteria = ExamenPromocion.GetCriteria(Session());
                criteria.AddEq("OidExamen", this.Oid);
                _promociones = ExamenPromociones.GetChildList(criteria.List <ExamenPromocion>());
            }
            catch (Exception ex)
            {
                iQExceptionHandler.TreatException(ex);
            }

            MarkOld();
        }
Пример #2
0
        public void CopyValues(Pregunta_Examen source)
        {
            if (source == null)
            {
                return;
            }

            _record.CopyValues(source.Base.Record);
        }
Пример #3
0
        //internal void Insert(Modulo parent)
        //{
        //    // if we're not dirty then don't update the database
        //    if (!this.IsDirty) return;

        //    //Debe obtener la sesion del padre pq el objeto es padre a su vez
        //    SessionCode = parent.SessionCode;

        //    _oid_modulo = parent.Oid;

        //    try
        //    {
        //        ValidationRules.CheckRules();

        //        if (!IsValid)
        //            throw new iQValidationException(moleQule.Library.Resources.Messages.GENERIC_VALIDATION_ERROR);

        //        parent.Session().Save(this);

        //        _preguntas.Update(this);
        //        _preguntaexamens.Update(this);
        //        _alumnos.Update(this);
        //    }
        //    catch (Exception ex)
        //    {
        //        iQExceptionHandler.TreatException(ex);
        //    }

        //    MarkOld();
        //}

        //internal void Update(Modulo parent)
        //{
        //    // if we're not dirty then don't update the database
        //    if (!this.IsDirty) return;

        //    //Debe obtener la sesion del padre pq el objeto es padre a su vez
        //    SessionCode = parent.SessionCode;

        //    _oid_modulo = parent.Oid;

        //    try
        //    {
        //        ValidationRules.CheckRules();

        //        if (!IsValid)
        //            throw new iQValidationException(moleQule.Library.Resources.Messages.GENERIC_VALIDATION_ERROR);

        //        Examen obj = parent.Session().Get<Examen>(Oid);
        //        obj.CopyValues(this);
        //        parent.Session().Update(obj);

        //        _preguntas.Update(this);
        //        _preguntaexamens.Update(this);
        //        _alumnos.Update(this);
        //    }
        //    catch (Exception ex)
        //    {
        //        iQExceptionHandler.TreatException(ex);
        //    }

        //    MarkOld();
        //}


        //internal void DeleteSelf(Modulo parent)
        //{
        //    // if we're not dirty then don't update the database
        //    if (!this.IsDirty) return;

        //    // if we're new then don't update the database
        //    if (this.IsNew) return;

        //    try
        //    {
        //        SessionCode = parent.SessionCode;
        //        Session().Delete(Session().Get<Examen>(Oid));
        //    }
        //    catch (Exception ex)
        //    {
        //        iQExceptionHandler.TreatException(ex);
        //    }

        //    MarkNew();
        //}

        #endregion

        #region Root Data Access

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

                Childs = criteria.Childs;

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

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

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

                        string query = Pregunta_Examens.SELECT_BY_EXAMEN(this.Oid);
                        reader     = nHManager.Instance.SQLNativeSelect(query, Session());
                        _preguntas = Pregunta_Examens.GetChildList(reader);

                        PreguntaExamen.DoLOCK(Session());

                        query            = PreguntaExamens.SELECT_BY_EXAMEN(this.Oid);
                        reader           = nHManager.Instance.SQLNativeSelect(query, Session());
                        _preguntaexamens = PreguntaExamens.GetChildList(criteria.SessionCode, reader);

                        Alumno_Examen.DoLOCK(Session());

                        query    = Alumno_Examens.SELECT(GetInfo(false));
                        reader   = nHManager.Instance.SQLNativeSelect(query, Session());
                        _alumnos = Alumno_Examens.GetChildList(criteria.SessionCode, reader);

                        ExamenPromocion.DoLOCK(Session());

                        query        = ExamenPromociones.SELECT(this);
                        reader       = nHManager.Instance.SQLNativeSelect(query, Session());
                        _promociones = ExamenPromociones.GetChildList(criteria.SessionCode, reader);
                    }
                }
            }
            catch (Exception ex)
            {
                if (Transaction() != null)
                {
                    Transaction().Rollback();
                }
                iQExceptionHandler.TreatException(ex);
            }
        }
Пример #4
0
 public void CopyFrom(Pregunta_Examen source)
 {
     _base.CopyValues(source);
 }