/// <summary>
        /// Abre el formulario para ver item
        /// <returns>void</returns>
        /// </summary>
        public override void OpenViewForm()
        {
            try
            {
                PlantillaExamenInfo item = PlantillaExamenInfo.Get(ActiveOID, false);

                if (item.Desarrollo)
                {
                    AddForm(new PlantillaDesarrolloViewForm(ActiveOID));
                }
                else
                {
                    AddForm(new PlantillaViewForm(ActiveOID));
                }
            }
            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);
            }
        }
        public PlantillaDesarrolloViewForm(PlantillaExamenInfo source)
            : base()
        {
            InitializeComponent();

            _entity = source.Clone();
            SetFormData();
            _mf_type  = ManagerFormType.MFView;
            this.Text = Resources.Labels.PLANTILLA_EXAMEN_EDIT_TITLE;
        }
 protected override void GetFormSourceData(long oid)
 {
     _entity  = PlantillaExamenInfo.Get(oid, false);
     _mf_type = ManagerFormType.MFView;
 }
Exemplo n.º 4
0
        private void Select_Button_Click(object sender, EventArgs e)
        {
            _plantilla = PlantillaExamenInfo.Get(ActiveOID);

            if (_plantilla != null)
            {
                _guardado = true;

                if (!_plantilla.Desarrollo)
                {
                    TemaList temas = TemaList.GetModuloList(_modulo.Oid, false);

                    foreach (Preguntas_PlantillaInfo item in _plantilla.Preguntas)
                    {
                        long count = item.NPreguntas;

                        PreguntaList preguntas_tema = PreguntaList.GetPreguntasDisponiblesTema(item.OidTema, _entity.Desarrollo, _entity.FechaExamen, count);

                        if (preguntas_tema != null)
                        {
                            foreach (PreguntaInfo info in preguntas_tema)
                            {
                                if (count == 0)
                                {
                                    break;
                                }

                                Pregunta_Examen pregunta = Pregunta_Examen.NewChild(_entity);
                                pregunta.OidPregunta = info.Oid;
                                _entity.Pregunta_Examens.AddItem(pregunta);
                                count--;
                            }
                        }

                        if (count != 0)
                        {
                            TemaInfo tema = temas.GetItem(item.OidTema);
                            MessageBox.Show("No hay suficientes preguntas disponibles para el tema " + tema.Codigo);
                        }
                    }
                }
                else
                {
                    long count = _plantilla.NPreguntas;

                    PreguntaList preguntas = PreguntaList.GetPreguntasDisponiblesModulo(_entity.OidModulo, _entity.Desarrollo, _entity.FechaExamen, count);

                    if (preguntas != null)
                    {
                        foreach (PreguntaInfo info in preguntas)
                        {
                            if (count == 0)
                            {
                                break;
                            }

                            Pregunta_Examen pregunta = Pregunta_Examen.NewChild(_entity);
                            pregunta.OidPregunta = info.Oid;
                            _entity.Pregunta_Examens.AddItem(pregunta);
                            count--;
                        }
                    }

                    if (count != 0)
                    {
                        MessageBox.Show("No hay suficientes preguntas disponibles en el submódulo");
                    }
                }
            }

            Cerrar();
            Close();
        }