Esempio n. 1
0
        private List <PXSqlContent> GetSortedContentsList(string mMainTableId, bool contructedFromPxs, BasicValueType[] contentsInPxs)
        {
            List <PXSqlContent> myOut = new List <PXSqlContent>();
            Dictionary <string, ContentsRow> altIBasen = mMetaQuery.GetContentsRows(mMainTableId);


            //side effect:
            ContentsRow someContentsRow = null;

            foreach (ContentsRow tmpRow in altIBasen.Values)
            { //just want any one of the rows
                someContentsRow = tmpRow;
                break;
            }

            couldHaveBeenByMainTableOnly = new PXSqlThingsThatWouldBeTheSameInAllPXSqlContent(someContentsRow, this, mConfig);

            PXSqlContact contact = new PXSqlContact(this, this.MainTable.MainTable);


            PXSqlContent mContent = null;

            if (this.ConstructedFromPxs)
            {
                int documentOrder = 0;
                foreach (BasicValueType contents in contentsInPxs)
                {
                    if (altIBasen.ContainsKey(contents.code))
                    {
                        mContent           = new PXSqlContent(altIBasen[contents.code], this, mConfig, contact);
                        mContent.SortOrder = documentOrder;
                        myOut.Add(mContent);
                        documentOrder++;
                    }
                }
            }
            else
            {
                foreach (KeyValuePair <string, ContentsRow> cont in altIBasen)
                {
                    mContent           = new PXSqlContent(cont.Value, this, mConfig, contact);
                    mContent.SortOrder = int.Parse(cont.Value.StoreColumnNo);
                    myOut.Add(mContent);
                }
            }

            if (myOut.Count < 1)
            {
                throw new ApplicationException("No contents to process");
            }
            myOut.Sort();
            return(myOut);
        }
Esempio n. 2
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
        }