private void TranslationsSupergridCellValueChanged(object sender, GridCellValueChangedEventArgs e) { var row = (ApplicationTranslation)e.GridCell.GridRow.GetCell(OBJECT).Value; var gridTitle = (string)e.GridCell.GridColumn.DataPropertyName; var langId = int.Parse(gridTitle.Split('_')[1]); var translation = new ApplicationTranslations().GetByKeyAndLanguageId(row.Key, langId).Find(x => x.SubKey.Equals(row.SubKey)) ?? new ApplicationTranslation(-1, row.Key, row.SubKey, langId, e.NewValue as string); if (langId != (int)Enums.Languages.en_GB && string.IsNullOrEmpty(e.NewValue as string)) { new ApplicationTranslations().Delete(translation); } else if (translation.Id == -1) { new ApplicationTranslations().Add(translation); } else { translation.Value = e.NewValue as string; new ApplicationTranslations().Modify(translation); } //AddHistoryAction(TranslationKey.History_TranslationsForm_Modified, "Translation '{0}' '{1}' for '{2}' modified from {3} to {4} by user {5}.", row.Key, row.SubKey, Translations.Enums.TranslatedEnumDictionary[(Enums.Languages)langId], e.OldValue, row.Value, CurrentUser.User.Username); AddHistoryAction(TranslationKey.History_TranslationsForm_Modified, "Translation '{0}' '{1}' for '{2}' modified from {3} to {4} by user {5}.", row.Key, row.SubKey, (Enums.Languages)langId, e.OldValue, row.Value, CurrentUser.User.Username); }
public DataTable GetApplicationTranslationsDataTable() { try { var applicationTranslationsList = new ApplicationTranslations().GetAll(); var applicationTranslationsDataTable = ApplicationTranslationsHelper.Instance.GetDataTable(applicationTranslationsList); return(applicationTranslationsDataTable); } catch (Exception ex) { Trace.WriteError(ex.Message, Trace.GetMethodName(), CLASSNAME, ex); return(null); } }