/// <summary> /// Delete the translation of the term /// </summary> private void BtnDelete() { using (TMExpressionTranslation tt = TMExpressionTranslation.GetByKey(expressionId, languageCode)) { if (tt != null) { #region Delete result if (tt.Delete(HyperCatalog.Shared.SessionState.User.Id)) { Page.ClientScript.RegisterStartupScript(this.GetType(), "reloadParent", "<script>ReloadParent();top.close();</script>"); } else { lbMessage.Text = TMExpressionTranslation.LastError; lbMessage.CssClass = "hc_error"; lbMessage.Visible = true; } #endregion } else { lbMessage.Text = "Error: TM Expression translation can't be deleted - translation not found"; lbMessage.CssClass = "hc_error"; lbMessage.Visible = true; } } }
/// <summary> /// Delete the selected translation of the TM Expression /// </summary> private void Delete() { for (int i = 0; i < dg.Rows.Count; i++) { TemplatedColumn col = (TemplatedColumn)dg.Rows[i].Cells.FromKey("Select").Column; CheckBox cb = (CheckBox)((CellItem)col.CellItems[i]).FindControl("g_sd"); if (cb.Checked) { using (TMExpressionTranslation tt = TMExpressionTranslation.GetByKey(expressionId, dg.Rows[i].Cells.FromKey("LanguageCode").ToString())) { if (tt != null) { #region Delete result if (!tt.Delete(HyperCatalog.Shared.SessionState.User.Id)) { lbMessage.Text = "Error: Translation [" + dg.Rows[i].Cells.FromKey("LanguageCode").ToString() + "] can't be deleted"; lbMessage.CssClass = "hc_error"; lbMessage.Visible = true; break; } #endregion } else { lbMessage.Text = "Error: Term translation [" + dg.Rows[i].Cells.FromKey("Language").ToString() + "] can't be deleted - translation not found"; lbMessage.CssClass = "hc_error"; lbMessage.Visible = true; } } } } ShowTMTranslations(); lbMessage.Text = "Data deleted"; lbMessage.CssClass = "hc_success"; lbMessage.Visible = true; }