private void BindLanguage(string languageId) { BXLanguage lang = BXLanguage.GetById(languageId); if (lang == null) lang = new BXLanguage(); txtID.Text = lang.TextEncoder.Decode(lang.Id); Active.Checked = lang.Active; Default.Checked = lang.Default; Default.Enabled = !lang.Default; Name.Text = lang.Name; Sort.Text = lang.Sort.ToString(); Culture.SelectedCulture = lang.Culture; }
private void SaveLanguage(bool isApply) { if (!currentUserCanModify) { errorMessage.AddErrorMessage(GetMessage("Exception.YouDontHaveRightsToPerformThisOperation")); return; } BXLanguage lang = BXLanguage.GetById(LanguageId, BXTextEncoder.EmptyTextEncoder); if (lang == null) lang = new BXLanguage(txtID.Text, BXTextEncoder.EmptyTextEncoder); lang.Name = Name.Text.Trim(); lang.Active = Active.Checked; if (!lang.Default) lang.Default = Default.Checked; lang.Culture = Culture.SelectedCulture; lang.Sort = int.Parse(Sort.Text); lang.Save(); BXLoc.ResetCultureCache(); if (isApply) Response.Redirect(string.Format("LanguageEdit.aspx?id={0}", UrlEncode(lang.Id))); else Response.Redirect("Language.aspx"); }