Exemplo n.º 1
0
        protected void ibApproveContent_Command(object sender, CommandEventArgs e)
        {
            if (currentUser == null)
            {
                return;
            }

            News news = new News(siteSettings.SiteId, Convert.ToInt32(e.CommandArgument));

            if (news == null || news.NewsID == -1 || !news.StateId.HasValue)
            {
                return;
            }

            news.StateId          = WorkflowHelper.GetNextWorkflowStateId(workflowId, news.StateId.Value);
            news.ApprovedUserGuid = currentUser.UserGuid;
            news.ApprovedBy       = Context.User.Identity.Name.Trim();
            news.ApprovedUtc      = DateTime.UtcNow;
            news.RejectedNotes    = null;
            bool result = news.SaveState(lastWorkflowStateId);

            if (result)
            {
                if (!WebConfigSettings.DisableWorkflowNotification)
                {
                    NewsHelper.SendApprovalRequestNotification(
                        SiteUtils.GetSmtpSettings(),
                        siteSettings,
                        workflowId,
                        currentUser,
                        news);
                }

                message.SuccessMessage = ResourceHelper.GetResourceString("Resource", "UpdateSuccessMessage");

                grid.Rebind();
            }
        }
Exemplo n.º 2
0
        protected void ibApproveContent_Command(object sender, CommandEventArgs e)
        {
            if (currentUser == null || !isReviewRole)
            {
                return;
            }

            News news = new News(basePage.SiteId, Convert.ToInt32(e.CommandArgument));

            if (news == null || news.NewsID == -1 || !news.StateId.HasValue)
            {
                return;
            }

            news.StateId          = WorkflowHelper.GetNextWorkflowStateId(workflowId, news.StateId.Value);
            news.ApprovedUserGuid = currentUser.UserGuid;
            news.ApprovedBy       = Context.User.Identity.Name.Trim();
            news.ApprovedUtc      = DateTime.UtcNow;
            news.RejectedNotes    = null;
            bool result = news.SaveState(lastWorkflowStateId);

            if (result)
            {
                if (!WebConfigSettings.DisableWorkflowNotification)
                {
                    NewsHelper.SendApprovalRequestNotification(
                        SiteUtils.GetSmtpSettings(),
                        basePage.SiteInfo,
                        workflowId,
                        currentUser,
                        news);
                }

                WebUtils.SetupRedirect(this, Request.RawUrl);
            }
        }