public BranchCDOfOrganizationAttribute(Type organizationFieldType, bool onlyActive = true, Type searchType = null) { OrganizationFieldType = organizationFieldType; Type selectorSource = typeof(Search <Branch.branchCD, Where <MatchWithBranch <Branch.branchID> > >); PXDimensionSelectorAttribute attr = new PXDimensionSelectorAttribute(_DimensionName, selectorSource) { ValidComboRequired = true, DescriptionField = typeof(Branch.acctName), SelectorMode = SelectorMode }; _Attributes.Add(attr); _Attributes.Add(new PXRestrictorAttribute(BqlCommand.Compose( typeof(Where <, ,>), typeof(Branch.organizationID), typeof(Equal <>), typeof(Optional2 <>), OrganizationFieldType, typeof(Or <,>), typeof(Optional2 <>), OrganizationFieldType, typeof(IsNull)), Messages.TheSpecifiedBranchDoesNotBelongToTheSelectedCompany)); if (onlyActive) { _Attributes.Add(new PXRestrictorAttribute(typeof(Where <Branch.active, Equal <True> >), Messages.BranchInactive)); } Initialize(); }
public CustomerActive2Attribute() { System.Type type1 = BqlCommand.Compose(typeof(Search2 <, ,>), typeof(BAccountR.bAccountID), typeof(LeftJoin <, ,>), typeof(Customer), typeof(On <Customer.bAccountID, Equal <BAccountR.bAccountID>, And <Match <Customer, Current <AccessInfo.userName> > > >), typeof(LeftJoin <, ,>), typeof(PX.Objects.CR.Contact), typeof(On <PX.Objects.CR.Contact.bAccountID, Equal <BAccountR.bAccountID>, And <PX.Objects.CR.Contact.contactID, Equal <BAccountR.defContactID> > >), typeof(LeftJoin <, ,>), typeof(Address), typeof(On <Address.bAccountID, Equal <BAccountR.bAccountID>, And <Address.addressID, Equal <BAccountR.defAddressID> > >), typeof(LeftJoin <, ,>), typeof(PX.Objects.CR.Location), typeof(On <PX.Objects.CR.Location.bAccountID, Equal <BAccountR.bAccountID>, And <PX.Objects.CR.Location.locationID, Equal <BAccountR.defLocationID> > >), typeof(InnerJoin <,>), typeof(CSAnswers), typeof(On <CSAnswers.refNoteID, Equal <BAccountR.noteID>, And <CSAnswers.attributeID, Equal <FLXProjectEntry.BranchAtt>, And <CSAnswers.value, Contains <RTrim <Current <CustomerExt.usrBranchCD> > > > > >), typeof(Where <BAccountR.type, In3 <BAccountType.branchType, BAccountType.organizationType, BAccountType.customerType, BAccountType.combinedType> >)); PXAggregateAttribute.AggregatedAttributesCollection attributes = this._Attributes; System.Type type2 = type1; System.Type substituteKey = typeof(BAccountR.acctCD); System.Type[] typeArray = new System.Type[13] { typeof(BAccountR.acctCD), typeof(BAccountR.acctName), typeof(Address.addressLine1), typeof(Address.addressLine2), typeof(Address.postalCode), typeof(PX.Objects.CR.Contact.phone1), typeof(Address.city), typeof(Address.countryID), typeof(PX.Objects.CR.Location.taxRegistrationID), typeof(Customer.curyID), typeof(PX.Objects.CR.Contact.attention), typeof(Customer.customerClassID), typeof(Customer.status) }; PXDimensionSelectorAttribute selectorAttribute1; PXDimensionSelectorAttribute selectorAttribute2 = selectorAttribute1 = new PXDimensionSelectorAttribute("BIZACCT", type2, substituteKey, typeArray); attributes.Add((PXEventSubscriberAttribute)selectorAttribute1); selectorAttribute2.DescriptionField = typeof(Customer.acctName); selectorAttribute2.CacheGlobal = true; selectorAttribute2.FilterEntity = typeof(Customer); this._SelAttrIndex = this._Attributes.Count - 1; this.Filterable = true; }
public ProjectByApproverAttribute() { Type searchType = typeof( Search5 < PMProject.contractID , LeftJoin <PMTask, On <PMTask.projectID, Equal <PMProject.contractID>, And <PMTask.approverID, Equal <Current <EPActivityFilter.approverID> > > > > , Where < PMProject.isActive, Equal <True> , And <Where <PMTask.taskID, IsNotNull, Or <PMProject.approverID, Equal <Current <EPActivityFilter.approverID> > > > > > , Aggregate <GroupBy <PMProject.contractID, GroupBy <PMProject.contractCD, GroupBy <PMProject.description, GroupBy <PMProject.status> > > > > , OrderBy <Asc <PMProject.contractCD> > > ); PXDimensionSelectorAttribute select = new PXDimensionSelectorAttribute(ProjectAttribute.DimensionName, searchType, typeof(PMProject.contractCD), typeof(PMProject.contractCD), typeof(PMProject.description), typeof(PMProject.status)); select.DescriptionField = typeof(PMProject.description); select.ValidComboRequired = true; select.CacheGlobal = true; _Attributes.Add(select); _SelAttrIndex = _Attributes.Count - 1; }
private void InitAttribute(Type search, Type branchID, bool filterBranch, bool suppressActiveVerify) { _branchID = branchID; search = search ?? typeof(Search <CashAccount.cashAccountID>); Type searchCommand = generateNewSearch(search.GetGenericArguments(), _branchID, filterBranch); if (searchCommand == null) { throw new PXArgumentException("search", ErrorMessages.ArgumentException); } var dimensionSelectorAttribute = new PXDimensionSelectorAttribute(DimensionName, searchCommand, typeof(CashAccount.cashAccountCD), _selectorCols) { CacheGlobal = true, DescriptionField = typeof(CashAccount.descr) }; _Attributes.Add(dimensionSelectorAttribute); _SelAttrIndex = _Attributes.Count - 1; this.Filterable = true; if (!suppressActiveVerify) { Type msgParam = typeof(CashAccount.cashAccountCD); PXRestrictorAttribute cashAccountActiveStatusRestrictor = new PXRestrictorAttribute(typeof(Where <CashAccount.active, Equal <True> >), CA.Messages.CashAccountInactive, msgParam); _Attributes.Add(cashAccountActiveStatusRestrictor); } }
public ContractAttribute(Type WhereType) { Type SearchType = BqlCommand.Compose( typeof(Search2 <, , ,>), typeof(Contract.contractID), typeof(InnerJoin <ContractBillingSchedule, On <ContractBillingSchedule.contractID, Equal <Contract.contractID> > >), typeof(Where <, ,>), typeof(Contract.isTemplate), typeof(Equal <boolFalse>), typeof(And <, ,>), typeof(Contract.baseType), typeof(Equal <>), typeof(Contract.ContractBaseType), typeof(And <>), WhereType, typeof(OrderBy <Desc <Contract.contractCD> >)); PXDimensionSelectorAttribute select = new PXDimensionSelectorAttribute(DimensionName, SearchType, typeof(Contract.contractCD), typeof(Contract.contractCD), typeof(Contract.customerID), typeof(Contract.locationID), typeof(Contract.description), typeof(Contract.status), typeof(Contract.expireDate), typeof(ContractBillingSchedule.lastDate), typeof(ContractBillingSchedule.nextDate)); select.DescriptionField = typeof(Contract.description); _Attributes.Add(select); _SelAttrIndex = _Attributes.Count - 1; }
public ContractInventoryItemAttribute() { Type SearchType = BqlCommand.Compose( typeof(Search5 <, ,>), typeof(InventoryItem.inventoryID), typeof(LeftJoin <ARSalesPrice, On <ARSalesPrice.inventoryID, Equal <InventoryItem.inventoryID>, And <ARSalesPrice.uOM, Equal <InventoryItem.baseUnit>, And <ARSalesPrice.curyID, Equal <Current <ContractItem.curyID> >, And <ARSalesPrice.priceType, Equal <PriceTypes.basePrice>, And <ARSalesPrice.breakQty, Equal <decimal0>, And <ARSalesPrice.isPromotionalPrice, Equal <False>, And <ARSalesPrice.isFairValue, Equal <False> > > > > > > > >), typeof(Aggregate <GroupBy <InventoryItem.inventoryID, GroupBy <InventoryItem.stkItem> > >)); PXDimensionSelectorAttribute select = new PXDimensionSelectorAttribute( DimensionName, SearchType, typeof(InventoryItem.inventoryCD) ); select.DescriptionField = typeof(InventoryItem.descr); _Attributes.Add(select); _SelAttrIndex = _Attributes.Count - 1; }
public FSInventoryAttribute(Type searchType, Type substituteKey, Type descriptionField) : base() { PXDimensionSelectorAttribute attr = new PXDimensionSelectorAttribute(DimensionName, searchType, substituteKey); attr.CacheGlobal = true; attr.DescriptionField = descriptionField; _Attributes.Add(attr); _SelAttrIndex = _Attributes.Count - 1; }
public PMLaborItemAttribute(Type project, Type earningType, Type employeeSearch) { this.projectField = project; this.earningTypeField = earningType; this.employeeSearch = employeeSearch; PXDimensionSelectorAttribute select = new PXDimensionSelectorAttribute(InventoryAttribute.DimensionName, typeof(Search <InventoryItem.inventoryID, Where <InventoryItem.itemType, Equal <INItemTypes.laborItem>, And <Match <Current <AccessInfo.userName> > > > >), typeof(InventoryItem.inventoryCD)); _Attributes.Add(select); _SelAttrIndex = _Attributes.Count - 1; }
public ContractItemAttribute() { PXDimensionSelectorAttribute select = new PXDimensionSelectorAttribute( DimensionName, typeof(Search <ContractItem.contractItemCD>) , typeof(ContractItem.contractItemCD) , typeof(ContractItem.contractItemCD), typeof(ContractItem.descr), typeof(ContractItem.baseItemID)); select.DescriptionField = typeof(ContractItem.descr); _Attributes.Add(select); _SelAttrIndex = _Attributes.Count - 1; }
public TestInventoryRawAttribute() : base() { Type SearchType = typeof(Search <InventoryItem.inventoryCD, Where <Match <Current <AccessInfo.userName> > > >); PXDimensionSelectorAttribute attr = new PXDimensionSelectorAttribute(DimensionName, SearchType, typeof(InventoryItem.inventoryCD)); attr.CacheGlobal = true; // This is the secret sauce - MaskAutocomplete attr.SelectorMode = PXSelectorMode.MaskAutocomplete; _Attributes.Add(attr); _SelAttrIndex = _Attributes.Count - 1; }
public INAdjustmentEntry() { INSetup record = insetup.Current; PXUIFieldAttribute.SetVisible <INTran.tranType>(transactions.Cache, null, false); PXUIFieldAttribute.SetEnabled <INTran.tranType>(transactions.Cache, null, false); PXDimensionSelectorAttribute.SetValidCombo <INTran.subItemID>(transactions.Cache, true); PXDimensionSelectorAttribute.SetValidCombo <INTranSplit.subItemID>(splits.Cache, true); PXVerifySelectorAttribute.SetVerifyField <INTran.origRefNbr>(transactions.Cache, null, true); }
public ContractTemplateAttribute() { PXDimensionSelectorAttribute select = new PXDimensionSelectorAttribute( DimensionName, typeof(Search <ContractTemplate.contractID, Where <ContractTemplate.isTemplate, Equal <boolTrue>, And <ContractTemplate.baseType, Equal <ContractTemplate.ContractBaseType> > > >) , typeof(ContractTemplate.contractCD) , typeof(ContractTemplate.contractCD), typeof(ContractTemplate.description), typeof(ContractTemplate.status)); select.DescriptionField = typeof(ContractTemplate.description); _Attributes.Add(select); _SelAttrIndex = _Attributes.Count - 1; }
public ContractAttribute() { PXDimensionSelectorAttribute select = new PXDimensionSelectorAttribute( DimensionName, typeof(Search2 <Contract.contractID, InnerJoin <ContractBillingSchedule, On <ContractBillingSchedule.contractID, Equal <Contract.contractID> > >, Where <Contract.isTemplate, Equal <boolFalse>, And <Contract.baseType, Equal <Contract.ContractBaseType> > > >) , typeof(Contract.contractCD) , typeof(Contract.contractCD), typeof(Contract.customerID), typeof(Contract.locationID), typeof(Contract.description), typeof(Contract.status), typeof(Contract.expireDate), typeof(ContractBillingSchedule.lastDate), typeof(ContractBillingSchedule.nextDate)); select.DescriptionField = typeof(Contract.description); _Attributes.Add(select); _SelAttrIndex = _Attributes.Count - 1; }
public INTransferEntry() { INSetup record = insetup.Current; PXUIFieldAttribute.SetVisible <INTran.tranType>(transactions.Cache, null, false); PXUIFieldAttribute.SetEnabled <INTran.tranType>(transactions.Cache, null, false); PXDimensionSelectorAttribute.SetValidCombo <INTran.subItemID>(transactions.Cache, true); PXDimensionSelectorAttribute.SetValidCombo <INTranSplit.subItemID>(splits.Cache, true); PXSelectorAttribute.SetColumns <INTran.subItemID>(transactions.Cache, new Type[] { typeof(INSubItem.subItemCD), typeof(INSiteStatus.qtyOnHand), typeof(INSiteStatus.active) }, null); PXSelectorAttribute.SetColumns <INTranSplit.subItemID>(splits.Cache, new Type[] { typeof(INSubItem.subItemCD), typeof(INSiteStatus.qtyOnHand), typeof(INSiteStatus.active) }, null); }
public ContractItemAttribute(Type WhereType) { Type SearchType = BqlCommand.Compose( typeof(Search <, ,>), typeof(ContractItem.contractItemCD), WhereType, typeof(OrderBy <Desc <ContractItem.contractItemCD> >)); PXDimensionSelectorAttribute select = new PXDimensionSelectorAttribute(DimensionName, SearchType, typeof(ContractItem.contractItemCD) , typeof(ContractItem.contractItemCD), typeof(ContractItem.descr), typeof(ContractItem.baseItemID)); select.DescriptionField = typeof(ContractItem.descr); _Attributes.Add(select); _SelAttrIndex = _Attributes.Count - 1; }
public ContractTemplateAttribute(Type WhereType) { Type SearchType = BqlCommand.Compose( typeof(Search <,>), typeof(ContractTemplate.contractID), typeof(Where <, ,>), typeof(ContractTemplate.baseType), typeof(Equal <>), typeof(CTPRType.contractTemplate), typeof(And <>), WhereType); PXDimensionSelectorAttribute select = new PXDimensionSelectorAttribute(DimensionName, SearchType, typeof(ContractTemplate.contractCD), typeof(ContractTemplate.contractCD), typeof(ContractTemplate.description), typeof(ContractTemplate.status)); select.DescriptionField = typeof(ContractTemplate.description); _Attributes.Add(select); _SelAttrIndex = _Attributes.Count - 1; }
public CashAccountRawAttribute() { Type searchType = typeof(Search2 <CashAccount.cashAccountCD, InnerJoin < Account, On <Account.accountID, Equal <CashAccount.accountID>, And2 < Match <Account, Current <AccessInfo.userName> >, And <Match <Account, Current <AccessInfo.branchID> > > > >, InnerJoin < Sub, On <Sub.subID, Equal <CashAccount.subID>, And <Match <Sub, Current <AccessInfo.userName> > > > > > >); PXDimensionSelectorAttribute attr = new PXDimensionSelectorAttribute(_DimensionName, searchType) { CacheGlobal = true, DescriptionField = typeof(CashAccount.descr) }; _Attributes.Add(attr); _SelAttrIndex = _Attributes.Count - 1; }
public OrganizationAttribute(bool onlyActive, Type selectorSource, Type defaultingSource) { PXDimensionSelectorAttribute attr = new PXDimensionSelectorAttribute(_DimensionName, selectorSource, typeof(Organization.organizationCD), typeof(Organization.organizationCD), typeof(Organization.organizationName)) { ValidComboRequired = true, DescriptionField = typeof(Organization.organizationName) }; _Attributes.Add(attr); _Attributes.Add(defaultingSource != null ? new PXDefaultAttribute(defaultingSource) : new PXDefaultAttribute()); if (onlyActive) { _Attributes.Add(new PXRestrictorAttribute(typeof(Where <Organization.active, Equal <True> >), Messages.TheCompanyIsInactive)); } Initialize(); }
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); }