/// <summary>
    /// Handles the UniGrid's OnAction event.
    /// </summary>
    /// <param name="actionName">Name of item (button) that throws event</param>
    /// <param name="actionArgument">ID (value of Primary key) of corresponding data row</param>
    protected void uniGrid_OnAction(string actionName, object actionArgument)
    {
        switch (actionName.ToLowerCSafe())
        {
        case "edit":
            URLHelper.Redirect("BadWords_Edit.aspx?badwordid=" + Convert.ToString(actionArgument));
            break;

        case "delete":
            BadWordInfoProvider.DeleteBadWordInfo(Convert.ToInt32(actionArgument));
            break;
        }
    }
Example #2
0
    private void OnAction(string actionName, object actionArgument)
    {
        switch (actionName.ToLowerCSafe())
        {
        case "delete":
            BadWordInfoProvider.DeleteBadWordInfo(ValidationHelper.GetInteger(actionArgument, 0));
            break;

        case "edit":
            string editUrl = UIContextHelper.GetElementUrl("CMS.BadWords", "Administration.BadWords.Edit");
            editUrl = URLHelper.AddParameterToUrl(editUrl, "objectid", actionArgument.ToString());
            editUrl = URLHelper.AddParameterToUrl(editUrl, "displaytitle", "false");
            URLHelper.Redirect(editUrl);
            break;
        }
    }
Example #3
0
    /// <summary>
    /// Deletes all "testbadword" bad words. Called when the "Delete bad word(s)" button is pressed.
    /// Expects the CreateBadWord method to be run first.
    /// </summary>
    private bool DeleteBadWord()
    {
        // Prepare the parameters
        string where = "[WordExpression] = 'testbadword' ";

        // Get the data
        DataSet words = BadWordInfoProvider.GetBadWords(where, null);

        if (!DataHelper.DataSourceIsEmpty(words))
        {
            foreach (DataRow wordDr in words.Tables[0].Rows)
            {
                // Create object from DataRow
                BadWordInfo deleteWord = new BadWordInfo(wordDr);

                // Delete the bad word
                BadWordInfoProvider.DeleteBadWordInfo(deleteWord);
            }

            return(true);
        }

        return(false);
    }