private static Dictionary <string, List <string> > GetPropertyLabelsPairs(PXCache cache, Dictionary <string, List <object> > valuesDic, Type valuesType)
        {
            PXCache       propertiesCache = cache.BqlTable == valuesType ? cache : cache.Graph.Caches[valuesType];
            List <string> properties      = propertiesCache.Fields;
            Dictionary <string, List <string> > labelsDic =
                new Dictionary <string, List <string> >(properties.Count);

            CRListAttributesHelper currentListHelper;

            foreach (string field in properties)
            {
                PXFieldState state = propertiesCache.GetStateExt(null, field) as PXFieldState;
                if (state == null || !state.Enabled)
                {
                    continue;
                }

                if (!labelsDic.ContainsKey(field) && valuesDic.ContainsKey(field) &&
                    (currentListHelper = CRListAttributesHelper.CreateFrom(cache.Graph, propertiesCache, field)) != null)
                {
                    labelsDic.Add(field, currentListHelper.GetLabels(valuesDic[field]));
                }
            }
            return(labelsDic);
        }
Esempio n. 2
0
        public static CRListAttributesHelper CreateFrom(PXGraph graph, PXCache fieldCache, string field)
        {
            CRListAttributesHelper result        = null;
            PXStringListAttribute  stringListAtt = GetAttribute <PXStringListAttribute>(fieldCache, field);

            if (stringListAtt != null)
            {
                result = new CRStringListAttHelper(stringListAtt);
            }
            PXIntListAttribute intListAtt = GetAttribute <PXIntListAttribute>(fieldCache, field);

            if (intListAtt != null)
            {
                result = new CRIntListAttHelper(intListAtt);
            }
            CRBaseListAttribute baseListAtt = GetAttribute <CRBaseListAttribute>(fieldCache, field);

            if (baseListAtt != null)
            {
                result = new CRBaseListAttHelper(baseListAtt);
            }
            if (result != null)
            {
                result.Graph = graph;
            }
            return(result);
        }