Пример #1
0
        //for selection or presentation with grouping id in from pxs
        public PXSqlGrouping(GroupingRow groupingRow, PXSqlMeta_21 meta, PXSqlVariableClassification var, StringCollection outputCodes)
        {
            Init(groupingRow, meta, var);
            StringCollection tempParentList = new StringCollection();

            mGroups = new List <PXSqlGroup>();
            PXSqlGroup tmpGroup = null;

            foreach (string code in outputCodes)
            {
                tmpGroup = new PXSqlGroup(code);
                mGroups.Add(tmpGroup);
            }

            foreach (PXSqlGroup group in mGroups)
            {
                List <VSGroupRow> tempList = meta.MetaQuery.GetVSGroupRow(mValuePoolId, mValuesetIds, mGroupingId, group.ParentCode);
                if (tempList.Count > 0)
                {
                    foreach (VSGroupRow row in tempList)
                    {
                        group.AddChildCode(row.ValueCode);
                    }
                }
                else
                {
                    group.AddChildCode(group.ParentCode);
                }
            }
            // Add the values to valuecollection of this variable
            AddValues(mValuePoolId, outputCodes, valuePoolValueTextExists);
        }
Пример #2
0
        /// <summary>
        /// Constructor called when parser is in selectionmode and there are no grouping ids in pxs or no pxs at all.
        /// </summary>
        /// <returns></returns>
        public PXSqlGrouping(GroupingRow groupingRow, PXSqlMeta_22 meta, PXSqlVariableClassification var, GroupingIncludesType include)
        {
            Init(groupingRow, meta, var);
            //TODO overriding include from paxiom, have to discuss how paxion can override database default.
            this.mIncludeType = include;
            // DONE, is now passed to paxiom as part of GroupingInfo ... this.mIncludeType = this.mDefaultIncludeType;
            //TODO end
            tempValueList = new StringCollection();
            StringCollection tempParentList = new StringCollection();

            mGroups = new List <PXSqlGroup>();
            PXSqlGroup tmpGroup = null;

            this.isHierarchy = this.mHierarchy != meta.Config.Codes.HierarchyNon;
            if (!isHierarchy)
            // Not hierarchical groups
            {
                this.mIncludeType = include;
                List <ValueGroupRow> myValuegroupRows = meta.MetaQuery.GetValueGroupRowsSorted(mGroupingId, null, true, meta.MainLanguageCode);

                foreach (ValueGroupRow myRow in myValuegroupRows)
                {
                    if (!tempParentList.Contains(myRow.GroupCode))
                    {
                        tmpGroup = new PXSqlGroup(myRow.GroupCode);
                        mGroups.Add(tmpGroup);
                        tempParentList.Add(myRow.GroupCode);
                    }
                    else
                    {
                        foreach (PXSqlGroup group in mGroups)
                        {
                            if (group.ParentCode == myRow.GroupCode)
                            {
                                tmpGroup = group;
                                break;
                            }
                        }
                    }
                    tmpGroup.AddChildCode(myRow.ValueCode);
                }
                AddValues(mValuePoolId, tempParentList, valuePoolValueTextExists);
            }
            else
            //hierarchical groups
            {
                this.mIncludeType = GroupingIncludesType.All;
                createHierarchy(meta.MetaQuery.GetValueGroupRowsSorted(mGroupingId, levelOne, true, meta.MainLanguageCode));
                setHierarchyLevelsOpen();
                setHierarchyLevels();
                setHierarchyNames();
                variable.Values.Clear();
                AddValues(mValuePoolId, tempValueList, valuePoolValueTextExists);
            }
        }
Пример #3
0
        //for selection or presentation with grouping id in from pxs
        public PXSqlGrouping(GroupingRow groupingRow, PXSqlMeta_22 meta, PXSqlVariableClassification var, StringCollection outputCodes)
        {
            Init(groupingRow, meta, var);


            StringCollection tempParentList = new StringCollection();

            mGroups = new List <PXSqlGroup>();
            PXSqlGroup tmpGroup = null;

            this.isHierarchy = this.mHierarchy != meta.Config.Codes.HierarchyNon;
            foreach (string code in outputCodes)
            {
                tmpGroup = new PXSqlGroup(code);
                mGroups.Add(tmpGroup);
            }

            foreach (PXSqlGroup group in mGroups)
            {
                //TODO; 2.2 bytt VSGroupRow
                // throw new NotImplementedException("i PXSqlGrouping");

                Dictionary <string, ValueGroupRow> templist = meta.MetaQuery.GetValueGroupRowskeyValueCode(mGroupingId, group.ParentCode, true);
                if (templist.Count > 0)
                {
                    foreach (KeyValuePair <string, ValueGroupRow> row in templist)
                    {
                        group.AddChildCode(row.Key);
                    }
                }
                else
                {
                    group.AddChildCode(group.ParentCode);
                }

                //List<VSGroupRow> tempList = meta.MetaQuery.GetVSGroupRow(mValuePoolId, mValuesetIds, mGroupingId,group.ParentCode);
                //if (tempList.Count > 0)
                //{
                //    foreach(VSGroupRow row in tempList)
                //    {
                //    group.AddChildCode(row.ValueCode);
                //    }
                //}
                //else
                //{
                //    group.AddChildCode(group.ParentCode);
                //}
            }
            // Add the values to valuecollection of this variable
            AddValues(mValuePoolId, outputCodes, valuePoolValueTextExists);
        }
Пример #4
0
        //for selection or presentation with grouping id in from pxs
        public PXSqlGrouping(GroupingRow groupingRow, PXSqlMeta_24 meta, PXSqlVariableClassification var, StringCollection outputCodes)
        {
            Init(groupingRow, meta, var);


            StringCollection tempParentList = new StringCollection();

            mGroups = new List <PXSqlGroup>();
            PXSqlGroup tmpGroup = null;

            this.isHierarchy = this.mHierarchy != meta.Config.Codes.HierarchyNon;
            foreach (string code in outputCodes)
            {
                tmpGroup = new PXSqlGroup(code);
                mGroups.Add(tmpGroup);
            }

            var parentGroupCodes = mGroups.Select(x => x.ParentCode).ToArray();
            Dictionary <string, ValueGroupRow>  templist = meta.MetaQuery.GetValueGroupRowskeyValueCode(mGroupingId, parentGroupCodes, true);
            Dictionary <string, List <string> > childCodesByParentCode = new Dictionary <string, List <string> >();

            foreach (var listItem in templist)
            {
                string parentCode = listItem.Value.GroupCode;

                if (!childCodesByParentCode.ContainsKey(parentCode))
                {
                    childCodesByParentCode[parentCode] = new List <string>();
                }

                childCodesByParentCode[parentCode].Add(listItem.Key);
            }

            foreach (PXSqlGroup group in mGroups)
            {
                if (childCodesByParentCode.ContainsKey(group.ParentCode))
                {
                    foreach (var childCode in childCodesByParentCode[group.ParentCode])
                    {
                        group.AddChildCode(childCode);
                    }
                }
                else
                {
                    group.AddChildCode(group.ParentCode);
                }
            }

            // Add the values to valuecollection of this variable
            AddValues(mValuePoolId, outputCodes, valuePoolValueTextExists);
        }
Пример #5
0
        private void Init(GroupingRow groupingRow, PXSqlMeta_24 meta, PXSqlVariableClassification var)
        {
            this.meta = meta;

            this.variable = var;
            this.valuePoolValueTextExists = var.ValuePool.ValueTextExists;
            this.mValuePoolId             = groupingRow.ValuePool;
            this.mValuesetIds             = var.ValusetIds;
            this.mGroupingId = groupingRow.Grouping;
            this.mGroupPres  = groupingRow.GroupPres;
            // throw new NotImplementedException("I init i PXSqlGrouping");
            //TODO; tok bort this.mGeoAreaNo = groupingRow.GeoAreaNo;
            //           this.mGeoAreaNo = groupingRow.GeoAreaNo;
            this.mHierarchy  = groupingRow.Hierarchy;
            this.Description = groupingRow.Description;

            this.mIsDefault = !string.IsNullOrEmpty(groupingRow.DefaultInGui) && groupingRow.DefaultInGui == meta.Config.Codes.Yes;

            this.PresText = new Dictionary <string, string>();
            foreach (string langCode in meta.LanguageCodes)
            {
                this.PresText[langCode] = groupingRow.texts[langCode].PresText;
            }
            this.SortCode = groupingRow.texts[meta.MainLanguageCode].SortCode;

            //TODO added databasedefault to override value from paxiom, should be possible to do both
            switch (this.mGroupPres.ToUpper())
            {
            case "I":
                mDefaultIncludeType = GroupingIncludesType.SingleValues;
                break;

            case "A":
                mDefaultIncludeType = GroupingIncludesType.AggregatedValues;
                break;

            case "B":
                mDefaultIncludeType = GroupingIncludesType.All;
                break;

            default:
                mDefaultIncludeType = GroupingIncludesType.AggregatedValues;
                break;
            }
        }
Пример #6
0
        //for Selection without grouping id in from pxs
        public PXSqlGrouping(GroupingRow groupingRow, PXSqlMeta_21 meta, PXSqlVariableClassification var, GroupingIncludesType include)
        {
            Init(groupingRow, meta, var);
            //TODO overriding include from paxiom, have to discuss how paxion can override database default.
            this.mIncludeType = include;
            // DONE, is now passed to paxiom as part of GroupingInfo ...  this.mIncludeType = this.mDefaultIncludeType;
            //TODO end
            StringCollection tempParentList = new StringCollection();

            mGroups = new List <PXSqlGroup>();
            PXSqlGroup tmpGroup = null;

            foreach (VSGroupRow myRow in meta.MetaQuery.GetVSGroupRowsSorted(mValuePoolId, mValuesetIds, mGroupingId, meta.MainLanguageCode))
            {
                if (!tempParentList.Contains(myRow.GroupCode))
                {
                    tmpGroup = new PXSqlGroup(myRow.GroupCode);
                    mGroups.Add(tmpGroup);
                    tempParentList.Add(myRow.GroupCode);
                }
                else
                {
                    foreach (PXSqlGroup group in mGroups)
                    {
                        if (group.ParentCode == myRow.GroupCode)
                        {
                            tmpGroup = group;
                            break;
                        }
                    }
                }
                tmpGroup.AddChildCode(myRow.ValueCode);
            }

            // Add the values to valuecollection of this variable
            AddValues(mValuePoolId, tempParentList, valuePoolValueTextExists);

            //PXSqlValue tempValue;
            //    foreach (ValueRow row in meta.MetaQuery.GetValueRowsByValuePool(mValuePoolId, tempParentList, valuePoolValueTextExists))
            //{
            //    tempValue = new PXSqlValue(row, meta.LanguageCodes, meta.MainLanguageCode);
            //    var.Values.Add(tempValue.ValueCode,tempValue);
            //}
        }
Пример #7
0
        private void Init(GroupingRow groupingRow, PXSqlMeta_21 meta, PXSqlVariableClassification var)
        {
            this.meta     = meta;
            this.variable = var;
            this.valuePoolValueTextExists = var.ValuePool.ValueTextExists;
            this.mValuePoolId             = groupingRow.ValuePool;
            this.mValuesetIds             = var.ValusetIds;
            this.mGroupingId = groupingRow.Grouping;
            this.mGroupPres  = groupingRow.GroupPres;
            this.mGeoAreaNo  = groupingRow.GeoAreaNo;
            this.PresText    = new Dictionary <string, string>();
            this.Description = groupingRow.Description;
            foreach (string langCode in meta.LanguageCodes)
            {
                this.PresText[langCode] = groupingRow.texts[langCode].PresText;
            }
            this.SortCode = groupingRow.texts[meta.MainLanguageCode].SortCode;
            //TODO added databasedefault to override value from paxiom, should be possible to do both
            switch (this.mGroupPres.ToUpper())
            {
            case "I":
                mDefaultIncludeType = GroupingIncludesType.SingleValues;
                break;

            case "A":
                mDefaultIncludeType = GroupingIncludesType.AggregatedValues;
                break;

            case "B":
                mDefaultIncludeType = GroupingIncludesType.All;
                break;

            default:
                mDefaultIncludeType = GroupingIncludesType.AggregatedValues;
                break;
            }
        }