예제 #1
0
        public override void CommandPreparing(PXCache sender, PXCommandPreparingEventArgs e)
        {
            base.CommandPreparing(sender, e);

            if (e.Row == null)
            {
                return;
            }

            bool insert = (e.Operation & PXDBOperation.Command) == PXDBOperation.Insert;
            bool update = (e.Operation & PXDBOperation.Command) == PXDBOperation.Update;

            if (insert || update)
            {
                object currentValue = sender.GetValue(e.Row, _valueField.Name);

                if (Equals(currentValue, _expectedValue))
                {
                    if (e.Value == null)
                    {
                        e.DataType  = PXDbType.UniqueIdentifier;
                        e.DataValue = PXAccess.GetTrueUserID();
                    }
                    else
                    {
                        e.ExcludeFromInsertUpdate();
                    }
                }
                else
                {
                    e.DataValue = null;
                }
            }
        }
예제 #2
0
        void IPXCommandPreparingSubscriber.CommandPreparing(PXCache sender, PXCommandPreparingEventArgs e)
        {
            base.CommandPreparing(sender, e);

            if (e.Row == null)
            {
                return;
            }

            bool insert = (e.Operation & PXDBOperation.Command) == PXDBOperation.Insert;
            bool update = (e.Operation & PXDBOperation.Command) == PXDBOperation.Update;

            if (insert || update)
            {
                object currentValue = sender.GetValue(e.Row, _valueField.Name);

                if (Equals(currentValue, _expectedValue))
                {
                    if (e.Value == null)
                    {
                        e.DataType  = PXDbType.DirectExpression;
                        e.DataValue = UseTimeZone ? e.SqlDialect.GetUtcDate : e.SqlDialect.GetDate;
                    }
                    else
                    {
                        e.ExcludeFromInsertUpdate();
                    }
                }
                else
                {
                    e.DataValue = null;
                }
            }
        }
        public virtual void CommandPreparing(PXCache sender, PXCommandPreparingEventArgs e)
        {
            PXDBOperation command = e.Operation.Command();

            if (command == PXDBOperation.Update || command == PXDBOperation.Insert && this.NoInsert)
            {
                e.ExcludeFromInsertUpdate();
            }
        }
        public virtual void INItemSite_InvtSubID_CommandPreparing(PXCache sender, PXCommandPreparingEventArgs e)
        {
            if ((e.Operation & PXDBOperation.Command) == PXDBOperation.Update)
            {
                if ((bool?)sender.GetValueOriginal <INItemSite.overrideInvtAcctSub>(e.Row) == true && ((INItemSite)e.Row).OverrideInvtAcctSub != true)
                {
                    sender.SetValue <INItemSite.invtSubID>(e.Row, null);
                    e.Value = null;
                    return;
                }
            }

            if ((e.Operation & PXDBOperation.Command) == PXDBOperation.Insert || (e.Operation & PXDBOperation.Command) == PXDBOperation.Update)
            {
                if (((INItemSite)e.Row).OverrideInvtAcctSub != true)
                {
                    e.ExcludeFromInsertUpdate();
                }
            }
        }
예제 #5
0
        public override void CommandPreparing(PXCache sender, PXCommandPreparingEventArgs e)
        {
            base.CommandPreparing(sender, e);

            e.BqlTable = _BqlTable;
            var table = e.Table == null ? _BqlTable : e.Table;

            e.Expr = new Data.SQLTree.Column(_databaseField, new Data.SQLTree.SimpleTable(table), e.DataType);

            PXDBOperation command = e.Operation.Command();

            if (command == PXDBOperation.Update || command == PXDBOperation.Insert)
            {
                object currentValue = sender.GetValue(e.Row, _valueField.Name);

                if (!Equals(currentValue, _expectedValue))
                {
                    e.ExcludeFromInsertUpdate();
                }
            }
        }
        public override void CommandPreparing(PXCache sender, PXCommandPreparingEventArgs e)
        {
            base.CommandPreparing(sender, e);

            bool insert = (e.Operation & PXDBOperation.Command) == PXDBOperation.Insert;
            bool update = (e.Operation & PXDBOperation.Command) == PXDBOperation.Update;

            if (insert)
            {
                e.ExcludeFromInsertUpdate();
            }
            else if (update)
            {
                e.DataType   = PXDbType.Bit;
                e.DataLength = 1;
                e.BqlTable   = _BqlTable;
                var table = e.Table == null ? _BqlTable : e.Table;
                e.Expr          = new PX.Data.SQLTree.Column(_RelatedDatabaseFieldName, new PX.Data.SQLTree.SimpleTable(table), e.DataType);
                e.IsRestriction = true;
                e.Value         = e.DataValue = sender.GetValue(e.Row, _FieldName) ?? sender.GetValue(e.Row, RelatedBqlField.Name);
            }
        }