/// <summary> /// Copia los atributos del objeto /// </summary> /// <param name="source">Objeto origen</param> protected void CopyValues(EstadisticaExamen source) { if (source == null) { return; } Oid = source.Oid; _numero_pregunta = source.NumeroPregunta; _total_fallos = source.TotalFallos; _porcentaje_fallos = source.PorcentajeFallos; _anulada = source.Anulada; _numero_pregunta_banco = source.NumeroPreguntaBanco; _nivel = source.Nivel; _tema = source.Tema; }
/// <summary> /// Retrieve the complete list from db /// </summary> /// <param name="get_childs">retrieving the childs</param> /// <returns></returns> public static EstadisticaExamenList GetList(long oid_examen, bool childs) { CriteriaEx criteria = EstadisticaExamen.GetCriteria(EstadisticaExamen.OpenSession()); criteria.Childs = childs; //No criteria. Retrieve all de List if (nHManager.Instance.UseDirectSQL) { criteria.Query = EstadisticaExamenList.SELECT_PORCENTAJE_FALLOS(oid_examen); } EstadisticaExamenList list = DataPortal.Fetch <EstadisticaExamenList>(criteria); CloseSession(criteria.SessionCode); return(list); }
public void CopyFrom(EstadisticaExamen source) { CopyValues(source); }
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); }