Example #1
0
        protected virtual void _(Events.FieldUpdating <FeaturesSet.aSC606> e)
        {
            e.NewValue = PXBoolAttribute.ConvertValue(e.NewValue);

            FeaturesSet row = (FeaturesSet)e.Row;

            if (row == null)
            {
                return;
            }

            bool?oldValue = row.ASC606;

            if (row.ASC606 != null && oldValue != (bool)e.NewValue)
            {
                int?result = PXSelectGroupBy <
                    ARTranAlias,
                    Aggregate <Count> >
                             .SelectSingleBound(this, null)
                             .RowCount;

                if (result > 0)
                {
                    string          question = PXMessages.LocalizeFormatNoPrefixNLA(AR.Messages.UnreleasedDocsWithDRCodes, result);
                    WebDialogResult wdr      = Features.Ask(question, MessageButtons.YesNo);
                    if (wdr != WebDialogResult.Yes)
                    {
                        e.NewValue = oldValue;
                        e.Cancel   = true;
                        return;
                    }
                }

                //The system calculates the number of Stock and Non-Stock Inventories
                //in Active status which have MDA deferral code and empty field Allocation Method in Revenue Components.
                if ((bool)e.NewValue == false)
                {
                    //use AR.Messages.MDAInventoriesWithoutAllocationMethod
                }
            }
        }