/// <summary>Duplica un objeto y abre el formulario para editar item
        /// <returns>void</returns>
        /// </summary>
        public override void DuplicateObject(long oid)
        {
            try
            {
                PlanExtra old = PlanExtra.Get(oid);
                PlanExtra dup = old.CloneAsNew();
                old.CloseSession();

                AddForm(new PlanExtraAddForm(dup));
            }
            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();
        }
 /// <summary>
 /// Abre el formulario para editar item
 /// <returns>void</returns>
 /// </summary>
 public override void OpenEditForm()
 {
     try
     {
         PlanExtraEditForm form = new PlanExtraEditForm(ActiveOID);
         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);
     }
 }
        /// <summary>
        /// Abre el formulario para borrar item
        /// <returns>void</returns>
        /// </summary>
        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
            {
                PlanExtra.Delete(oid);
                _action_result = DialogResult.OK;

                //Se eliminan todos los formularios de ese objeto
                foreach (ItemMngBaseForm form in _list_active_form)
                {
                    if (form.Oid == oid)
                    {
                        form.Dispose();
                        break;
                    }
                }
            }
            catch (Csla.DataPortalException ex)
            {
                MessageBox.Show(iQExceptionHandler.GetiQException(ex).Message);
            }
            //}
        }
 /// <summary>Aplica las reglas de validación de usuarios al formulario.
 /// <returns>void</returns>
 /// </summary>
 protected override void ApplyAuthorizationRules()
 {
     Tabla.Visible         = PlanExtra.CanGetObject();
     Add_Button.Enabled    = PlanExtra.CanAddObject();
     Edit_Button.Enabled   = PlanExtra.CanEditObject();
     Delete_Button.Enabled = PlanExtra.CanDeleteObject();
     Print_Button.Enabled  = PlanExtra.CanGetObject();
     View_Button.Enabled   = PlanExtra.CanGetObject();
 }
 public PlanExtraAddForm(PlanExtra source)
     : base()
 {
     InitializeComponent();
     _entity = source.Clone();
     _entity.BeginEdit();
     SetFormData();
     _mf_type  = ManagerFormType.MFAdd;
     this.Text = Resources.Labels.PLAN_EXTRA_ADD_TITLE;
 }
        public override void UpdateList()
        {
            switch (_current_action)
            {
            case molAction.Add:
                if (_entity == null)
                {
                    return;
                }
                List.AddItem(_entity.GetInfo(false));
                if (FilterType == IFilterType.Filter)
                {
                    PlanExtraList listA = PlanExtraList.GetList(_filter_results);
                    listA.AddItem(_entity.GetInfo(false));
                    _filter_results = listA.GetSortedList();
                }
                break;

            case molAction.Edit:
            case molAction.Lock:
            case molAction.Unlock:
                if (_entity == null)
                {
                    return;
                }
                ActiveItem.CopyFrom(_entity);
                break;

            case molAction.Delete:
                if (ActiveItem == null)
                {
                    return;
                }
                List.RemoveItem(ActiveOID);
                if (FilterType == IFilterType.Filter)
                {
                    PlanExtraList listD = PlanExtraList.GetList(_filter_results);
                    listD.RemoveItem(ActiveOID);
                    _filter_results = listD.GetSortedList();
                }
                break;
            }

            _entity = null;
            RefreshSources();
        }
Exemplo n.º 7
0
        /// <summary>
        /// Guarda en la bd el objeto actual
        /// </summary>
        protected override bool SaveObject()
        {
            using (StatusBusy busy = new StatusBusy(moleQule.Face.Resources.Messages.SAVING))
            {
                this.Datos.RaiseListChangedEvents = false;

                PlanExtra temp = _entity.Clone();
                temp.ApplyEdit();

                // do the save
                try
                {
                    _entity = temp.Save();
                    _entity.ApplyEdit();

                    //Decomentar si se va a mantener en memoria
                    //_entity.BeginEdit();
                    return(true);
                }
                catch (iQValidationException ex)
                {
                    MessageBox.Show(iQExceptionHandler.GetAllMessages(ex) +
                                    Environment.NewLine + ex.SysMessage,
                                    moleQule.Library.Application.AppController.APP_TITLE,
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Exclamation);
                    return(false);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(iQExceptionHandler.GetAllMessages(ex),
                                    moleQule.Library.Application.AppController.APP_TITLE,
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Exclamation);
                    return(false);
                }
                finally
                {
                    this.Datos.RaiseListChangedEvents = true;
                }
            }
        }
 protected override void GetFormSourceData()
 {
     _entity = PlanExtra.New();
     _entity.BeginEdit();
 }
 public void SetSourceData(PlanExtra item)
 {
     _entity = item;
 }
Exemplo n.º 10
0
 protected override void GetFormSourceData(long oid)
 {
     _entity = PlanExtra.Get(oid);
     _entity.BeginEdit();
     _mf_type = ManagerFormType.MFEdit;
 }