예제 #1
0
        public void RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            if (SkipVerification)
            {
                return;
            }

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

            if (!UseCostCode())
            {
                return;
            }

            int?costCode = (int?)sender.GetValue(e.Row, _FieldName);

            if (costCode == null)
            {
                return;
            }

            if (ReleasedField != null)
            {
                bool?released = (bool?)sender.GetValue(e.Row, ReleasedField.Name);
                if (released == true)
                {
                    return;
                }
            }

            if (SkipVerificationForDefault == true && costCode == GetDefaultCostCode())
            {
                return;
            }

            if (!IsValid(costCode.Value))
            {
                string warning = CostCodeSelector.GetValidationWarning(costCode.Value);
                PXUIFieldAttribute.SetWarning(sender, e.Row, _FieldName, warning);
            }
            else
            {
                PXUIFieldAttribute.SetError(sender, e.Row, _FieldName, null);
            }
        }
예제 #2
0
        public void FieldVerifying(PXCache sender, PXFieldVerifyingEventArgs e)
        {
            if (task != null && !SkipVerification && e.NewValue != null && UseCostCode())
            {
                int costCodeID = (int)e.NewValue;
                if (SkipVerificationForDefault == true && costCodeID == GetDefaultCostCode())
                {
                    return;
                }

                if (!IsValid(costCodeID))
                {
                    string warning = CostCodeSelector.GetValidationWarning(costCodeID);
                    sender.RaiseExceptionHandling(FieldName, e.Row, e.NewValue, new PXSetPropertyException(warning, PXErrorLevel.Warning));
                }
            }
        }