Пример #1
0
    protected void HeaderActions_ActionPerformed(object sender, CommandEventArgs e)
    {
        // Check user permission (for complex operations only)
        if (e.CommandName != "refresh")
        {
            if (!MembershipContext.AuthenticatedUser.IsAuthorizedPerResource("cms.newsletter", "configure"))
            {
                RedirectToAccessDenied("cms.newsletter", "configure");
            }
        }

        switch (e.CommandName.ToLowerCSafe())
        {
        case "resendall":
        {
            EmailQueueManager.SendAllEmails(true, true, 0);
            gridElem.ReloadData();
            ShowInformation(GetString("EmailQueue.SendingEmails"));
        }
        break;

        case "resendallfailed":
        {
            EmailQueueManager.SendAllEmails(true, false, 0);
            gridElem.ReloadData();
            ShowInformation(GetString("EmailQueue.SendingEmails"));
        }
        break;

        case "deleteall":
        {
            EmailQueueItemInfoProvider.DeleteEmailQueueItem(siteId);
            gridElem.ReloadData();
        }
        break;

        case "deleteallfailed":
        {
            EmailQueueItemInfoProvider.DeleteFailedEmailQueueItem(siteId);
            gridElem.ReloadData();
        }
        break;

        case "refresh":
        {
            gridElem.ReloadData();
        }
        break;
        }
    }
Пример #2
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 gridElem_OnAction(string actionName, object actionArgument)
    {
        if (!MembershipContext.AuthenticatedUser.IsAuthorizedPerResource("cms.newsletter", "configure"))
        {
            RedirectToAccessDenied("cms.newsletter", "configure");
        }

        switch (actionName.ToLowerCSafe())
        {
        case "resend":
            // Resend an issue from the queue
            EmailQueueManager.ResendEmail(Convert.ToInt32(actionArgument));
            break;

        case "delete":
            // Delete EmailQueueItem object from database
            EmailQueueItemInfoProvider.DeleteEmailQueueItem(Convert.ToInt32(actionArgument));
            break;
        }
    }