public void SetSourceData(string item, ModuloInfo modulo, Examen examen) { _modulo = modulo; _submodulos = SubmoduloList.GetModuloList(_modulo.Oid, false); _temas = TemaList.GetModuloList(_modulo.Oid, false); _preguntas_examen = examen.PreguntaExamens; _examen = examen.GetInfo(false); this.Text = Resources.Labels.RESUMEN_EXAMEN_TITLE; lista = new List <RegistroResumen>(); string memo_preguntas = ";" + item; long contador = 0; foreach (SubmoduloInfo obj in _submodulos) { foreach (TemaInfo tema in _temas) { if (tema.OidSubmodulo == obj.Oid) { foreach (PreguntaExamen p in _preguntas_examen) { if (p.OidTema == tema.Oid) { lista = RegistroResumen.ContabilizaPregunta(lista, obj.Oid, obj.Codigo + " " + obj.Texto, tema.Codigo); contador++; } } } } } lista.Add(new RegistroResumen("TODOS", "TODOS", contador)); RefreshMainData(); }
protected virtual void SetRespuestas() { _alumno_examen.OidExamen = _examen.Oid; _examen = ExamenInfo.Get(_examen.Oid, true); Respuesta_Alumno_Examen respuesta; foreach (PreguntaExamenInfo item in _examen.PreguntaExamenes) { respuesta = _alumno_examen.Respuestas.NewItem(_alumno_examen); respuesta.OidPreguntaExamen = item.Oid; respuesta.Orden = item.Orden; respuesta.Pregunta = item.Texto; respuesta.Correcta = true; foreach (RespuestaExamenInfo resp in item.RespuestaExamenes) { if (resp.Correcta) { respuesta.Opcion = resp.Opcion; respuesta.OpcionCorrecta = resp.Opcion; } } } Datos_Respuestas.DataSource = Respuesta_Alumno_Examenes.SortList(_alumno_examen.Respuestas, "Orden", ListSortDirection.Ascending); }
protected override void GetFormSourceData(long oid) { Examen examen = Examen.Get(oid, true); string[] preguntas = examen.MemoPreguntas.Split(';'); //se genera la lista de preguntas del examen con la que se va a trabajar foreach (string item in preguntas) { try { long oid_pregunta = Convert.ToInt32(item); Pregunta_Examen p_examen = Pregunta_Examen.NewChild(examen); p_examen.OidPregunta = oid_pregunta; examen.Pregunta_Examens.AddItem(p_examen); } catch { continue; } } _entity = examen.GetInfo(true); examen.CloseSession(); _mf_type = ManagerFormType.MFView; }
public void SetSourceData(ExamenInfo item) { _entity = item; _alumnos = AlumnoList.GetAlumnosAdmitidosList(_entity.OidModulo, _entity.Desarrollo, true); _promociones = PromocionList.GetByModuloList(_entity.OidModulo, false); this.Text = Resources.Labels.SELECT_ALUMNOS; RefreshSecondaryData(); RefreshMainData(); }
public void SetSourceData(Alumno item, Alumno_Examen alumno_examen) { _entity = item; _alumno_examen = alumno_examen; //_alumno_examen.LoadChilds(typeof(Respuesta_Alumno_Examenes), false); _examen = ExamenInfo.Get(_alumno_examen.OidExamen, true); RefreshMainData(); }
public ExamenDesarrolloReportForm(bool IsModal, ExamenInfo item, PreguntaList preguntas, Pregunta_Examens preguntas_examen) : base(IsModal) { InitializeComponent(); _entity = item; _preguntas = preguntas; _preguntas_examen = preguntas_examen; SetFormData(); this.Text = Resources.Labels.PRINT_TITLE; }
protected void SetUnlinkedGridValues(string gridName) { switch (gridName) { case "Tabla": { ExamenList examenes = ExamenList.GetList(false); foreach (DataGridViewRow row in Tabla.Rows) { if (row.IsNewRow) { continue; } Alumno_ExamenInfo info = (Alumno_ExamenInfo)row.DataBoundItem; if (info != null) { ExamenInfo examen = examenes.GetItem(info.OidExamen); if (examen != null) { if (info.Presentado) { if (examen.Desarrollo) { string calif = string.Empty; if (info.Respuestas == null) { info = Alumno_ExamenInfo.Get(info.Oid, true); } foreach (Respuesta_Alumno_ExamenInfo item in info.Respuestas) { if (calif != string.Empty) { calif += " - "; } calif += item.Calificacion.ToString() + "%"; } row.Cells["Calificacion"].Value = calif; } else { row.Cells["Calificacion"].Value = info.Calificacion.ToString() + "%"; } } else { row.Cells["Calificacion"].Value = "NP"; } } } } } break; } }
protected override void SetRowFormat(DataGridViewRow row) { if (row.IsNewRow) { return; } ExamenInfo item = (ExamenInfo)row.DataBoundItem; item = row.DataBoundItem as ExamenInfo; row.DefaultCellStyle.BackColor = System.Drawing.Color.LightBlue; }
private void Examen_BT_Click(object sender, EventArgs e) { ExamenSelectForm form = new ExamenSelectForm(this); form.ShowDialog(); if (form.DialogResult == DialogResult.OK) { _examen = form.Selected as ExamenInfo; Examen_TB.Text = _examen.Titulo; SetPreguntas(); } }
public override void DeleteObject(long oid) { //if (MessageBox.Show(moleQule.Face.Resources.Messages.DELETE_CONFIRM, // moleQule.Face.Resources.Labels.ADVISE_TITLE, // MessageBoxButtons.YesNoCancel, // MessageBoxIcon.Question) == DialogResult.Yes) //{ try { ExamenInfo examen = ExamenInfo.Get(oid, false); if (!examen.FechaEmision.Date.Equals(DateTime.MaxValue.Date) && !examen.FechaEmision.Date.Equals(DateTime.MinValue)) { MessageBox.Show("No se puede eliminar un examen que ha sido emitido."); _action_result = DialogResult.Ignore; return; } string memo = examen.MemoPreguntas; if (memo != string.Empty) { MessageBox.Show("No se puede eliminar un examen que incluye preguntas." + Environment.NewLine + "Libere las preguntas."); _action_result = DialogResult.Ignore; return; } Examen.Delete(oid); _action_result = DialogResult.OK; //Se eliminan todos los formularios de ese objeto foreach (EntityDriverForm form in _list_active_form) { if (form is ItemMngBaseForm) { if (((ItemMngBaseForm)form).Oid == oid) { form.Dispose(); break; } } } } catch (DataPortalException ex) { MessageBox.Show(iQExceptionHandler.GetiQException(ex).Message); } //} }
protected void SetUnlinkedGridValues(string gridName) { switch (gridName) { case "Respuestas_Grid": PreguntaExamenList preguntas = ExamenInfo.Get(_examen.OidExamen).PreguntaExamenes; foreach (DataGridViewRow row in Respuestas_Grid.Rows) { if (row.IsNewRow) { continue; } Respuesta_Alumno_Examen info = (Respuesta_Alumno_Examen)row.DataBoundItem; if (info != null) { PreguntaExamenInfo pregunta = preguntas.GetItem(info.OidPreguntaExamen); if (pregunta != null) { row.Cells["Orden"].Value = pregunta.Orden; row.Cells["Pregunta"].Value = pregunta.Texto; row.Cells["Correcta"].Value = false; foreach (RespuestaExamenInfo resp in pregunta.RespuestaExamenes) { if (resp.Opcion == info.Opcion) { if (resp.Correcta) { row.Cells["Correcta"].Value = true; info.Correcta = true; } else { info.Correcta = false; } break; } } } } } break; } }
public void OpenEditForm(long oid_examen) { try { ExamenInfo examen = ExamenInfo.Get(oid_examen, false); if (examen != null) { //Si el examen no está emitido if (examen.FechaEmision.Date.Equals(DateTime.MaxValue.Date)) { ExamenEditForm form = new ExamenEditForm(oid_examen); if (form.Entity != null) { AddForm(form); _entity = form.Entity; } } else //En caso de que el examen haya sido emitido { ExamenEmitidoEditForm form = new ExamenEmitidoEditForm(oid_examen); if (form.Entity != null) { AddForm(form); _entity = form.Entity; } } } } catch (Csla.DataPortalException ex) { MessageBox.Show(ex.BusinessException.ToString(), moleQule.Face.Resources.Labels.ERROR_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } catch (Exception ex) { MessageBox.Show(ex.ToString(), moleQule.Face.Resources.Labels.ERROR_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private void SetPreguntas() { _examen = ExamenInfo.Get(_examen.Oid, true); _preguntas = _examen.PreguntaExamenes; Respuesta_Alumno_Examen respuesta; foreach (PreguntaExamenInfo item in _preguntas) { respuesta = _alumno_examen.Respuestas.NewItem(_alumno_examen); respuesta.OidPreguntaExamen = item.Oid; respuesta.Orden = item.Orden; respuesta.Pregunta = item.Texto; } Datos_Respuestas.DataSource = Respuesta_Alumno_Examenes.SortList(_alumno_examen.Respuestas, "Orden", ListSortDirection.Ascending); }
protected override void EditExamenAction() { try { Alumno_Examen current = (Alumno_Examen)Examenes_Grid.CurrentRow.DataBoundItem; if (current != null && current.Presentado) { ExamenInfo examen = ExamenInfo.Get(current.OidExamen, false); if (examen != null && !examen.Desarrollo) { Alumno_ExamenEditForm form = new Alumno_ExamenEditForm(); form.SetSourceData(Entity, current); form.ShowDialog(); Datos_Alumno_Examen.ResetBindings(false); } } } catch { } }
private void Imprimir_BT_Click(object sender, EventArgs e) { ExamenReportMng reportMng = new ExamenReportMng(AppContext.ActiveSchema); ExamenInfo info = _entity.GetInfo(true); foreach (PromocionInfo promo in _promociones) { List <Alumno_ExamenInfo> lista = new List <Alumno_ExamenInfo>(); foreach (Alumno_ExamenInfo item in info.Alumnos) { AlumnoInfo alumno = _alumnos.GetItem(item.OidAlumno); bool pertenece = false; foreach (Alumno_PromocionInfo pr in alumno.Promociones) { if (pr.OidPromocion == promo.Oid) { pertenece = true; break; } } if (alumno != null && pertenece) { lista.Add(item); } } if (lista.Count > 0) { ReportViewer.SetReport(reportMng.GetDetailReport(info, lista, promo, moleQule.Library.Common.CompanyInfo.Get(AppContext.ActiveSchema.Oid))); ReportViewer.ShowDialog(); } } }
public static void FormatFechaDisponibilidad() { PreguntaExamenList preguntasexamen = PreguntaExamenList.GetList(false); PreguntaList preguntas = PreguntaList.GetList(false); ExamenList examenes = ExamenList.GetList(false); foreach (PreguntaInfo item in preguntas) { DateTime fecha_disponibilidad = DateTime.MaxValue; foreach (PreguntaExamenInfo pexamen in preguntasexamen) { //la pregunta se encuentra en un examen emitido if (item.Oid == pexamen.OidPregunta) { ExamenInfo examen = examenes.GetItem(pexamen.OidExamen); DateTime fecha = examen.FechaExamen.AddMonths(6); if (fecha_disponibilidad.Equals(DateTime.MaxValue) || (!fecha_disponibilidad.Equals(DateTime.MaxValue) && fecha.Date > fecha_disponibilidad.Date)) { fecha_disponibilidad = fecha; } } } if (fecha_disponibilidad.Date.Equals(DateTime.MaxValue.Date)) { fecha_disponibilidad = item.FechaAlta; } if (!item.FechaDisponibilidad.Date.Equals(fecha_disponibilidad.Date)) { Pregunta.FormatDisponibilidad(item.Oid, fecha_disponibilidad); } } }
private void Examen_BT_Click(object sender, EventArgs e) { ExamenSelectForm form = new ExamenSelectForm(this); form.ShowDialog(); if (form.DialogResult == DialogResult.OK) { _examen = form.Selected as ExamenInfo; if (_entity.AlumnoExamens.GetItemByExamen(_examen.Oid) != null) { MessageBox.Show("El examen seleccionado ya ha sido asignado previamente a este alumno", moleQule.Face.Resources.Labels.ADVISE_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } Examen_TB.Text = _examen.Titulo; SetRespuestas(); } }
protected override void SetUnlinkedGridValues(string gridName) { switch (gridName) { case "Examenes_Grid": { ExamenList examenes = ExamenList.GetList(false); foreach (DataGridViewRow row in Examenes_Grid.Rows) { if (row.IsNewRow) { continue; } Alumno_Examen info = (Alumno_Examen)row.DataBoundItem; if (info != null) { ExamenInfo examen = examenes.GetItem(info.OidExamen); if (examen != null) { row.Cells["Examen"].Value = examen.Titulo; if (info.Presentado) { if (examen.Desarrollo) { string calif = string.Empty; foreach (Respuesta_Alumno_Examen item in info.Respuestas) { if (calif != string.Empty) { calif += " - "; } calif += item.Calificacion.ToString() + "%"; } row.Cells["Calificacion"].Value = calif; } else { row.Cells["Calificacion"].Value = info.Calificacion.ToString(); } } else { row.Cells["Calificacion"].Value = "NP"; } } } } } break; case "Practicas_Grid": { //ClasePracticaList practicas = ClasePracticaList.GetList(); foreach (DataGridViewRow row in Practicas_Grid.Rows) { if (row.IsNewRow) { continue; } Alumno_Practica info = (Alumno_Practica)row.DataBoundItem; if (info != null) { if (info.Calificacion == Resources.Labels.NO_APTO_LABEL) { if (info.Falta) { info.Calificacion = Resources.Labels.FALTA_ASISTENCIA_LABEL; row.DefaultCellStyle = FaltaStyle; } else { row.DefaultCellStyle = NoAptaStyle; } } else { if (info.Calificacion == Resources.Labels.FALTA_ASISTENCIA_LABEL) { row.DefaultCellStyle = FaltaStyle; } else { if (info.Calificacion == Resources.Labels.APTO_LABEL) { row.DefaultCellStyle = AptaStyle; } } } } if (info.Recuperada) { row.DefaultCellStyle = AptaStyle; } } } break; case "Faltas_Grid": { ParteAsistenciaList partes = ParteAsistenciaList.GetList(false); foreach (DataGridViewRow row in Faltas_Grid.Rows) { if (row.IsNewRow) { continue; } Alumno_Parte info = (Alumno_Parte)row.DataBoundItem; if (info != null) { ParteAsistenciaInfo item = partes.GetItem(info.OidParte); if (item != null) { row.Cells["Clase"].Value = item.Texto; row.Cells["Fecha"].Value = item.Fecha; row.Cells["Hora"].Value = item.HoraInicio; } } } } break; } }
protected override void LiberarAction() { if (!AppContext.User.IsAdmin /*|| !(AppContext.User.Name == "Admin")*/) { MessageBox.Show("Esta acción solo está permitida al administrador del sistema"); return; } _liberar = true; if (Entity.FechaExamen.Date > DateTime.Today.Date) { if (Entity.Alumnos != null && Entity.Alumnos.Count > 0) { MessageBox.Show("No se puede liberar un examen que tiene alumnos asociados."); } else { PgMng.Reset(Entity.PreguntaExamens.Count * 2 + 2, 1, "Eliminando copias de preguntas y respuestas...", this); PreguntaExamens preguntas = Entity.PreguntaExamens.Clone(); Entity.MemoPreguntas = string.Empty; foreach (PreguntaExamen p in preguntas) { Entity.PreguntaExamens.Remove(p.Oid); Entity.MemoPreguntas += p.OidPregunta.ToString() + ";"; PgMng.Grow(); } string directorio = Library.Application.AppController.FOTOS_PREGUNTAS_EXAMEN_PATH + Entity.Oid.ToString("00000"); if (Directory.Exists(directorio)) { Directory.Delete(directorio, true); } PgMng.Grow("Liberando preguntas..."); if (Entity.MemoPreguntas != string.Empty) { PgMng.Grow("Liberando preguntas..."); string lista_preguntas = Entity.MemoPreguntas.Replace(';', ',').Substring(0, Entity.MemoPreguntas.Length - 1); _preguntas_examen = Preguntas.GetPreguntasByList(lista_preguntas, _entity.SessionCode); foreach (Pregunta item in _preguntas_examen) { DateTime fecha = ExamenInfo.GetUltimoByPreguntaIncluida(item.Oid, Entity.FechaExamen); if (fecha != DateTime.MinValue) { item.FechaDisponibilidad = fecha.AddMonths(6); item.FechaUltimoExamen = fecha; } else { item.FechaDisponibilidad = item.FechaAlta; item.FechaUltimoExamen = item.FechaAlta.AddMonths(-6); } item.Bloqueada = false; item.Reservada = true; PgMng.Grow(); } _preguntas_examen.Save(); } Entity.FechaEmision = DateTime.MaxValue; FExamen_DTP.Enabled = true; Desarrollo_CB.Enabled = true; Instructor_CB.Enabled = true; Promocion_CB.Enabled = true; Tipo_TB.Enabled = true; PgMng.FillUp(); MessageBox.Show("El examen ha sido liberado correctamente."); SaveAction(); //Scripts.FormatFechaDisponibilidad(); } } else { MessageBox.Show("No se puede liberar un examen que ya se ha celebrado."); } _liberar = false; }
private void Imprimir_BT_Click(object sender, EventArgs e) { InsertarRegistros(); ExamenInfo EntityInfo = _entity.GetInfo(true); ExamenReportMng reportMng = new ExamenReportMng(AppContext.ActiveSchema); //List<Alumno_ExamenInfo> lista = new List<Alumno_ExamenInfo>(); //foreach (AlumnoInfo alumno in _alumnos) //{ // Alumno_ExamenInfo item = EntityInfo.Alumnos.GetItemByProperty("OidAlumno", alumno.Oid); // if (item != null) // lista.Add(item); //} foreach (TreeNode promocion in Arbol_TV.Nodes) { List <Alumno_ExamenInfo> lista = new List <Alumno_ExamenInfo>(); foreach (TreeNode alumno in promocion.Nodes) { if (alumno.Checked) { long oid = ((AlumnoInfo)alumno.Tag).Oid; Alumno_ExamenInfo item = EntityInfo.Alumnos.GetItemByProperty("OidAlumno", oid); if (item != null) { lista.Add(item); } } } if (lista.Count > 0) { bool defecto = moleQule.Library.Instruction.ModulePrincipal.GetImpresionEmpresaDefaultBoolSetting(); CompanyInfo empresa = null; if (defecto) { empresa = CompanyInfo.Get(moleQule.Library.Instruction.ModulePrincipal.GetImpresionEmpresaDefaultOidSetting(), false); } while (empresa == null) { moleQule.Face.Common.CompanySelectForm form = new Common.CompanySelectForm(this); DialogResult result = form.ShowDialog(); try { if (result == DialogResult.OK) { empresa = form.Selected as CompanyInfo; } } catch { empresa = null; } } ISchemaInfo schema = AppContext.ActiveSchema; try { schema = empresa as ISchemaInfo; if (schema == null) { schema = AppContext.ActiveSchema; } } catch { } ReportViewer.SetReport(reportMng.GetDetailAsistenciaExamenReport(EntityInfo, _promociones, lista, empresa, ((PromocionInfo)promocion.Tag).Nombre)); ReportViewer.ShowDialog(); } } /*foreach (Alumno_ExamenInfo item in EntityInfo.Alumnos) * { * AlumnoInfo alumno = _alumnos.GetItem(item.OidAlumno); * if (alumno != null) * { * //item.OidPromocion = alumno.OidPromocion; * lista.Add(item); * } * }*/ //if (lista.Count > 0) //{ // ReportViewer.SetReport(reportMng.GetDetailAsistenciaExamenReport(EntityInfo, // _promociones, lista, // moleQule.Library.Common.EmpresaInfo.Get(AppContext.ActiveSchema.Oid))); // ReportViewer.ShowDialog(); //} }