Exemple #1
0
        private void DataGridView_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.RowIndex > -1)
            {
                Examen ex = examenes[Convert.ToInt32(DGVExamen.Rows[e.RowIndex].Cells[2].Value)];
                idExamenSelected = ex.IdData;
                indexRowSelected = e.RowIndex;
                ConfiguracionExamen.GetInstance().Loading = true;
                DGVExamen.Enabled = false;

                PanelExamen.SuspendLayout();
                CargarPlantillaEnPanel(ex);
                SetTabRespuestas(examenes[idExamenSelected]);


                HabilitarBarTitle();
                if (ex.Estado == EstadoExamen.Terminado)
                {
                    BlockPanelExamen();
                    DeshabilitarTools();
                }
                else
                {
                    UnblockPanelExamen();
                    HabilitarTools();
                }
                ConfiguracionExamen.GetInstance().Loading = false;
                PanelExamen.ResumeLayout(false);
            }
        }
Exemple #2
0
        private void CargarPlantillaEnPanel(Examen examen)
        {
            LogicaCuenta oLCuenta  = new LogicaCuenta();
            Plantilla    plantilla = Plantillas.GetInstance().GetPlantilla(examen.IdPlantilla);

            CheckEstado.Checked = Convert.ToBoolean((int)examen.Estado);
            LabelExamen.Text    = Plantillas.GetInstance().Coleccion()[examen.IdPlantilla].Nombre;

            Cuenta account = oLCuenta.ObtenerCuenta(examen.IdCuenta);

            LabelUsuarioLast.Text = (account.Nombre + account.PrimerApellido).ToUpper() + " (" + account.Dni + ")";


            this.SuspendLayout();
            List <ExamenEditorFila> filas = new List <ExamenEditorFila>();

            panelActual = new ExamenEditorContenedor(PanelExamen.Width - 10, PanelExamen.Height - 10);
            PanelExamen.SuspendLayout();

            ExamenEditorFila  filaForm  = null;
            ExamenEditorItem  itemForm  = null;
            ExamenEditorGrupo grupoForm = null;
            PlantillaItem     item;
            int posicion = 0;

            for (int indice = 0; indice < plantilla.Filas.Count; indice++)
            {
                if (PlantillaFila.PlantillaFilaTipo.Agrupada == plantilla.Filas[indice].Tipo)
                {
                    PlantillaFilaGrupo filaGrupo = (PlantillaFilaGrupo)plantilla.Filas[indice];
                    filaForm = new ExamenEditorFila(panelActual.Width - 10, 25);
                    filaForm.SuspendLayout();
                    filaForm.Tipo = ExamenEditorFila.TipoForm.Grupo;
                    grupoForm     = new ExamenEditorGrupo(filaForm.Width - 5, 0);
                    grupoForm.SuspendLayout();
                    grupoForm.Location = new Point(0, 0);
                    grupoForm.Nombre   = filaGrupo.Nombre;
                    List <ExamenEditorItem> items = new List <ExamenEditorItem>();
                    for (int j = 0; j < filaGrupo.Items.Count; j++)
                    {
                        item     = filaGrupo.Items[j];
                        itemForm = new ExamenEditorItem(grupoForm.Width - 20, 25, item.TieneUnidad);

                        itemForm.SuspendLayout();
                        itemForm.TabIndex = posicion;
                        posicion++;
                        itemForm.IdItem    = item.IdData;
                        itemForm.Nombre    = item.Nombre;
                        itemForm.TipoDato  = item.TipoDato;
                        itemForm.TipoCampo = item.TipoCampo;
                        if (item.TipoCampo == TipoCampo.Lista)
                        {
                            itemForm.Opciones = item.OpcionesByIndice;
                        }
                        else if (item.TipoCampo == TipoCampo.Texto)
                        {
                            filaForm.Height = 80;
                            itemForm.Height = 80;
                        }

                        if (item.TipoDato == TipoDato.Entero || item.TipoDato == TipoDato.Bool)
                        {
                            itemForm.RegEx = DiccionarioGeneral.GetInstance().Expression[(int)item.TipoDato];
                        }
                        if (item.TieneUnidad)
                        {
                            itemForm.Unidad = item.Unidad;
                        }
                        itemForm.Location = new Point(10, 20);
                        items.Add(itemForm);
                        itemForm.ResumeLayout(false);
                    }
                    grupoForm.Items = items;
                    filaForm.Grupo  = grupoForm;
                    filas.Add(filaForm);
                    grupoForm.ResumeLayout(false);
                    filaForm.ResumeLayout(false);
                }
                else
                {
                    item     = ((PlantillaFilaSimple)plantilla.Filas[indice]).Item;
                    filaForm = new ExamenEditorFila(panelActual.Width - 10, 25);
                    filaForm.SuspendLayout();
                    filaForm.Location = new Point(10, 10);
                    filaForm.Tipo     = ExamenEditorFila.TipoForm.Item;

                    itemForm = new ExamenEditorItem(filaForm.Width - 5, 25, item.TieneUnidad);

                    itemForm.SuspendLayout();
                    itemForm.Location = new Point(0, 0);
                    itemForm.IdItem   = item.IdData;
                    itemForm.Nombre   = item.Nombre;
                    itemForm.TabIndex = posicion;
                    posicion++;
                    itemForm.TipoCampo = item.TipoCampo;
                    itemForm.TipoDato  = item.TipoDato;
                    if (item.TipoCampo == TipoCampo.Lista)
                    {
                        itemForm.Opciones = item.OpcionesByIndice;
                    }
                    else if (item.TipoCampo == TipoCampo.Texto)
                    {
                        filaForm.Height = 80;
                        itemForm.Height = 80;
                    }
                    if (item.TieneUnidad)
                    {
                        itemForm.Unidad = item.Unidad;
                    }
                    filaForm.Item = itemForm;
                    filas.Add(filaForm);
                    itemForm.ResumeLayout(false);
                    filaForm.ResumeLayout(false);
                }
            }

            panelActual.Filas = filas;
            PanelExamen.Controls.Add(panelActual);
            PanelExamen.ResumeLayout(false);
            this.ResumeLayout(false);
        }