Exemplo n.º 1
0
        public PXSqlContent(ContentsRow row, PXSqlMeta_24 pxsqlMeta, SqlDbConfig_24 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))
            {
                // 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

                mValueOfCellsInMissingRows = pxsqlMeta.mPxsqlNpm.DefaultCodeMissingLineMagic;
                mNPMcharacterinMissingRows = pxsqlMeta.mPxsqlNpm.DefaultCodeMissingLineNPMCharacter;

                if (!(String.IsNullOrEmpty(mRow.PresMissingLine)))
                {
                    mValueOfCellsInMissingRows = pxsqlMeta.mPxsqlNpm.DataSymbolNMagic(mRow.PresMissingLine);
                    mNPMcharacterinMissingRows = pxsqlMeta.mPxsqlNpm.DataSymbolNNPMCharacter(mRow.PresMissingLine);
                }
                mCategoryOfCellsInMissingRows = pxsqlMeta.mPxsqlNpm.GetCategory(mValueOfCellsInMissingRows).ToString();
            }
            #endregion mCategoryOfCellsInMissingRows and mValueOfCellsInMissingRows
        }
Exemplo n.º 2
0
        ///
        /// <PXKeyword name="DATANOTECELL">
        ///   <rule>
        ///     <description>Sends codes from SpecialCharacter when found in datatables.</description>
        ///     <table modelName ="Maintable">
        ///     <column modelName="SpecCharExists"/>
        ///     </table>
        ///     <table modelName ="SpecialCharacter">
        ///     <column modelName="all"/>
        ///     </table>
        ///     <table modelName ="The datatables">
        ///       <column modelName="NPM columns and missing rows"/>
        ///     </table>
        ///   </rule>
        /// </PXKeyword>
        ///
        public void ParseMeta(PCAxis.Paxiom.IPXModelParser.MetaHandler handler, string preferredLanguage)
        {
            string keyword;

            string noLanguage = null;

            StringCollection values;

            //Add not notes if NPM charavters has been used
            if (this.usedNPMCharacters.Count() > 0)
            {
                foreach (var language in languages)
                {
                    foreach (var usedNPMCharacter in this.usedNPMCharacters)
                    {
                        var presCharacterNPM = usedNPMCharacter.presCharacters[language];
                        var presTextNPM      = usedNPMCharacter.presTexts[language];

                        if (!string.IsNullOrEmpty(presCharacterNPM) && !string.IsNullOrEmpty(presTextNPM))
                        {
                            string npmCharacterExplanation = presCharacterNPM + " = " + presTextNPM;

                            StringCollection npmValues = new StringCollection();
                            npmValues.Add(npmCharacterExplanation);

                            string subKeyWord = null; //In order to show it

                            handler(PXKeywords.NOTE, language, subKeyWord, npmValues);
                        }
                    }
                }
            }

            /*
             * Code below is commented out because it did not work.
             */

            /*
             * foreach (KeyValuePair<string, string> dcn in theDataNoteCellEntries)
             * {
             *  keyword = PXKeywords.DATANOTECELL;
             *  values = new StringCollection();
             *  values.Add(dcn.Value);
             *  String myKey = dcn.Key.Replace(",", "\",\"");//for PXModelBuilder.SplittString   A","B","C
             *  // not "A","B","C"
             *  handler(keyword, noLanguage, myKey, values);
             *
             * }
             */

            /*
             *  Code below for PXKeywords.DATANOTECELL is copied from 2.1 because it works
             */

            PXSqlNpm         myNpms = mMeta.mPxsqlNpm;
            StringCollection datanoteDistictValues = new StringCollection();

            keyword = PXKeywords.DATANOTECELL;

            foreach (KeyValuePair <string, string> dcn in theDataNoteCellEntries)
            {
                PXSqlNpm.NPMCharacter myNpm = myNpms.GetNpmBySpeciaCharacterType(dcn.Value);
                foreach (string lang in mMeta.LanguageCodes)
                {
                    string presCharacter = myNpm.presCharacters[lang];
                    values = new StringCollection();
                    values.Add(presCharacter);
                    String myKey = dcn.Key.Replace(",", "\",\"");//for PXModelBuilder.SplittString   A","B","C
                    // not "A","B","C"
                    handler(keyword, lang, myKey, values);
                }
                // Keep distinct values of special character to get Presetext.
                if (!datanoteDistictValues.Contains(dcn.Value))
                {
                    datanoteDistictValues.Add(dcn.Value);
                }
            }

            keyword = PXKeywords.NOTE;
            foreach (string datanoteDistinctValue in datanoteDistictValues)
            {
                PXSqlNpm.NPMCharacter myNpm = myNpms.GetNpmBySpeciaCharacterType(datanoteDistinctValue);
                foreach (string lang in mMeta.LanguageCodes)
                {
                    string presText = myNpm.presCharacters[lang] + " = " + myNpm.presTexts[lang];
                    values = new StringCollection();
                    values.Add(presText);
                    handler(keyword, lang, null, values);
                }
            }

            if (attributes.HasAttributes)
            {
                //ATTRIBUTE-ID
                keyword = PXKeywords.ATTRIBUTE_ID;
                values  = new StringCollection();
                foreach (AttributeRow attr in attributes.SortedAttributes.Values)
                {
                    values.Add(attr.Attribute);
                }
                handler(keyword, noLanguage, null, values);


                //ATTRIBUTE-TEXT
                keyword = PXKeywords.ATTRIBUTE_TEXT;
                values  = new StringCollection();

                foreach (string lang in languages)
                {
                    values.Clear();
                    foreach (AttributeRow attr in attributes.SortedAttributes.Values)
                    {
                        values.Add(attr.texts[lang].PresText);
                    }
                    handler(keyword, lang, null, values);
                }

                // Default ATTRIBUTES

                noLanguage = null;
                keyword    = PXKeywords.ATTRIBUTES;

                values = new StringCollection();
                string[] tmpStrings = defaultAttributes.Split(':');
                foreach (string tmpString in tmpStrings)
                {
                    values.Add(tmpString);
                }
                handler(keyword, noLanguage, null, values);
                //ATTRIBUTES
                foreach (KeyValuePair <string, StringCollection> att in attributeEntries)
                {
                    if (att.Key != defaultAttributes)
                    {
                        values = new StringCollection();
                        string myKey = "";
                        tmpStrings = att.Key.Split(':');
                        foreach (string tmpString in tmpStrings)
                        {
                            values.Add(tmpString);
                        }
                        foreach (string position in att.Value)
                        {
                            myKey = position.Replace(",", "\",\"");
                            handler(keyword, noLanguage, myKey, values);
                        }
                    }
                }
            }
        }