protected virtual PXFieldState[] GetSlot(string name, DefinitionParams definitionParams, Type[] tables) { Definition def = PXDatabase.GetSlot <Definition, DefinitionParams>( name, definitionParams, tables); return(def == null ? null : def.Fields); }
public static bool IsRowsExists() { string slotName = typeof(RecordExistsSlot <Table, KeyField, Where>).ToString(); var slot = PXDatabase.GetSlot <RecordExistsSlot <Table, KeyField, Where> >(slotName, typeof(Table)); return(slot.RecordExists); }
private static SitePILocks GetSitePILocksFromSlot(int siteID, Func <List <PILocks> > getPILocksFunc) { return(PXDatabase.GetSlot <SitePILocks, Func <List <PILocks> > >( $"{typeof(SitePILocks).FullName}~{siteID}", getPILocksFunc, GetTablesToWatch())); }
private List <CurrencyRate> GetCachedCurrencyRates() { List <CurrencyRate> rates = PX.Common.PXContext.GetSlot <List <CurrencyRate> >(); if (rates == null) { rates = PX.Common.PXContext.SetSlot <List <CurrencyRate> >(PXDatabase.GetSlot <List <CurrencyRate> >(typeof(CM.CurrencyRate).FullName, typeof(CurrencyRate))); } return(rates); }
private ConcurrentBag <CurrencyRate> GetCachedCurrencyRates() { ConcurrentBag <CurrencyRate> rates = PX.Common.PXContext.GetSlot <CurrencyRateCollection>(); if (rates == null) { rates = PX.Common.PXContext.SetSlot <CurrencyRateCollection>(PXDatabase.GetSlot <CurrencyRateCollection>(typeof(CM.CurrencyRate).FullName, typeof(CurrencyRate))); } return(rates); }
public static TimeZoneInfo.AdjustmentRule GetRule(int year, string id) { var parameter = new DefinitionParameters(id, year); var key = _SLOT_KEY + year + id; using (new PXConnectionScope()) { return(PXDatabase.GetSlot <Definition, DefinitionParameters>(key, parameter, _tables). With(_ => _.Rule)); } }
public static EPActivityReminder GetFromSlot(string key, TasksAndEventsReminder graph) { EPActivityReminder slot = PXDatabase.GetSlot <EPActivityReminder, TasksAndEventsReminder>(key, graph, typeof(CRActivity), typeof(EPView), typeof(EPAttendee), typeof(CRReminder), typeof(UserPreferences)); if (slot.DBChanged) { PXContext.SetSlot <EPActivityReminder>(key, null); PXDatabase.ResetSlot <EPActivityReminder>(key, typeof(CRActivity), typeof(EPView), typeof(EPAttendee), typeof(CRReminder), typeof(UserPreferences)); slot = PXDatabase.GetSlot <EPActivityReminder, TasksAndEventsReminder>(key, graph, typeof(CRActivity), typeof(EPView), typeof(EPAttendee), typeof(CRReminder), typeof(UserPreferences)); } return(slot); }
public override void CacheAttached(PXCache sender) { base.CacheAttached(sender); _Definition = PX.Common.PXContext.GetSlot <Definition>(); if (_Definition == null) { PX.Common.PXContext.SetSlot(_Definition = PXDatabase.GetSlot <Definition>(typeof(Definition).FullName, typeof(CSAttribute))); } sender.Graph.FieldUpdating.AddHandler(sender.GetItemType(), _FieldName, AttributeIDFieldUpdating); }
public virtual IEnumerable <Data.EP.ActivityService.IActivityType> GetActivityTypes() { List <EPActivityType> activityTypes = PXDatabase.GetSlot <List <EPActivityType> >(typeof(EPActivityType).Name, typeof(EPActivityType)); if (activityTypes.Count == 0) { PXSelect <EPActivityType, Where <EPActivityType.active, Equal <True>, And <EPActivityType.isInternal, Equal <True> > > > .Clear(Graph); activityTypes.AddRange(PXSelect <EPActivityType, Where <EPActivityType.active, Equal <True>, And <EPActivityType.isInternal, Equal <True> > > > .Select(Graph).RowCast <EPActivityType>()); } return(activityTypes); }
private void BuildLists() { Definition = PXDatabase.GetSlot <AP1099BoxDefinition>(typeof(AP1099BoxDefinition).FullName, typeof(AP1099Box)); if (!Definition.AP1099Boxes.Any()) { return; } _AllowedValues = Definition.AP1099Boxes.Select(kvp => (int)kvp.Key).ToArray(); _AllowedLabels = Definition.AP1099Boxes.Select(kvp => string.Concat(kvp.Key, "-", kvp.Value)).ToArray(); _NeutralAllowedLabels = _AllowedLabels; }
public static ActivityStatistics GetFromSlot(Source source) { Type[] tables = source.Tables ?? new Type[] { typeof(CRActivity), typeof(EPAttendee), typeof(EPView), typeof(UserPreferences) }; string key = _ACTIVITY_SLOT_KEY_PREFIX + source.SrceenID + PXAccess.GetUserID(); var slot = PXDatabase.GetSlot <ActivityStatistics, Source>(key, source, tables); if (slot != null && slot.Day != DateTime.Today) { PXDatabase.ResetSlot <ActivityStatistics>(key, tables); slot = PXDatabase.GetSlot <ActivityStatistics, Source>(key, source, tables); } return(slot); }
public static TimeZoneInfo.AdjustmentRule GetRule(int year, string id) { var parameter = new DefinitionParameters(id, year); var key = _SLOT_KEY + year + id; Definition def = PXContext.GetSlot <Definition>(key); if (def == null) { using (new PXConnectionScope()) { def = PXDatabase.GetSlot <Definition, DefinitionParameters>(key, parameter, _tables); PXContext.SetSlot(key, def); } } return(def?.Rule); }
public static bool IsEntityInUse <Table>(params object[] keys) where Table : IBqlTable { if (Attribute.IsDefined(typeof(Table), typeof(EntityInUseDBSlotOnAttribute))) { var slot = PXDatabase.GetSlot <EntityInUseDefinition <Table> >(typeof(EntityInUseDefinition <Table>).FullName, typeof(Table)); return(keys.Length != 0 ? slot.EntitiesInUse.Contains(GetHash <Table>(keys)) : slot.EntitiesInUse.Any()); } else { KeysCollection cacheKeys = GetCacheKeys <Table>(); if (keys.Length != 0 && cacheKeys.Count() != keys.Length) { throw new PXArgumentException(nameof(keys)); } var fields = new PXDataField[cacheKeys.Count * (keys.Length != 0 ? 2 : 1)]; for (int i = 0; i < cacheKeys.Count; i++) { string cacheKey = cacheKeys[i]; fields[i] = new PXDataField(cacheKey); if (keys.Length != 0) { fields[cacheKeys.Count + i] = new PXDataFieldValue(cacheKey, keys[i]); } } using (PXDataRecord record = PXDatabase.SelectSingle <Table>(fields)) { return(record != null); } } }
public static bool IsEnabled() { return(PXDatabase.GetSlot <EntityRestrictionDefinition>(typeof(EntityRestrictionDefinition).Name, typeof(PreferencesSecurity)).Enabled); }
public static void Add(APAdjust adjustment) { PXDatabase.GetSlot <LienWaiverWarningsCacheService>(Key).Caches.Add(adjustment); }
public static EPActivityReminder GetFromSlot(string key, PXGraph graph) { return(PXDatabase.GetSlot <EPActivityReminder, PXGraph>(key, graph, typeof(EPActivity), typeof(EPView), typeof(EPAttendee), typeof(UserPreferences))); }
private static ActivityStatistics GetSlot <TStatistics>(string key, PXGraph graph, params Type[] tables) where TStatistics : class, IPrefetchable <PXGraph>, new() { return(PXDatabase.GetSlot <TStatistics, PXGraph>(key, graph, tables) as ActivityStatistics); }
public static Definition Get() { return(PXDatabase.GetSlot <Definition>(typeof(PXDateTimeInfo).Name, typeof(EPSetup))); }
public static void ClearStoredAdjustments() { PXDatabase.GetSlot <PreparePaymentsAdjustmentsCache>(Key).Caches.Clear(); }
public static List <APAdjust> GetStoredAdjustments() { return(PXDatabase.GetSlot <PreparePaymentsAdjustmentsCache>(Key).Caches); }
public static bool ShouldShowWarning(APAdjust adjustment) { return(PXDatabase.GetSlot <LienWaiverWarningsCacheService>(Key).Caches.Contains(adjustment)); }
private static ItemCategoriesDefinition GetSlot() { //Returns or initializes a new instance of ItemCategoriesDefinition. System will automatically invalidate and Prefetch again if INCategory or INItemCategory tables are updated. return(PXDatabase.GetSlot <ItemCategoriesDefinition>("ItemCategories", typeof(INCategory), typeof(INItemCategory))); }
private static USFeatureDefinition GetSlot() { return(PXDatabase.GetSlot <USFeatureDefinition, PXDatabaseUSProvider>("USFEATUREACTIVE", new PXDatabaseUSProvider(), typeof(USSetup))); }
public static bool IsExchange(int emailAccountID) { Definition def = PXDatabase.GetSlot <Definition>("EmailExchangeAccounts", typeof(EMailAccount)); return(def.Exchanges != null && def.Exchanges.Contains(emailAccountID)); }
protected override Definition GetSlot(string slotName) { return(PXDatabase.GetSlot <WizardDefinition, PXWizardSiteMapProvider>(slotName + Thread.CurrentThread.CurrentUICulture.Name, this, Tables)); }
public static EPActivityReminder GetFromSlot(string key, TasksAndEventsReminder graph) { return(PXDatabase.GetSlot <EPActivityReminder, TasksAndEventsReminder>(key, graph, typeof(CRActivity), typeof(EPView), typeof(EPAttendee), typeof(CRReminder), typeof(UserPreferences))); }
public virtual IEnumerable <Data.EP.ActivityService.IActivityType> GetActivityTypes() { ActivityTypeDeinition def = PXDatabase.GetSlot <ActivityTypeDeinition>(typeof(EPActivityType).Name, typeof(EPActivityType)); return(def.List); }
public static void Add(IEnumerable <APAdjust> adjustments) { PXDatabase.GetSlot <PreparePaymentsAdjustmentsCache>(Key).Caches.AddRange(adjustments); }