コード例 #1
0
ファイル: PXSqlContent.cs プロジェクト: trygu/PxWeb
        /**
         * Translates database code to Paxiom code for StockFA.
         */
        private string PaxiomifyStockFA(string StockFA, SqlDbConfig_21 config)
        {
            string myOut = "";

            if (!String.IsNullOrEmpty(StockFA))
            {
                if (StockFA.Equals(config.Codes.StockFAS))
                {
                    myOut = PXConstant.STOCKFA_STOCK;
                }
                else if (StockFA.Equals(config.Codes.StockFAA))
                {
                    myOut = PXConstant.STOCKFA_AVERAGE;
                }
                else if (StockFA.Equals(config.Codes.StockFAF))
                {
                    myOut = PXConstant.STOCKFA_FLOW;
                }
                else
                {
                    myOut = PXConstant.STOCKFA_OTHER;
                    //throw new ApplicationException("Unknown StockFA code:\"" + StockFA + "\"");
                }
            }
            return(myOut);
        }
コード例 #2
0
 internal ValueText2(DataRow mRow, SqlDbConfig_21 dbconf, string metaModel)
 {
     this.mSortCodeValue   = mRow["SortCodeValue"].ToString();
     this.mSortCodeVsValue = mRow["SortCodeVsValue"].ToString();
     this.mValueTextS      = mRow[dbconf.Value.ValueTextS].ToString();
     this.mValueTextL      = mRow[dbconf.Value.ValueTextL].ToString();
 }
コード例 #3
0
 public ValueRow2(DataRow mRow, SqlDbConfig_21 dbconf, string metaModel, int sortOrder)
 {
     this.mValuePool = mRow[dbconf.VSValue.ValuePool].ToString(); // VAL_Vardeforrad
     this.mValueSet  = mRow[dbconf.VSValue.ValueSet].ToString();  // VAL_Vardemangd
     this.mValueCode = mRow[dbconf.VSValue.ValueCode].ToString();
     this.mSortOrder = sortOrder.ToString();
     this.mFootnote  = null;
 }
コード例 #4
0
 public ValueRow(DataRow mRow, SqlDbConfig_21 dbconf, IMetaVersionComparator metaModel, StringCollection languageCodes, int sortOrder)
 {
     this.mValuePool = mRow[dbconf.Value.ValuePoolCol.Label()].ToString();
     this.mValueCode = mRow[dbconf.Value.ValueCodeCol.Label()].ToString();
     foreach (string languageCode in languageCodes)
     {
         texts.Add(languageCode, new ValueText(mRow, dbconf, languageCode, metaModel));
     }
 }
コード例 #5
0
        // private List<RelevantFootNotesRow> mRelevantFootNootes;


        #endregion
        #region Constructor



        /// <summary>
        ///
        /// </summary>
        /// <param name="mainTableId"></param>
        /// <param name="preferredLang">The code ("no","en",...) of the language the client wants as main language in paxiom. May be null or empty, indicating the client dont care, in which case a "random" language is choosen.</param>
        /// <param name="getAllLangs"></param>
        /// <param name="config"></param>
        /// <param name="selectedDbInfo"></param>
        /// <param name="aModus"></param>
        public PXSqlMeta_21(string mainTableId, string preferredLang, bool getAllLangs, SqlDbConfig config, InfoForDbConnection selectedDbInfo, PCAxis.Sql.Parser.Instancemodus aModus)
            : base(config, selectedDbInfo, aModus, false)
        {
            log.Info("PXSqlMeta(string mainTableId(=" + mainTableId + "), StringCollection desiredLanguages, SqlDbConfig config, Instancemodus aModus(=" + aModus.ToString() + "))");
            this.mMainTableId = mainTableId;
            this.mConfig      = (SqlDbConfig_21)config;
            mMetaQuery        = new MetaQuery(this.mConfig, this.SelectedDbInfo);
            SetLanguageCodesNoPxs(preferredLang, getAllLangs);
            BuildMeta();
        }
コード例 #6
0
ファイル: FootNoteRows.cs プロジェクト: trygu/PxWeb
 public RelevantFoonotesTexts(DataRow myRow, SqlDbConfig_21 dbconf, String languageCode, string metaModel)
 {
     if (dbconf.isSecondaryLanguage(languageCode))
     {
         this.mFootNotetext = myRow[dbconf.FootnoteLang2.Alias + dbconf.GetMetaSuffix(languageCode) + "_" + dbconf.FootnoteLang2.FootnoteText].ToString();
     }
     else
     {
         this.mFootNotetext = myRow[dbconf.Footnote.Alias + "_" + dbconf.Footnote.FootnoteText].ToString();
     }
 }
コード例 #7
0
        public static string sqlString(SqlDbConfig_21 DB, string aMainTable)
        {
            string currentMethod = "MainTableVariableRow.sqlString";

            SqlDbConfig_21.TblSubTableVariable stv = DB.SubTableVariable;

            return("SELECT DISTINCT " + stv.VariableCol.ForSelect() + ", " +
                   stv.VariableTypeCol.ForSelect() + "," +
                   stv.StoreColumnNoCol.ForSelect() +
                   " /*** SQLID: " + currentMethod + "_01 ***/ " +
                   " FROM " + DB.MetatablesSchema + stv.TableName + " " + stv.Alias +
                   " WHERE " + stv.MainTableCol.Is(aMainTable));

            // SELECT DISTINCT STB.Variable, STB.VariableType og StoreColumnNoCol  /*** SQLID: GetMainTablesVariablesById_01 ***/
            // FROM MetaData.SubTableVariable STB
            // WHERE STB.MainTable = '<mainTable>'
        }
コード例 #8
0
 internal ValueText(DataRow mRow, SqlDbConfig_21 dbconf, String languageCode, IMetaVersionComparator metaModel)
 {
     {
         if (dbconf.isSecondaryLanguage(languageCode))
         {
             this.mValueTextS = mRow[dbconf.ValueLang2.ValueTextSCol.Label(languageCode)].ToString();
             this.mValueTextL = mRow[dbconf.ValueLang2.ValueTextLCol.Label(languageCode)].ToString();
             this.mSortCode   = mRow[dbconf.ValueLang2.SortCodeCol.Label(languageCode)].ToString();
         }
         else
         {
             this.mValueTextS = mRow[dbconf.Value.ValueTextSCol.Label()].ToString();
             this.mValueTextL = mRow[dbconf.Value.ValueTextLCol.Label()].ToString();
             this.mSortCode   = mRow[dbconf.Value.SortCodeCol.Label()].ToString();
         }
     }
 }
コード例 #9
0
ファイル: FootNoteRows.cs プロジェクト: trygu/PxWeb
 public RelevantFootNotesRow(DataRow myRow, SqlDbConfig_21 dbconf, StringCollection languageCodes, string metaModel)
 {
     this.mMainTable  = myRow["MainTable"].ToString();
     this.mFootNoteNo = myRow["FootNoteNo"].ToString();
     //this.mFootNoteType = myRow["FootNoteType"].ToString();
     this.mFootNoteType = (PXSqlNoteType)Enum.Parse(typeof(PXSqlNoteType), myRow["FootNoteType"].ToString());
     this.mContents     = myRow["Contents"].ToString();
     this.mVariable     = myRow["Variable"].ToString();
     this.mValuePool    = myRow["ValuePool"].ToString();
     this.mValueCode    = myRow["ValueCode"].ToString();
     this.mTimePeriod   = myRow["TimePeriod"].ToString();
     this.mSubTable     = myRow["SubTable"].ToString();
     this.mMandOpt      = myRow["MandOpt"].ToString();
     this.mShowFootNote = myRow["ShowFootNotes"].ToString();
     foreach (string languageCode in languageCodes)
     {
         texts.Add(languageCode, new RelevantFoonotesTexts(myRow, dbconf, languageCode, metaModel));
     }
 }
コード例 #10
0
ファイル: PXSqlContent.cs プロジェクト: trygu/PxWeb
        /**Translates database code to Paxiom code for CFPrices*/
        private string PaxiomifyCFPrices(string CFPrices, SqlDbConfig_21 config)
        {
            string myOut = "";

            if (!String.IsNullOrEmpty(CFPrices))
            {
                if (CFPrices.Equals(config.Codes.CFPricesC))
                {
                    myOut = PXConstant.CFPRICES_CURRENT;
                }
                else if (CFPrices.Equals(config.Codes.CFPricesF))
                {
                    myOut = PXConstant.CFPRICES_FIXED;
                }
                else
                {
                    throw new ApplicationException("Unknown CFPrices code:\"" + CFPrices + "\"");
                }
            }
            return(myOut);
        }
コード例 #11
0
        public PXSqlMeta_21(PxsQuery mPxsObject, string preferredLang, SqlDbConfig config, InfoForDbConnection selectedDbInfo, PCAxis.Sql.Parser.Instancemodus aModus)
            : base(config, selectedDbInfo, aModus, true)

        {
            log.Debug("PXSqlMeta(PxsQuery mPxsObject, SqlDbConfig config, Instancemodus aModus");


            //disse er trukket hit for å kunne kjøre med String hovedtabellId.
            this.mMainTableId = mPxsObject.Query.TableSource;

            //TODO; denne burde kunne fjernes
            this.mPxsSubTableId = mPxsObject.Query.SubTable;
            this.mConfig        = (SqlDbConfig_21)config;

            mMetaQuery = new MetaQuery(this.mConfig, this.SelectedDbInfo);

            this.mPxsFile = this.rearrangePxsQuery(mPxsObject);

            SetLanguageCodesFromPxs(preferredLang);
            BuildMeta(); //
        }
コード例 #12
0
        public ValueRowDictionary(DataTable mTable, SqlDbConfig_21 dbconf, string metaModel)
        {
            string theValueCode;
            string theLanguage;
            int    sortOrder = 0;

            foreach (DataRow mRow in mTable.Rows)
            {
                theValueCode = mRow[dbconf.VSValue.ValueCode].ToString();
                if (!mValueRows.ContainsKey(theValueCode))
                {
                    sortOrder += 1;  // this will be the sortorder for mainlanguage.  Since each language could have its own sortorder this well be set in the Valuetext and coukd be used by the calling program.
                    mValueRows.Add(theValueCode, new ValueRow2(mRow, dbconf, metaModel, sortOrder));
                } //denne bør fel flyttes et par hakk ned
                theLanguage = mRow["Language"].ToString();
                if (!mValueRows[theValueCode].texts.ContainsKey(theLanguage))
                {
                    mValueRows[theValueCode].texts.Add(theLanguage, new ValueText2(mRow, dbconf, metaModel));
                }
            }
        }
コード例 #13
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);
            }
        }
コード例 #14
0
 public MainTableVariableRow(DataRow myRow, SqlDbConfig_21 dbconf, string metaModel)
 {
     this.mVariable      = myRow[dbconf.SubTableVariable.VariableCol.Label()].ToString();
     this.mVariableType  = myRow[dbconf.SubTableVariable.VariableTypeCol.Label()].ToString();
     this.mStoreColumnNo = myRow[dbconf.SubTableVariable.StoreColumnNoCol.Label()].ToString();
 }
コード例 #15
0
ファイル: PXMetaAdmValues.cs プロジェクト: trygu/PxWeb
        public PXMetaAdmValues(Dictionary <string, MetaAdmRow> altIBasen, SqlDbConfig_21 dbConfig)
        {
            SqlDbConfig_21.DbKeywords Keywords = dbConfig.Keywords;



            //PXCodepage
            if (Keywords.Optional_PXCodepage != null)
            {
                if (altIBasen.ContainsKey(Keywords.Optional_PXCodepage))
                {
                    _PXCodepage = altIBasen[Keywords.Optional_PXCodepage].Value;
                }
                else
                {
                    throw new ApplicationException("Keyword:" + Keywords.Optional_PXCodepage + " not found in table with modelname MetaAdm.");
                }
            }

            //PXDescriptionDefault
            if (Keywords.Optional_PXDescriptionDefault != null)
            {
                if (altIBasen.ContainsKey(Keywords.Optional_PXDescriptionDefault))
                {
                    _PXDescriptionDefault = altIBasen[Keywords.Optional_PXDescriptionDefault].Value.Equals(dbConfig.Codes.Yes);
                }
                else
                {
                    throw new ApplicationException("Keyword:" + Keywords.Optional_PXDescriptionDefault + " not found in table with modelname MetaAdm.");
                }
            }
            //AllwaysUseMaintablePrestextSInDynamicTitle
            if (Keywords.Optional_AllwaysUseMaintablePrestextSInDynamicTitle != null)
            {
                if (altIBasen.ContainsKey(Keywords.Optional_AllwaysUseMaintablePrestextSInDynamicTitle))
                {
                    _AllwaysUseMaintablePrestextSInDynamicTitle = altIBasen[Keywords.Optional_AllwaysUseMaintablePrestextSInDynamicTitle].Value.Equals(dbConfig.Codes.Yes);
                }
                else
                {
                    throw new ApplicationException("Keyword:" + Keywords.Optional_PXDescriptionDefault + " not found in table with modelname MetaAdm.");
                }
            }

            //PXCharset
            if (Keywords.Optional_PXCharset != null)
            {
                if (altIBasen.ContainsKey(Keywords.Optional_PXCharset))
                {
                    _PXCharset = altIBasen[Keywords.Optional_PXCharset].Value;
                }
                else
                {
                    throw new ApplicationException("Keyword:" + Keywords.Optional_PXCharset + " not found in table with modelname MetaAdm.");
                }
            }

            //PXAxisVersion
            if (Keywords.Optional_PXAxisVersion != null)
            {
                if (altIBasen.ContainsKey(Keywords.Optional_PXAxisVersion))
                {
                    _PXAxisVersion = altIBasen[Keywords.Optional_PXAxisVersion].Value;
                }
                else
                {
                    throw new ApplicationException("Keyword:" + Keywords.Optional_PXAxisVersion + " not found in table with modelname MetaAdm.");
                }
            }

            //if(altIBasen.ContainsKey("DefaultCodeMissingLine")){
            //    _DefaultCodeMissingLine = altIBasen["DefaultCodeMissingLine"].Value;
            //} else {
            //    log.Error(" Keyword:\"DefaultCodeMissingLine\" not found in table with modelname MetaAdm.");

            //}
        }
コード例 #16
0
ファイル: PXSqlContent.cs プロジェクト: trygu/PxWeb
        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
        }