public UILabel FindOrCreateUILabel(string _fieldName) { UILabel l = ObjectLabels.Where(x => x.FieldName == _fieldName).FirstOrDefault(); if (l == null) //Create new one { l = new UILabel(Session) { FieldName = _fieldName }; ObjectLabels.Add(l); UILabelLang cap = new UILabelLang(Session) { Lang_en = _fieldName, UILabelType = MyEnums.UILabelType.FieldCaption }; UILabelLang hlp = new UILabelLang(Session) { Lang_en = _fieldName, UILabelType = MyEnums.UILabelType.FieldHelp }; l.Langs.Add(cap); l.Langs.Add(hlp); l.Save(); l.Session.CommitTransaction(); } return(l); }
public string ChooseValueForCurrentLang(MyEnums.UILabelType _uiLabelType) { string ret = ""; //string lang = string.IsNullOrEmpty(CoreLib.GlobalMethods.UILang) ? "en" : CoreLib.GlobalMethods.UILang; UILabelLang lblLang = Langs.Where(x => x.UILabelType == _uiLabelType).FirstOrDefault(); ret = lblLang.Lang; return(ret); }