/// <summary>
        /// Actualiza un registro en la base de datos
        /// </summary>
        /// <param name="parent">Objeto padre</param>
        internal void Update(Examen 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;

            OidExamen = parent.Oid;

            ValidationRules.CheckRules();

            if (!IsValid)
            {
                throw new iQValidationException(Library.Resources.Messages.GENERIC_VALIDATION_ERROR);
            }

            ExamenPromocionRecord obj = parent.Session().Get <ExamenPromocionRecord>(Oid);

            obj.CopyValues(this._base._record);
            parent.Session().Update(obj);

            MarkOld();
        }
        public static List <long> GetPreguntasReservadas(Examen item)
        {
            ExamenList  examenes = GetFechaList(item.FechaExamen);
            List <long> list     = new List <long>();

            foreach (ExamenInfo info in examenes)
            {
                if (info.Oid != item.Oid)
                {
                    if (info.MemoPreguntas != string.Empty)
                    {
                        string[] lista = info.MemoPreguntas.Split(';');
                        foreach (string serial in lista)
                        {
                            if (serial != string.Empty)
                            {
                                list.Add(Convert.ToInt32(serial));
                            }
                        }
                    }
                    else
                    {
                        foreach (PreguntaExamenInfo pregunta in info.PreguntaExamenes)
                        {
                            list.Add(pregunta.OidPregunta);
                        }
                    }
                }
            }

            return(list);
        }
示例#3
0
        internal void Update(Examen parent)
        {
            // if we're not dirty then don't update the database
            if (!this.IsDirty)
            {
                return;
            }

            OidExamen = parent.Oid;

            try
            {
                ValidationRules.CheckRules();

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

                AlumnoExamenRecord obj = parent.Session().Get <AlumnoExamenRecord>(Oid);
                obj.CopyValues(this.Base.Record);
                parent.Session().Update(obj);

                _respuestas.Update(this, parent.Session());
            }
            catch (Exception ex)
            {
                iQExceptionHandler.TreatException(ex);
            }

            MarkOld();
        }
示例#4
0
        internal void DeleteSelf(Examen 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
            {
                parent.Session().Delete(parent.Session().Get <AlumnoExamenRecord>(Oid));
            }
            catch (Exception ex)
            {
                iQExceptionHandler.TreatException(ex);
            }

            MarkNew();
        }
        /// <summary>
        /// Crea un nuevo elemento y lo añade a la lista
        /// </summary>
        /// <returns>Nuevo item</returns>
        public ExamenPromocion NewItem(Examen parent)
        {
            this.NewItem(ExamenPromocion.NewChild(parent));
            ExamenPromocion item = this[Count - 1];

            return(item);
        }
示例#6
0
        internal void Insert(Examen parent)
        {
            // if we're not dirty then don't update the database
            if (!this.IsDirty)
            {
                return;
            }

            OidExamen = parent.Oid;

            try
            {
                ValidationRules.CheckRules();

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

                parent.Session().Save(this.Base.Record);
            }
            catch (Exception ex)
            {
                iQExceptionHandler.TreatException(ex);
            }

            MarkOld();
        }
        internal void Update(Examen parent)
        {
            this.RaiseListChangedEvents = false;

            // update (thus deleting) any deleted child objects
            foreach (PreguntaExamen obj in DeletedList)
            {
                obj.DeleteSelf(parent);
            }

            // now that they are deleted, remove them from memory too
            DeletedList.Clear();

            // AddItem/update any current child objects
            foreach (PreguntaExamen obj in this)
            {
                if (obj.IsNew)
                {
                    obj.Insert(parent);
                }
                else
                {
                    obj.Update(parent);
                }
            }

            this.RaiseListChangedEvents = true;
        }
 public static string SELECT(Examen item)
 {
     Library.Instruction.QueryConditions conditions = new Library.Instruction.QueryConditions {
         Examen = item.GetInfo(false)
     };
     return(SELECT(conditions, false));
 }
        /// <summary>
        /// Crea un nuevo objeto hijo
        /// </summary>
        /// <param name="parent">Objeto padre</param>
        /// <returns>Nuevo objeto creado</returns>
        internal static ExamenPromocion NewChild(Examen parent)
        {
            if (!CanAddObject())
            {
                throw new System.Security.SecurityException(Library.Resources.Messages.USER_NOT_ALLOWED);
            }

            return(new ExamenPromocion(parent));
        }
        /// <summary>
        /// Devuelve una lista de todos los elementos
        /// </summary>
        /// <returns>Lista de elementos</returns>
        public static ExamenList GetModuloList(long oid_modulo)
        {
            CriteriaEx criteria = Examen.GetCriteria(Examen.OpenSession());

            criteria.AddEq("OidModulo", oid_modulo);
            ExamenList list = ExamenList.RetrieveList(typeof(Examen), AppContext.ActiveSchema.Code, criteria);

            CloseSession(criteria.SessionCode);
            return(list);
        }
 /// <summary>
 /// Retrieve the complete list from db
 /// </summary>
 /// <returns>RespuestaList</returns>
 public void FormatCodigoList()
 {
     foreach (ExamenInfo item in this)
     {
         if (item.Numero == 0)
         {
             string     query    = UPDATE_CODIGO(item.Oid);
             CriteriaEx criteria = Examen.GetCriteria(Examen.OpenSession());
             nHManager.Instance.SQLNativeExecute(query, Session());
             CloseSession(criteria.SessionCode);
         }
     }
 }
示例#12
0
        public void CopyValues(Examen source)
        {
            if (source == null)
            {
                return;
            }

            _record.CopyValues(source.Base.Record);

            _modulo     = source.Modulo;
            _instructor = source.Instructor;
            _promocion  = source.Promocion;
        }
示例#13
0
        public static Alumno_Examen NewChild(Examen parent)
        {
            if (!CanAddObject())
            {
                throw new System.Security.SecurityException(
                          moleQule.Library.Resources.Messages.USER_NOT_ALLOWED);
            }

            Alumno_Examen obj = new Alumno_Examen();

            obj.OidExamen = parent.Oid;
            return(obj);
        }
        /// <summary>
        /// Retrieve the complete list from db
        /// </summary>
        /// <returns>ExamenList</returns>
        public static ExamenList GetComboAlumno_ExamenList(long oid_promocion)
        {
            CriteriaEx criteria = Examen.GetCriteria(Examen.OpenSession());

            //No criteria. Retrieve all de List
            if (nHManager.Instance.UseDirectSQL)
            {
                criteria.Query = Examens.SELECT_EXAMENES_PENDIENTES(oid_promocion);
            }
            ExamenList list = DataPortal.Fetch <ExamenList>(criteria);

            CloseSession(criteria.SessionCode);

            return(list);
        }
        /// <summary>
        /// Retrieve the complete list from db
        /// </summary>
        /// <returns>ExamenList</returns>
        private static ExamenList GetFechaList(DateTime fecha_examen)
        {
            CriteriaEx criteria = Examen.GetCriteria(Examen.OpenSession());

            //No criteria. Retrieve all de List
            if (nHManager.Instance.UseDirectSQL)
            {
                criteria.Query = Examens.SELECT_BY_FECHA(fecha_examen);
            }
            criteria.Childs = true;
            ExamenList list = DataPortal.Fetch <ExamenList>(criteria);

            CloseSession(criteria.SessionCode);

            return(list);
        }
        /// <summary>
        /// Retrieve the complete list from db
        /// </summary>
        /// <param name="get_childs">retrieving the childs</param>
        /// <returns></returns>
        public ExamenList GetExamenesFiltrados(long oid_modulo, long oid_instructor, long oid_promocion,
                                               string tipo, DateTime fecha_creacion, DateTime fecha_emision,
                                               DateTime fecha_examen, bool desarrollo, bool filtro, string texto)
        {
            ExamenList lista = new ExamenList();
            string     query = ExamenList.SELECT_EXAMENES_FILTRADOS(oid_modulo, oid_instructor, oid_promocion, tipo,
                                                                    fecha_creacion, fecha_examen, fecha_emision, desarrollo, filtro, texto);
            int sesion = Examen.OpenSession();

            IDataReader reader = nHManager.Instance.SQLNativeSelect(query, Session(sesion));

            lista = ExamenList.GetChildList(reader, false);

            CloseSession(sesion);

            return(lista);
        }
        //  private ExamenList() { }

        /// <summary>
        /// Retrieve the complete list from db
        /// </summary>
        /// <returns>ExamenList</returns>
        public static ExamenList GetList(bool childs)
        {
            CriteriaEx criteria = Examen.GetCriteria(Examen.OpenSession());

            criteria.Childs = childs;

            //No criteria. Retrieve all de List
            if (nHManager.Instance.UseDirectSQL)
            {
                criteria.Query = ExamenList.SELECT();
            }

            ExamenList list = DataPortal.Fetch <ExamenList>(criteria);

            CloseSession(criteria.SessionCode);

            return(list);
        }
        /// <summary>
        /// Borra un registro de la base de datos.
        /// </summary>
        /// <param name="parent">Objeto padre</param>
        /// <remarks>Borrado inmediato<remarks/>
        internal void DeleteSelf(Examen 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;
            }

            SessionCode = parent.SessionCode;
            Session().Delete(Session().Get <ExamenPromocionRecord>(Oid));

            MarkNew();
        }
示例#19
0
        /// <summary>
        /// Retrieve the complete list from db
        /// </summary>
        /// <returns>AlumnoList</returns>
        public static Alumno_ExamenList GetExamenList(long oid_examen)
        {
            CriteriaEx criteria = Alumno_Examen.GetCriteria(Alumno_Examen.OpenSession());

            criteria.Childs = false;

            QueryConditions conditions = new QueryConditions()
            {
                Examen = Examen.New().GetInfo(false)
            };

            conditions.Examen.Oid = oid_examen;
            criteria.Query        = Alumno_Examen.SELECT(conditions, false);
            //No criteria. Retrieve all de List
            Alumno_ExamenList list = DataPortal.Fetch <Alumno_ExamenList>(criteria);

            CloseSession(criteria.SessionCode);

            return(list);
        }
        /// <summary>
        /// Realiza el Save de los objetos de la lista. Inserta, Actualiza o Borra en función
        /// de los flags de cada objeto de la lista
        /// </summary>
        /// <param name="parent">BusinessBaseEx padre de la lista</param>
        internal void Update(Examen parent)
        {
            try
            {
                this.RaiseListChangedEvents = false;

                SessionCode = parent.SessionCode;

                // update (thus deleting) any deleted child objects
                foreach (ExamenPromocion obj in DeletedList)
                {
                    obj.DeleteSelf(parent);
                }

                // now that they are deleted, remove them from memory too
                DeletedList.Clear();

                // add/update any current child objects
                foreach (ExamenPromocion obj in this)
                {
                    if (!this.Contains(obj))
                    {
                        if (obj.IsNew)
                        {
                            obj.Insert(parent);
                        }
                        else
                        {
                            obj.Update(parent);
                        }
                    }
                }
            }
            finally
            {
                this.RaiseListChangedEvents = true;
            }
        }
 public PreguntaExamen NewItem(Examen parent)
 {
     this.AddItem(PreguntaExamen.NewChild(parent));
     return(this[Count - 1]);
 }
示例#22
0
        public static EstadisticaExamenList GetList(Examen examen)
        {
            EstadisticaExamenList list = new EstadisticaExamenList();

            int       total_alumnos = 0;
            Hashtable cont_fallos   = new Hashtable();

            foreach (PreguntaExamen preg in examen.PreguntaExamens)
            {
                EstadisticaExamen item = new EstadisticaExamen();

                item.Oid                 = preg.Oid;
                item.NumeroPregunta      = preg.Orden;
                item.TotalFallos         = 0;
                item.PorcentajeFallos    = 0;
                item.Anulada             = preg.Anulada;
                item.NumeroPreguntaBanco = preg.NPregunta;
                item.Nivel               = preg.Nivel;
                item.Tema                = preg.Tema;

                cont_fallos.Add(preg.Orden, item);
            }

            foreach (Alumno_Examen alumno in examen.Alumnos)
            {
                if (alumno.Presentado)
                {
                    total_alumnos++;
                    foreach (Respuesta_Alumno_Examen resp in alumno.Respuestas)
                    {
                        PreguntaExamen preg = examen.PreguntaExamens.GetItem(resp.OidPreguntaExamen);

                        if (!preg.Anulada)
                        {
                            if (!resp.Correcta)
                            {
                                ((EstadisticaExamen)cont_fallos[resp.Orden]).TotalFallos++;
                            }
                        }
                    }
                }
            }

            list.IsReadOnly = false;

            foreach (PreguntaExamen preg in examen.PreguntaExamens)
            {
                EstadisticaExamen item = (EstadisticaExamen)cont_fallos[preg.Orden];

                if (!preg.Anulada)
                {
                    item.PorcentajeFallos = total_alumnos != 0 ? Decimal.Round((decimal)item.TotalFallos / total_alumnos, 2) * 100 : 0;
                }

                list.Add(item.GetInfo());
            }

            list.IsReadOnly = true;

            return(list);
        }
示例#23
0
 public Alumno_Examen NewItem(Examen parent)
 {
     this.AddItem(Alumno_Examen.NewChild(parent));
     return(this[Count - 1]);
 }
 public static string SELECT(Examen parent)
 {
     return(ExamenPromocion.SELECT(new QueryConditions {
         Examen = parent.GetInfo(false)
     }, true));
 }
示例#25
0
 public void CopyFrom(Examen source)
 {
     _base.CopyValues(source);
 }
 /// <summary>
 /// NO UTILIZAR DIRECTAMENTE. LO UTILIZA LA FUNCION DE CREACION DE LA LISTA DEL PADRE
 /// </summary>
 private ExamenPromocion(Examen parent)
 {
     OidExamen = parent.Oid;
     MarkAsChild();
 }