示例#1
0
        public LanguagePreferences(int userId)
        {
            IEnumerable <System.Data.IDataRecord> preferences = DB.GetLanguagePreferences(userId);

            this.Languages = new List <PrefStruct>();

            foreach (var record in preferences)
            {
                var curLang = InterfaceLanguages.GetLanguageById(int.Parse(record["lang"].ToString()));

                if (curLang == null)
                {
                    continue;
                }
                else
                {
                    this.Languages.Add(new PrefStruct
                    {
                        PrefPos = int.Parse(record["ord"].ToString()),
                        lang    = curLang
                    });
                }
            }

            this.Languages = this.Languages.OrderBy(p => p.PrefPos).ToList();
        }
示例#2
0
        public MultiDictTranslation(int id, string text, int langId, string correspondingItemId, String searchText)
        {
            this.Id     = id;
            this.Text   = text;
            this.LangId = langId;
            this.correspondingItemId = correspondingItemId;

            var langInfo = InterfaceLanguages.GetLanguageById(this.LangId);

            this.LangCode      = langInfo.Code;
            this.langShortCode = langInfo.ShortCode;
            this.SearchText    = searchText;
        }