private void AttacheNewFields() { var cache = Details.Cache; cache.Fields.Add(_NAME_FIELD); var nameState = PXFieldState.CreateInstance(null, null, null, null, null, null, null, null, _NAME_FIELD, null, Messages.Name, null, PXErrorLevel.Undefined, true, true, null, PXUIVisibility.Undefined, null, null, null); FieldSelecting.AddHandler(cache.GetItemType(), _NAME_FIELD, (sender, args) => { args.ReturnState = nameState; var sourceField = ((EPChangesetDetail)args.Row).With(_ => _.SourceField); if (string.IsNullOrEmpty(sourceField)) { return; } var entityType = GetCurrentEntityType(); if (entityType == null) { return; } var displayName = (Caches[entityType].GetStateExt(null, sourceField) as PXFieldState).With(_ => _.DisplayName); args.ReturnValue = string.IsNullOrEmpty(displayName) ? sourceField : displayName; }); cache.Fields.Add(_OLDVALUE_FIELD); var oldValueState = PXFieldState.CreateInstance(null, null, null, null, null, null, null, null, _OLDVALUE_FIELD, null, Messages.OldValue, null, PXErrorLevel.Undefined, true, true, null, PXUIVisibility.Undefined, null, null, null); FieldSelecting.AddHandler(cache.GetItemType(), _OLDVALUE_FIELD, (sender, args) => { args.ReturnState = oldValueState; args.ReturnValue = GetValue(args.Row as EPChangesetDetail, typeof(EPChangesetDetail.oldValue).Name); }); cache.Fields.Add(_NEWVALUE_FIELD); var newValueState = PXFieldState.CreateInstance(null, null, null, null, null, null, null, null, _NEWVALUE_FIELD, null, Messages.NewValue, null, PXErrorLevel.Undefined, true, true, null, PXUIVisibility.Undefined, null, null, null); FieldSelecting.AddHandler(cache.GetItemType(), _NEWVALUE_FIELD, (sender, args) => { args.ReturnState = newValueState; args.ReturnValue = GetValue(args.Row as EPChangesetDetail, typeof(EPChangesetDetail.newValue).Name); }); }
protected override void PreliminaryFieldSelecting(PXCache s, PXFieldSelectingEventArgs e, string fieldName) { var matrix = (EntryMatrix)e.Row; var ret = PXFieldState.CreateInstance(e.ReturnState, typeof(bool), fieldName: fieldName); ret.Enabled = AllAdditionalAttributesArePopulated(); ret.DisplayName = PXLocalizer.Localize(Messages.SelectRow); ret.Visibility = PXUIVisibility.Visible; ret.Visible = true; e.ReturnState = ret; e.ReturnValue = matrix?.AllSelected; }
protected virtual void APPayment_RowUpdating(PXCache sender, PXRowUpdatingEventArgs e) { APPayment row = e.NewRow as APPayment; if (row != null && row.Selected == true) { PXFieldState state = (PXFieldState)sender.GetStateExt <APPayment.extRefNbr>(row); if (state != null && !string.IsNullOrEmpty(state.Error)) { row.Selected = false; } } }
private static string GetParamTypeName(PXGraph g, PXViewParameter p) { string type = ""; if (p.Bql != null) { Type rt = p.Bql.GetReferencedType(); Type cacheType = BqlCommand.GetItemType(rt); if (cacheType != null) { PXFieldState state = (PXFieldState)g.Caches[cacheType].GetStateExt(null, rt.Name); if (state != null) { return(state.DataType.Name); } } } if (p.Argument != null) { Type pt = p.Argument.ParameterType; if (pt.IsGenericType) { Type gd = pt.GetGenericTypeDefinition(); if (gd == typeof(Nullable <>)) { type = Nullable.GetUnderlyingType(pt).Name; } else { Type[] ga = pt.GetGenericArguments(); List <string> args = new List <string>(); foreach (Type a in ga) { args.Add(a.Name); } type = gd.Name + "<" + String.Join(",", args.ToArray()) + ">"; } } else { type = pt.Name; } //pt = Nullable.GetUnderlyingType(pt); //type = pt.ToString(); } return(type); }
public virtual FLXCommissionTable CreateComisionTable( CROpportunityProducts opporProd) { FLXCommissionTable flxCommissionTable = new FLXCommissionTable(); CROpportunity current = this.Base.Opportunity.Current; PXFieldState valueExt = this.Base.Opportunity.Cache.GetValueExt((object)current, "AttributeENDCUSTOME") as PXFieldState; flxCommissionTable.EndCustomerID = new int?((int)PXSelectorAttribute.GetField(this.Base.bAccountBasic.Cache, (object)this.Base.BAccounts, "acctCD", valueExt.Value, "bAccountID")); flxCommissionTable.CustomerID = current.BAccountID; flxCommissionTable.OpportunityID = current.OpportunityID; flxCommissionTable.OpporLineNbr = opporProd.LineNbr; flxCommissionTable.NonStock = opporProd.InventoryID; return(flxCommissionTable); }
public void TaxCalcMode_FieldSelecting(PXCache sender, PXFieldSelectingEventArgs e) { if (e.Row == null) { return; } bool?flagValue = (bool?)sender.GetValue(e.Row, _FieldOrdinal); if (flagValue == true) { e.ReturnState = PXFieldState.CreateInstance(e.ReturnState, typeof(string), null, null, null, null, null, null, null, null, null, null, PXErrorLevel.Undefined, false, null, null, PXUIVisibility.Undefined, null, null, null); } }
private static void TranID_CATran_BatchNbr_FieldSelectingHendler(PXCache sender, PXFieldSelectingEventArgs e) { if (e.Row == null || e.IsAltered) { string ViewName = null; PXCache cache = sender.Graph.Caches[typeof(CATran)]; PXFieldState state = cache.GetStateExt <CATran.batchNbr>(null) as PXFieldState; if (state != null) { ViewName = state.ViewName; } e.ReturnState = PXFieldState.CreateInstance(e.ReturnState, null, false, false, 0, 0, null, null, null, null, null, null, PXErrorLevel.Undefined, false, true, true, PXUIVisibility.Visible, ViewName, null, null); } }
public static IEnumerable <FieldValue> GetAttributeProperties(PXGraph graph, ref int firstSortOrder, List <string> suffixes) { int order = firstSortOrder; GetAttributeSuffixes(graph, ref suffixes); List <FieldValue> res = new List <FieldValue>(); PXCache cache = graph.Caches[typeof(TMain)]; foreach (string field in cache.Fields) { if (!suffixes.Any(suffix => field.EndsWith(string.Format("_{0}", suffix)))) { continue; } PXFieldState state = cache.GetStateExt(null, field) as PXFieldState; if (state == null) { continue; } string displayName = state.DisplayName; string attrID = field; string local = field; foreach (string suffix in suffixes.Where(suffix => local.EndsWith(string.Format("_{0}", suffix)))) { attrID = field.Replace(string.Format("_{0}", suffix), string.Empty); displayName = state.DisplayName.Replace(string.Format("${0}$-", suffix), string.Empty); break; } res.Add(new FieldValue { Selected = false, CacheName = typeof(TMain).FullName, Name = field, DisplayName = displayName, AttributeID = attrID, Order = order++ + 1000 }); } firstSortOrder = order; return(res); }
static string GetFieldDescription(PXCache cache, object row, Type fieldType, object[] keys) { string description = cache.DisplayName; if (keys.Any()) { description += KeysSeparator + string.Join(KeysSeparator, keys); } description += FieldSeparator; PXFieldState state = (PXFieldState)cache.GetStateExt(row, fieldType.Name); description += state.DisplayName; return(description); }
public virtual void FieldSelecting(PXCache sender, PXFieldSelectingEventArgs e) { if (_AttributeLevel == PXAttributeLevel.Item || e.IsAltered) { object row = e.Row; Type conditionType = Condition; if (row == null || conditionType == null) { return; } var persistingCheck = GetConditionResult(sender, row, conditionType) ? PXPersistingCheck.NullOrBlank : PXPersistingCheck.Nothing; e.ReturnState = PXFieldState.CreateInstance(e.ReturnState, null, null, null, persistingCheck == PXPersistingCheck.Nothing ? (int?)null : 1, null, null, null, _FieldName, null, null, null, PXErrorLevel.Undefined, null, null, null, PXUIVisibility.Undefined, null, null, null); } }
public virtual void POOrderRS_CuryID_FieldSelecting(PXCache sender, PXFieldSelectingEventArgs e) { POOrderRS row = (POOrderRS)e.Row; APInvoice doc = Base.Document.Current; if (row != null && doc != null) { if (row.CuryID != doc.CuryID) { string fieldName = typeof(POOrderRS.curyID).Name; PXErrorLevel msgLevel = PXErrorLevel.RowWarning; e.ReturnState = PXFieldState.CreateInstance(e.ReturnState, typeof(String), false, null, null, null, null, null, fieldName, null, null, AP.Messages.APDocumentCurrencyDiffersFromSourceDocument, msgLevel, null, null, null, PXUIVisibility.Undefined, null, null, null); e.IsAltered = true; } } }
protected IEnumerable rows() { PXCache cache = Caches[typeof(TEnqFilter)]; DiscrepancyEnqFilter header = cache.Current as DiscrepancyEnqFilter; if (header.FilterDetails != null) { PXFieldState state = Filter.Cache.GetStateExt <DiscrepancyEnqFilter.filterDetails>(header) as PXFieldState; if (state?.Value is IEnumerable value) { return(value); } } List <TEnqResult> result = SelectDetails(); Filter.Cache.SetValueExt <DiscrepancyEnqFilter.filterDetails>(header, result); return(result); }
protected virtual void CarrierPluginDetail_Value_FieldSelecting(PXCache sender, PXFieldSelectingEventArgs e) { CarrierPluginDetail row = e.Row as CarrierPluginDetail; if (row != null) { string fieldName = typeof(CarrierPluginDetail.value).Name; switch (row.ControlType) { case CarrierPluginDetail.Combo: List <string> labels = new List <string>(); List <string> values = new List <string>(); foreach (KeyValuePair <string, string> kv in row.GetComboValues()) { values.Add(kv.Key); labels.Add(kv.Value); } e.ReturnState = PXStringState.CreateInstance(e.ReturnState, CarrierDetail.ValueFieldLength, null, fieldName, false, 1, null, values.ToArray(), labels.ToArray(), true, null); break; case CarrierPluginDetail.CheckBox: e.ReturnState = PXFieldState.CreateInstance(e.ReturnState, typeof(Boolean), false, null, -1, null, null, null, fieldName, null, null, null, PXErrorLevel.Undefined, null, null, null, PXUIVisibility.Undefined, null, null, null); break; case CarrierPluginDetail.Password: if (e.ReturnState != null) { string strValue = e.ReturnState.ToString(); string encripted = new string('*', strValue.Length); e.ReturnState = PXFieldState.CreateInstance(encripted, typeof(string), false, null, -1, null, null, null, fieldName, null, null, null, PXErrorLevel.Undefined, null, null, null, PXUIVisibility.Undefined, null, null, null); } break; default: break; } } }
protected PXFieldState InitValueFieldState(FieldValue field = null) { PXFieldState state; if (field != null && (state = Caches[typeof(TPrimary)].GetStateExt(null, field.Name) as PXFieldState) != null) { state.SetFieldName(typeof(FieldValue.value).Name); state.Value = field.Value; state.Enabled = true; return(state); } else { PXFieldState defState = PXStringState.CreateInstance(null, null, null, typeof(FieldValue.value).Name, false, 0, null, null, null, null, null); defState.DisplayName = Messages.PropertyValue; return(defState); } }
protected virtual void INUnit_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { INUnit row = (INUnit)e.Row; PXFieldState state = (PXFieldState)sender.GetStateExt <INUnit.fromUnit>(row); uint msgNbr; String msqPrefix; if (Item.Current != null && row.ToUnit == Item.Current.BaseUnit && (state.Error == null || state.Error == PXMessages.Localize(Messages.BaseUnitNotSmallest, out msgNbr, out msqPrefix) || state.ErrorLevel == PXErrorLevel.RowInfo)) { if (row.UnitMultDiv == MultDiv.Multiply && row.UnitRate < 1 || row.UnitMultDiv == MultDiv.Divide && row.UnitRate > 1) { sender.RaiseExceptionHandling <INUnit.fromUnit>(row, row.FromUnit, new PXSetPropertyException(Messages.BaseUnitNotSmallest, PXErrorLevel.RowWarning)); } else { sender.RaiseExceptionHandling <INUnit.fromUnit>(row, row.FromUnit, null); } } }
//Copied from PX.Data.Handlers.PXEntityOpener (it is private) public static void SelectCurrent(PXView primaryView, PX.Data.Description.PXViewDescription primaryViewInfo, params KeyValuePair <string, string>[] pars) { //selecting data List <object> searches = new List <object>(); List <object> parameters = new List <object>(); List <string> sortCols = new List <string>(); List <bool> descendings = new List <bool>(); int startRow = 0, totalRows = 0; foreach (KeyValuePair <string, string> pair in pars) { if (!primaryView.Cache.Keys.Contains(pair.Key)) { return; } PXFieldState state = primaryView.Cache.GetStateExt(null, pair.Key) as PXFieldState; object val = Convert.ChangeType(pair.Value, state.DataType); searches.Add(val); sortCols.Add(pair.Key); descendings.Add(false); if (primaryViewInfo.Parameters.Any(p => p.Name == pair.Key)) { parameters.Add(val); } } List <object> recs = primaryView.Select(null, parameters.ToArray(), searches.ToArray(), sortCols.ToArray(), descendings.ToArray(), null, ref startRow, 1, ref totalRows); if (recs == null || recs.Count == 0) { return; } Object current = recs[0] is PXResult ? ((PXResult)recs[0])[primaryView.Cache.GetItemType()] : recs[0]; if (current == null) { return; } primaryView.Cache.Current = current; }
public virtual void POReceiptLineS_ReceiptNbr_FieldSelecting(PXCache sender, PXFieldSelectingEventArgs e) { POReceiptLineS row = (POReceiptLineS)e.Row; APInvoice doc = Base.Document.Current; if (row != null && doc != null) { POOrder order = PXSelect <POOrder, Where <POOrder.orderType, Equal <Required <POOrder.orderType> >, And <POOrder.orderNbr, Equal <Required <POOrder.orderNbr> > > > > .Select(Base, row.POType, row.PONbr); if (order != null && order.CuryID != doc.CuryID) { string fieldName = typeof(POReceipt.curyID).Name; PXErrorLevel msgLevel = PXErrorLevel.RowWarning; e.ReturnState = PXFieldState.CreateInstance(e.ReturnState, typeof(String), false, null, null, null, null, null, fieldName, null, null, AP.Messages.APDocumentCurrencyDiffersFromSourceDocument, msgLevel, null, null, null, PXUIVisibility.Undefined, null, null, null); e.IsAltered = true; } } }
public virtual void GLTran_RowSelected(PXCache sender, PXRowSelectedEventArgs e, Batch batch) { var tran = e.Row as GLTran; JournalEntry.SetReclassTranWarningsIfNeed(sender, tran); SetGLTranRefNbrRequired(tran, batch); if (ShouldCreateTaxTrans(batch)) { PXFieldState state = (PXFieldState)sender.GetStateExt <GLTran.taxID>(tran); //Needed to prevent error from being overriden by warning if (String.IsNullOrEmpty(state.Error) || state.IsWarning == true) { WarnIfMissingTaxID(tran); } } tran.IncludedInReclassHistory = JournalEntry.CanShowReclassHistory(tran, batch.BatchType); }
protected override void AttributeFieldSelecting(PXCache sender, PXFieldSelectingEventArgs e, PXFieldState state, string attributeName, int idx) { //Out-of-box DisplayName is prefixed with "$Attributes$-" - if you need to take that off. state.DisplayName = (!String.IsNullOrEmpty(state.DisplayName)) ? (state.DisplayName.Replace("$Attributes$-", "")) : attributeName; if (_StrLotSerialClassAttributes == null || !_StrLotSerialClassAttributes.Contains(state.Name.Replace("_LotSerialAttributes", ""))) { state.Visible = false; state.Visibility = PXUIVisibility.Invisible; } else { state.Visible = true; //Requires AutoGenerateColumns="AppendDynamic" for PXGrid Control for dynamic Attribute columns creation state.Visibility = PXUIVisibility.Dynamic; } e.IsAltered = true; base.AttributeFieldSelecting(sender, e, state, attributeName, idx); }
private void updateOtherSiblings(PXCache sender, object row) { bool needRefresh = false; if (_parentAttribute == null) { return; } PXFieldState state = (PXFieldState)sender.GetStateExt(row, _FieldName); if (state.DataType != typeof(bool)) { return; } if ((bool?)sender.GetValue(row, _FieldName) == false) { return; } foreach (object sibling in PXParentAttribute.SelectSiblings(sender, row, _parentAttribute.ParentType)) { if (!sender.ObjectsEqual(sibling, row)) { if ((bool?)sender.GetValue(sibling, _FieldName) == true) { sender.SetValue(sibling, _FieldName, false); sender.Update(sibling); needRefresh = true; } } } if (needRefresh) { foreach (var kvp in sender.Graph.Views) { PXView view = kvp.Value; if (_BqlTable.IsAssignableFrom(view.GetItemType())) { view.RequestRefresh(); } } } }
protected virtual void BoxScreenConfiguration_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { var screenConfig = e.Row as BoxScreenConfiguration; if (!string.IsNullOrEmpty(screenConfig.ScreenID)) { string graphTypeName = PXPageIndexingService.GetGraphTypeByScreenID(screenConfig.ScreenID); if (string.IsNullOrEmpty(graphTypeName)) { throw new PXException(Messages.PrimaryGraphForScreenIDNotFound, screenConfig.ScreenID); } Type graphType = PXBuildManager.GetType(graphTypeName, true); var graph = PXGraph.CreateInstance(graphType); string primaryViewName = PXPageIndexingService.GetPrimaryView(graphTypeName); PXView view = graph.Views[primaryViewName]; //Construct ddl values and displayed values, specifying field name for duplicates var fieldsArray = PXFieldState.GetFields(graph, view.BqlSelect.GetTables(), true); var displayNames = fieldsArray.GroupBy(fa => fa.DisplayName).ToDictionary(k => k.Key, v => v.ToList()); var labels = new List <string>(); var values = new List <string>(); foreach (var displayName in displayNames) { if (displayName.Value.Count > 1) { foreach (var displayNameField in displayName.Value) { labels.Add($"{displayName.Key} ({displayNameField.Name})"); values.Add(displayNameField.Name); } } else { labels.Add(displayName.Key); values.Add(displayName.Value.FirstOrDefault()?.Name); } } PXStringListAttribute.SetList <BoxScreenGroupingFields.fieldName>(Fields.Cache, null, values.ToArray(), labels.ToArray()); } }
public override void DescriptionFieldSelecting( PXCache sender, PXFieldSelectingEventArgs e, string alias) { object obj = sender.GetValue(e.Row, this._FieldName); base.DescriptionFieldSelecting(sender, e, alias); if (obj == null || e.ReturnValue != null) { return; } using (new PXReadDeletedScope()) { SOLine soLine = (SOLine)PXSelectBase <SOLine, PXSelect <SOLine, Where <SOLine.noteID, Equal <Required <SOLine.noteID> > > > .Config> .SelectSingleBound(sender.Graph, new object[0], obj); e.ReturnValue = soLine != null ? (object)soLine.OrderNbr : obj; e.ReturnState = (object)PXFieldState.CreateInstance(e.ReturnState, typeof(string), new bool?(false), new bool?(true), fieldName: alias, error: PXLocalizer.Localize("Sales Order line was not found.", typeof(PX.Objects.SO.Messages).FullName), errorLevel: PXErrorLevel.Warning, enabled: new bool?(false), visibility: PXUIVisibility.Visible); } }
protected virtual void FillAttributeViewName(int attributeNumber) { if (attributeNumber < AdditionalAttributes.Current.ViewNames?.Length) { string attributeID = AdditionalAttributes.Current.AttributeIdentifiers[attributeNumber]; string viewNameAttribute = $"attr{ attributeID }"; var selectorAttribute = new MatrixAttributeValueSelectorAttribute(attributeNumber, ShowDisabledValue) { FieldName = viewNameAttribute }; selectorAttribute.CacheAttached(AdditionalAttributes.Cache); var args = new PXFieldSelectingEventArgs(null, null, true, false); selectorAttribute.FieldSelecting(AdditionalAttributes.Cache, args); PXFieldState state = (PXFieldState)args.ReturnState; AdditionalAttributes.Current.ViewNames[attributeNumber] = state.ViewName; } }
private void CreateFieldStateForFieldName(PXFieldSelectingEventArgs e, Type type) { List <string> allowedValues = new List <string>(); List <string> allowedLabels = new List <string>(); Dictionary <string, string> fields = new Dictionary <string, string>(); foreach (var field in PXCache.GetBqlTable(type) .GetProperties(BindingFlags.Instance | BindingFlags.Public) .SelectMany(p => p.GetCustomAttributes(true).Where(atr => atr is PXMassMergableFieldAttribute), (p, atr) => p)) { PXFieldState fs = this.Caches[type].GetStateExt(null, field.Name) as PXFieldState; if (!fields.ContainsKey(field.Name)) { fields[field.Name] = fs != null ? fs.DisplayName : field.Name; } } if (type == typeof(Location)) { foreach (var field in PXCache.GetBqlTable(typeof(Contact)) .GetProperties(BindingFlags.Instance | BindingFlags.Public) .SelectMany(p => p.GetCustomAttributes(true).Where(atr => atr is PXMassMergableFieldAttribute), (p, atr) => p)) { PXFieldState fs = this.Caches[type].GetStateExt(null, field.Name) as PXFieldState; if (!fields.ContainsKey(field.Name)) { fields[field.Name] = fs != null ? fs.DisplayName : field.Name; } } } foreach (var item in fields.OrderBy(i => i.Value)) { allowedValues.Add(item.Key); allowedLabels.Add(item.Value); } e.ReturnState = PXStringState.CreateInstance(e.ReturnValue, 60, null, "FieldName", false, 1, null, allowedValues.ToArray(), allowedLabels.ToArray(), true, null); }
public virtual void FieldSelecting(PXCache sender, PXFieldSelectingEventArgs e) { if (!PXAccess.FeatureInstalled <FeaturesSet.gDPRCompliance>() || e.Row == null) { return; } var thisValue = sender.GetValue(e.Row, FieldName); if (thisValue == null) { return; } var optedInValue = sender.GetValue(e.Row, nameof(IConsentable.ConsentAgreement)); if (optedInValue == null) { return; } var isOptedIn = (bool)optedInValue; var expirationDate = (DateTime?)thisValue; var status = sender.GetStatus(e.Row); if (isOptedIn && expirationDate < sender.Graph.Accessinfo.BusinessDate && status != PXEntryStatus.Inserted) { e.ReturnState = PXFieldState.CreateInstance(e.ReturnState, null, null, null, null, null, null, null, null, null, null, Messages.ConsentExpired, PXErrorLevel.Warning, null, null, null, PXUIVisibility.Undefined, null, null, null); } else { e.ReturnState = PXFieldState.CreateInstance(e.ReturnState, null, null, null, null, null, null, null, null, null, null, null, PXErrorLevel.Undefined, null, null, null, PXUIVisibility.Undefined, null, null, null); } }
private PXFieldState CreateFieldStateForFieldValue(object returnState, string entityType, string cacheName, string fieldName) { Type type = GraphHelper.GetType(entityType); if (type != null) { Type cachetype = GraphHelper.GetType(cacheName); if (cachetype == null) { return(null); } PXCache cache = this.Caches[cachetype]; PXDBAttributeAttribute.Activate(cache); PXFieldState state = cache.GetStateExt(null, fieldName) as PXFieldState; if (state != null) { if (returnState == null) { object item = cache.CreateInstance(); object newValue; cache.RaiseFieldDefaulting(fieldName, item, out newValue); if (newValue != null) { cache.RaiseFieldSelecting(fieldName, item, ref newValue, false); } state.Value = newValue; } else { state.Value = returnState; } state.Enabled = true; } return(state); } return(null); }
public virtual void InventorySummaryEnquiryResult_LocationID_FieldSelecting(PXCache cache, PXFieldSelectingEventArgs e, Action <PXCache, PXFieldSelectingEventArgs> baseMethod) { string locationName = null; switch (e.ReturnValue) { case null: locationName = PXMessages.LocalizeNoPrefix(Messages.Unassigned); break; case InventorySummaryEnquiryResult.TotalLocationID: locationName = PXMessages.LocalizeNoPrefix(Messages.TotalLocation); break; default: locationName = INLocation.PK.Find(Base, e.ReturnValue as int?).With(loc => Base.IsMobile ? loc.Descr : loc.LocationCD); break; } if (locationName != null) { e.ReturnState = PXFieldState.CreateInstance(locationName, typeof(string), false, null, null, null, null, null, nameof(InventorySummaryEnquiryResult.locationID), null, GetLocationDisplayName(), null, PXErrorLevel.Undefined, null, null, null, PXUIVisibility.Undefined, null, null, null); e.Cancel = true; } string GetLocationDisplayName() { var displayName = PXUIFieldAttribute.GetDisplayName <InventorySummaryEnquiryResult.locationID>(cache); if (displayName != null) { displayName = PXMessages.LocalizeNoPrefix(displayName); } return(displayName); } }
protected virtual void _(Events.FieldSelecting <PMLaborCostRate, PMLaborCostRate.taskID> e) { if (e.Row != null && e.Row.Type == PMLaborCostRateType.Certified) { e.ReturnState = PXStringState.CreateInstance(null, null, null, nameof(PMLaborCostRate.TaskID), false, null, null, null, null, null, null); PXFieldState ss = e.ReturnState as PXFieldState; ss.Enabled = false; ss.Visible = PXAccess.FeatureInstalled <FeaturesSet.projectModule>(); ss.Visibility = PXAccess.FeatureInstalled <FeaturesSet.projectModule>() ? PXUIVisibility.Visible : PXUIVisibility.Invisible; e.Cancel = true; } else if (e.Row == null) { //For Excel Import - make field as editable in order to map the field. e.ReturnState = PXStringState.CreateInstance(null, null, null, nameof(PMLaborCostRate.TaskID), false, null, null, null, null, null, null); PXFieldState ss = e.ReturnState as PXFieldState; ss.Enabled = true; ss.Visible = PXAccess.FeatureInstalled <FeaturesSet.projectModule>(); ss.Visibility = PXAccess.FeatureInstalled <FeaturesSet.projectModule>() ? PXUIVisibility.Visible : PXUIVisibility.Invisible; ss.DisplayName = PXUIFieldAttribute.GetDisplayName <PMLaborCostRate.taskID>(e.Cache); e.Cancel = true; } }
protected virtual void EPRuleCondition_FieldName_FieldVerifying(PXCache sender, PXFieldVerifyingEventArgs e) { EPRuleCondition condition = (EPRuleCondition)e.Row; Type type = GraphHelper.GetType(AssigmentMap.Current.EntityType); if (type != null) { Type cachetype = GraphHelper.GetType(condition.Entity); if (cachetype == null) { return; } PXCache cache = this.Caches[cachetype]; PXDBAttributeAttribute.Activate(cache); PXFieldState state = cache.GetStateExt(null, e.NewValue.ToString()) as PXFieldState; if (state == null) { throw new PXException(Messages.FieldCannotBeFound); } } }
public override void CacheAttached(PXCache sender) { base.CacheAttached(sender); var values = new List <string>() { " " }; var labels = new List <string>() { " " }; var type = typeof(PMTask); // Acuminator disable once PX1045 PXGraphCreateInstanceInEventHandlers Needed because the info is retrieved using a graph instance. if (PXAccess.FeatureInstalled <FeaturesSet.projectModule>()) { ProjectEntry projectEntryGraph = PXGraph.CreateInstance <ProjectEntry>(); foreach (var field in projectEntryGraph.GetFieldNames(SmartsheetConstants.ViewName.TASK)) { if (ignoredFields.Any(fieldName => field.Contains(fieldName) || field.Contains("_") || field.Contains("Note"))) { continue; } if (!values.Contains(field)) { PXFieldState fs = projectEntryGraph.Caches[type].GetStateExt(null, field) as PXFieldState; values.Add(field); labels.Add(fs != null ? fs.DisplayName : field); } } } _AllowedValues = values.ToArray(); _AllowedLabels = labels.ToArray(); }