Beispiel #1
0
        /// <summary>
        ///Get Language Model from AD_Language
        /// </summary>
        /// <param name="ctx">context</param>
        /// <param name="AD_Language">language e.g. en_US</param>
        /// <returns>language or null</returns>
        public static MLanguage Get(Ctx ctx, string AD_Language)
        {
            MLanguage lang = null;
            String    sql  = "SELECT * FROM AD_Language WHERE AD_Language=" + AD_Language;


            return(lang);
        }
Beispiel #2
0
        /// <summary>
        /// Load active Countries (no summary).
        /// Set Default Language to Client Language
        /// </summary>
        /// <param name="ctx">Ctx</param>
        private static void LoadAllCountries(Ctx ctx)
        {
            MClient   client = MClient.Get(ctx);
            MLanguage lang   = MLanguage.Get(ctx, client.GetAD_Language());
            MCountry  usa    = null;
            //

            int countryID = Util.GetValueOfInt(ctx.Get("P|C_Country_ID"));

            s_countries = new CCache <String, MCountry>("C_Country", 250);
            String sql = "SELECT * FROM C_Country WHERE IsActive='Y' AND IsSummary='N'";

            try
            {
                DataSet ds = DataBase.DB.ExecuteDataset(sql, null, null);
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    DataRow  dr = ds.Tables[0].Rows[i];
                    MCountry c  = new MCountry(ctx, dr, null);
                    s_countries.Add(c.GetC_Country_ID().ToString(), c);
                    //	Country code of Client Language
                    if (lang != null && lang.GetCountryCode().Equals(c.GetCountryCode()) && _default == null)
                    {
                        _default = c;
                    }
                    else if (countryID == c.GetC_Country_ID())
                    {
                        _default = c;
                    }
                    if (c.GetC_Country_ID() == 100)             //	USA
                    {
                        usa = c;
                    }
                }
            }
            catch (Exception e)
            {
                _log.Log(Level.SEVERE, sql, e);
            }
            if (_default == null)
            {
                _default = usa;
            }
            _log.Fine("#" + s_countries.Size()
                      + " - Default=" + _default);
        }
Beispiel #3
0
        /// <summary>
        ///Get Language Model from AD_Language
        /// </summary>
        /// <param name="ctx">context</param>
        /// <param name="AD_Language_ID">language e.g. 191</param>
        /// <param name="trxName">trx</param>
        /// <returns>language or null</returns>
        public static MLanguage Get(Ctx ctx, String AD_Language, Trx trxName)
        {
            MLanguage lang = null;
            String    sql  = "SELECT * FROM AD_Language WHERE AD_Language='" + AD_Language + "'";
            DataSet   ds   = null;

            try
            {
                ds = DataBase.DB.ExecuteDataset(sql, null, trxName);
                DataRow rs;
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    rs   = ds.Tables[0].Rows[i];
                    lang = new MLanguage(ctx, rs, trxName);
                }
                ds = null;
            }
            catch (Exception ex)
            {
                s_log.Log(Level.SEVERE, sql, ex);
            }
            ds = null;
            return(lang);
        }