protected virtual void BatchSelection_RowInserted(PXCache sender, PXRowInsertedEventArgs e) { BatchSelection batch = (BatchSelection)e.Row; if (batch != null && !String.IsNullOrWhiteSpace(batch.Module) && !String.IsNullOrWhiteSpace(batch.BatchNbr)) { batch = PXSelectReadonly <BatchSelection, Where <BatchSelection.module, Equal <Required <BatchSelection.module> >, And <BatchSelection.batchNbr, Equal <Required <BatchSelection.batchNbr> > > > > .Select(this, batch.Module, batch.BatchNbr); PXSelectorAttribute selectorAttr = (PXSelectorAttribute)sender.GetAttributesReadonly <BatchSelection.batchNbr>(batch).Find( (PXEventSubscriberAttribute attr) => { return(attr is PXSelectorAttribute); }); BqlCommand selectorSearch = selectorAttr.GetSelect(); if (batch != null && selectorSearch.Meet(sender, batch)) { Batch_Detail.Delete(batch); Batch_Detail.Update(batch); } else { batch = (BatchSelection)e.Row; sender.RaiseExceptionHandling <BatchSelection.batchNbr>(batch, batch.BatchNbr, new PXSetPropertyException(Messages.BatchNbrNotValid)); Batch_Detail.Delete(batch); } } }
public static IEnumerable <Type> GetDecimalFieldsAggregate <Table>(PXGraph graph, bool closing) where Table : IBqlTable { var result = new List <Type> { }; PXCache cache = graph.Caches[typeof(Table)]; if (cache == null) { throw new PXException(Messages.FailedToGetCache, typeof(Table).FullName); } List <Type> decimalFields = cache.BqlFields .Where(fieldType => cache.GetAttributesReadonly(cache.GetField(fieldType)).OfType <PXDBDecimalAttribute>().Any() || cache.GetAttributesReadonly(cache.GetField(fieldType)).OfType <PXDBCalcedAttribute>().Any()) .ToList(); for (int i = 0; i < decimalFields.Count; i++) { bool lastField = (i + 1 == decimalFields.Count); Type bqlField = decimalFields[i]; result.Add(closing && lastField ? typeof(Sum <>) : typeof(Sum <,>)); result.Add(bqlField); } return(result); }
public static void SetPeriodsByMaster <TField>(PXCache cache, object row, string masterFinPeriodID) where TField : IBqlField { cache.GetAttributesReadonly <TField>(row) .OfType <FinPeriodIDAttribute>().First() .SetPeriodsByMaster(cache, row, masterFinPeriodID); }
public static string CalcFinPeriodIDForMaster <TField>(PXCache cache, object row, string masterFinPeriodID) where TField : IBqlField { return(cache.GetAttributesReadonly <TField>(row) .OfType <FinPeriodIDAttribute>().First() .CalcFinPeriodIDForMaster(cache, row, masterFinPeriodID)); }
public static void SetMasterPeriodID <TField>(PXCache cache, object row) where TField : IBqlField { cache.GetAttributesReadonly <TField>(row) .OfType <FinPeriodIDAttribute>().First() .SetMasterPeriodID(cache, row); }
public static void DefaultPeriods <TField>(PXCache cache, object row) where TField : IBqlField { cache.GetAttributesReadonly <TField>(row) .OfType <FinPeriodIDAttribute>().First() .DefaultPeriods(cache, row); }
/// <exclude/> public static long?GetPersistedCuryInfoID(PXCache sender, long?curyInfoID) { if (curyInfoID == null || curyInfoID.Value > 0L) { return(curyInfoID); } foreach (var attr in sender.GetAttributesReadonly(null)) { if (attr is CurrencyInfoAttribute) { CurrencyInfoAttribute cattr = (CurrencyInfoAttribute)attr; object parent; if (cattr._SourceType != null && cattr._IsRestriction.Persisted != null && cattr._IsRestriction.Persisted.TryGetValue(curyInfoID, out parent)) { long?ret = sender.Graph.Caches[cattr._SourceType].GetValue(parent, cattr._SourceField ?? cattr._FieldName) as long?; if (ret != null && ret.Value > 0L) { return(ret); } } return(curyInfoID); } } return(curyInfoID); }
/// <summary> /// For the specified BQL field and its value, returns the label defined for that /// value by a cache-level instance of <see cref="PXStringListAttribute"/> /// residing on the field. /// </summary> /// <remarks> /// This method can be used when the string list is changed dynamically /// at the cache level. /// </remarks> public static string For <TField>(PXCache cache, string fieldValue) where TField : IBqlField { if (cache == null) { throw new ArgumentNullException(nameof(cache)); } if (fieldValue == null) { throw new ArgumentNullException(nameof(fieldValue)); } PXStringListAttribute stringListAttribute = cache .GetAttributesReadonly <TField>() .OfType <PXStringListAttribute>() .SingleOrDefault(); if (stringListAttribute == null) { throw new PXException( Messages.FieldDoesNotHaveCacheLevelAttribute, typeof(TField).FullName, nameof(PXStringListAttribute)); } string label; if (!stringListAttribute.ValueLabelDic.TryGetValue(fieldValue, out label)) { throw new PXException( Messages.StringListAttributeDoesNotDefineLabelForValue, fieldValue); } return(label); }
public static void SetComplianceDocumentReference <TField>(PXCache cache, ComplianceDocument doc, string docType, string refNumber, Guid?noteId) where TField : IBqlField { cache.GetAttributesReadonly <TField>(doc) .OfType <ComplianceDocumentRefNoteAttribute>().First() .SetComplianceDocumentReference(cache, doc, docType, refNumber, noteId); }
public static void VerifyPeriod <Field>(PXCache cache, object row) where Field : IBqlField { foreach (CAAPAROpenPeriodAttribute attr in cache.GetAttributesReadonly <Field>(row).OfType <CAAPAROpenPeriodAttribute>()) { attr.IsValidPeriod(cache, row, cache.GetValue <Field>(row)); } }
public override void Verify(PXCache cache, object item, List <object> pars, ref bool?result, ref object value) { if (!cache.GetAttributesReadonly(item, OuterField.Name).Exists(attr => attr is PXStringListAttribute)) { return; } string val = (string)Calculate <StringlistValue>(cache, item); PXStringState state = (PXStringState)cache.GetStateExt(item, OuterField.Name); value = new List <string>(state.AllowedValues).Exists(str => String.CompareOrdinal(str, val) == 0) ? val : null; }
public override object Evaluate(PXCache cache, object item, Dictionary <Type, object> pars) { if (!cache.GetAttributesReadonly(item, OuterField.Name).Any(attr => attr is PXStringListAttribute)) { return(null); } string val = (string)pars[typeof(StringlistValue)]; PXStringState state = (PXStringState)cache.GetStateExt(item, OuterField.Name); return(new List <string>(state.AllowedValues).Exists(str => string.CompareOrdinal(str, val) == 0) ? val : null); }
public override void CacheAttached(PXCache sender) { base.CacheAttached(sender); foreach (PXDBStringAttribute attr in sender.GetAttributesReadonly(_FieldName).Where(attr => attr is PXDBStringAttribute).Cast <PXDBStringAttribute>()) { _Length = attr.Length; } if (_Length > 0) { sender.Graph.FieldUpdating.AddHandler(sender.GetItemType(), _FieldName.ToLower(), MultiSelectFieldUpdating); } }
/// <summary> /// Collects all the non-key fields of the specified cache which are decorated with <see cref="PXDBDecimalAttribute"/>. /// </summary> public static IEnumerable <string> GetAllDBDecimalFields(this PXCache cache, params string[] excludeFields) { IEnumerable <string> ret = cache.Fields .Where(fld => cache.GetAttributesReadonly(fld).OfType <PXDBDecimalAttribute>().Any(a => a.IsKey != true)); if (excludeFields?.Length > 0) { ret = ret.Where(fld => !excludeFields.Any(efld => string.Equals(fld, efld, StringComparison.OrdinalIgnoreCase))); } return(ret); }
public override void CacheAttached(PXCache sender) { PXDefaultAttribute defAttr = sender.GetAttributesReadonly(_FieldName).OfType <PXDefaultAttribute>().FirstOrDefault(); if (defAttr != null) { defAttr.PersistingCheck = PXPersistingCheck.Nothing; } else { throw new PXException(ErrorMessages.UsageOfAttributeWithoutPrerequisites, GetType().Name, typeof(PXDefaultAttribute).Name, sender.GetItemType().FullName, FieldName); } base.CacheAttached(sender); }
private void findParentAttribute(PXCache sender, object row) { if (_parentAttribute != null) { return; } foreach (PXEventSubscriberAttribute attr in sender.GetAttributesReadonly(row, _key.Name)) { if (attr is PXParentAttribute) { _parentAttribute = (PXParentAttribute)attr; break; } } }
protected object[] ChangeReference(PXGraph graph, DacReference reference, object childEntity, object newId) { PXCache cache = graph.Caches[reference.ReferenceField.DeclaringType]; string changingFieldName = reference.ReferenceField.Name; Func <object, object[]> keysSelector = (item) => cache.Keys.Select(k => cache.GetValue(item, k)).ToArray(); //for selectors cache.Current = childEntity; object oldValue = cache.GetValue(childEntity, changingFieldName); if (oldValue != null && oldValue.Equals(newId) || oldValue == null && newId == null) { return(keysSelector(childEntity)); } //setting ordinary value if (cache.Keys.All(k => k.ToLower() != changingFieldName.ToLower())) { cache.SetValueExt(childEntity, changingFieldName, newId); cache.SetStatus(childEntity, PXEntryStatus.Updated); return(keysSelector(childEntity)); } //setting value that is part of PK key //if it is identity column, it would be changed after insert object newItem = cache.CreateCopy(childEntity); cache.SetValueExt(newItem, changingFieldName, newId); //resetting keys to persist new entity string[] identityKeys = cache.Keys.Where(k => cache.GetAttributesReadonly(newItem, k) .OfType <PXDBIdentityAttribute>() .Any()).ToArray(); identityKeys.ForEach(k => cache.SetValueExt(newItem, k, null)); cache.Update(newItem); cache.SetStatus(childEntity, PXEntryStatus.Deleted); EntityForIdentityInserting(graph, newItem); /*cache.PersistInserted(newItem); * cache.SetStatus(newItem, PXEntryStatus.Notchanged);*/ return(keysSelector(newItem)); }
public static void CopyTranslations <TSourceField, TDestinationField>( PXCache sourceCache, object sourceData, PXCache destinationCache, object destinationData, Func <string, string> processTranslation) where TSourceField : IBqlField where TDestinationField : IBqlField { if (IsEnabled) { var translationAttribute = sourceCache.GetAttributesReadonly <TSourceField>(sourceData) .OfType <DBMatrixLocalizableDescriptionAttribute>().FirstOrDefault(); string[] translations = translationAttribute.GetTranslations(sourceCache, sourceData) .Select(t => processTranslation(t)).ToArray(); destinationCache.Adjust <DBMatrixLocalizableDescriptionAttribute>(destinationData).For <TDestinationField>(a => a.SetTranslations(destinationCache, destinationData, translations)); } }
public static IEnumerable<Type> GetDecimalFieldsAggregate<Table>(PXGraph graph) where Table : IBqlTable { var result = new List<Type> { }; PXCache cache = graph.Caches[typeof(Table)]; if (cache == null) throw new PXException(Messages.FailedToGetCache, typeof(Table).FullName); foreach (Type bqlField in cache.BqlFields .Where(fieldType => cache.GetAttributesReadonly(cache.GetField(fieldType)).OfType<PXDBDecimalAttribute>().Any())) { result.Add(typeof(Sum<,>)); result.Add(bqlField); } return result; }
public static void Sync(PXCache sender, object data) { PMCommitmentAttribute commitmentAttribute = null; foreach (PXEventSubscriberAttribute attr in sender.GetAttributesReadonly("commitmentID")) { if (attr is PMCommitmentAttribute) { commitmentAttribute = (PMCommitmentAttribute)attr; break; } } if (commitmentAttribute != null) { commitmentAttribute.SyncCommitment(sender, data, true); } }
public virtual void RowPersisting(PXCache sender, PXRowPersistingEventArgs e) { object row = e.Row; Type conditionType = Condition; if (row == null || conditionType == null) { return; } PXPersistingCheck persistingCheck = GetConditionResult(sender, row, conditionType) ? PXPersistingCheck.NullOrBlank : PXPersistingCheck.Nothing; PXDefaultAttribute defaultAttribute = sender.GetAttributesReadonly(_FieldName).OfType <PXDefaultAttribute>().FirstOrDefault(); if (defaultAttribute != null) { defaultAttribute.PersistingCheck = persistingCheck; defaultAttribute.RowPersisting(sender, e); defaultAttribute.PersistingCheck = PXPersistingCheck.Nothing; } }
public static IEnumerable <FieldValue> GetMarkedProperties(PXGraph graph, ref int firstSortOrder) { PXCache cache = graph.Caches[typeof(TPrimary)]; int order = firstSortOrder; List <FieldValue> res = (cache.Fields.Where( fieldname => cache.GetAttributesReadonly(fieldname).OfType <TMarkAttribute>().Any()) .Select(fieldname => new { fieldname, state = cache.GetStateExt(null, fieldname) as PXFieldState }) .Where(@t => @t.state != null) .Select(@t => new FieldValue() { Selected = false, CacheName = typeof(TPrimary).FullName, Name = @t.fieldname, DisplayName = @t.state.DisplayName, AttributeID = null, Order = order++ })).ToList(); firstSortOrder = order; return(res); }
protected virtual void APInvoiceExt_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { APInvoiceExt invoice = e.Row as APInvoiceExt; if (invoice == null) { return; } PXUIFieldAttribute.SetEnabled(sender, invoice, false); PXUIFieldAttribute.SetEnabled <APInvoiceExt.selected>(sender, invoice, true); PXUIFieldAttribute.SetEnabled <APInvoiceExt.retainageReleasePct>(sender, invoice, true); PXUIFieldAttribute.SetEnabled <APInvoiceExt.curyRetainageReleasedAmt>(sender, invoice, true); PXUIFieldAttribute.SetEnabled <APInvoiceExt.retainageVendorRef>(sender, invoice, true); APVendorRefNbrAttribute aPVendorRefNbrAttribute = sender.GetAttributesReadonly <APInvoiceExt.retainageVendorRef>() .OfType <APVendorRefNbrAttribute>().FirstOrDefault(); if (aPVendorRefNbrAttribute != null) { var args = new PXFieldVerifyingEventArgs(invoice, invoice.RetainageVendorRef, true); aPVendorRefNbrAttribute.FieldVerifying(sender, args); } if (invoice.Selected ?? true) { Dictionary <String, String> errors = PXUIFieldAttribute.GetErrors(sender, invoice, PXErrorLevel.Error); if (errors.Count > 0) { invoice.Selected = false; DocumentList.Cache.SetStatus(invoice, PXEntryStatus.Updated); sender.RaiseExceptionHandling <APInvoiceExt.selected>( invoice, null, new PXSetPropertyException(Messages.ErrorRaised, PXErrorLevel.RowError)); PXUIFieldAttribute.SetEnabled <APInvoiceExt.selected>(sender, invoice, false); } } }
public static void AddToInvoiced(PXCache sender, PMCommitment container) { PMCommitmentAttribute commitmentAttribute = null; foreach (PXEventSubscriberAttribute attr in sender.GetAttributesReadonly("commitmentID")) { if (attr is PMCommitmentAttribute) { commitmentAttribute = (PMCommitmentAttribute)attr; break; } } if (commitmentAttribute != null) { commitmentAttribute.AddInvoiced(sender, container); } else { AddInvoicedBase(sender, container); } }
protected virtual void CSAttribute_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { if (e.Row == null) { return; } var row = e.Row as CSAttribute; SetControlsState(row, sender); ValidateAttributeID(sender, row); if (row.ControlType == CSAttribute.GISelector) { if (!string.IsNullOrEmpty(row.ObjectName as string)) { try { Type objType = System.Web.Compilation.PXBuildManager.GetType(row.ObjectName, true); PXCache objCache = this.Caches[objType]; string[] fields = objCache.Fields .Where(f => objCache.GetBqlField(f) != null || f.EndsWith("_Attributes", StringComparison.OrdinalIgnoreCase)) .Where(f => !objCache.GetAttributesReadonly(f).OfType <PXDBTimestampAttribute>().Any()) .Where(f => !string.IsNullOrEmpty((objCache.GetStateExt(null, f) as PXFieldState)?.ViewName)) .Where(f => f != "CreatedByID" && f != "LastModifiedByID") .ToArray(); PXStringListAttribute.SetList <CSAttribute.fieldName>(sender, row, fields, fields); } catch { } } else { PXStringListAttribute.SetList <CSAttribute.fieldName>(sender, row, Array.Empty <string>(), Array.Empty <string>()); } } }
protected virtual void RowUpdatedImpl(PXCache cache, PXRowUpdatedEventArgs e) { if (RedefaultOrRevalidateOnOrganizationSourceUpdated) { object value = null; object errorValue = null; bool hasError = false; foreach (PXEventSubscriberAttribute attribute in cache.GetAttributesReadonly(e.Row, _FieldName)) { IPXInterfaceField uiFieldAttribute = attribute as IPXInterfaceField; if (uiFieldAttribute != null) { hasError = uiFieldAttribute.ErrorLevel == PXErrorLevel.Error || uiFieldAttribute.ErrorLevel == PXErrorLevel.RowError; if (hasError || uiFieldAttribute.ErrorLevel == PXErrorLevel.Warning || uiFieldAttribute.ErrorLevel == PXErrorLevel.RowWarning) { errorValue = uiFieldAttribute.ErrorValue; value = hasError ? errorValue : FormatForDisplay((string)cache.GetValue(e.Row, _FieldName)); cache.RaiseExceptionHandling(_FieldName, e.Row, value, null); } } } OrganizationDependedPeriodKey newPeriodKey = GetFullKey(cache, e.Row); OrganizationDependedPeriodKey oldPeriodKey = GetFullKey(cache, e.OldRow); if (ShouldExecuteRedefaultFinPeriodIDonRowUpdated(errorValue, hasError, newPeriodKey, oldPeriodKey)) { RedefaultPeriodID(cache, e.Row); } else if (!newPeriodKey.IsNotPeriodPartsEqual(oldPeriodKey) && oldPeriodKey.PeriodID != null && !cache.Graph.IsContractBasedAPI && !cache.Graph.UnattendedMode && !cache.Graph.IsImport && !cache.Graph.IsExport) { OrganizationDependedPeriodKey basePeriodForMapping = GetFullKey(cache, e.OldRow); if (hasError) { basePeriodForMapping.PeriodID = UnFormatPeriod((string)errorValue); } else if (oldPeriodKey.PeriodID != newPeriodKey.PeriodID) { basePeriodForMapping.PeriodID = newPeriodKey.PeriodID; } string mappedPeriod = GetMappedPeriodID(cache, newPeriodKey, basePeriodForMapping); cache.SetValueExt(e.Row, _FieldName, FormatForDisplay(mappedPeriod)); } else { cache.SetValueExt(e.Row, _FieldName, FormatForDisplay(newPeriodKey.PeriodID)); } } }
public virtual Dictionary <Type, object> ExtractValues(PXCache sender, object row, PXResult res, IEnumerable <Type> fieldTypes) { Dictionary <Type, object> result = new Dictionary <Type, object>(); Dictionary <Type, Type> selectorFieldByTable = new Dictionary <Type, Type>(); Type lastField = null; foreach (Type field in fieldTypes) { Type tableType = BqlCommand.GetItemType(field); if (tableType != null) { if (sender.GetItemType().IsAssignableFrom(tableType) || tableType.IsAssignableFrom(sender.GetItemType())) //field of the given table or a base dac/table { if (!result.ContainsKey(field)) { result.Add(field, GetFieldValue(sender, row, field, res != null)); } lastField = field; } else if (lastField != null && typeof(IBqlTable).IsAssignableFrom(BqlCommand.GetItemType(field))) //field of any other table { object foreign = null; if (res != null) { //mass processing - The values are searched in the joined resultset. foreign = res[BqlCommand.GetItemType(field)]; if (foreign != null) { PXCache fcache = sender.Graph.Caches[foreign.GetType()]; if (!result.ContainsKey(field)) { result.Add(field, GetFieldValue(fcache, foreign, field, false)); } } } if (foreign == null) { //lazy loading - The values are selected through the selectors, with a call to DB string selectorFieldName; if (selectorFieldByTable.ContainsKey(tableType)) { selectorFieldName = selectorFieldByTable[tableType].Name; } else { selectorFieldName = lastField.Name; } foreign = PXSelectorAttribute.Select(sender, row, selectorFieldName); if (foreign == null) { foreach (PXEventSubscriberAttribute attr in sender.GetAttributesReadonly(selectorFieldName)) { PXAggregateAttribute aggatt = attr as PXAggregateAttribute; if (aggatt != null) { PXDimensionSelectorAttribute dimAttr = aggatt.GetAttribute <PXDimensionSelectorAttribute>(); PXSelectorAttribute selAttr = aggatt.GetAttribute <PXSelectorAttribute>(); if (dimAttr != null) { selAttr = dimAttr.GetAttribute <PXSelectorAttribute>(); } if (selAttr != null) { PXView select = sender.Graph.TypedViews.GetView(selAttr.PrimarySelect, !selAttr.DirtyRead); object[] pars = new object[selAttr.ParsCount + 1]; pars[pars.Length - 1] = sender.GetValue(row, selAttr.FieldOrdinal); foreign = PXSelectorAttribute.SelectSingleBound(select, new object[] { row, sender.Graph.Accessinfo }, pars); } } } } if (foreign is PXResult) { foreign = ((PXResult)foreign)[0]; } if (foreign != null) { if (!selectorFieldByTable.ContainsKey(tableType)) { selectorFieldByTable.Add(tableType, lastField); //result.Remove(lastField); } PXCache fcache = sender.Graph.Caches[foreign.GetType()]; if (!result.ContainsKey(field)) { result.Add(field, GetFieldValue(fcache, foreign, field, false)); } } } } } } return(result); }
private PXDefaultAttribute GetDefaultAttribute(PXCache sender) => sender.GetAttributesReadonly(_FieldName).OfType <PXDefaultAttribute>().FirstOrDefault();
protected override IEnumerable GetRecords() { PXCache cache = this._Graph.Caches[BqlCommand.GetItemType(_moduleField)]; if (cache.Current == null) { yield break; } string docType = (string)cache.GetValue(cache.Current, _docTypeField.Name); string module = (string)cache.GetValue(cache.Current, _moduleField.Name); bool excludeUnreleased = cache .GetAttributesReadonly(cache.Current, _FieldName) .OfType <DRDocumentSelectorAttribute>() .First() .ExcludeUnreleased; int?businessAccountID = null; if (_businessAccountField != null) { businessAccountID = (int?)cache.GetValue(cache.Current, _businessAccountField.Name); } if (module == BatchModule.AR) { PXSelectBase <ARInvoice> relevantInvoices = new PXSelectJoin < ARInvoice, InnerJoin <BAccount, On <BAccount.bAccountID, Equal <ARInvoice.customerID> > >, Where <ARInvoice.docType, Equal <Required <ARInvoice.docType> >, And <Where <ARInvoice.drSchedCntr, Less <ARInvoice.lineCntr>, Or <ARInvoice.drSchedCntr, IsNull> > > > > (this._Graph); if (excludeUnreleased) { relevantInvoices.WhereAnd <Where <ARInvoice.released, Equal <True> > >(); } object[] queryParameters; if (businessAccountID.HasValue) { relevantInvoices.WhereAnd < Where <ARInvoice.customerID, Equal <Required <ARInvoice.customerID> > > >(); queryParameters = new object[] { docType, businessAccountID }; } else { queryParameters = new object[] { docType }; } foreach (PXResult <ARInvoice, BAccount> result in relevantInvoices.Select(queryParameters)) { ARInvoice arInvoice = result; BAccount customer = result; string status = null; ARDocStatus.ListAttribute documentStatusListAttribute = new ARDocStatus.ListAttribute(); if (documentStatusListAttribute.ValueLabelDic.ContainsKey(arInvoice.Status)) { status = documentStatusListAttribute.ValueLabelDic[arInvoice.Status]; } DRDocumentRecord record = new DRDocumentRecord { BAccountCD = customer.AcctCD, RefNbr = arInvoice.RefNbr, Status = status, FinPeriodID = arInvoice.FinPeriodID, DocType = arInvoice.DocType, DocDate = arInvoice.DocDate, LocationID = arInvoice.CustomerLocationID, CuryOrigDocAmt = arInvoice.CuryOrigDocAmt, CuryID = arInvoice.CuryID }; yield return(record); } } else { foreach (var item in base.GetRecords()) { yield return(item); } } }
protected static Type GetCondition <AttrType, Field>(PXCache sender, object row) where AttrType : PXBaseConditionAttribute where Field : IBqlField { return(sender.GetAttributesReadonly <Field>().OfType <AttrType>().Select(attr => (attr).Condition).FirstOrDefault()); }