Пример #1
0
        public static CMetaobjectLanguage sGetLanguage(int LanguageCode, IDatabaseProvider Provider)
        {
            CMetaobjectLanguage R = new CMetaobjectLanguage();

            Hashtable Params = new Hashtable();
            Params.Add(CDBConst.CONST_TABLE_FIELD_LANGUAGES_CODE, LanguageCode);

            var SQL = "SELECT " + CDBConst.CONST_TABLE_FIELD_LANGUAGES_CODE + ", " + CDBConst.CONST_TABLE_FIELD_LANGUAGES_NAME;
            SQL += " FROM " + CDBConst.CONST_TABLE_LANGUAGES;
            SQL += " WHERE " + CDBConst.CONST_TABLE_FIELD_LANGUAGES_CODE + " = @p" + CDBConst.CONST_TABLE_FIELD_LANGUAGES_CODE;

            var T = Provider.QueryGetData(SQL, false, Params);
            if (T == null || T.Rows.Count == 0)
                return null;

            R.LanguageName = T.Rows[0][1].PostProcessDatabaseValue<string>("");
            R.LanguageCode = T.Rows[0][0].PostProcessDatabaseValue<int>(-1);

            return R;
        }
Пример #2
0
        public static List<CMetaobjectLanguage> sGetAllLanguages(IDatabaseProvider Provider)
        {
            List<CMetaobjectLanguage> R = new List<CMetaobjectLanguage>();

            var SQL = "SELECT " + CDBConst.CONST_TABLE_FIELD_LANGUAGES_CODE + ", " + CDBConst.CONST_TABLE_FIELD_LANGUAGES_NAME;
            SQL += " FROM " + CDBConst.CONST_TABLE_LANGUAGES;

            var T = Provider.QueryGetData(SQL, false, null);
            if (T == null || T.Rows.Count == 0)
                return R;

            for (int i = 0; i < T.Rows.Count; i++)
            {
                var Language = new CMetaobjectLanguage()
                {
                    LanguageCode = T.Rows[i][0].PostProcessDatabaseValue<int>(),
                    LanguageName = T.Rows[i][1].PostProcessDatabaseValue<string>()
                };
                R.Add(Language);
            }

            return R;
        }