public EPApprovalProcess()
        {
            Records.SetProcessCaption(EP.Messages.Approve);
            Records.SetProcessAllCaption(EP.Messages.ApproveAll);
            Records.SetSelected <EPOwned.selected>();
            Records.SetProcessDelegate(list => Approve(list, true));
            Records.ConfirmationTitle   = Messages.Approve;
            Records.ConfirmationMessage = Messages.ApproveAllConfirmation;
            this.Actions.Move(nameof(RejectAll), Records.ScheduleActionKey, true);

            this.Reject.StateSelectingEvents += new PXFieldSelecting(delegate(PXCache sender, PXFieldSelectingEventArgs e)
            {
                if (PXLongOperation.GetStatus(this.UID) != PXLongRunStatus.NotExists)
                {
                    e.ReturnState = PXButtonState.CreateInstance(e.ReturnState, null, null, null, null, null, false,
                                                                 PXConfirmationType.Unspecified, null, null, null, null, null, null, null, null, null, null, null, typeof(EPApproval));
                    ((PXButtonState)e.ReturnState).Enabled = false;
                }
            });
            this.RejectAll.StateSelectingEvents += new PXFieldSelecting(delegate(PXCache sender, PXFieldSelectingEventArgs e)
            {
                if (PXLongOperation.GetStatus(this.UID) != PXLongRunStatus.NotExists)
                {
                    e.ReturnState = PXButtonState.CreateInstance(e.ReturnState, null, null, null, null, null, false,
                                                                 PXConfirmationType.Unspecified, null, null, null, null, null, null, null, null, null, null, null, typeof(EPApproval));
                    ((PXButtonState)e.ReturnState).Enabled = false;
                }
            });
        }
        public static PXAction GetSaveAction(this PXGraph graph)
        {
            PXAction saveAction = null;
            Type     primary    = !String.IsNullOrEmpty(graph.PrimaryView) ? graph.Views[graph.PrimaryView].GetItemType() : null;

            foreach (PXAction action in graph.Actions.Values)
            {
                PXButtonState state = action.GetState(null) as PXButtonState;

                if (state != null && state.SpecialType == PXSpecialButtonType.Save)
                {
                    if (primary == null || state.ItemType == null || primary == state.ItemType || primary.IsSubclassOf(state.ItemType))
                    {
                        saveAction = action;
                        break;
                    }
                }
            }

            if (saveAction == null)
            {
                throw new PXException("There is not a Save action in the graph " + graph.GetType());
            }

            return(saveAction);
        }
        public static PXAction GetDeleteAction(this PXGraph graph)
        {
            PXAction deleteAction = null;
            Type     primary      = !String.IsNullOrEmpty(graph.PrimaryView) ? graph.Views[graph.PrimaryView].GetItemType() : null;

            foreach (PXAction action in graph.Actions.Values)
            {
                PXButtonState state = action.GetState(null) as PXButtonState;

                if (state != null && state.SpecialType == PXSpecialButtonType.Delete)
                {
                    if (primary == null || state.ItemType == null || primary == state.ItemType || primary.IsSubclassOf(state.ItemType))
                    {
                        deleteAction = action;
                        break;
                    }
                }
            }

            if (deleteAction == null || deleteAction.GetEnabled() == false)
            {
                throw new PXException(TX.Error.APPOINTMENT_NOT_DELETABLE);
            }

            return(deleteAction);
        }
Exemple #4
0
        private void AddAvailableAction(PXAction action, string shortcut, List <string> actions, List <string> actionNames, object row)
        {
            PXButtonState state = action.GetState(row) as PXButtonState;

            if (state == null || !state.Enabled)
            {
                return;
            }
            actions.Add(shortcut);
            actionNames.Add(state.DisplayName);
        }
        protected virtual void BalanceFilter_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            if (e.Row != null)
            {
                BalanceFilter filter = Filter.Current;

                if (Depreciate)
                {
                    Balances.SetProcessDelegate(delegate(List <FABookBalance> list)
                    {
                        if (PXLongOperation.GetTaskList().Where(_ => _.Screen == "FA.50.20.00").ToArray().Count() > 1)
                        {
                            throw new PXException(Messages.AnotherDeprRunning);
                        }
                        AssetProcess.DepreciateAsset(list, null, filter.PeriodID, true);
                    });
                }
                else
                {
                    Balances.SetProcessDelegate(delegate(List <FABookBalance> list)
                    {
                        if (PXLongOperation.GetTaskList().Where(_ => _.Screen == "FA.50.20.00").ToArray().Count() > 1)
                        {
                            throw new PXException(Messages.AnotherDeprRunning);
                        }
                        AssetProcess.CalculateAsset(list, filter.PeriodID);
                    });
                }

                Balances.SetProcessVisible(false);
                Balances.SetProcessAllVisible(false);

                PXButtonState pstate    = Actions["Process"].GetState(e.Row) as PXButtonState;
                PXButtonState pastate   = Actions["ProcessAll"].GetState(e.Row) as PXButtonState;
                bool          penabled  = pstate == null || pstate.Enabled;
                bool          paenabled = pastate == null || pastate.Enabled;

                Calculate.SetEnabled(penabled);
                CalculateAll.SetEnabled(paenabled);

                CalcDepr.SetEnabled(!string.IsNullOrEmpty(filter.PeriodID) && fasetup.Current.UpdateGL == true && penabled);
                CalcDeprAll.SetEnabled(!string.IsNullOrEmpty(filter.PeriodID) && fasetup.Current.UpdateGL == true && paenabled);
            }
        }
Exemple #6
0
        public void CreditCardsFilter_RowSelected(PXCache sender, PXRowSelectedEventArgs args)
        {
            CreditCardsFilter filter = args.Row as CreditCardsFilter;

            if (filter == null)
            {
                return;
            }

            CustomerCardPaymentData.AllowInsert = false;
            CustomerCardPaymentData.AllowDelete = false;
            PXButtonState buttonState = (PXButtonState)Actions["Process"].GetState(Filter.Current);
            bool          enabled     = buttonState.Visible && buttonState.Enabled;

            SetDefaultPaymentMethod.SetEnabled(enabled);
            LoadCards.SetEnabled(enabled);
            Save.SetEnabled(string.IsNullOrEmpty(filter.ProcessingCenterId) ? false : true);
            PXCache cache = Caches[typeof(CustomerPaymentMethod)];

            PXUIFieldAttribute.SetVisible <CustomerPaymentMethod.customerCCPID>(cache, null, true);
            PXUIFieldAttribute.SetVisible <CreditCardsFilter.scheduledServiceSync>(sender, null, false);
        }
        public GLConsolSetupMaint()
        {
            GLSetup setup = glsetup.Current;

            ConsolSetupRecords.SetProcessCaption(Messages.ProcSynchronize);
            ConsolSetupRecords.SetProcessAllCaption(Messages.ProcSynchronizeAll);
            ConsolSetupRecords.SetProcessDelegate <GLConsolSetupMaint>(Synchronize);
            PXUIFieldAttribute.SetEnabled(ConsolSetupRecords.Cache, null, true);
            PXUIFieldAttribute.SetEnabled <GLConsolSetup.lastPostPeriod>(ConsolSetupRecords.Cache, null, false);
            PXUIFieldAttribute.SetEnabled <GLConsolSetup.lastConsDate>(ConsolSetupRecords.Cache, null, false);
            ConsolSetupRecords.SetAutoPersist(true);
            ConsolSetupRecords.Cache.AllowDelete = true;
            ConsolSetupRecords.Cache.AllowInsert = true;

            PXUIFieldAttribute.SetRequired <GLConsolSetup.segmentValue>(ConsolSetupRecords.Cache, true);
            PXUIFieldAttribute.SetRequired <GLConsolSetup.sourceLedgerCD>(ConsolSetupRecords.Cache, true);

            Save.StateSelectingEvents += new PXFieldSelecting(delegate(PXCache sender, PXFieldSelectingEventArgs e)
            {
                e.ReturnState = PXButtonState.CreateInstance(e.ReturnState, null, null, null, null, null, false,
                                                             PXConfirmationType.Unspecified, null, null, null, null, null, null, null, null, null, null, null, null);
                ((PXButtonState)e.ReturnState).Enabled = !PXLongOperation.Exists(this.UID);
            });
        }
        protected virtual void DeleteButtonFieldSelectingHandler(PXCache sender, PXFieldSelectingEventArgs e)
        {
            e.ReturnState = PXButtonState.CreateDefaultState <TPrimaryDAC>(e.ReturnState);

            ((PXButtonState)e.ReturnState).Enabled = OrganizationLedgerLinkSelect.AllowDelete;
        }