예제 #1
0
        public void ValidateVendorAndJointPayees(PXCache cache, APAdjust adjustment, List <JointPayee> jointPayees)
        {
            var projectIds = LienWaiverProjectDataProvider.GetProjectIds(adjustment, cache.Graph).ToList();
            var doesAnyOutstandingComplianceExistForJointVendors = jointPayees.Any(jp =>
                                                                                   lienWaiverDataProvider.DoesAnyOutstandingComplianceExistForJointVendor(jp, projectIds));
            var outstandingCompliances = lienWaiverDataProvider
                                         .GetOutstandingCompliancesForPrimaryVendor(adjustment.VendorID, projectIds).ToList();

            if (outstandingCompliances.Any() && doesAnyOutstandingComplianceExistForJointVendors)
            {
                ValidateVendorAndJointPayees(cache, jointPayees, adjustment, projectIds,
                                             outstandingCompliances);
            }
            else if (outstandingCompliances.Any())
            {
                ValidatePrimaryVendor(cache, adjustment, projectIds, outstandingCompliances);
            }
            else if (doesAnyOutstandingComplianceExistForJointVendors)
            {
                jointPayees.ForEach(jp => ValidateJointPayee(cache, jp, adjustment, projectIds));
            }
            else
            {
                cache.ClearFieldErrors <APAdjust.adjdLineNbr>(adjustment);
            }
        }
예제 #2
0
 public static void ClearFieldErrorIfExists <TField>(this PXCache cache, object row, string errorMessage)
     where TField : IBqlField
 {
     if (HasError <TField>(cache, row, errorMessage))
     {
         cache.ClearFieldErrors <TField>(row);
     }
 }
        public static void ClearFieldSpecificError <TField>(this PXCache cache, object record, string errorMsg, params object[] errorMessageArguments)
            where TField : IBqlField
        {
            String fieldError    = PXUIFieldAttribute.GetError <TField>(cache, record);
            String specificError = PXMessages.LocalizeFormatNoPrefix(errorMsg, errorMessageArguments);

            if (String.Equals(fieldError, specificError, StringComparison.CurrentCulture))
            {
                cache.ClearFieldErrors <TField>(record);
            }
        }
예제 #4
0
        private static void RemoveErrorWarning <TField>(PXCache cache, object entity, string errorMessage)
            where TField : IBqlField
        {
            var fieldName = cache.GetField(typeof(TField));
            var hasError  = cache.GetAttributes(entity, fieldName).OfType <IPXInterfaceField>()
                            .Any(x => x.ErrorText == errorMessage);

            if (hasError)
            {
                cache.ClearFieldErrors <TField>(entity);
            }
        }
예제 #5
0
 public void ValidateJointPayeePayment(PXCache cache, JointPayeePayment jointPayeePayment)
 {
     try
     {
         ValidateJointAmountToPay(jointPayeePayment);
     }
     catch (Exception exception)
     {
         PXUIFieldAttribute.SetError <JointPayeePayment.jointAmountToPay>(cache,
                                                                          jointPayeePayment, exception.Message, jointPayeePayment.JointAmountToPay?.ToString());
         return;
     }
     cache.ClearFieldErrors <JointPayeePayment.jointAmountToPay>(jointPayeePayment);
 }