/// <summary> /// Display word properties /// </summary> private void ShowWord() { #region Retrieve information about the current container SpecificDictionaryWord specificWord = SpecificDictionaryWord.GetByKey(word, languageCode); if (specificWord != null) { txtValue.Text = specificWord.Text; txtComment.Text = specificWord.Comment; hlSubmitter.Text = specificWord.SubmitterName; hlSubmitter.NavigateUrl = "mailto:" + UITools.GetDisplayEmail(specificWord.Submitter.Email) + Server.HtmlEncode("?subject=The word you've submitted [" + word + "]"); lbOrganizationSubmitter.Text = specificWord.Submitter.OrgName; lbSubmittedOn.Text = SessionState.User.FormatUtcDate(specificWord.SubmitDate.Value, true, SessionState.User.FormatDate + ' ' + SessionState.User.FormatTime); panelSubmitter.Visible = true; if (specificWord.Approver != null) { hlApprover.Text = specificWord.ApproverName; hlApprover.NavigateUrl = "mailto:" + UITools.GetDisplayEmail(specificWord.Approver.Email) + Server.HtmlEncode("?subject=The word you've apporved [" + word + "]"); lbOrganizationApprover.Text = specificWord.Approver.OrgName; lbApprovedOn.Text = SessionState.User.FormatUtcDate(specificWord.ApproveDate.Value, true, SessionState.User.FormatDate + ' ' + SessionState.User.FormatTime); panelApprover.Visible = true; } UITools.ShowToolBarButton(uwToolbar, "Delete"); UITools.ShowToolBarSeparator(uwToolbar, "SepDelete"); } else { UITools.HideToolBarButton(uwToolbar, "Delete"); UITools.HideToolBarSeparator(uwToolbar, "SepDelete"); } #endregion }
/// <summary> /// Display the selected word properties /// </summary> /// <param name="selWord">word</param> void UpdateDataEdit(string selWord) { SessionState.swFilterWord = txtFilter.Text; SessionState.swPageIndexWord = dg.DisplayLayout.Pager.CurrentPageIndex.ToString(); //DDL_Cultures.Enabled = false; panelGrid.Visible = false; webTab.EnableViewState = false; webTab.Tabs.GetTab(0).ContentPane.TargetUrl = "./SpellChecker/Word_properties.aspx?w=" + selWord + "&l=" + ViewState["LanguageCode"]; webTab.SelectedTabIndex = 0; if (selWord == "-1") { #region New Word lbTitle.Text = "New word"; #endregion } else { #region Word selected SpecificDictionaryWord w = SpecificDictionaryWord.GetByKey(selWord, ViewState["LanguageCode"].ToString()); if (selWord.Length > 50) { selWord = selWord.Substring(0, 50) + "..."; } lbTitle.Text = "Word: " + selWord; #endregion } panelTabWord.Visible = true; }
/// <summary> /// Save the word properties /// </summary> private void BtnSave() { SpecificDictionaryWord w = SpecificDictionaryWord.GetByKey(txtValue.Text, languageCode); string m = string.Empty; if (w == null) { w = new HyperCatalog.SpellChecker.SpecificDictionaryWord(txtValue.Text, languageCode, txtComment.Text, SessionState.User.Id, SessionState.User.FullName, SessionState.User.Id, SessionState.User.FullName, null, null, DateTime.UtcNow, DateTime.UtcNow, false); m = "Word created"; } else { w.ApproverId = SessionState.User.Id; w.ApproveDate = DateTime.UtcNow; w.Comment = txtComment.Text.Trim(); w.Approved = false; m = "Word updated"; } if (w.Save()) { lbMessage.Text = m; lbMessage.CssClass = "hc_success"; lbMessage.Visible = true; } else { lbMessage.Text = "Error: Word can't be created/updated"; lbMessage.CssClass = "hc_error"; lbMessage.Visible = true; } }
/// <summary> /// Approve words selected /// </summary> private void ApproveSelectedItems() { lbMessage.Text = string.Empty; int nbApprovedRows = 0; int nbSelectedRows = 0; foreach (UltraGridRow dr in dg.Rows) { TemplatedColumn col = (TemplatedColumn)dr.Cells.FromKey("Select").Column; CheckBox cb = (CheckBox)((CellItem)col.CellItems[dr.Index]).FindControl("g_sd"); if (cb.Checked) { nbSelectedRows++; SpecificDictionaryWord w = SpecificDictionaryWord.GetByKey(dr.Cells.FromKey("word").ToString(), ViewState["LanguageCode"].ToString()); if (w != null) { if (!w.Approved) { w.Approved = true; w.ApproveDate = DateTime.UtcNow; w.ApproverId = SessionState.User.Id; if (!w.Save()) { lbMessage.Text = "Error: word [" + dr.Cells.FromKey("word").ToString() + "] can't be approved<br>"; lbMessage.CssClass = "hc_error"; lbMessage.Visible = true; break; } else { nbApprovedRows++; } } } else { lbMessage.Text = "Error: word [" + dr.Cells.FromKey("word").ToString() + "] not found<br>"; lbMessage.CssClass = "hc_error"; lbMessage.Visible = true; break; } } } if (nbSelectedRows == 0) { lbMessage.Text = "No words selected"; lbMessage.CssClass = "hc_error"; lbMessage.Visible = true; } else { lbMessage.Text = nbApprovedRows.ToString() + " words approved"; lbMessage.CssClass = "hc_success"; lbMessage.Visible = true; UpdateDataView(); dg.DisplayLayout.Pager.CurrentPageIndex = 1; } }