Beispiel #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();
        }
Beispiel #2
0
 public override void OpenAddForm()
 {
     try
     {
         ExamenAddForm form = new ExamenAddForm(true);
         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);
     }
 }