Ejemplo n.º 1
0
        public override void DoExecuteAction(molAction action)
        {
            switch (_current_action)
            {
            case molAction.Add:

                //EnableForm(false);
                AddAction();
                this.Enabled = true;
                break;

            case molAction.Delete:

                if (this.Datos.Count > 0)
                {
                    //EnableForm(false);
                    DeleteAction();
                }
                break;

            case molAction.Select:

                if (this.Datos.Count > 0)
                {
                    _action_result = DialogResult.OK;
                    SelectAction();
                    DialogResult = _action_result;
                }
                break;

            default:
                base.DoExecuteAction(action);
                break;
            }
        }
Ejemplo n.º 2
0
        public override void DoExecuteAction(molAction action)
        {
            switch (action)
            {
            case molAction.CustomAction1:
                //EnableForm(false);
                CustomAction1();
                break;

            case molAction.CustomAction2:
                //EnableForm(false);
                CustomAction2();
                break;

            case molAction.CustomAction3:
                //EnableForm(false);
                CustomAction3();
                break;

            case molAction.CustomAction4:
                //EnableForm(false);
                CustomAction4();
                break;

            default:
                base.DoExecuteAction(action);
                break;
            }
        }
Ejemplo n.º 3
0
        protected void SetActionStyle(molAction action, string title, Bitmap image)
        {
            switch (action)
            {
            case molAction.CustomAction1:
            {
                Action1_TI.Image = image;
                Action1_TI.Text  = title;
            }
            break;

            case molAction.CustomAction2:
            {
                Action2_TI.Image = image;
                Action2_TI.Text  = title;
            }
            break;

            case molAction.CustomAction3:
            {
                Action3_TI.Image = image;
                Action3_TI.Text  = title;
            }
            break;

            case molAction.CustomAction4:
            {
                Action4_TI.Image = image;
                Action4_TI.Text  = title;
            }
            break;
            }
        }
Ejemplo n.º 4
0
        protected override void ActivateAction(molAction action, bool state)
        {
            switch (action)
            {
            case molAction.Add:
                Add_TI.Visible = state;
                break;

            case molAction.Delete:
                Delete_TI.Visible = state;
                break;

            case molAction.Print:
                Print_TI.Visible      = state;
                Print_BT.Visible      = state;
                Separator2_TI.Visible = state;
                break;

            case molAction.Select:
                Select_TI.Visible = state;
                break;

            case molAction.Close:
                Close_TI.Visible = state;
                break;
            }
        }
Ejemplo n.º 5
0
        protected void SetActionStyle(molAction action, string title, Bitmap image)
        {
            switch (action)
            {
            case molAction.CustomAction1:
            {
                CustomAction1_MI.Image = (image != null) ? image : CustomAction1_MI.Image;
                CustomAction1_MI.Text  = title;
            }
            break;

            case molAction.CustomAction2:
            {
                CustomAction2_MI.Image = (image != null) ? image : CustomAction2_MI.Image;
                CustomAction2_MI.Text  = title;
            }
            break;

            case molAction.CustomAction3:
            {
                CustomAction3_MI.Image = (image != null) ? image : CustomAction3_MI.Image;
                CustomAction3_MI.Text  = title;
            }
            break;

            case molAction.CustomAction4:
            {
                CustomAction4_MI.Image = (image != null) ? image : CustomAction4_MI.Image;
                CustomAction4_MI.Text  = title;
            }
            break;
            }
        }
Ejemplo n.º 6
0
        protected override void ActivateAction(molAction action, bool state)
        {
            if (EntityType == null)
            {
                return;
            }

            switch (action)
            {
            case molAction.CustomAction1:
                CustomAction1_MI.Visible = state;
                break;

            case molAction.CustomAction2:
                CustomAction1_MI.Visible = state;
                break;

            case molAction.CustomAction3:
                CustomAction1_MI.Visible = state;
                break;

            case molAction.CustomAction4:
                CustomAction1_MI.Visible = state;
                break;

            case molAction.Refresh:
                Refresh_MI.Visible    = state;
                Separator1_MI.Visible = state;
                break;
            }
        }
Ejemplo n.º 7
0
        protected override void ActivateAction(molAction action, bool state)
        {
            if (EntityType == null)
            {
                return;
            }

            switch (action)
            {
            case molAction.ChangeStateContabilizado:

                if ((AppContext.User != null) && (state))
                {
                    base.ActivateAction(action, Library.AutorizationRulesControler.CanEditObject(Library.Invoice.Resources.SecureItems.CUENTA_CONTABLE));
                }
                else
                {
                    base.ActivateAction(action, state);
                }

                break;

            default:
                base.ActivateAction(action, state);
                break;
            }
        }
Ejemplo n.º 8
0
        public override void DoExecuteAction(molAction action)
        {
            switch (action)
            {
            case molAction.CustomAction1:

                if (this.Datos.Count == 0)
                {
                    return;
                }
                CustomAction1();

                break;

            case molAction.CustomAction2:

                if (this.Datos.Count == 0)
                {
                    return;
                }
                CustomAction2();

                break;

            case molAction.CustomAction3:

                if (this.Datos.Count == 0)
                {
                    return;
                }
                CustomAction3();

                break;

            case molAction.CustomAction4:

                if (this.Datos.Count == 0)
                {
                    return;
                }
                CustomAction4();

                break;

            case molAction.Refresh:

                RefreshAction();
                break;

            default:
                base.DoExecuteAction(action);
                break;
            }
        }
Ejemplo n.º 9
0
        public override void ExecuteAction(molAction action, bool nested)
        {
            try
            {
#if TRACE
                PgMng.Record(String.Format("ItemMngBaseForm::ExecuteAction {0} INI", action.ToString()));
#endif
                if (!nested)
                {
                    if (Status == EStatus.Working)
                    {
                        return;
                    }

                    Status = EStatus.Working;

                    _current_action = action;

                    //Se usa un atributo porque si uso el DialogResult el ShowDialog entiende que quiero cerrar el formulario
                    _action_result = DialogResult.Ignore;
                }

                DoExecuteAction(action);
#if TRACE
                PgMng.Record(String.Format("ItemMngBaseForm::ExecuteAction {0} END", action.ToString()));
#endif
            }
            catch (iQValidationException ex)
            {
                Control control = ControlsMng.GetControlByProperty(Controls, ex.Field);

                if (control != null)
                {
                    MarkError(control, ex.Message);
                }
                else
                {
                    PgMng.ShowWarningException(ex);
                }
            }
            catch (Exception ex)
            {
                PgMng.ShowErrorException(ex);
            }
            finally
            {
                Status = EStatus.OK;
                if (PgMng != null)
                {
                    PgMng.FillUp();
                }
            }
        }
Ejemplo n.º 10
0
        protected override void ActivateAction(molAction action, bool state)
        {
            switch (action)
            {
            case molAction.CustomAction1:

                CustomAction1_TI.Enabled = state;
                CustomAction1_MI.Enabled = state;
                CustomAction1_TI.Visible = state;
                CustomAction1_MI.Visible = state;

                break;

            case molAction.CustomAction2:

                CustomAction2_TI.Enabled = state;
                CustomAction2_MI.Enabled = state;
                CustomAction2_TI.Visible = state;
                CustomAction2_MI.Visible = state;

                break;

            case molAction.CustomAction3:

                CustomAction3_TI.Enabled = state;
                CustomAction3_MI.Enabled = state;
                CustomAction3_TI.Visible = state;
                CustomAction3_MI.Visible = state;

                break;

            case molAction.Print:

                Print_TI.Enabled = state;
                Print_MI.Enabled = state;
                Print_TI.Visible = state;
                Print_MI.Visible = state;

                PrintBlock_TSS.Visible = state;

                break;

            case molAction.Refresh:

                Refresh_TI.Enabled = state;
                Refresh_MI.Enabled = state;
                Refresh_TI.Visible = state;
                Refresh_MI.Visible = state;

                break;
            }
        }
Ejemplo n.º 11
0
        protected override void ActivateAction(molAction action, bool state)
        {
            if (EntityType == null)
            {
                return;
            }

            switch (action)
            {
            default:
                base.ActivateAction(action, state);
                break;
            }
        }
Ejemplo n.º 12
0
        public override void DoExecuteAction(molAction action)
        {
            switch (action)
            {
            case molAction.CustomAction1:

                CustomAction1();

                break;

            case molAction.CustomAction2:

                CustomAction2();
                break;

            case molAction.CustomAction3:

                CustomAction3();

                break;

            case molAction.DateSelection:

                DateSelectAction();

                break;

            case molAction.Print:

                PrintAction();

                break;

            case molAction.Refresh:

                RefreshAction();

                break;

            case molAction.Submit:

                SubmitAction();

                break;

            default:
                base.ExecuteAction(action);
                break;
            }
        }
Ejemplo n.º 13
0
        protected override void ActivateAction(molAction action, bool state)
        {
            switch (action)
            {
            case molAction.Submit:
                Submit_BT.Visible = state;
                break;

            case molAction.Print:
                Imprimir_Button.Visible = state;
                break;

            case molAction.Close:
                Cancel_BT.Visible = state;
                break;
            }
        }
Ejemplo n.º 14
0
        public override void DoExecuteAction(molAction action)
        {
            switch (action)
            {
            case molAction.Save:

                if (this.Datos.Count == 0)
                {
                    return;
                }
                DownloadAction();

                break;

            default:
                base.DoExecuteAction(action);
                break;
            }
        }
Ejemplo n.º 15
0
        public virtual void ExecuteAction(molAction action, bool nested)
        {
            try
            {
#if TRACE
                PgMng.Record(String.Format("ChildForm::ExecuteAction {0} INI", action.ToString()));
#endif
                if (!nested)
                {
                    if (Status == EStatus.Working)
                    {
                        return;
                    }

                    Status = EStatus.Working;

                    _current_action = action;

                    //Se usa un atributo porque si uso el DialogResult el ShowDialog entiende que quiero cerrar el formulario
                    _action_result = DialogResult.Ignore;
                }

                DoExecuteAction(action);
#if TRACE
                PgMng.Record(String.Format("ChildForm::ExecuteAction {0} END", action.ToString()));
#endif
            }
            catch (iQImplementationException ex)
            {
                PgMng.ShowInfoException(ex);
            }
            catch (Exception ex)
            {
                PgMng.ShowErrorException(ex);
            }
            finally
            {
                Status = EStatus.OK;
                //EnableForm(true);
                PgMng.FillUp();
            }
        }
Ejemplo n.º 16
0
        public virtual void DoExecuteAction(molAction action)
        {
            switch (action)
            {
            case molAction.Cancel:

                DialogResult = DialogResult.Cancel;
                CancelAction();
                break;

            case molAction.CancelBkJob:

                CancelBkJobAction();
                break;

            case molAction.Default:

                //Para permitir que se ejecute la accion por defecto
                Status = EStatus.OK;

                DefaultAction();
                break;

            case molAction.Print:

                PrintAction();
                break;

            case molAction.Submit:

                SubmitAction();
                if (_action_result == DialogResult.OK)
                {
                    DialogResult = DialogResult.OK;
                }
                break;
            }
        }
Ejemplo n.º 17
0
        public override void DoExecuteAction(molAction action)
        {
            switch (action)
            {
            case molAction.Cancel:

                if (CancelConfirmation)
                {
                    if (DialogResult.Yes == ProgressInfoMng.ShowQuestion(Resources.Messages.CANCEL_CONFIRM))
                    {
                        _action_result = DialogResult.Cancel;
                        CancelAction();
                    }
                    else
                    {
                        _action_result = DialogResult.Ignore;
                    }
                }
                else
                {
                    _action_result = DialogResult.Cancel;
                    CancelAction();
                }

                break;

            case molAction.Close:

                DialogResult = DialogResult.Cancel;
                Cerrar();
                break;

            case molAction.Print:

                _action_result = DialogResult.Ignore;
                PrintAction();
                break;

            case molAction.Save:

                ErrorMng_EP.Clear();
#if !TRACE
                PgMng.Reset(3, 1, Face.Resources.Messages.SAVING, this);
#endif
                //Se usa un atributo porque si uso el DialogResult el ShowDialog entiende que quiero cerrar el formulario
                _action_result = DialogResult.Ignore;

                SaveAction();

                switch (_action_result)
                {
                case DialogResult.OK:
                    _action_result = DialogResult.OK;
                    Close();
                    break;

                case DialogResult.Cancel:
                    _action_result = DialogResult.Cancel;
                    Close();
                    break;

                case DialogResult.Ignore:
                    break;
                }

                break;

            case molAction.ShowDocuments:

                _action_result = DialogResult.Ignore;
                DocumentsAction();
                break;

            default:
                base.DoExecuteAction(action);
                break;
            }
        }
Ejemplo n.º 18
0
 public void ExecuteAction(molAction action)
 {
     ExecuteAction(action, false);
 }
Ejemplo n.º 19
0
 protected void HideAction(molAction action)
 {
     ActivateAction(action, false);
 }
Ejemplo n.º 20
0
 protected void ShowAction(molAction action)
 {
     ActivateAction(action, true);
 }
Ejemplo n.º 21
0
 protected virtual void ActivateAction(molAction action, bool state)
 {
 }
Ejemplo n.º 22
0
 protected virtual void EnableAction(molAction action, bool state)
 {
 }
Ejemplo n.º 23
0
        protected override void ActivateAction(molAction action, bool state)
        {
            if (EntityType == null)
            {
                return;
            }

            bool allow;

            switch (action)
            {
            case molAction.Add:

                allow = (bool)EntityType.InvokeMember("CanAddObject", BindingFlags.Static | BindingFlags.InvokeMethod | BindingFlags.Public, null, null, null);

                Add_Button.Enabled = (allow) ? state : false;
                Nuevo_MI.Enabled   = (allow) ? state : false;
                Add_Button.Visible = (allow) ? state : false;
                Nuevo_MI.Visible   = (allow) ? state : false;

                break;

            case molAction.View:

                allow = (bool)EntityType.InvokeMember("CanGetObject", BindingFlags.Static | BindingFlags.InvokeMethod | BindingFlags.Public, null, null, null);

                View_Button.Enabled = (allow) ? state : false;
                Detalle_MI.Enabled  = (allow) ? state : false;
                View_Button.Visible = (allow) ? state : false;
                Detalle_MI.Visible  = (allow) ? state : false;

                break;

            case molAction.Edit:

                allow = (bool)EntityType.InvokeMember("CanEditObject", BindingFlags.Static | BindingFlags.InvokeMethod | BindingFlags.Public, null, null, null);

                Edit_Button.Enabled  = (allow) ? state : false;
                Modificar_MI.Enabled = (allow) ? state : false;
                Edit_Button.Visible  = (allow) ? state : false;
                Modificar_MI.Visible = (allow) ? state : false;

                break;

            case molAction.Delete:

                allow = (bool)EntityType.InvokeMember("CanDeleteObject", BindingFlags.Static | BindingFlags.InvokeMethod | BindingFlags.Public, null, null, null);

                Delete_Button.Enabled = (allow) ? state : false;
                Borrar_MI.Enabled     = (allow) ? state : false;
                Delete_Button.Visible = (allow) ? state : false;
                Borrar_MI.Visible     = (allow) ? state : false;

                break;

            case molAction.Print:
                Imprimir_MI.Enabled = state;
                Imprimir_MI.Visible = state;
                break;

            case molAction.Copy:
                Duplicar_MI.Enabled = state;
                Duplicar_MI.Visible = state;
                break;

            case molAction.Select:
                Select_TI.Enabled = state;
                Select_TI.Visible = state;
                break;

            case molAction.Close:
                Close_TI.Enabled = state;
                Close_TI.Visible = state;
                break;
            }
        }
Ejemplo n.º 24
0
 public MenuItemViewModel GetItem(molAction action)
 {
     return(this.FirstOrDefault(x => x.Operation == action));
 }
Ejemplo n.º 25
0
        protected override void ActivateAction(molAction action, bool state)
        {
            if (EntityType == null)
            {
                return;
            }

            bool allow;

            switch (action)
            {
            case molAction.CustomAction1:
                Action1_TI.Visible = state;
                break;

            case molAction.CustomAction2:
                Action2_TI.Visible = state;
                break;

            case molAction.CustomAction3:
                Action3_TI.Visible = state;
                break;

            case molAction.CustomAction4:
                Action4_TI.Visible = state;
                break;

            case molAction.Cancel:
                Cancel_TI.Visible = state;
                Cancel_BT.Visible = state;
                break;

            case molAction.Unlock:

                ChangeState_TI.Visible = (ChangeState_TI.Visible) ? true : state;
                ChangeState_TI.Enabled = (ChangeState_TI.Visible) ? true : state;

                Abierto_TI.Enabled = state;
                Abierto_TI.Visible = state;

                if ((AppContext.User != null) && (state))
                {
                    Abierto_TI.Enabled = Library.AutorizationRulesControler.CanEditObject(Library.Resources.SecureItems.ESTADO);
                }

                break;

            case molAction.ChangeStateAnulado:

                allow = (bool)EntityType.InvokeMember("CanEditObject", BindingFlags.Static | BindingFlags.InvokeMethod | BindingFlags.Public, null, null, null);

                ChangeState_TI.Visible = (ChangeState_TI.Visible) ? true : state;
                ChangeState_TI.Enabled = (ChangeState_TI.Visible) ? true : state;

                Anulado_TI.Visible = (allow) ? state : false;

                break;

            case molAction.ChangeStateContabilizado:

                ChangeState_TI.Visible = (ChangeState_TI.Visible) ? true : state;
                ChangeState_TI.Enabled = (ChangeState_TI.Visible) ? true : state;

                Contabilizado_TI.Visible = state;

                if ((AppContext.User != null) && (state))
                {
                    Contabilizado_TI.Enabled = Library.AutorizationRulesControler.CanEditObject(Library.Resources.SecureItems.ESTADO);
                }

                break;

            case molAction.ChangeStateEmitido:

                ChangeState_TI.Visible = (ChangeState_TI.Visible) ? true : state;
                ChangeState_TI.Enabled = (ChangeState_TI.Visible) ? true : state;

                Emitido_TI.Visible = state;

                if ((AppContext.User != null) && (state))
                {
                    Emitido_TI.Enabled = Library.AutorizationRulesControler.CanEditObject(Library.Resources.SecureItems.ESTADO);
                }

                break;

            case molAction.Print:
                Print_TI.Visible       = state;
                Separator02_TI.Visible = state;
                Print_TI.Enabled       = state;
                Separator02_TI.Enabled = state;
                break;

            case molAction.Refresh:
                Refresh_TI.Visible     = state;
                Separator03_TI.Visible = state;
                break;

            case molAction.ShowDocuments:
                Docs_TI.Visible = state;
                break;

            case molAction.Submit:
                Submit_TI.Enabled = state;
                Submit_BT.Enabled = state;
                break;
            }
        }
Ejemplo n.º 26
0
        protected override void EnableAction(molAction action, bool state)
        {
            switch (action)
            {
            case molAction.Add:

                Add_Button.Enabled = state;
                Nuevo_MI.Enabled   = state;

                break;

            case molAction.View:

                View_Button.Enabled = state;
                Detalle_MI.Enabled  = state;

                break;

            case molAction.Edit:

                Edit_Button.Enabled  = state;
                Modificar_MI.Enabled = state;

                break;

            case molAction.Delete:

                Delete_Button.Enabled = state;
                Borrar_MI.Enabled     = state;

                break;

            case molAction.Copy:

                Copy_MI.Enabled = state;
                Copy_TI.Enabled = state;

                break;

            case molAction.ChangeStateAnulado:

                ChangeState_TI.Enabled = (ChangeState_TI.Visible) ? true : state;

                Anulado_TI.Enabled = state;
                Anulado_MI.Enabled = state;

                break;

            case molAction.ChangeStateContabilizado:

                ChangeState_TI.Enabled   = (ChangeState_TI.Visible) ? true : state;
                Contabilizado_TI.Enabled = state;
                Contabilizado_MI.Enabled = state;

                break;

            case molAction.ChangeStateEmitido:

                ChangeState_TI.Enabled = (ChangeState_TI.Visible) ? true : state;

                if ((AppContext.User != null) && (state))
                {
                    Emitido_TI.Enabled = Library.AutorizationRulesControler.CanEditObject(Library.Resources.SecureItems.ESTADO);
                    Emitido_MI.Enabled = Library.AutorizationRulesControler.CanEditObject(Library.Resources.SecureItems.ESTADO);
                }

                break;

            case molAction.CustomAction1:

                CustomAction1_TI.Enabled = state;
                CustomAction1_MI.Enabled = state;
                break;

            case molAction.CustomAction2:

                CustomAction2_TI.Enabled = state;
                CustomAction2_MI.Enabled = state;
                break;

            case molAction.CustomAction3:

                CustomAction3_TI.Enabled = state;
                CustomAction3_MI.Enabled = state;
                break;

            case molAction.CustomAction4:

                CustomAction4_TI.Enabled = state;
                CustomAction4_MI.Enabled = state;
                break;

            case molAction.ExportPDF:

                ExportPDF_MI.Enabled = state;
                ExportPDF_TI.Enabled = state;
                break;

            case molAction.EmailPDF:

                EmailPDF_MI.Enabled = state;
                EmailPDF_TI.Enabled = state;
                break;

            case molAction.EmailLink:

                EmailLink_MI.Visible = state;
                EmailLink_TI.Visible = state;
                break;

            case molAction.FilterOn:
            case molAction.FilterOff:

                Filtrar_MI.Enabled     = state;
                FilterValue_TI.Enabled = state;
                FilterOff_MI.Enabled   = state;
                FilterOff_TI.Enabled   = state;
                break;

            case molAction.Print:

                Print_Button.Enabled = state;
                Imprimir_MI.Enabled  = state;

                break;

            case molAction.PrintDetail:

                PrintDetail_MI.Enabled = state;
                PrintDetail_TI.Enabled = state;

                break;

            case molAction.PrintListQR:

                PrintQR_MI.Enabled = state;
                PrintQR_TI.Enabled = state;
                break;

            case molAction.Refresh:

                Refresh_TI.Enabled = state;
                Refresh_MI.Enabled = state;

                break;

            case molAction.Unlock:

                ChangeState_TI.Enabled = (ChangeState_TI.Visible) ? true : state;

                Abierto_TI.Enabled = state;
                Abierto_MI.Enabled = state;

                if ((AppContext.User != null) && (state))
                {
                    Abierto_TI.Enabled = Library.AutorizationRulesControler.CanEditObject(Library.Resources.SecureItems.ESTADO);
                    Abierto_MI.Enabled = Library.AutorizationRulesControler.CanEditObject(Library.Resources.SecureItems.ESTADO);
                }

                break;

            case molAction.Select:
                Select_TI.Enabled = state;
                break;

            case molAction.SelectAll:
                SelectAll_TI.Enabled = state;
                break;

            case molAction.Close:
                Close_TI.Enabled = state;
                break;
            }
        }
Ejemplo n.º 27
0
        protected override void ActivateAction(molAction action, bool state)
        {
            if (EntityType == null)
            {
                return;
            }

            bool allow;

            switch (action)
            {
            case molAction.Add:

                allow = (bool)EntityType.InvokeMember("CanAddObject", BindingFlags.Static | BindingFlags.InvokeMethod | BindingFlags.Public, null, null, null);

                Add_Button.Enabled = (allow) ? state : false;
                Add_Button.Visible = (allow) ? state : false;
                Nuevo_MI.Enabled   = (allow) ? state : false;

                break;

            case molAction.AdvancedSearch:
                ShowSearchPanel(state);
                break;

            case molAction.View:

                allow = (bool)EntityType.InvokeMember("CanGetObject", BindingFlags.Static | BindingFlags.InvokeMethod | BindingFlags.Public, null, null, null);

                View_Button.Enabled = (allow) ? state : false;
                View_Button.Visible = (allow) ? state : false;
                Detalle_MI.Enabled  = (allow) ? state : false;

                break;

            case molAction.Edit:

                allow = (bool)EntityType.InvokeMember("CanEditObject", BindingFlags.Static | BindingFlags.InvokeMethod | BindingFlags.Public, null, null, null);

                Edit_Button.Enabled  = (allow) ? state : false;
                Edit_Button.Visible  = (allow) ? state : false;
                Modificar_MI.Enabled = (allow) ? state : false;

                break;

            case molAction.Delete:

                allow = (bool)EntityType.InvokeMember("CanDeleteObject", BindingFlags.Static | BindingFlags.InvokeMethod | BindingFlags.Public, null, null, null);

                Delete_Button.Enabled = (allow) ? state : false;
                Delete_Button.Visible = (allow) ? state : false;
                Borrar_MI.Enabled     = (allow) ? state : false;

                break;

            case molAction.Copy:

                allow = (bool)EntityType.InvokeMember("CanAddObject", BindingFlags.Static | BindingFlags.InvokeMethod | BindingFlags.Public, null, null, null);

                Copy_MI.Visible = (allow) ? state : false;
                Copy_TI.Visible = (allow) ? state : false;

                break;

            case molAction.ChangeStateAnulado:

                allow = (bool)EntityType.InvokeMember("CanEditObject", BindingFlags.Static | BindingFlags.InvokeMethod | BindingFlags.Public, null, null, null);

                ChangeState_TI.Visible = (ChangeState_TI.Visible) ? true : state;
                ChangeState_TI.Enabled = (ChangeState_TI.Visible) ? true : state;

                Anulado_TI.Visible = (allow) ? state : false;
                Anulado_MI.Visible = (allow) ? state : false;

                break;

            case molAction.ChangeStateContabilizado:

                ChangeState_TI.Visible = (ChangeState_TI.Visible) ? true : state;
                ChangeState_TI.Enabled = (ChangeState_TI.Visible) ? true : state;

                Contabilizado_TI.Visible = state;
                Contabilizado_MI.Visible = state;

                break;

            case molAction.ChangeStateEmitido:

                ChangeState_TI.Visible = (ChangeState_TI.Visible) ? true : state;
                ChangeState_TI.Enabled = (ChangeState_TI.Visible) ? true : state;

                Emitido_TI.Visible = state;
                Emitido_MI.Visible = state;

                if ((AppContext.User != null) && (state))
                {
                    Emitido_TI.Enabled = Library.AutorizationRulesControler.CanEditObject(Library.Resources.SecureItems.ESTADO);
                    Emitido_MI.Enabled = Library.AutorizationRulesControler.CanEditObject(Library.Resources.SecureItems.ESTADO);
                }

                break;

            case molAction.CustomAction1:
                CustomAction1_TI.Enabled = state;
                CustomAction1_MI.Enabled = state;
                CustomAction1_TI.Visible = state;
                CustomAction1_MI.Visible = state;
                break;

            case molAction.CustomAction2:
                CustomAction2_TI.Enabled = state;
                CustomAction2_MI.Enabled = state;
                CustomAction2_TI.Visible = state;
                CustomAction2_MI.Visible = state;
                break;

            case molAction.CustomAction3:
                CustomAction3_TI.Enabled = state;
                CustomAction3_TI.Visible = state;
                CustomAction3_MI.Visible = state;
                CustomAction3_MI.Enabled = state;
                break;

            case molAction.CustomAction4:
                CustomAction4_TI.Enabled = state;
                CustomAction4_TI.Visible = state;
                CustomAction4_MI.Visible = state;
                CustomAction4_MI.Enabled = state;
                break;

            case molAction.ExportPDF:
                ExportPDF_MI.Visible = state;
                ExportPDF_TI.Visible = state;
                break;

            case molAction.EmailPDF:
                EmailPDF_MI.Visible = state;
                EmailPDF_TI.Visible = state;
                break;

            case molAction.EmailLink:
                EmailLink_MI.Visible = state;
                EmailLink_TI.Visible = state;
                break;

            case molAction.FilterOn:
            case molAction.FilterOff:
                Filtrar_MI.Visible     = state;
                FilterValue_TI.Visible = state;
                FilterOff_MI.Visible   = state;
                FilterOff_TI.Visible   = state;
                Separator3_TI.Visible  = state;
                break;

            case molAction.Print:
                Print_Button.Enabled = state;
                Print_Button.Visible = state;

                Imprimir_MI.Enabled = state;
                Imprimir_MI.Visible = state;

                Filter_TSS.Enabled = state;
                Filter_TSS.Visible = state;

                break;

            case molAction.PrintDetail:
                PrintDetail_MI.Visible = state;
                PrintDetail_MI.Enabled = state;

                PrintDetail_TI.Visible = state;
                PrintDetail_TI.Enabled = state;

                break;

            case molAction.PrintListQR:
                PrintQR_MI.Visible = state;
                PrintQR_TI.Visible = state;
                break;

            case molAction.Refresh:

                Refresh_TI.Visible = state;
                Refresh_MI.Visible = state;
                Close_TSS.Visible  = state;

                break;

            case molAction.ShowDocuments:

                Docs_TI.Visible  = state;
                Docs_TSS.Visible = state;

                Docs_MI.Visible  = state;
                Docs_MSS.Visible = state;

                break;

            case molAction.Unlock:

                ChangeState_TI.Visible = (ChangeState_TI.Visible) ? true : state;
                ChangeState_TI.Enabled = (ChangeState_TI.Visible) ? true : state;

                Abierto_TI.Enabled = state;
                Abierto_MI.Enabled = state;
                Abierto_TI.Visible = state;
                Abierto_MI.Visible = state;

                if ((AppContext.User != null) && (state))
                {
                    Abierto_TI.Enabled = Library.AutorizationRulesControler.CanEditObject(Library.Resources.SecureItems.ESTADO);
                    Abierto_MI.Enabled = Library.AutorizationRulesControler.CanEditObject(Library.Resources.SecureItems.ESTADO);
                }

                break;

            case molAction.Select:
                Select_TI.Visible = state;
                break;

            case molAction.SelectAll:
                SelectAll_TI.Visible = state;
                break;

            case molAction.Close:
                Close_TI.Enabled = state;
                break;
            }
        }
Ejemplo n.º 28
0
        protected override void ActivateAction(molAction action, bool state)
        {
            if (EntityType == null)
            {
                return;
            }

            bool allow;

            switch (action)
            {
            case molAction.Add:

                allow = (bool)EntityType.InvokeMember("CanAddObject", BindingFlags.Static | BindingFlags.InvokeMethod | BindingFlags.Public, null, null, null);

                Add_TI.Enabled = (allow) ? state : false;
                Add_TI.Visible = (allow) ? state : false;
                Add_MI.Enabled = (allow) ? state : false;

                break;

            case molAction.Copy:

                allow = (bool)EntityType.InvokeMember("CanAddObject", BindingFlags.Static | BindingFlags.InvokeMethod | BindingFlags.Public, null, null, null);

                Copy_TI.Enabled = (allow) ? state : false;
                Copy_TI.Visible = (allow) ? state : false;
                Copy_MI.Visible = (allow) ? state : false;

                break;

            case molAction.Edit:

                allow = (bool)EntityType.InvokeMember("CanEditObject", BindingFlags.Static | BindingFlags.InvokeMethod | BindingFlags.Public, null, null, null);

                Edit_TI.Enabled = (allow) ? state : false;
                Edit_TI.Visible = (allow) ? state : false;
                Edit_MI.Enabled = (allow) ? state : false;

                break;

            case molAction.View:

                allow = (bool)EntityType.InvokeMember("CanGetObject", BindingFlags.Static | BindingFlags.InvokeMethod | BindingFlags.Public, null, null, null);

                View_TI.Enabled = (allow) ? state : false;
                View_TI.Visible = (allow) ? state : false;
                View_MI.Enabled = (allow) ? state : false;

                break;

            case molAction.Delete:

                allow = (bool)EntityType.InvokeMember("CanDeleteObject", BindingFlags.Static | BindingFlags.InvokeMethod | BindingFlags.Public, null, null, null);

                Delete_TI.Enabled = (allow) ? state : false;
                Delete_TI.Visible = (allow) ? state : false;
                Delete_MI.Enabled = (allow) ? state : false;

                break;

            case molAction.FilterOn:
            case molAction.FilterOff:
                Filter_MI.Visible      = state;
                FilterValue_TI.Visible = state;
                FilterOff_MI.Visible   = state;
                FilterOff_TI.Visible   = state;
                break;

            case molAction.Print:
                Print_Button.Enabled  = state;
                PrintList_MI.Enabled  = state;
                Separator2_TI.Enabled = state;
                break;

            case molAction.EmailPDF:
                EmailSeparator_TI.Visible = state;
                EmailPDF_MI.Visible       = state;
                EmailPDF_TI.Visible       = state;
                break;

            case molAction.Select:
                Select_TI.Visible = state;
                break;

            case molAction.SelectAll:
                SelectAll_TI.Visible = state;
                break;

            case molAction.AdvancedSearch:
                ShowSearchPanel(state);
                break;

            case molAction.Close:
                Close_TI.Enabled = state;
                break;

            case molAction.Save:

                allow = (bool)EntityType.InvokeMember("CanGetObject", BindingFlags.Static | BindingFlags.InvokeMethod | BindingFlags.Public, null, null, null);

                Download_TI.Enabled = (allow) ? state : false;
                Download_TI.Visible = (allow) ? state : false;

                break;
            }
        }
Ejemplo n.º 29
0
        protected override void ActivateAction(molAction action, bool state)
        {
            bool allow;

            if (EntityType == null)
            {
                return;
            }

            switch (action)
            {
            case molAction.Add:

                allow = (bool)EntityType.InvokeMember("CanAddObject", BindingFlags.Static | BindingFlags.InvokeMethod | BindingFlags.Public, null, null, null);

                Add_Button.Visible = state;
                Nuevo_MI.Visible   = state;
                break;

            case molAction.View:

                allow = (bool)EntityType.InvokeMember("CanGetObject", BindingFlags.Static | BindingFlags.InvokeMethod | BindingFlags.Public, null, null, null);

                View_Button.Visible = state;
                Detalle_MI.Visible  = state;
                break;

            case molAction.Edit:

                allow = (bool)EntityType.InvokeMember("CanEditObject", BindingFlags.Static | BindingFlags.InvokeMethod | BindingFlags.Public, null, null, null);

                Edit_Button.Visible  = state;
                Modificar_MI.Visible = state;
                break;

            case molAction.Delete:

                allow = (bool)EntityType.InvokeMember("CanDeleteObject", BindingFlags.Static | BindingFlags.InvokeMethod | BindingFlags.Public, null, null, null);

                Delete_Button.Visible = state;
                Borrar_MI.Visible     = state;
                break;

            case molAction.FilterOn:
            case molAction.FilterOff:
                Filtrar_MI.Visible     = state;
                FilterValue_TI.Visible = state;
                FilterOff_MI.Visible   = state;
                FilterOff_TI.Visible   = state;
                Separator3_TI.Visible  = state;
                break;

            case molAction.Print:
                Print_Button.Visible  = state;
                Imprimir_MI.Visible   = state;
                Separator2_TI.Visible = state;
                break;

            case molAction.PrintDetail:
                PrintDetail_MI.Visible = state;
                PrintDetail_TI.Visible = state;
                break;

            case molAction.ExportPDF:
                ExportPDF_MI.Visible = state;
                ExportPDF_TI.Visible = state;
                break;

            case molAction.EmailPDF:
                EmailPDF_MI.Visible = state;
                EmailPDF_TI.Visible = state;
                break;

            case molAction.EmailLink:
                EmailLink_MI.Visible = state;
                EmailLink_TI.Visible = state;
                break;

            case molAction.Copy:

                allow = (bool)EntityType.InvokeMember("CanAddObject", BindingFlags.Static | BindingFlags.InvokeMethod | BindingFlags.Public, null, null, null);

                Copy_MI.Visible = state;
                Copy_TI.Visible = state;
                break;

            case molAction.Select:
                Select_TI.Visible = state;
                break;

            case molAction.SelectAll:
                SelectAll_TI.Visible = state;
                break;

            case molAction.Close:
                Close_TI.Visible = state;
                break;

            case molAction.Lock:
            case molAction.Unlock:
                Unlock_TI.Visible     = state;
                Unlock_MI.Visible     = state;
                Lock_TI.Visible       = state;
                Lock_MI.Visible       = state;
                Separator4_TI.Visible = state;
                Separator3_MI.Visible = state;

                if (AppContext.User != null)
                {
                    Unlock_TI.Enabled = AppContext.User.IsAdmin;
                    Unlock_MI.Enabled = AppContext.User.IsAdmin;
                    Lock_TI.Enabled   = AppContext.User.IsAdmin;
                    Lock_MI.Enabled   = AppContext.User.IsAdmin;
                }

                break;
            }
        }