Ejemplo n.º 1
0
    /// <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)
    {
        if (actionName == "edit")
        {
            SelectedItemID = Convert.ToInt32(actionArgument);
            RaiseOnEdit();
        }
        else if (actionName == "delete")
        {
            PollInfo pi = PollInfoProvider.GetPollInfo(Convert.ToInt32(actionArgument));
            if (pi != null)
            {
                if ((pi.PollSiteID > 0) && !CheckPermissions("cms.polls", PERMISSION_MODIFY) ||
                    (pi.PollSiteID <= 0) && !CheckPermissions("cms.polls", PERMISSION_GLOBALMODIFY))
                {
                    return;
                }

                // Delete PollInfo object from database with it's dependences
                PollInfoProvider.DeletePollInfo(Convert.ToInt32(actionArgument));
            }

            ReloadData();
        }
    }
Ejemplo n.º 2
0
    /// <summary>
    /// Deletes poll. Called when the "Delete poll" button is pressed.
    /// Expects the CreatePoll method to be run first.
    /// </summary>
    private bool DeletePoll()
    {
        // Get the poll
        PollInfo deletePoll = PollInfoProvider.GetPollInfo("MyNewPoll", SiteContext.CurrentSiteID);

        // Delete the poll
        PollInfoProvider.DeletePollInfo(deletePoll);

        return(deletePoll != null);
    }