protected virtual void APDiscount_Type_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e) { APDiscount discount = e.Row as APDiscount; if (discount == null) { return; } DiscountSequence sequence = PXSelect < DiscountSequence, Where < DiscountSequence.discountID, Equal <Required <DiscountSequence.discountID> > > > .SelectWindowed(this, 0, 1, discount.DiscountID); if (sequence != null) { discount.Type = (string)e.OldValue; sender.RaiseExceptionHandling <APDiscount.type>(discount, e.OldValue, new PXSetPropertyException(AR.Messages.DiscountTypeCannotChanged)); } else if ( discount.Type == DiscountType.Document && discount.ApplicableTo != DiscountTarget.Vendor) { sender.SetValueExt <APDiscount.applicableTo>(e.Row, DiscountTarget.Vendor); } }
protected virtual void APDiscount_Type_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e) { APDiscount row = e.Row as APDiscount; if (row != null) { DiscountSequence sequence = PXSelect <DiscountSequence, Where <DiscountSequence.discountID, Equal <Required <DiscountSequence.discountID> > > > .SelectWindowed(this, 0, 1, row.DiscountID); if (sequence != null) { row.Type = (string)e.OldValue; sender.RaiseExceptionHandling <APDiscount.type>(row, e.OldValue, new PXSetPropertyException(SO.Messages.DiscountTypeCannotChanged)); } if (row.Type == SO.DiscountType.Flat) { row.IsAutoNumber = true; if (string.IsNullOrEmpty(row.LastNumber)) { row.LastNumber = "000000000"; } } } }