예제 #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;
                }
            }
        }
예제 #3
0
 protected virtual void SOShipLine_LineAmt_CommandPreparing(PXCache sender, PXCommandPreparingEventArgs e)
 {
     if ((e.Operation & PXDBOperation.Option) == PXDBOperation.GroupBy)
     {
         e.FieldName = BqlCommand.Null;
         e.Cancel    = true;
     }
 }
        public virtual void CommandPreparing(PXCache sender, PXCommandPreparingEventArgs e)
        {
            PXDBOperation command = e.Operation.Command();

            if (command == PXDBOperation.Update || command == PXDBOperation.Insert && this.NoInsert)
            {
                e.ExcludeFromInsertUpdate();
            }
        }
 protected virtual void ARInvoiceRefNbrCommandPreparing(PXCache sender, PXCommandPreparingEventArgs e)
 {
     if ((e.Operation & PXDBOperation.External) == PXDBOperation.External && e.Value == null)
     {
         e.Expr   = new Data.SQLTree.Column <ARInvoice.refNbr>();
         e.Value  = "";
         e.Cancel = true;
     }
 }
        public override void CommandPreparing(PXCache sender, PXCommandPreparingEventArgs e)
        {
            if ((e.Operation & PXDBOperation.External) == PXDBOperation.External)
            {
                return;
            }

            base.CommandPreparing(sender, e);
        }
예제 #7
0
 protected virtual void ARInvoiceRefNbrCommandPreparing(PXCache sender, PXCommandPreparingEventArgs e)
 {
     if ((e.Operation & PXDBOperation.External) == PXDBOperation.External && e.Value == null)
     {
         e.FieldName = SqlDialect.quoteTableAndColumn(typeof(ARInvoice).Name, typeof(ARInvoice.refNbr).Name);
         e.Value     = "";
         e.Cancel    = true;
     }
 }
 public override void CommandPreparing(PXCache sender, PXCommandPreparingEventArgs e)
 {
     if ((e.Operation & PXDBOperation.Command) == PXDBOperation.Insert ||
         (e.Operation & PXDBOperation.Command) == PXDBOperation.Update)
     {
         bool?encryptionRequired = sender.GetValue(e.Row, _EncryptionRequiredField.Name) as bool?;
         isEncryptionRequired = (encryptionRequired == true);
     }
     base.CommandPreparing(sender, e);
 }
예제 #9
0
            public void Parameter_CommandPreparing(PXCache sender, PXCommandPreparingEventArgs e)
            {
                long?Key;

                if ((e.Operation & PXDBOperation.Command) == PXDBOperation.Select && (e.Operation & PXDBOperation.Option) != PXDBOperation.External &&
                    (e.Operation & PXDBOperation.Option) != PXDBOperation.ReadOnly && e.Row == null && (Key = e.Value as long?) != null)
                {
                    if (Key < 0L)
                    {
                        e.DataValue = null;
                        e.Cancel    = true;
                    }
                }
            }
예제 #10
0
 public override void CommandPreparing(PXCache sender, PXCommandPreparingEventArgs e)
 {
     if ((e.Operation & PXDBOperation.Command) == PXDBOperation.Select)
     {
         if (((e.Operation & PXDBOperation.Option) == PXDBOperation.Normal ||
              (e.Operation & PXDBOperation.Option) == PXDBOperation.Internal))
         {
             base.CommandPreparing(sender, e);
         }
         else if ((e.Operation & PXDBOperation.Option) == PXDBOperation.GroupBy)
         {
             e.FieldName = BqlCommand.Null;
         }
     }
 }
        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();
                }
            }
        }
예제 #12
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);
            }
        }
예제 #14
0
 public void CommandPreparing(PXCache sender, PXCommandPreparingEventArgs e)
 {
     throw new NotImplementedException();
 }
예제 #15
0
 protected virtual void CurrencyRate_CuryRateID_CommandPreparing(PXCache sender, PXCommandPreparingEventArgs e)
 {
     if ((e.Operation & PXDBOperation.Option) == PXDBOperation.Second)
     {
         e.Cancel        = true;
         e.IsRestriction = true;
         e.FieldName     = "CuryRateID";
         e.DataValue     = PXDatabase.SelectIdentity();
     }
 }
예제 #16
0
 protected virtual void BranchBAccount_BranchBranchCD_CommandPreparing(PXCache sender, PXCommandPreparingEventArgs e)
 {
     //PXDBChildIdentity() hack
     if (e.Table != null && e.Operation == PXDBOperation.Update)
     {
         e.IsRestriction = false;
         e.Cancel        = true;
     }
 }
 public void SOInvoice_RefNbr_CommandPreparing(PXCache sender, PXCommandPreparingEventArgs e) =>
 throw new PXSetupNotEnteredException("Setup is not entered", typeof(SOInvoice));
예제 #18
0
 protected virtual void CurrencyRate_CuryRateID_CommandPreparing(PXCache sender, PXCommandPreparingEventArgs e)
 {
     if ((e.Operation & PXDBOperation.Option) == PXDBOperation.Second)
     {
         e.Cancel        = true;
         e.IsRestriction = true;
         e.Expr          = new Data.SQLTree.Column <CurrencyRate.curyRateID>();
         e.DataValue     = PXDatabase.SelectIdentity();
     }
 }
예제 #19
0
 protected virtual void CurrencyRate_CuryRateID_CommandPreparing(PXCache sender, PXCommandPreparingEventArgs e)
 {
     if ((e.Operation & PXDBOperation.Option) == PXDBOperation.Second)
     {
         e.Cancel = true;
     }
 }
예제 #20
0
 protected virtual void CurrencyRate_CuryEffDate_CommandPreparing(PXCache sender, PXCommandPreparingEventArgs e)
 {
     if ((e.Operation & PXDBOperation.Option) == PXDBOperation.Second)
     {
         e.IsRestriction = true;
     }
 }