예제 #1
0
        public virtual void SetBehaviorBasedOnLines(PXGraph obj)
        {
            if (Base.Document.Current != null && PXAccess.FeatureInstalled <FeaturesSet.changeOrder>())
            {
                bool changeOrderBehaviorIsRequired = false;

                var select = new PXSelect <PMChangeOrderLine,
                                           Where <PMChangeOrderLine.pOOrderType, Equal <Current <POOrder.orderType> >,
                                                  And <PMChangeOrderLine.pOOrderNbr, Equal <Current <POOrder.orderNbr> > > > >(Base);

                PMChangeOrderLine link = select.SelectSingle();
                if (link != null)
                {
                    changeOrderBehaviorIsRequired = true;
                }

                if (changeOrderBehaviorIsRequired && Base.Document.Current.Behavior != POBehavior.ChangeOrder)
                {
                    Base.Document.Current.Behavior = POBehavior.ChangeOrder;
                    Base.Document.Update(Base.Document.Current);
                }
                else if (!changeOrderBehaviorIsRequired && Base.Document.Current.Behavior == POBehavior.ChangeOrder)
                {
                    Base.Document.Current.Behavior = POBehavior.Standard;
                    Base.Document.Update(Base.Document.Current);
                }
            }
        }
        protected virtual void _(Events.FieldVerifying <PMChangeOrderClass, PMChangeOrderClass.isPurchaseOrderEnabled> e)
        {
            var select = new PXSelectJoin <PMChangeOrderLine,
                                           InnerJoin <PMChangeOrder, On <PMChangeOrderLine.refNbr, Equal <PMChangeOrder.refNbr> > >,
                                           Where <PMChangeOrder.classID, Equal <Current <PMChangeOrderClass.classID> > > >(this);

            PMChangeOrderLine res = select.SelectWindowed(0, 1);

            if (res != null)
            {
                throw new PXSetPropertyException <PMChangeOrderClass.isPurchaseOrderEnabled>(Messages.ClassContainsDetails);
            }
        }