Exemplo n.º 1
0
        /// <summary>Duplica un objeto y abre el formulario para editar item
        /// <returns>void</returns>
        /// </summary>
        public override void CopyObjectAction(long oid)
        {
            try
            {
                Examen new_item = Examen.Duplicate(oid);

                if (new_item != null)
                {
                    ExamenAddForm add_form = new ExamenAddForm(new_item);
                    AddForm(add_form);

                    if (add_form.ActionResult == DialogResult.OK)
                    {
                        PgMng.Reset(3, 1, Resources.Messages.LOADING_DATA, this);

                        new_item = Examen.Get(add_form.Entity.Oid);
                        bool no_disponibles = new_item.DuplicateList(oid);
                        PgMng.Grow();

                        new_item.Save();
                        new_item.CloseSession();
                        PgMng.Grow();

                        if (no_disponibles)
                        {
                            PgMng.ShowInfoException(Resources.Messages.EXAMEN_DUPLICADO_CON_PREGUNTAS_NO_DISPONIBLES);
                        }

                        PgMng.FillUp();

                        ExamenEditForm form = new ExamenEditForm(new_item.Oid);
                        AddForm(form);
                    }
                }
            }
            catch (iQException ex)
            {
                MessageBox.Show(ex.Message,
                                moleQule.Face.Resources.Labels.ERROR_TITLE,
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation);
            }
            catch (Csla.DataPortalException ex)
            {
                MessageBox.Show(iQExceptionHandler.GetiQException(ex).Message,
                                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);
            }

            RefreshList();
        }
Exemplo n.º 2
0
        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);
            }
        }