示例#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
        public void ParseNote(PXSqlMeta_21 mMeta, PCAxis.Paxiom.IPXModelParser.MetaHandler handler, string langCode)
        {
            string           keyWord;
            string           subKeyWord;
            StringCollection parseValue;

            foreach (PXSqlNote note in this)
            {
                if ((note.ShowFootNote == mMeta.Config.Codes.FootnoteShowP) || (note.ShowFootNote == mMeta.Config.Codes.FootnoteShowB))
                {
                    if (note.MandOpt == mMeta.Config.Codes.FootnoteM)
                    {
                        keyWord = "VALUENOTEX";
                    }
                    else
                    {
                        keyWord = "VALUENOTE";
                    }
                    subKeyWord = note.Variable + "\",\"" + note.ValueCode;
                    parseValue = new StringCollection();
                    parseValue.Add(note.NotePresTexts[langCode]);
                    handler(keyWord, langCode, subKeyWord, parseValue);
                }
            }
        }
示例#3
0
        //public PXSqlValuepool() { }

        /// <summary>Loads the data from a row
        /// </summary>
        /// <param name="inRow">The data row</param>
        /// <param name="meta">For config.codes </param>
        public PXSqlValuepool(QueryLib_21.ValuePoolRow inRow, PXSqlMeta_21 meta)
        {
            this.vpRow = inRow;

            if (this.ValueTextExists.Equals(meta.Config.Codes.ValueTextExistsN))
            {
                this.mValueTextOption = PXConstant.VALUETEXTOPTION_NOTEXT;
            }
            else if (this.ValueTextExists.Equals(meta.Config.Codes.ValueTextExistsX))
            {
                this.mValueTextOption = PXConstant.VALUETEXTOPTION_TOOLONG;
            }
            else
            {
                this.mValueTextOption = PXConstant.VALUETEXTOPTION_NORMAL;
            }

            mPresText = new Dictionary <string, string>();
            mDomain   = new Dictionary <string, string>();
            foreach (string langCode in vpRow.texts.Keys)
            {
                mPresText[langCode] = vpRow.texts[langCode].PresText;
                mDomain[langCode]   = vpRow.texts[langCode].ValuePoolLangDependent;
            }
        }
示例#4
0
        private void SetSelectedSubTable(PXSqlMeta_21 pxsqlMeta)
        {
            Boolean isEqualValueSet;

            foreach (KeyValuePair <string, PCAxis.Sql.Parser_21.PXSqlSubTable> subTable in this)
            {
                isEqualValueSet = true;
                string subTableName = subTable.Value.SubTable;
                Dictionary <string, SubTableVariableRow> fromDb = pxsqlMeta.MetaQuery.GetSubTableVariableRowskeyVariable(pxsqlMeta.MainTable.MainTable, subTableName);

                foreach (PQVariable pqvariable in mPxsQuery.Query.Variables)
                {
                    string variableName     = pqvariable.code;
                    string selectedValueset = pqvariable.SelectedValueset;
                    if (!fromDb.ContainsKey(variableName))
                    {
                        throw new Exception("The variable \"" + variableName + "\" given in the query, does not exist in the database, for the maintable \"" + pxsqlMeta.MainTable.MainTable + "\". Is the query of date? Or the database?");
                    }
                    string valuesetIdFromSubTableVariableRow = fromDb[variableName].ValueSet;
                    if (selectedValueset != valuesetIdFromSubTableVariableRow && selectedValueset != PXSqlKeywords.FICTIONAL_ID_ALLVALUESETS)
                    {
                        isEqualValueSet = false;
                        break;
                    }
                }
                if (isEqualValueSet)
                {
                    this[subTableName].IsSelected = true;
                }
            }
        }
示例#5
0
        public void ParseNote(PXSqlMeta_21 mMeta, PCAxis.Paxiom.IPXModelParser.MetaHandler handler, string langCode)
        {
            string           keyWord;
            string           subKeyWord = null;
            StringCollection parseValue;

            foreach (PXSqlNote note in this.tableNotes.Values)
            {
                if (note.MandOpt == mMeta.Config.Codes.FootnoteM)
                {
                    keyWord = "NOTEX";
                }
                else
                {
                    keyWord = "NOTE";
                }
                parseValue = new StringCollection();
                parseValue.Add(note.NotePresTexts[langCode]);
                handler(keyWord, langCode, subKeyWord, parseValue);
            }



            foreach (PXSqlNote note in this.variableNotes)
            {
                if (note.MandOpt == mMeta.Config.Codes.FootnoteM)
                {
                    keyWord = "NOTEX";
                }
                else
                {
                    keyWord = "NOTE";
                }
                subKeyWord = note.Variable;
                parseValue = new StringCollection();
                parseValue.Add(note.NotePresTexts[langCode]);
                handler(keyWord, langCode, subKeyWord, parseValue);
            }



            foreach (PXSqlNote note in this.contentsNotes)
            {
                subKeyWord = mMeta.ContensCode + "\",\"" + mMeta.ContentsVariable.Values.GetValueByContentsCode(note.Contents).ValueCode;
                //subKeyWord = mMeta.ContensCode + "," + note.Contents;
                if (note.MandOpt == mMeta.Config.Codes.FootnoteM)
                {
                    keyWord = "VALUENOTEX";
                }
                else
                {
                    keyWord = "VALUENOTE";
                }

                parseValue = new StringCollection();
                parseValue.Add(note.NotePresTexts[langCode]);
                handler(keyWord, langCode, subKeyWord, parseValue);
            }
        }
示例#6
0
 /// <summary>Initializes a new instance of the PXSqlGroupingInfos class, and fills the list of PXSqlGroupingInfo</summary>
 /// <param name="meta">Holds the state of the builder</param>
 /// <param name="variableName">The variable which has these groupings.</param>
 /// <param name="valueSetIds">The valueSets that apply to this builder </param>
 internal PXSqlGroupingInfos(PXSqlMeta_21 meta, string variableName, StringCollection valueSetIds)
 {
     foreach (PCAxis.Sql.QueryLib_21.GroupingRow gRow in meta.MetaQuery.GetRelevantGroupingRows(valueSetIds))
     {
         infos.Add(new PXSqlGroupingInfo(gRow, meta.Config.Codes));
     }
     this.variableName = variableName;
 }
示例#7
0
 public PXSqlParser_21(PXSqlMeta_21 inPXSqlMeta)
 {
     mPXSqlMeta = inPXSqlMeta;
     if (mPXSqlMeta.inPresentationModus)
     {
         symbols = mPXSqlMeta.mPxsqlNpm;
     }
 }
示例#8
0
 public PXSqlVariableContents(String name, PXSqlMeta_21 meta)
     : base(name, meta, true, false, false)
 {
     mStoreColumnNo = -1;
     SetSelected();
     if (!meta.ConstructedFromPxs)
     {
         mIndex = mStoreColumnNo;
     }
     SetDefaultPresTextOption();
     SetPresText();
 }
示例#9
0
        public PXSqlMaintable(MainTableRow mtRow, DataStorageRow dataStorageRow, MenuSelectionRow menuSelectionRow, PXSqlMeta_21 meta)
        {
            this.meta            = meta;
            this.mtRow           = mtRow;
            this.mDataStorageRow = dataStorageRow;

            this.mSubjectCode = menuSelectionRow.Selection;

            foreach (string langCode in menuSelectionRow.texts.Keys)
            {
                mSubjectAreaByLanguage[langCode] = menuSelectionRow.texts[langCode].PresText;
            }
        }
示例#10
0
 public PXSqlNote(RelevantFootNotesRow footNoteRow, PXSqlMeta_21 mMeta)
 {
     this.mShowFootNote  = footNoteRow.ShowFootNote;
     this.mMandOpt       = footNoteRow.MandOpt;
     this.mFootNoteNo    = footNoteRow.FootNoteNo;
     this.mContents      = footNoteRow.Contents;
     this.mVariable      = footNoteRow.Variable;
     this.mValueCode     = footNoteRow.ValueCode;
     this.mTimePeriode   = footNoteRow.TimePeriod;
     this.mNotePresTexts = new Dictionary <string, String>();
     foreach (string langCode in mMeta.LanguageCodes)
     {
         this.mNotePresTexts.Add(langCode, footNoteRow.texts[langCode].FootNoteText);
     }
 }
示例#11
0
 public PXSqlNote(PXSqlMeta_21 mMeta)
 {
     this.mShowFootNote  = mMeta.Config.Codes.FootnoteShowB;
     this.mMandOpt       = mMeta.Config.Codes.FootnoteM;
     this.mFootNoteNo    = FootNoteTableContainsOnlyMetadataDummyNumber;
     this.mContents      = "";
     this.mVariable      = "";
     this.mValueCode     = "";
     this.mTimePeriode   = "";
     this.mNotePresTexts = new Dictionary <string, String>();
     foreach (string langCode in mMeta.LanguageCodes)
     {
         this.mNotePresTexts.Add(langCode, FootNoteTableContainsOnlyMetadata);
     }
 }
示例#12
0
        public void ParseNote(PXSqlMeta_21 mMeta, PCAxis.Paxiom.IPXModelParser.MetaHandler handler, string langCode)
        {
            string           keyWord;
            string           subKeyWord = null;
            StringCollection parseValue;

            foreach (PXSqlNote note in this)
            {
                if (mMeta.Contents.Count == 1)
                {
                    if ((note.ShowFootNote == mMeta.Config.Codes.FootnoteShowP) || (note.ShowFootNote == mMeta.Config.Codes.FootnoteShowB))
                    {
                        if (note.MandOpt == mMeta.Config.Codes.FootnoteM)
                        {
                            keyWord = "NOTEX";
                        }
                        else
                        {
                            keyWord = "NOTE";
                        }
                        subKeyWord = note.Variable;
                        parseValue = new StringCollection();
                        parseValue.Add(note.NotePresTexts[langCode]);
                        handler(keyWord, langCode, subKeyWord, parseValue);
                    }
                }
                // if more than one contentsvariable is selected the note should be presented different, but there are
                // no way to parse it to PAXIOm and specify that the note is valid for only one contents.
                else
                {
                    if ((note.ShowFootNote == mMeta.Config.Codes.FootnoteShowP) || (note.ShowFootNote == mMeta.Config.Codes.FootnoteShowB))
                    {
                        if (note.MandOpt == mMeta.Config.Codes.FootnoteM)
                        {
                            keyWord = "NOTEX";
                        }
                        else
                        {
                            keyWord = "NOTE";
                        }
                        subKeyWord = note.Variable;
                        parseValue = new StringCollection();
                        parseValue.Add(note.NotePresTexts[langCode]);
                        handler(keyWord, langCode, subKeyWord, parseValue);
                    }
                }
            }
        }
示例#13
0
        //for presentation without grouping id in from pxs
        public PXSqlGrouping(PXSqlMeta_21 meta, PXSqlVariableClassification var, List <PXSqlGroup> groupFromPxs)
        {
            this.meta     = meta;
            this.variable = var;
            this.valuePoolValueTextExists = var.ValuePool.ValueTextExists;
            this.mValuePoolId             = var.ValuePool.ValuePool;
            this.mGroups = groupFromPxs;

            StringCollection parentCodes = new StringCollection();

            foreach (PXSqlGroup group in groupFromPxs)
            {
                parentCodes.Add(group.ParentCode);
            }
            AddValues(mValuePoolId, parentCodes, valuePoolValueTextExists);
        }
示例#14
0
 public PXSqlVariable(string name, PXSqlMeta_21 meta, bool isContVar, bool isTimeVar, bool isClassVar)
 {
     this.Name                     = name;
     this.IsTimevariable           = isTimeVar;
     this.IsContentVariable        = isContVar;
     this.IsClassificationVariable = isClassVar;
     this.IsStub                   = false;
     this.IsHeading                = false;
     this.Values                   = new PxSqlValues();
     this.PresText                 = new Dictionary <string, string>();
     this.meta                     = meta;
     this.metaQuery                = meta.MetaQuery;
     // should be moved to classvar
     this.IsEliminatedByValue = false;
     this.selectedValueset    = PXSqlKeywords.FICTIONAL_ID_ALLVALUESETS;
 }
示例#15
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);
            //}
        }
示例#16
0
           //private bool mTableContainsMetaOnly;
           #endregion props  


    #region  contructor
        public PXSqlVariableTime(MainTableVariableRow aTVRow, PXSqlMeta_21 meta)
            :base(aTVRow.Variable,meta,false,true,false)
        {
            mStoreColumnNo = int.Parse(aTVRow.StoreColumnNo);
            if (!meta.ConstructedFromPxs)
            {
                mIndex = mStoreColumnNo;
            }
            SetSelected();
            SetPresText();
            SetDefaultPresTextOption();            
            SetTimeValues();
            mTimeScale = new PXSqlTimeScale(meta.MetaQuery.GetTimeScaleRow(meta.MainTable.TimeScale),meta.Config);
            SetTimeVal();
            PossiblyResetPresText();



        }
示例#17
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;
            }
        }
示例#18
0
        public PXSqlSubTables(Dictionary <string, SubTableRow> altIBasen, PxsQuery pPxsQuery, PXSqlMeta_21 pxsqlMeta)
            : base()
        {
            this.mPxsQuery = pPxsQuery;
            PXSqlSubTable mSubTable;

            foreach (SubTableRow subTableRow in altIBasen.Values)
            {
                mSubTable = new PXSqlSubTable(subTableRow);
                this.Add(mSubTable.SubTable, mSubTable);
            }
            // set selected subtables.
            if (pPxsQuery == null)
            {
                foreach (PXSqlSubTable subTable in this.Values)
                {
                    subTable.IsSelected = true;
                }
            }
            else
            {
                SetSelectedSubTable(pxsqlMeta);
            }
        }
示例#19
0
        internal PXSqlThingsThatWouldBeTheSameInAllPXSqlContent(ContentsRow someContentsRow, PXSqlMeta_21 meta, SqlDbConfig_21 config)
        {
            mStatAuthorityCode = someContentsRow.StatAuthority;
            string copyright = someContentsRow.Copyright;

            if (copyright.Equals(config.Codes.Copyright1) || copyright.Equals(config.Codes.Copyright2))
            {
                mCopyright = false;
            }
            else if (copyright.Equals(config.Codes.Copyright3))
            {
                mCopyright = true;
            }
            else
            {
                mCopyright = true;
                log.Error("The database has copyright=" + copyright + ", but the valid codes from config are " + config.Codes.Copyright1 + "," + config.Codes.Copyright2 + " or " + config.Codes.Copyright3 + ".");
            }
            if (copyright.Equals(config.Codes.Copyright1))
            {
                mOfficialStatistics = true;
            }
            else
            {
                mOfficialStatistics = false;
            }
            OrganizationRow org = meta.MetaQuery.GetOrganizationRow(mStatAuthorityCode);

            foreach (string language in org.texts.Keys)
            {
                nameByLangCode.Add(language, org.texts[language].OrganizationName);
            }
        }
示例#20
0
        /// <summary>
        /// Builds the Contactstring for each language in meta.LanguageCodes.
        /// </summary>
        public PXSqlContact(PXSqlMeta_21 meta, string mMainTableId)
        {
            foreach (string language in meta.LanguageCodes)
            {
                mBigFatContactStringsByLanguage.Add(language, "");
            }

            try
            {
                Dictionary <string, MainTablePersonRow> personIDs = new Dictionary <string, MainTablePersonRow>();
                try
                {
                    foreach (KeyValuePair <string, MainTablePersonRow> RoleHead in meta.MetaQuery.GetMainTablePersonRows(mMainTableId, meta.Config.Codes.RoleHead))
                    {
                        if (!personIDs.ContainsKey(RoleHead.Key))
                        {
                            personIDs.Add(RoleHead.Key, RoleHead.Value);
                        }
                    }
                } catch (Exceptions.PCAxisSqlException e)
                {
                    log.Error("Cant add RoleHead", e);
                }

                try
                {
                    foreach (KeyValuePair <string, MainTablePersonRow> RoleContact in meta.MetaQuery.GetMainTablePersonRows(mMainTableId, meta.Config.Codes.RoleContact))
                    {
                        if (!personIDs.ContainsKey(RoleContact.Key))
                        {
                            personIDs.Add(RoleContact.Key, RoleContact.Value);
                        }
                    }
                } catch (Exceptions.PCAxisSqlException e)
                {
                    log.Error("Cant add RoleContact", e);
                }



                bool firstPerson = true;
                foreach (string personId in personIDs.Keys)
                {
                    PersonRow person = meta.MetaQuery.GetPersonRow(personId);

                    if (!orgs.ContainsKey(person.OrganizationCode))
                    {
                        orgs.Add(person.OrganizationCode, meta.MetaQuery.GetOrganizationRow(person.OrganizationCode));
                    }
                    OrganizationRow org = orgs[person.OrganizationCode];

                    foreach (string language in meta.LanguageCodes)
                    {
                        if (!firstPerson)
                        {
                            mBigFatContactStringsByLanguage[language] += "#";
                        }
                        // mBigFatContactStringsByLanguage[language] += person.Forename + " " + person.Surname +
                        //    "," + org.texts[language].OrganizationName + "," + person.PhonePrefix + " " + person.PhoneNo +
                        //    "," + person.PhonePrefix + " " + person.FaxNo + "," + person.Email;



                        mBigFatContactStringsByLanguage[language] += person.Forename + " " + person.Surname + ", " + org.texts[language].OrganizationName +
                                                                     "# " + PCAxis.Paxiom.Localization.PxResourceManager.GetResourceManager().GetString("PxcContactPhone", language) + ": " + person.PhonePrefix + " " + person.PhoneNo +
                                                                     "#" + PCAxis.Paxiom.Localization.PxResourceManager.GetResourceManager().GetString("PxcContactFax", language) + ": " + person.PhonePrefix + " " + person.FaxNo +
                                                                     "#" + PCAxis.Paxiom.Localization.PxResourceManager.GetResourceManager().GetString("PxcContactEMail", language) + ": " + person.Email;
                    }

                    firstPerson = false;
                }
            } catch (Exceptions.PCAxisSqlException e)
            {
                log.Error("Cant find contact info", e);
            }
        }
示例#21
0
        public PXSqlContent(ContentsRow row, PXSqlMeta_21 pxsqlMeta, SqlDbConfig_21 config, PXSqlContact contact)
        {
            mRow     = row;
            mContact = contact;
            //pxsqlMeta.MetaQuery.DB.Codes.Copyright1;
            mContents = row.Contents;
            //mFootnoteContents = row.FootnoteContents;
            //mFootnoteTime = row.FootnoteTime;
            //mFootnoteValue = row.FootnoteValue;
            //mFootnoteVariable = row.FootnoteVariable;
            mPresText  = new Dictionary <string, string>();
            mPresTextS = new Dictionary <string, string>();
            mPresCode  = row.PresCode;

            mBasePeriod = new Dictionary <string, string>();
            mRefPeriod  = new Dictionary <string, string>();
            mUnit       = new Dictionary <string, string>();


            foreach (string langCode in pxsqlMeta.LanguageCodes)
            {
                mPresText[langCode]   = row.texts[langCode].PresText;
                mPresTextS[langCode]  = row.texts[langCode].PresTextS;
                mBasePeriod[langCode] = row.texts[langCode].BasePeriod;
                mRefPeriod[langCode]  = row.texts[langCode].RefPeriod;
                mUnit[langCode]       = row.texts[langCode].Unit;
            }

            mPresDecimals = mRow.PresDecimals;
            pxsqlMeta.DecimalHandler.ShowDecimals  = mPresDecimals;
            pxsqlMeta.DecimalHandler.StoreDecimals = mRow.StoreDecimals;

            mSeasAdj     = mRow.SeasAdj.Equals(config.Codes.Yes);
            mDayAdj      = mRow.DayAdj.Equals(config.Codes.Yes);
            mLastUpdatet = mRow.LastUpdated;
            mStockFA     = PaxiomifyStockFA(mRow.StockFA, config);
            mCFPrices    = PaxiomifyCFPrices(mRow.CFPrices, config);


            mAggregPossible = !mRow.AggregPossible.Equals(config.Codes.No); //not notPossible since yes is default

            #region mCategoryOfCellsInMissingRows and mValueOfCellsInMissingRows
            if (pxsqlMeta.inPresentationModus && mRow.PresCellsZero.Equals(config.Codes.No))
            {
                //for version 2.0 use default,
                // both 2.1 and 2.2 uses a mRow.PresMissingLine from the SpecialCharacter.CharacterType( which is the primary key)
                // or if mRow.PresMissingLine is missing: the default
                if (String.Compare(pxsqlMeta.MetaModelVersion, "2.0", false, System.Globalization.CultureInfo.InvariantCulture) > 0)
                {
                    mValueOfCellsInMissingRows = pxsqlMeta.mPxsqlNpm.DefaultCodeMissingLineMagic;
                    if (!(String.IsNullOrEmpty(mRow.PresMissingLine)))
                    {
                        mValueOfCellsInMissingRows = pxsqlMeta.mPxsqlNpm.DataSymbolNMagic(mRow.PresMissingLine);
                    }
                    mCategoryOfCellsInMissingRows = pxsqlMeta.mPxsqlNpm.GetCategory(mValueOfCellsInMissingRows).ToString();
                }
                else
                {
                    // 2010.11.29 Changed There is no DefaultCodeMissinLine i 2.0.  Use the same symbol as DataNotAvialable
                    //mValueOfCellsInMissingRows = 0;
                    //mCategoryOfCellsInMissingRows = "3";
                    mValueOfCellsInMissingRows    = pxsqlMeta.mPxsqlNpm.DataNotAvailableMagic;
                    mCategoryOfCellsInMissingRows = pxsqlMeta.mPxsqlNpm.GetCategory(mValueOfCellsInMissingRows).ToString();
                }
            }
            #endregion mCategoryOfCellsInMissingRows and mValueOfCellsInMissingRows
        }
示例#22
0
 public PXSqlVariables(PXSqlMeta_21 meta)
 {
     this.meta = meta;
 }
示例#23
0
        public void ParseNote(PXSqlMeta_21 mMeta, PCAxis.Paxiom.IPXModelParser.MetaHandler handler, string langCode)
        {
            List <PXSqlVariable> stubAndHead = new List <PXSqlVariable>();

            stubAndHead.AddRange(mMeta.Stubs);
            stubAndHead.AddRange(mMeta.Headings);
            StringCollection CellNoteDimensions;
            string           subKeyWord;
            string           keyWord;
            StringCollection parseValue;

            foreach (PXSqlNote note in this)
            {
                if (note.MandOpt == mMeta.Config.Codes.FootnoteM)
                {
                    keyWord = "CELLNOTEX";
                }
                else
                {
                    keyWord = "CELLNOTE";
                }
                CellNoteDimensions = new StringCollection();
                foreach (PXSqlVariable var in stubAndHead)
                {
                    if (var.IsTimevariable)
                    {
                        if (var.Values.ContainsKey(note.TimePeriode))
                        {
                            CellNoteDimensions.Add(note.TimePeriode);
                        }
                        else
                        {
                            CellNoteDimensions.Add(star);
                        }
                    }
                    else if (var.IsContentVariable)
                    {
                        if (var.Values.ContainsKey(note.Contents))
                        {
                            CellNoteDimensions.Add(note.Contents);
                        }
                        else
                        {
                            CellNoteDimensions.Add(star);
                        }
                    }
                    else if (var.Name == note.Variable)
                    {
                        if (var.Values.ContainsKey(note.ValueCode))
                        {
                            CellNoteDimensions.Add(note.ValueCode);
                        }
                        else
                        {
                            CellNoteDimensions.Add(star);
                        }
                    }
                    else
                    {
                        CellNoteDimensions.Add(star);
                    }
                }
                subKeyWord = "";
                parseValue = new StringCollection();
                foreach (string dim in CellNoteDimensions)
                {
                    subKeyWord += "\"" + dim + "\",";
                }
                subKeyWord = subKeyWord.TrimStart('"');
                subKeyWord = subKeyWord.TrimEnd(',', '"');
                parseValue.Add(note.NotePresTexts[langCode]);
                handler(keyWord, langCode, subKeyWord, parseValue);
            }
        }
示例#24
0
        public void ParseNote(PXSqlMeta_21 mMeta, PCAxis.Paxiom.IPXModelParser.MetaHandler handler, string langCode)
        {
            string           keyWord;
            string           subKeyWord;
            StringCollection parseValue;

            if (mMeta.Contents.Count == 1)
            {
                foreach (PXSqlNote note in this)
                {
                    if ((note.ShowFootNote == mMeta.Config.Codes.FootnoteShowP) || (note.ShowFootNote == mMeta.Config.Codes.FootnoteShowB))
                    {
                        if (note.MandOpt == mMeta.Config.Codes.FootnoteM)
                        {
                            keyWord = "VALUENOTEX";
                        }
                        else
                        {
                            keyWord = "VALUENOTE";
                        }
                        subKeyWord = mMeta.TimeVariable.Name + "\",\"" + note.TimePeriode;
                        parseValue = new StringCollection();
                        parseValue.Add(note.NotePresTexts[langCode]);
                        handler(keyWord, langCode, subKeyWord, parseValue);
                    }
                }
            }
            else
            {
                List <PXSqlVariable> stubAndHead = new List <PXSqlVariable>();
                stubAndHead.AddRange(mMeta.Stubs);
                stubAndHead.AddRange(mMeta.Headings);
                StringCollection CellNoteDimensions;
                foreach (PXSqlNote note in this)
                {
                    if (note.MandOpt == mMeta.Config.Codes.FootnoteM)
                    {
                        keyWord = "CELLNOTEX";
                    }
                    else
                    {
                        keyWord = "CELLNOTE";
                    }
                    CellNoteDimensions = new StringCollection();
                    foreach (PXSqlVariable var in stubAndHead)
                    {
                        if (var.IsTimevariable)
                        {
                            if (var.Values.ContainsKey(note.TimePeriode))
                            {
                                CellNoteDimensions.Add(note.TimePeriode);
                            }
                            else
                            {
                                throw new PCAxis.Sql.Exceptions.DbException(12);
                            }
                        }
                        else if (var.IsContentVariable)
                        {
                            if (var.Values.GetValueByContentsCode(note.Contents) != null)
                            {
                                CellNoteDimensions.Add(var.Values.GetValueByContentsCode(note.Contents).ValueCode);
                            }
                            //if (var.Values.ContainsKey(note.Contents))
                            //    CellNoteDimensions.Add(note.Contents);
                            else
                            {
                                throw new PCAxis.Sql.Exceptions.DbException(13);
                            }
                        }
                        else
                        {
                            CellNoteDimensions.Add(star);
                        }
                    }
                    subKeyWord = "";
                    parseValue = new StringCollection();
                    foreach (string dim in CellNoteDimensions)
                    {
                        subKeyWord += "\"" + dim + "\",";
                    }
                    subKeyWord = subKeyWord.TrimStart('"');
                    subKeyWord = subKeyWord.TrimEnd(',', '"');
                    parseValue.Add(note.NotePresTexts[langCode]);
                    handler(keyWord, langCode, subKeyWord, parseValue);
                }
            }
        }
示例#25
0
 /// <summary>
 /// Receives the data and stores it.
 /// </summary>
 /// <param name="inDataNoteCellEntries">the data</param>
 public PXSqlParseMetaPostData_21(Dictionary <string, string> inDataNoteCellEntries, PCAxis.Sql.Parser_21.PXSqlMeta_21 meta)
 {
     theDataNoteCellEntries = inDataNoteCellEntries;
     mMeta = meta;
 }
示例#26
0
 /// <summary>
 /// IDisposable implemenatation
 /// </summary>
 override public void Dispose()
 {
     mPXSqlMeta = null;
 }
示例#27
0
 /// <summary>
 /// Creating a parser that sends data for the named variable
 /// </summary>
 /// <param name="inPXSqlMeta">PXSqlMeta holding variables</param>
 /// <param name="variableCode">Name of the vaiable</param>
 public PXSqlParserForCodelists_21(PXSqlMeta_21 inPXSqlMeta, String variableCode)
 {
     mPXSqlMeta = inPXSqlMeta;
     _variables = new List <PXSqlVariableClassification>();
     _variables.Add(inPXSqlMeta.VariablesClassification[variableCode]);
 }
示例#28
0
        public PXSqlVariableClassification(MainTableVariableRow aTVRow, PXSqlMeta_21 meta)
            : base(aTVRow.Variable, meta, false, false, true)
        {
            if (this.meta.ConstructedFromPxs)
            {
                foreach (PQVariable tmpVar in this.meta.PxsFile.Query.Variables)
                {
                    if (this.Name == tmpVar.code)
                    {
                        this.pxsQueryVariable = tmpVar;
                    }
                }
            }
            SetSelected();

            if (this.isSelected)
            {
                this.mStoreColumnNo = int.Parse(aTVRow.StoreColumnNo);
                if (!this.meta.ConstructedFromPxs)
                {
                    this.mIndex = this.mStoreColumnNo;
                }

                SetValueset();
                SetValuePool();
                SetPresText();
                SetDefaultPresTextOption(); // would be overwritten if options set in pxs
                if (this.meta.ConstructedFromPxs)
                {
                    SetOptionsFromPxs();
                }

                if (this.meta.inSelectionModus)
                {
                    this.groupingInfos = new PXSqlGroupingInfos(this.meta, this.Name, valusetIds);
                }
            }
            else
            {
                SetValueset();
            }
            //  Elimination must be done after SetValues moved down.
            //   if (this.meta.InstanceModus == Instancemodus.selection)
            //       SetElimForSelection();
            //   else
            //       SetElimForPresentation();



            if (this.aggregationType.Equals("G"))
            {
                this.UsesGrouping = true;
                if (String.IsNullOrEmpty(this.aggregatingStructureId))
                {
                    throw new ApplicationException("Not implemented yet");
                }
                else if (this.aggregatingStructureId.Equals("UNKNOWNSTRUCTUREID"))
                {
                    List <PXSqlGroup> groupFromFile = GetListOfGroupFromPxs();

                    currentGrouping = new PXSqlGrouping(this.meta, this, groupFromFile);
                }
                else
                {
                    currentGrouping = new PXSqlGrouping(this.metaQuery.GetGroupingRow(this.ValuePool.ValuePool, this.aggregatingStructureId), this.meta, this, this.pxsQueryVariable.GetCodesNoWildcards());
                }
            }
            else
            {
                SetValues();
                SetCodelists();
            }


            if (this.meta.inSelectionModus)
            {
                SetElimForSelection();
            }
            else
            {
                SetElimForPresentation();
            }
        }
示例#29
0
文件: PXSqlNpm.cs 项目: trygu/PxWeb
        public PXSqlNpm(PXSqlMeta_21 mMeta)
        {
            this.mMeta         = mMeta;
            metaVersion        = mMeta.MetaModelVersion;
            cat1Counter        = 0;
            cat2Counter        = 0;
            cat3Counter        = 0;
            myMetaAdmVariables = new Dictionary <string, MetaAdmVariable>();
            if (metaVersion == "2.0")
            {
                NPMCharacter myNPMCharacter = new NPMCharacter();
                //myNPMCharacters = new Dictionary<int, NPMCharacter>();
                myNPMCharacters         = new List <NPMCharacter>();
                myNPMCharacter.id       = 0;
                myNPMCharacter.category = 3;
                //myNPMCharacter.pcAxisCode = PcAxisCodes.getDataSymbolNo(1);
                myNPMCharacter.pcAxisCode = PcAxisCodes.getDataSymbolNo(2);
                //TODO; FIX   (tja 2.1)
                myNPMCharacter.presCharacters = new Dictionary <string, string>();
                myNPMCharacter.presTexts      = new Dictionary <string, string>();
                foreach (string lang in mMeta.LanguageCodes)
                {
                    myNPMCharacter.presCharacters[lang] = "..";
                    myNPMCharacter.presTexts[lang]      = "";
                }
                myNPMCharacters.Add(myNPMCharacter);

                // Set MetaAdmvariable for DataNotAvailable
                MetaAdmVariable myMetaVariable = new MetaAdmVariable();
                myMetaVariable.name   = dataNotAvailable;
                myMetaVariable.value  = "";
                myMetaVariable.npmRef = 0;
                myMetaAdmVariables.Add(myMetaVariable.name, myMetaVariable);
                //TODO; FIX  (tja 2.1)
                //myMetaVariable = new MetaAdmVariable();
                //myMetaVariable.name = dataSymbolSum;
                //myMetaVariable.value = "";
                //myMetaVariable.npmRef = 0;
                //myMetaAdmVariables.Add(myMetaVariable.name, myMetaVariable);

                //myMetaVariable = new MetaAdmVariable();
                //myMetaVariable.name = dataSymbolNIL;
                //myMetaVariable.value = "";
                //myMetaVariable.npmRef = 0;
                //myMetaAdmVariables.Add(myMetaVariable.name, myMetaVariable);

                //myMetaVariable = new MetaAdmVariable();
                //myMetaVariable.name = dataNoteSum;
                //myMetaVariable.value = "";
                //myMetaVariable.npmRef = 0;
                //myMetaAdmVariables.Add(myMetaVariable.name, myMetaVariable);
                //----------------
            }
            else if (String.Compare(metaVersion, "2.0", false, CultureInfo.InvariantCulture) > 0)
            {
                //if ((metaVersion == (decimal)2.1) || (metaVersion == (decimal)2.2))
                //DataNotAvailable
                myMetaAdmRow = mMeta.MetaQuery.GetMetaAdmRow(dataNotAvailable);
                setMetaAdmInfo1(myMetaAdmRow);
                //DATANOTESUM
                myMetaAdmRow = mMeta.MetaQuery.GetMetaAdmRow(dataNoteSum);
                setMetaAdmInfo1(myMetaAdmRow);
                //DATASYMBOLNIL
                myMetaAdmRow = mMeta.MetaQuery.GetMetaAdmRow(dataSymbolNIL);
                setMetaAdmInfo1(myMetaAdmRow);
                //DATASYMBOLSUM
                myMetaAdmRow = mMeta.MetaQuery.GetMetaAdmRow(dataSymbolSum);
                setMetaAdmInfo1(myMetaAdmRow);
                //DEFAULTCODEMISSINGLINE
                myMetaAdmRow = mMeta.MetaQuery.GetMetaAdmRow(defaultCodeMissingLine);
                setMetaAdmInfo1(myMetaAdmRow);
                // assign properties for specialcharacters

                setNpmCharacters();
                setMetaAdm();
                maxDatasymbolN = cat3Counter;
            }
            else
            {
                throw new PCAxis.Sql.Exceptions.DbPxsMismatchException(14, mMeta.MetaModelVersion);
            }
        }
示例#30
0
        public PXSqlData_21(PXSqlMeta_21 mPXSqlMeta)
        {
            log.Debug("Start PXSqlData mPXSqlMeta.Name: " + mPXSqlMeta.Name);

            this.mMeta = mPXSqlMeta;


            symbols = mMeta.mPxsqlNpm;

            this.npm         = mMeta.SpecCharExists;
            this.hasGrouping = mMeta.HasGrouping;

            this.eliminationBySum = mMeta.EliminatedVariablesExist;

            //System.Console.WriteLine("DEBUG tukler med nmp og summ");
            //npm = true;
            //alwaysUseSum = true;

            this.useSum = hasGrouping || eliminationBySum;

            foreach (PXSqlVariable var in mMeta.Stubs)
            {
                keysInReverseOutputOrder.Add(var.Name);
            }

            foreach (PXSqlVariable var in mMeta.Headings)
            {
                keysInReverseOutputOrder.Add(var.Name);
            }
            keysInReverseOutputOrder.Reverse();

            numberOfOutputVariables = keysInReverseOutputOrder.Count;

            mValueCount  = new Dictionary <string, int>(numberOfOutputVariables);
            mIndexFactor = new Dictionary <string, int>(numberOfOutputVariables);

            foreach (PXSqlVariable var in mMeta.Variables.Values)
            {
                if (var.IsEliminatedByValue)
                {
                    log.Debug(var.Name + " Is Eliminated By Value");
                    keysOfEliminatedByValue.Add(var.Name);
                }
                else if (var.IsContentVariable)
                {
                    log.Debug(var.Name + " Is Content Variable");
                    theKeyOfTheContentsVariableVariable = var.Name;
                }
                else if (!var.isSelected)
                {
                    log.Debug(var.Name + " Is Eliminated By SUM");
                    keysOfEliminatedBySum.Add(var.Name);
                    eliminationFactor *= var.TotalNumberOfValuesInDB;
                }
            }

            #region init contKeys
            if (String.IsNullOrEmpty(theKeyOfTheContentsVariableVariable))   //just one contVar
            {
                throw new ApplicationException("Bug");
                // the size of ContentsVariableVariable should not influence how it is stored
                //                contKeys.Add( mMeta.FirstContents );
            }
            else
            {
                PXSqlVariable theContentsVariable = mMeta.Variables[theKeyOfTheContentsVariableVariable];
                foreach (PXSqlValue contCode in theContentsVariable.GetValuesForParsing())
                {
                    //contKeys.Add(contCode.ValueCode);
                    contKeys.Add(contCode.ContentsCode); // 2010.05.07  replaces line above because valuecode is now Prescode from contents. New contentscode added to PXSqlValue
                }
                foreach (string contCode in theContentsVariable.Values.Keys)
                {
                    //    contKeys.Add(contCode);
                }
            }

            #endregion init contKeys

            #region init defaults for missing rows
            //value to be used if row is missing
            ValueOfCellsInMissingRows    = new double[contKeys.Count];
            CategoryOfCellsInMissingRows = new string[contKeys.Count];

            int contCount2 = 0;

            anyDefaultMRNotZero = false;  // MR = missing record
            anyDefaultMROfCat3  = false;  // MR = missing record
            foreach (string contCode in contKeys)
            {
                PXSqlContent tmpCont = mMeta.Contents[contCode];
                log.Debug("PXSqlContents for " + contCode + " PresCellsZero:" + tmpCont.PresCellsZero + " PresMissingLine:" + tmpCont.PresMissingLine);

                CategoryOfCellsInMissingRows[contCount2] = tmpCont.CategoryOfCellsInMissingRows;
                ValueOfCellsInMissingRows[contCount2]    = tmpCont.ValueOfCellsInMissingRows;

                if (!CategoryOfCellsInMissingRows[contCount2].Equals("0"))
                {
                    anyDefaultMRNotZero = true;
                    if (CategoryOfCellsInMissingRows[contCount2].Equals("3"))
                    {
                        anyDefaultMROfCat3 = true;
                    }
                }
                contCount2++;
            }
            #endregion init defaults for missing rows

            log.Debug("eliminationFactor: " + eliminationFactor);



            log.Debug("useSum:" + useSum + " , npm: " + npm);
            log.Debug("Constructor done.");
        }