protected void uxAddButton_Click(object sender, EventArgs e) { try { if (Page.IsValid) { Culture culture = new Culture(); culture = SetupCulture(culture); culture = DataAccessContext.CultureRepository.Save(culture); LanguageTextAccess.CreateByCultureID(culture.CultureID, uxDisplayNameBaseDrop.SelectedValue); ClearInputField(); SetUpCultureInformation(culture); uxMessage.DisplayMessage(Resources.CultureMessages.AddSuccess); AdminUtilities.ClearLanguageCache(); } } catch (Exception ex) { uxMessage.DisplayException(ex); } }
protected void uxDeleteButton_Click(object sender, EventArgs e) { bool deleted = false; foreach (GridViewRow row in uxGrid.Rows) { CheckBox deleteCheck = (CheckBox)row.FindControl("uxCheck"); if (deleteCheck != null && deleteCheck.Checked) { string cultureID = uxGrid.DataKeys[row.RowIndex]["CultureID"].ToString(); string keyName = uxGrid.DataKeys[row.RowIndex]["KeyName"].ToString(); LanguageTextAccess.Delete(CurrentPageID, cultureID, keyName); deleted = true; } } uxGrid.EditIndex = -1; if (deleted) { uxMessage.DisplayMessage(Resources.LanguagePageMessages.KeywordDeleteSuccess); } RefreshGrid(); AdminUtilities.ClearLanguageCache(); uxStatusHidden.Value = "Deleted"; }
protected void uxDeleteButton_Click(object sender, EventArgs e) { bool deleted = false; foreach (GridViewRow row in uxSearchGrid.Rows) { CheckBox deleteCheck = (CheckBox)row.FindControl("uxCheck"); if (deleteCheck != null && deleteCheck.Checked) { string pageID = ((HiddenField)row.FindControl("uxPageIDHidden")).Value; string cultureID = ((HiddenField)row.FindControl("uxOldCultureIDHidden")).Value; string keyName = ((HiddenField)row.FindControl("uxOldKeyNameHidden")).Value; LanguageTextAccess.Delete(pageID, cultureID, keyName); deleted = true; } } uxSearchGrid.EditIndex = -1; if (deleted) { uxMessage.DisplayMessage(Resources.LanguagePageMessages.KeywordDeleteSuccess); } RefreshGrid(); AdminUtilities.ClearLanguageCache(); }
private void DeleteAllRelateFieldCultureID(string cultureID) { DataAccessContext.CategoryRepository.DeleteLocalesByCultureID(cultureID); DataAccessContext.ContentRepository.DeleteLocalesByCultureID(cultureID); DataAccessContext.OptionItemRepository.DeleteLocalesByCultureID(cultureID); DataAccessContext.OptionGroupRepository.DeleteLocalesByCultureID(cultureID); DataAccessContext.ProductRepository.DeleteLocalesByCultureID(cultureID); DataAccessContext.NewsRepository.DeleteLocalesByCultureID(cultureID); DataAccessContext.ShippingOptionRepository.DeleteLocalesByCultureID(cultureID); LanguageTextAccess.DeleteByCultureID(cultureID); }
protected void uxSearchGrid_RowUpdating(object sender, GridViewUpdateEventArgs e) { try { string pageID = ((HiddenField)uxSearchGrid.Rows[e.RowIndex].FindControl("uxPageIDHidden")).Value; string oldCultureID = ((HiddenField)uxSearchGrid.Rows[e.RowIndex].FindControl("uxOldCultureIDHidden")).Value; string oldKeyName = ((HiddenField)uxSearchGrid.Rows[e.RowIndex].FindControl("uxOldKeyNameHidden")).Value; string newCultureID = ((DropDownList)uxSearchGrid.Rows[e.RowIndex].FindControl("uxCultureDrop")).SelectedValue; string newKeyName = ((TextBox)uxSearchGrid.Rows[e.RowIndex].FindControl("uxKeyNameText")).Text.Trim(); string newTextData = ((TextBox)uxSearchGrid.Rows[e.RowIndex].FindControl("uxTextDataText")).Text.Trim(); LanguageTextAccess.Update( pageID, oldCultureID, oldKeyName, newCultureID, newKeyName, newTextData); // End editing uxSearchGrid.EditIndex = -1; uxMessage.DisplayMessage(Resources.LanguagePageMessages.KeywordUpdateSuccess); RefreshGrid(); } catch (Exception ex) { string message; if (ex.InnerException is DuplicatedPrimaryKeyException) { message = Resources.LanguagePageMessages.KeywordUpdateErrorDuplicated; } else { message = Resources.LanguagePageMessages.KeywordUpdateError; } throw new ApplicationException(message); } finally { // Avoid calling Update() automatically by GridView e.Cancel = true; } AdminUtilities.ClearLanguageCache(); }
protected override void RefreshGrid() { uxAdminContent.ShowBorderContent = true; int totalItems; uxSearchGrid.DataSource = LanguageTextAccess.Search( CultureIDSearch, GridHelper.GetFullSortText(), SearchFieldName, TextSearch, uxPagingControl.StartIndex, uxPagingControl.EndIndex, out totalItems); uxPagingControl.NumberOfPages = (int)Math.Ceiling((double)totalItems / uxPagingControl.ItemsPerPages); uxSearchGrid.DataBind(); }